number system understand

961 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
961
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

number system understand

  1. 1. Prepared By- Prof. M. P. Raj AIT 124 COMPUTER ORGANIZATION AND ARCHITECTURE 3(3+0)
  2. 2. Prepared By- Prof. M. P. Raj UNIT I Introduction to COA, Basic Computer Model and different units of Computer, Basic Working Principle of a Computer Number System Representation: Representation of Decimal, Binary, Octal and Hexadecimal Number; Conversation of Numbers, Representation of Unsigned & Sign integer, Representation of real number, Representation of character. Architecture is those attributes visible to the programmer – Instruction set, number of bits used for data representation, I/O mechanisms, addressing techniques. – e. g. Is there a multiply instruction? Computer architecture deals with the functional behavior of a computer system as viewed by a programmer (like the size of a data type – 32 bits to an integer). Organization is how features are implemented – Control signals, interfaces, memory technology. – e. g. Is there a hardware multiply unit or is it done by repeated addition? Computer organization deals with structural relationships that are not visible to the programmer (like clock frequency or the size of the physical memory). There is a concept of levels in computer architecture. The basic idea is that there are many levels at which a computer can be considered, from the highest level, where the user is running programs, to the lowest level, consisting of transistors and wires. Levels of Machines There are a number of levels in a computer, from the user level down to the transistor level. Progressing from the top level downward, the levels become less abstract as more of the internal structure of the computer becomes visible. The von Neumann Model The von Neumann model consists of five major components: (1) input unit; (2) output unit; (3) arithmetic logic unit; (4) memory unit; (5) control unit.
  3. 3. Prepared By- Prof. M. P. Raj The System Bus Model A refinement of the von Neumann model, the system bus model has a CPU (ALU and control), memory, and an input/output unit. Communication among components is handled by a shared pathway called the system bus, which is made up of the data bus, the address bus, and the control bus. There is also a power bus, and some architectures may also have a separate I/O bus.
  4. 4. Prepared By- Prof. M. P. Raj The Motherboard Moore’s Law Computing power doubles every 18 months for the same price. Project planning needs to take this observation seriously: an architectural innovation that is being developed for a projected benefit that quadruples performance in three years may no longer be relevant: the architectures that exist by then may already offer quadrupled performance and may look entirely different from what the innovation needs to be effective.
  5. 5. Prepared By- Prof. M. P. Raj
  6. 6. Prepared By- Prof. M. P. Raj Abstraction Layers A typical vision of a computer architecture as a series of abstraction layers: hardware, firmware, assembler, kernel, operating system and applications. Firmware In computing, firmware is software that is embedded in a hardware device. It is often provided on flash ROMs or as a binary image file that can be uploaded onto existing hardware by a user. Firmware is defined as: The computer program in a read-only memory (ROM) integrated circuit (a hardware part number or other configuration identifier is usually used to represent the software); • the erasable programmable read-only memory (EPROM) chip, whose program may be modified by special external hardware, but not by [a general purpose] application program. • the electrically erasable programmable read-only memory (EEPROM) chip, whose program may be modified by special electrical external hardware (not the usual optical light), but not by [a general purpose] application program. Assembler Assembler creates object code by translating assembly instruction mnemonics into opcodes, and by resolving symbolic names for memory locations and other entities. The use of symbolic references is a key feature of assemblers, saving tedious calculations and manual address updates after program modifications. Kernel In computing, the kernel is the central component of most computer operating systems (OSs). Its responsibilities include managing the system's resources and the communication between hardware and software components. As a basic component of an operating system, a kernel provides the lowest-level abstraction layer for the resources (especially memory, processor and I/O devices) that applications must control to perform their function. It typically makes these facilities available to application processes through inter-process communication mechanisms and system calls. These tasks are done differently by different kernels, depending on their design and implementation. While monolithic kernels will try to achieve these goals by executing all the code in the same address space to increase the performance of the system, micro kernels run most of their services in user space, aiming to improve maintainability and modularity of the code base. A range of possibilities exists between these two extremes.
  7. 7. Prepared By- Prof. M. P. Raj Operating System An operating system (OS) is a computer program that manages the hardware and software resources of a computer. An operating system performs basic tasks such as controlling and allocating memory, prioritizing system requests, controlling input and output devices, facilitating networking, and managing files. It also may provide a graphical user interface for higher level functions. It forms a platform for other software. Application software is a subclass of computer software that employs the capabilities of a computer directly to a task that the user wishes to perform. NUMBERING SYSTEMS AND COMPUTERS We humans use a decimal, or base-10, numbering system, presumably because people have 10 fingers. If we had three fingers and a thumb on each hand, as does the Extra Terrestrial (E.T.), from the classic movie, and Homer Simpson of the Simpson’s, then in all probability we would be using the octal numbering system, which has a base of 8. Early computers were designed around the decimal numbering system. This approach made the creation of computer logic capabilities unnecessarily complex and did not make efficient use of resources. (For example, 10 vacuum tubes were needed to represent one decimal digit.) In 1945, as computer pioneers were struggling to improve this cumbersome approach, John von Neumann suggested that the numbering system used by computers should take advantage of the physical characteristics of electronic circuitry. To deal with the basic electronic states of on and off, von Neumann suggested using the binary numbering system. His insight has vastly simplified the way computers handle data. Computers operate in binary and communicate to us in decimal. A special program translates decimal into binary on input, and binary into decimal on output. Under normal circumstances, a programmer would see only decimal input and output. On occasion, though, he or she must deal with long and confusing strings of 1s and 0s that represent the content of RAM, the computer’s memory. Occasionally a programmer or computer engineer takes a snapshot of the contents of RAM (on-bits and off-bits) at a given moment in time. To reduce at least part of the confusion of seeing only 1s and 0s on the output, the hexadecimal (base-16) numbering system is used as a shorthand to display the binary contents of both RAM and secondary storage, such as disk. The decimal equivalents for binary, decimal, and hexadecimal numbers are shown in Figure 1. We know that in decimal, any number greater than 9 is represented by a sequence of digits. When you count in decimal, you "carry" to the next position in groups of 10. As you examine Figure 1, notice that you carry in groups of 2 in binary and in groups of 16 in hexadecimal. Also note that any combination of four binary digits can be represented by one "hex" digit.
  8. 8. Prepared By- Prof. M. P. Raj FIGURE 1 Numbering System Equivalence Table The hexadecimal numbering system is used only for the convenience of the programmer or computer scientist, or computer engineer when reading and reviewing the binary display of memory. Computers do not operate or process in hex. During the 1960s and early 1970s, programmers often had to examine the contents of RAM to debug their programs (that is, to eliminate program errors). Today's programming languages have user friendly diagnostics (error messages) and computer-assisted tools that help programmers during program development. These diagnostics and development aids have minimized the need for applications programmers to convert binary and hexadecimal numbers into their more familiar decimal equivalents. However, if you become familiar with these numbering systems, you should achieve a better overall understanding of computers. And, someday you may need to read hex to decode an error message or set the jumpers on an expansion card. PRINCIPLES OF NUMBERING SYSTEMS Binary The binary, or base-2, numbering system is based on the same principles as the decimal, or base-10, numbering system, with which we are already familiar. The only difference between the two numbering systems is that binary uses only two digits, 0 and 1, and the decimal numbering system uses 10 digits, 0 through 9. The equivalents for binary, decimal, and hexadecimal numbers are shown in Figure 1. The value of a given digit is determined by its relative position in a sequence of digits. Consider the example in Figure 2. If we want to write the number 124 in decimal, the interpretation is almost automatic because of our familiarity with the decimal numbering system.
  9. 9. Prepared By- Prof. M. P. Raj FIGURE 2 Numbering System Fundamentals FIGURE 3 Representing a Binary Number To represent 124, we would follow the same thought process as we would in decimal (see Figure 2), but this time we have only two digits (0 and 1). For ease of understanding, the arithmetic is done in decimal. Hexadecimal Perhaps the biggest drawback to using the binary numbering system for computer operations is that programmers may have to deal with long and confusing strings of 1s and 0s. To reduce the confusion, the hexadecimal, or base-16, numbering system is used as shorthand to display the binary contents of primary and secondary storage.
  10. 10. Prepared By- Prof. M. P. Raj Notice that the bases of the binary and hexadecimal numbering systems are multiples of 2: 2 and 24 , respectively. Because of this, there is a convenient relationship between these numbering systems. The numbering-system equivalence table shown in Figure 1 illustrates that a single hexadecimal digit represents four binary digits (01112 = 716, 11012 = D16, 10102 = A16 where subscripts are used to indicate the base of the numbering system). Notice that in hexadecimal, or "hex," letters are used to represent the six higher order digits. Two hexadecimal digits can be used to represent the eight-bit byte of an EBCDIC equals sign (=) (011111102 is the same as 7E16). Figure 4 illustrates how a string of EBCDIC bits can be reduced to a more recognizable form using hexadecimal. FIGURE 4 System Expressed in Different Ways The word System is shown as it would appear in input/output, internal binary notation, and hexadecimal notation. We will now examine how to convert one number in a numbering system to an equivalent number in another numbering system. For example, there are occasions when we might wish to convert a hexadecimal number into its binary equivalent. We shall also learn the fundamentals of numbering-system arithmetic. CONVERTING NUMBERS FROM ONE BASE INTO ANOTHER Decimal to Binary or Hexadecimal A decimal number can be converted easily into an equivalent number of any base by the use of the division/remainder technique. This two-step technique is illustrated in Figure 5. Follow these steps to convert decimal to binary. FIGURE 5 Converting a Decimal Number into Its Binary Equivalent Use the two step division/remainder technique to convert a decimal number into an equivalent number of any base. Step 1. Divide the number (19, in this example) repeatedly by 2, and record the remainder of each division. In the first division, 2 goes into 19 nine times with a remainder of 1. The remainder is always one of the binary digits--0 or 1. In the last division you divide 1 by the base (2) and the remainder is 1.
  11. 11. Prepared By- Prof. M. P. Raj Step 2. Rotate the remainders as shown in Figure 5; the result (10011) is the binary equivalent of a decimal 19. Figure 6 illustrates how the same division/remainder technique is used to convert a decimal 453 into its hexadecimal equivalent (1C5). In a decimal-to-hex conversion, the remainder is always one of the 16 hex digits. FIGURE 6 Converting a Decimal Number into Its Hexadecimal Equivalent The two-step division/remainder technique is used to convert a decimal number to its hex equivalent. Binary to Decimal and Hexadecimal To convert from binary to decimal, multiply the 1s in a binary number by their position values, then sum the products (see Figure 7). In Figure 7, for example, binary 11010 is converted into its decimal equivalent (26). FIGURE 7 Converting a Binary Number into Its Decimal Equivalent Multiply the 1s in a binary number by their position values.
  12. 12. Prepared By- Prof. M. P. Raj The easiest conversion is binary to hex. To convert binary to hex, simply begin with the 1s position on the right and segment the binary number into groups of four digits each (see Figure 8). Refer to the equivalence table in Figure 2, and assign each group of four binary digits a hex equivalent. Combine your result, and the conversion is complete. Hexadecimal to Binary To convert hex numbers into binary, perform the grouping procedure for converting binary to hex in reverse (see Figure 8). FIGURE 8 Converting a Binary Number into Its Hexadecimal Equivalent Place the binary digits in groups of four, then convert the binary number directly to hexadecimal. Hexadecimal to Decimal Use the same procedure as that used for binary-to-decimal conversions (see Figure 7) to convert hex to decimal. Figure 9 demonstrates the conversion of a hex 3E7 into its decimal equivalent of 999. FIGURE 9 Converting a Hexadecimal Number into Its Decimal Equivalent Multiply the digits in a hexadecimal number by their position values. ARITHMETIC IN BINARY AND HEXADECIMAL The essentials of decimal arithmetic operations have been drilled into us so that we do addition and subtraction almost by instinct. We do binary arithmetic, as well as that of other numbering systems, in the same way that we do decimal arithmetic. The only difference is that we have fewer (binary) or more (hexadecimal) digits to use. Figure 10 illustrates and compares addition and subtraction in decimal with that in binary and hex. Notice in Figure 10 that you carry to and borrow from adjacent positions, just as you do in decimal arithmetic.
  13. 13. Prepared By- Prof. M. P. Raj FIGURE 10 Binary, Decimal, and Hexadecimal Arithmetic Comparison As you can see, the only difference in doing arithmetic in the various numbering systems is the number of digits used.
  14. 14. Prepared By- Prof. M. P. Raj Examples of Binary Arithmetic Example 1,2 Addition Example 3,4 Subtraction
  15. 15. Prepared By- Prof. M. P. Raj Examples of Hexadecimal Arithmetic Example 1 Addition Example 3 Subtraction
  16. 16. Prepared By- Prof. M. P. Raj Binary subtraction using 1’s complement Example 1 1101 1111 - 111  1’s complement - 0111 110 1000 + 1101 10101 here extra digit 1 indicates that answer is +ve and answer will be obtained by add 1 to the result. So 0101 + 1 = 110 i.e +ve 110 Example 2 1010 11111 - 10101  1’s complement - 10101 - 1011 01010 + 01010 010100 here extra digit is 0 that indicates that answer is –ve and in the form of 1’s complement of the result. So 11111 – 10100 = 01011 i.e. –ve 1011 Same way subtraction can be done using 7,9,15 ‘s complement Binary subtraction using 2’s complement Example 1 1101 1111 - 111  2’s complement - 0111 110 1000 + 1 1001 + 1101 10110 here extra digit 1 indicates that answer is +ve and answer is the result. So 0110 i.e +ve 110 Example 2 1010 11111 - 10101  1’s complement - 10101 - 1011 01010 + 1 01011 + 01010 010101 here extra digit is 0 that indicates that answer is –ve and in the form of 2’s complement of the result. So 11111 – 10101 01010 + 1 01011 i.e. –ve 1011 Same way subtraction can be done using 8, 10, 16‘s complement IMP Rules: Complement: n = 2, 8, 10, 16 1. For (n-1)’s complement subtract each digit of a number from (n-1) 2. For n’s complement subtract each digit of a number from (n-1) and add 1 to it. For Conversion:
  17. 17. Prepared By- Prof. M. P. Raj 1. Binary, Octal, Hexadecimal  Decimal: digit X (base/radix) digit position starting from zero . digit X (base/radix) digit position starting from -1 2. Decimal  Binary, Octal, Hexadecimal : For integer portion divide by base and write remainder in reverse order i.e. last reminder digit as first digit of a number. 3. Octal, Hexadecimal  Binary: Create pair of three digit for octal and write its equivalent octal digit. Create pair of three digit for hexadecimal and write its equivalent hexadecimal digit. For subtraction A- B: n = 2, 8, 10, 16 4. For 1, 7, 9 , 15’s complement a. Take (n-1)’s complement of B b. Add it to A i. If result has extra bit as ‘1’ then answer is +ve and by adding ‘1’ to result we get exact answer. ii. If result has extra bit as ‘0’ then answer is –ve and by taking (n-1)’s complement of result we get exact answer. 5. For 2,8,10,16’s complement a. Take n’s complement of B b. Add it to A i. If result has extra bit as ‘1’ then answer is +ve and by adding ‘1’ to result we get exact answer. ii. If result has extra bit as ‘0’ then answer is –ve and by taking n’s complement of result we get exact answer. Self-Check 1. The hex numbering system has a base of ________, and the binary numbering system has a base of ________. 2. The value of a particular digit in a number is determined by its relative position in a sequence of digits. (T/F) 3. A single hexadecimal digit can represent how many binary digits: (a) two, (b) three, or (c) four? 4. The bases of the binary and decimal numbering systems are multiples of 2. (T/F) 5. The binary equivalent of a decimal 255 is ________. 6. The binary equivalent of a hexadecimal 1C is ________. 7. The decimal equivalent of a hexadecimal 1B6 is ________. 8. The hexadecimal equivalent of a decimal 129 is ________. 9. The decimal equivalent of a binary 110101 is ________. 10. The hexadecimal equivalent of a binary 1001 is ________. 11. The binary equivalent of a decimal 28 is ________. 12. The binary equivalent of a hexadecimal 35 is ________. 13. The decimal equivalent of a hexadecimal 7 is ________. 14. The hexadecimal equivalent of a decimal 49 is ________. 15. The decimal equivalent of a binary 110110110 is ________. 16. The hexadecimal equivalent of a binary 1110 is ________. 17. The result of 1012 + 112 is ________ (in binary). 18. The result of A116 + BC16 + 1016 is ________ (in hexadecimal). 19. The result of 6010 + F116 - 10010012 is ________ (in decimal). 20. The result of 112 + 278 + 9310 - B16 is ________ (in decimal). Self-test answers. 1. 16, 2. 2. T. 3. 4. 4. F. 5. 11111111. 6. 11100. 7. 438. 8. 81. 9. 53. 10. 9. 11. 11100. 12. 110101. 13. 7. 14. 31. 15. 438. 16. E. 17. 10002. 18. 16D16. 19. 22810. 20. 10810.
  18. 18. Prepared By- Prof. M. P. Raj
  19. 19. Prepared By- Prof. M. P. Raj UNIT II Arithmetic and Logic Unit Logic Gates: AND, OR, NOT, NAND, NOR, XOR, Exclusive, NOR gates Boolean algebra: Introduction, Explanation of Boolean function, Describe truth table, Simplified Boolean function using postulates and draw logical diagram of simplified function, Simplified Boolean function using karnaugh map method. Sequential And Combinational Circuits: Introduction to combinational circuit and sequential circuit, half adder, full adder, multiplexer, demultiplexer, encoder, decoder Basic Logic Design Gate: It is a logic circuit with one or more input signal, but only one output signal. Logic Circuit: A circuit whose input and output signals are two state either low or high voltage. OR, AND , NOT are basic logic circuits. Truth Table: A table that shows all input and output possibilities for a logic circuits is known as truth table. OR Gate: It has two or more input signals but only one output signal. If any input signal is high then output signal is high A B A+B 0 0 0 0 1 1 1 0 1 1 1 1 Use of OR Gate: Octal to Binary encoder The circuit will convert an octal number into its equivalent binary number. When push button ‘5’ is pressed, the y2 and y0 OR gate have high input. Therefore output word is Y2 Y1Y0 = 101, which is binary of the octal number. And Gate: It has two or more input signals but only one output signal. If all input signals are high then output signal will be high i.e. if any input signal is low then output will be low. A B A.B 0 0 0 0 1 0 1 0 0 1 1 1 Use of AND gate
  20. 20. Prepared By- Prof. M. P. Raj UNIT III Memory Concept of Main Memory, Introduction to Flip Flop and explain SR, Clocked SR, D, JK, T flip flops

×