Introduction to Computer System Organization and Number Systems
Objectives 08/06/09 by: Karla Louissa Marie A. Dar, CpE
At the end of the session, the student is expected to:
Have an overview of the structured computer organization Identify the number system and its different bases Develop good computation skills in different number base conversions Appreciate the importance of number systems in relation to computers and its applications Distinguish the different processes of performing diverse arithmetic operations on various number systems Add, subtract, multiply and divide numbers following the standard steps Develop an attitude of handling numbers and its mathematical operations in detail
2
Structured Computer Organization 08/06/09 by: Karla Louissa Marie A. Dar, CpE
Program – sequence of instructions describing how to perform a certain task Machine language – a language into which it is possible for people to communicate with the computer
3
Think about this.. 08/06/09 by: Karla Louissa Marie A. Dar, CpE
There is a large gap between what is convenient to people and what is convenient for computers... People want to do X but computer can only do Y. How must the communication be done between the two?
4
Remedy 08/06/09 by: Karla Louissa Marie A. Dar, CpE
To design a new set of instructions that is more convenient for people to use than the set of built-in machine instructions (L0 and L1) Translation – the technique of replacing L1 by an equivalent L0 instruction first then allowing the computer to execute the new program with entirely L0 instructions Interpretation – write a program in L0 that takes programs in L1 as input data and carries them out by examining each instruction in turn and executing the equivalent sequence of L0 instructions directly
Interpreter – the program that carries it out
5
Virtual Machines 08/06/09 by: Karla Louissa Marie A. Dar, CpE
Virtual Machine – a hypothetical computer
6
Contemporary Multilevel Machines 08/06/09 by: Karla Louissa Marie A. Dar, CpE
Device level – level below level 0 wherein the designer sees individual transistors, which are the lowest-level primitives for computer designers.
7
Contemporary Multilevel Machines 08/06/09 by: Karla Louissa Marie A. Dar, CpE
Digital Logic Level – it is composed of gates which can form a 1-bit memory. These memories can be combined to form groups of 16,32,64 to form REGISTERS. Each register can hold a single binary number Microarchitectural Level – a collection of 8-32 registers that form a local memory and an ALU that is capable of performing simple arithmetic operations. The registers are connected to the ALU to form DATA PATH.
Microprogram – program that controls the operation of the data path
8
Contemporary Multilevel Machines 08/06/09 by: Karla Louissa Marie A. Dar, CpE
Instruction Set Architecture (ISA) Operating System Machine Level – set of instruction are in ISA level but there is a set of new instructions, different memory organization, ability to run 2 or more programs concurrently
9
Difference b/w levels 0-3 and 4-5 08/06/09 by: Karla Louissa Marie A. Dar, CpE
Assembler – programs that perform the translation from assembly language to level 1, 2, or 3. Compiler – it translates programs written in BASIC, C, C++, Java, LISP and Prolog to level 3 or 4
10
THE EVOLUTION OF PROGRAMMING LANGUAGES
Suppose we want to represent the equation wages = rate · hours to calculate the weekly wages in machine language. If 100100 stands for load, 100110 stands for multiplication and 100010 stands for store, then the following sequence of instructions might be needed to calculate the weekly wages.
100100 100110 100010
0000 010001 0000 010010 0000 010011
08/06/09 by: Karla Louissa Marie A. Dar, CpE
• Early computers were programmed in machine language.
11
Using the assembly language instructions, the equation to calculate the weekly wages can be written as follows: LOAD rate MULT hour STOR wages
08/06/09 by: Karla Louissa Marie A. Dar, CpE
Assembly languages - an instruction in assembly language is an easy-to-remember form called a mnemonic.
Assembler: An assembler is a program that translates a 12 program written in assembly language into an equivalent program in machine language.
High level languages- Basic, FORTRAN, COBOL, Pascal, C++, C
wages = rate · hours in C++, can be written as follows: wages = rate * hours; Compiler: A compiler is a program that translates a program written in a high level language to an equivalent machine language.
08/06/09 by: Karla Louissa Marie A. Dar, CpE
In order to calculate the weekly wages, the equation
13
Number System It is a way of counting things and identifying the quantity of something.
Base – it is also called as the radix It refers to the number of digits in a number system
08/06/09 by: Karla Louissa Marie A. Dar, CpE
14
Commonly Used Bases of number Systems in Assembly Language 08/06/09 by: Karla Louissa Marie A. Dar, CpE
Decimal Number System – the term decimal comes from the latin word “decem” which means TEN. Binary Number System – the term binary comes form the latin word meaning two at a time Hexadecimal Number System – the term hexadecimal comes from the greek word “hexa” meaning six and “decem” meaning 10. So, it has a base 16.
15
08/06/09 by: Karla Louissa Marie A. Dar, CpE
16
Conversion Of Number Systems Decimal-to-binary Conversion – it requires successive division by two Divide the number by 2 Multiply the quotient by 2 Get the remainder
Decimal to Hexadecimal Divide the number by 16 Multiply the quotient by 16 Get the remainder
08/06/09 by: Karla Louissa Marie A. Dar, CpE
17
Conversion of Number Systems Binary-to-decimal conversion Positional notation by powers of 2
Binary-to-hexadecimal conversion Hexadecimal-to-decimal conversion
Positional notation by powers of 16
Hexadecimal-to-binary conversion Memory method
08/06/09 by: Karla Louissa Marie A. Dar, CpE
18
Convert
08/06/09 by: Karla Louissa Marie A. Dar, CpE
19
Convert
08/06/09 by: Karla Louissa Marie A. Dar, CpE
20
Convert
08/06/09 by: Karla Louissa Marie A. Dar, CpE
21
Arithmetic Operations on Number Systems Addition - combines two numbers, the augend and the addend, into a single number called the sum Decimal Binary Hexadecimal Add starting from the rightmost digit If the result is greater than 15, subtract 16 from the result ( you’ll subtract 16 because hexadecimal is a base-16 number system. Count the number of times you subtract 16 and that will be the value of the carry over
08/06/09 by: Karla Louissa Marie A. Dar, CpE
22
Arithmetic Operations on Number Systems Subtraction: a = b – c; where a is the difference, b is the minuend and c is the subtrahend Decimal Binary Subtract starting from the rightmost digit If the minuend is less than the subtrahend, borrow one unit from the left digit which is equivalent to 2.
Hexadecimal Subtract starting from the rightmost digit Subtract the digits in the next place value. If the minuend is less than the subtrahend, borrow one unit from the left digit and that 1 unit is equal to 16
08/06/09 by: Karla Louissa Marie A. Dar, CpE
23
Arithmetic Operations on Number Systems Multiplication Decimal Binary Hexadecimal
Use the hexadecimal multiplication table
08/06/09 by: Karla Louissa Marie A. Dar, CpE
24
08/06/09 by: Karla Louissa Marie A. Dar, CpE
25
Arithmetic Operations on Number Systems Division Decimal Binary Hexadecimal Hexadecimal division is complicated to do manually Recommendation: Convert the dividend and the divisor into its decimal equivalent After converting, divide the numbers in decimal way Convert the quotient and the remainder into its hexadecimal equivalent.
08/06/09 by: Karla Louissa Marie A. Dar, CpE
26