UPLOAD

    2.1K

    EEEN311_Fall12_W1

    Published: July 18, 2018

    EEEN 311 - LOGIC CIRCUITS AND MICROPROCESSORS WEEK 1

    Comments

    EEEN311_Fall12_W1

    • 1. EEEN 311 Logic Circuits & Microprocessors EEEN 311 Logic Circuits & Microprocessors Introduction to Computing [Week 1]
    • 2. OBJECTIVES OBJECTIVES •Convert any number from base 2, base 10, or base 16 to any of the other two bases. •Add and subtract hex numbers. •Add binary numbers. •Represent any binary number in 2’s complement. •Represent an alphanumeric string in ASCII code. •Describe logical operations AND, OR, NOT, XOR, NAND, NOR. •Use logic gates to diagram simple circuits. Wednesday, July 18, 2018 2
    • 3. OBJECTIVES OBJECTIVES •Explain the difference between a bit, a nibble, a byte, and a word. •Give precise mathematical definitions of the terms kilobyte, megabyte, gigabyte, and terabyte. •Explain the difference between RAM and ROM, and describe their use. •Describe the purpose of the major components of a computer system. •List the three types of buses in a computer system and describe the purpose of each bus. •Describe the role of the CPU in computer systems. •List the major components of the CPU and describe the purpose of each. (cont) Wednesday, July 18, 2018 3
    • 4. Numbering and Coding Systems Numbering and Coding Systems •Speculation is that origin of the base 10 system is the fact that human beings have 10 fingers. •Humans use base 10 (decimal) arithmetic, and computers use the base 2 (binary) system. –In base 10 are 10 distinct symbols, 0, 1, 2, ...9. –In base 2 there are only two symbols, the binary digits 0 & 1 - commonly referred to as bits. •The binary system is used in computers because 0 & 1 represent the two voltage levels of off & on. Wednesday, July 18, 2018 4
    • 5. Numbering and Coding Systems-converting from decimal to binary- Numbering and Coding Systems -converting from decimal to binary- •To convert decimal to binary, divide the decimal number by 2 repeatedly until the quotient is zero. –Remainders are written in reverse order to obtain the binary number. Wednesday, July 18, 2018 5
    • 6. Numbering and Coding Systems-converting from binary to decimal- Numbering and Coding Systems -converting from binary to decimal- •To convert from binary to decimal, it is important to understand the concept of weight associated with each digit position. –Each digit position of a number in base 2 has a weight associated with it. Wednesday, July 18, 2018 6
    • 7. Numbering and Coding Systems-hexadecimal system- Numbering and Coding Systems -hexadecimal system- Base 16, or the hexadecimal system is a convenient representation of binary numbers, using 16 digits. Wednesday, July 18, 2018 7 §The first ten digits, 0 to 9, are the same as in decimal. §For the remaining six digits, letters A, B, C, D, E, and F are used. §It is easier for humans to express strings of 0s & 1s like 100010010110 as the hexadecimal number 896H.
    • 8. Numbering and Coding Systemsconverting binary to hex Numbering and Coding Systems converting binary to hex •To represent a binary number as its equivalent hexadecimal number, start from the right & group •4 bits at a time, replacing each 4-bit binary number with its hex equivalent shown. Wednesday, July 18, 2018 8
    • 9. Numbering and Coding Systemsconverting hex to binary Numbering and Coding Systems converting hex to binary •To convert from hex to binary, each hex digit is replaced with its 4-bit binary equivalent Wednesday, July 18, 2018 9
    • 10. Numbering and Coding Systemstwo ways of converting decimal to hex Numbering and Coding Systems two ways of converting decimal to hex •Convert directly from decimal to hex by repeated division, keeping track of the remainders. Wednesday, July 18, 2018 10
    • 11. Slide20 •Convert to binary first, then convert to hex. Wednesday, July 18, 2018 11
    • 12. Numbering and Coding Systemscounting in bases 10, 2 & 16 Numbering and Coding Systems counting in bases 10, 2 & 16 •Table shows the relationship between all three bases in the sequence of numbers from 0 to 31 in decimal, with equivalent binary & hex numbers. •In each base, when one more is added to the highest digit, that digit becomes zero. •A 1 is carried to the next-highest digit position. Wednesday, July 18, 2018 12
    • 13. Numbering and Coding Systemsaddition of binary and hex numbers Numbering and Coding Systems addition of binary and hex numbers •Table below shows the addition of two bits. •Addition of binary numbers. Wednesday, July 18, 2018 13
    • 14. Numbering and Coding Systemssubtraction of binary & hex numbers Numbering and Coding Systems subtraction of binary & hex numbers •All computers use the addition process to implement subtraction. –Computers have adder circuitry, but no separate circuitry for subtraction. •Adders are used in conjunction with 2’s complement circuitry to perform subtraction. –To implement “x – y”, the computer takes the 2’s complement of y and adds it to x. Wednesday, July 18, 2018 14
    • 15. Numbering and Coding Systems2’s compliment of a binary number Numbering and Coding Systems 2’s compliment of a binary number •To get the 2’s complement of a binary number, invert all the bits and then add 1 to the result. •Inverting the bits is simply a matter of changing all 0s to 1s and 1s to 0s. –This is called the 1’s complement. Wednesday, July 18, 2018 15
    • 16. Numbering and Coding Systemsaddition & subtraction of hex numbers •To add, start with the least significant digit, & add the digits together. –If the result is less than 16, write that digit as the sum for that position. –If greater than 16, subtract 16 from it to get the digit and carry 1 to the next digit. Numbering and Coding Systems addition & subtraction of hex numbers Wednesday, July 18, 2018 16
    • 17. Numbering and Coding Systemsaddition & subtraction of hex numbers •In subtracting two hex numbers, if the second digit is greater than the first, borrow 16 from the preceding digit. Numbering and Coding Systems addition & subtraction of hex numbers Wednesday, July 18, 2018 17 Mastery of these techniques is essential.
    • 18. Numbering and Coding SystemsASCII code Numbering and Coding Systems ASCII code •Because all information in the computer must be represented by 0s & 1s, binary patterns must be assigned to letters and other characters. •In the 1960s, a standard representation called ASCII was established. –Named for the American Standard Code for Information Interchange, pronounced “Ask-E”. •It assigns binary patterns for numbers 0 to 9, and all English alphabet letters, upper- and lower-case. –Also many control codes & punctuation marks. •ASCII is standard for keyboards and provides a standard for printing & displaying characters by output devices. –The pattern of ASCII was designed to allow for easy manipulation of ASCII data. •Digits 0 - 9 are represented by ASCII codes 30 - 39. –This enables a program to convert ASCII to decimal by masking off (changing to zero) the “3” in the upper nibble. •Conversion between uppercase and lowercase is as simple as changing bit 5 of the ASCII code. Wednesday, July 18, 2018 18
    • 19. Numbering and Coding Systemsselected ASCII codes Numbering and Coding Systems selected ASCII codes Wednesday, July 18, 2018 19
    • 20. Digital Primerbinary logic Digital Primer binary logic •Signals in digital electronics have two distinct voltage levels. –A system may define 0 V as logic 0 and +5 V as logic 1. •A valid digital signal in this example should be within either of the two shaded areas. –Figure shows this with built-in tolerances for variation in voltage. Wednesday, July 18, 2018 20
    • 21. Digital Primerlogic gates Digital Primer logic gates •Binary logic gates are simple circuits that take one or more input signals & send out one output signal. •AND gate - takes two or more inputs and performs a logic AND on them. Wednesday, July 18, 2018 21
    • 22. Digital Primerlogic gates Digital Primer logic gates •OR gate - will output a 1 if one or more inputs is 1. –If all inputs are 0, then, and only then, will output be 0. •Binary logic gates are simple circuits that take one or more input signals & send out one output signal. Wednesday, July 18, 2018 22
    • 23. Digital Primerlogic gates Digital Primer logic gates •Tri-state buffer - does not change the logic level of the input. –It is used to isolate or amplify the signal. Wednesday, July 18, 2018 23
    • 24. Digital Primerlogic gates Digital Primer logic gates •Inverter: [also called NOT.] Outputs value opposite to that input to the gate. –A 1 input will give a 0 output. –0 input will give a 1 output. •XOR gate - exclusive-OR It produces a 1 output if one (but only one) input is 1. Wednesday, July 18, 2018 24
    • 25. Digital Primerlogic gates Digital Primer logic gates •NAND - functions like an AND gate with an inverter on the output. •NOR gates - function like an OR gate with an inverter on the output. Wednesday, July 18, 2018 25
    • 26. Digital Primerlogic design using gates Digital Primer logic design using gates •A simple logic design to add two binary digits. –If we add two binary digits there are four possible. Wednesday, July 18, 2018 26 The sum column matches the output for the XOR function, and the carry column matches the output for the AND function.
    • 27. Digital Primerlogic design using gates Digital Primer logic design using gates •A simple adder implemented with XOR and AND gates. •Right hand side figure shows the same logic circuit implemented with AND and OR gates and inverters. Wednesday, July 18, 2018 27
    • 28. Digital Primerlogic design using gates Digital Primer logic design using gates •Logic diagram of a full-adder, along with a block diagram that masks the details of the circuit. Wednesday, July 18, 2018 28 Full-Adder Built from a Half-Adder
    • 29. Digital Primerflip-flops Digital Primer flip-flops •A widely used component in digital systems –Frequently used to store data. •D flip-flop is widely used widely used to latch data. –D-FF grabs data at the input as the clock is activated. –D-FF holds the data as long as the power is on. Wednesday, July 18, 2018 29 D Flip-Flops
    • 30. Inside the Computerterminology Inside the Computer terminology •A bit is a binary digit that can have the value 0 or 1. Wednesday, July 18, 2018 30 •A nibble is 4 bits. •A byte is defined as 8 bits. •A word is two bytes, or 16 bits.
    • 31. Inside the Computerterminology Inside the Computer terminology •A kilobyte is 210 bytes, which is 1,024 bytes. –The abbreviation K is often used to represent kilobytes. •A megabyte, or meg, is 220 bytes. –A little over 1 million bytes; exactly 1,048,576 bytes. •A gigabyte is 230 bytes (over 1 billion). •A terabyte is 240 bytes (over 1 trillion). Wednesday, July 18, 2018 31
    • 32. Inside the Computertwo common memory types Inside the Computer two common memory types •RAM - which stands for “random access memory” (sometimes called read/write memory). –Used for temporary storage of programs while running. •Data is lost when the computer is turned off. •RAM is sometimes called volatile memory. •ROM - stands for “read-only memory”. –Contains programs and information essential to the operation of the computer. •Information in ROM is permanent, cannot be changed by the user, and is not lost when the power is turned off. •ROM is called nonvolatile memory. Wednesday, July 18, 2018 32
    • 33. Inside the Computerinternal organization of computers Inside the Computer internal organization of computers •Internal workings of every computer can be broken down into three parts: •CPU function is to execute (process) information stored in memory. •I/O devices, such as keyboard & monitor provide a means of communicating with the CPU. •The CPU is connected to memory and I/O through a group of wires called a bus. –Allows signals to carry information from place to place. •In every computer there are three types of buses: –Address bus; Data bus; Control bus. Wednesday, July 18, 2018 33
    • 34. Inside the Computerinternal organization of computers Inside the Computer internal organization of computers •For a device (memory or I/O) to be recognized by the CPU, it must be assigned an address. –No two devices can have the same address. •The address assigned to a given device must be unique. •The CPU puts the address (in binary) on the address bus & decoding circuitry finds the device. –The CPU then uses the data bus either to get data from that device or to send data to it. •Control buses provide device read/write signals. –To indicate if the CPU is asking for, or sending information. Wednesday, July 18, 2018 34
    • 35. Inside the Computerinternal organization of computers Inside the Computer internal organization of computers Internal Organization Of Computers Wednesday, July 18, 2018 35
    • 36. Inside the Computermore about the data bus Inside the Computer more about the data bus •As data buses carry information in/out of a CPU, the more data buses available, the better the CPU. –More buses mean a more expensive CPU & computer. •Data buses are bidirectional, because the CPU must use them either to receive or to send data. –Average bus size is between 8 and 64. •Computer processing power is related to bus size. –An 8-bit bus can send out 1 byte a time. –A 16-bit bus can send out 2 bytes at a time. •Twice as fast. Wednesday, July 18, 2018 36
    • 37. Inside the Computermore about the address bus Inside the Computer more about the address bus •The address bus is used to identify devices and memory connected to the CPU. –The more address bits available, the larger the number of devices that can be addressed. •The number of CPU address bits determines the number of locations with which it can communicate. –Always equal to 2x, where x is the number of address lines, regardless of the size of the data bus. •The address bus is unidirectional. –The CPU uses the bus only to send addresses out. Wednesday, July 18, 2018 37
    • 38. Inside the ComputerCPU & relation to RAM and ROM Inside the Computer CPU & relation to RAM and ROM •For the CPU to process information, the data must be stored in RAM or ROM. –The CPU cannot get the information from the disk directly because the disk is too slow. –RAM & ROM are often referred to as primary memory. •Disks are called secondary memory. Wednesday, July 18, 2018 38
    • 39. Inside the Computerinside CPUs •A program stored in memory provides instructions to the CPU to perform an action. –Adding payroll numbers or controlling a robot. Inside the Computer inside CPUs Wednesday, July 18, 2018 39 Figure 0-19 Internal Block Diagram of a CPU Function of the CPU is to fetch these instructions from memory and then execute them.
    • 40. Inside the ComputerCPU and relation to RAM and ROM •To perform the actions of fetch and execute, all CPUs are equipped with resources such as… –Registers - to store information temporarily. •8, 16, 32, 64 bit, depending on CPU. –ALU (arithmetic/logic unit) - for arithmetic functions such as add, subtract, multiply, and divide. •Also logic functions such as AND, OR, and NOT. –Program counter - to point to the address of the next instruction to be executed. •In the IBM PC, a register called IP or instruction pointer. –Instruction decoder - to interpret the instruction fetched into the CPU. Inside the Computer CPU and relation to RAM and ROM Wednesday, July 18, 2018 40
    • 41. Inside the Computerinternal workings of computers •A step-by-step analysis of CPU processes to add three numbers, with steps & code shown. –Assume a CPU has registers A, B, C, and D. •An 8-bit data bus and a 16-bit address bus. –The CPU can access memory addresses 0000 to FFFFH. •A total of 10000H locations. Inside the Computer internal workings of computers Wednesday, July 18, 2018 41
    • 42. Inside the Computerinternal workings of computers •If the program to perform the actions listed above, is stored in memory locations starting at 1400H, the following would represent the contents for each memory address location… Inside the Computer internal workings of computers Wednesday, July 18, 2018 42
    • 43. Inside the Computerinternal workings of computers •The CPU’s program counter can have a value between 0000 and FFFFH. –The program counter must be set to the address of the first instruction code to be executed - 1400H. Inside the Computer internal workings of computers Wednesday, July 18, 2018 43
    • 44. Inside the Computerinternal workings of computers •The CPU puts the address 1400H on the address bus and sends it out. –Memory finds the location while the CPU activates the READ signal, indicating it wants the byte at 1400H. •The content (B0) is put on the data bus & brought to the CPU. Inside the Computer internal workings of computers Wednesday, July 18, 2018 44
    • 45. Inside the Computerinternal workings of computers •The CPU decodes the instruction B0 with the help of its instruction decoder dictionary. –Bring the byte of the next memory location into CPU Register A. Inside the Computer internal workings of computers Wednesday, July 18, 2018 45
    • 46. Inside the Computerinternal workings of computers •From memory location 1401H, the CPU fetches code 21H directly to Register A. –After completing the instruction, the program counter points to the address of the next instruction - 1402H. •Address 1402H is sent out on the address bus, to fetch the next instruction. Inside the Computer internal workings of computers Wednesday, July 18, 2018 46
    • 47. Inside the Computerinternal workings of computers •From 1402H, the CPU fetches code 04H. –After decoding, the CPU knows it must add the byte at the next address (1403) to the contents of register A. •After it brings the value (42H) into the CPU, it provides the contents of Register A, along with this value to the ALU to perform the addition. •Program counter becomes 1404, the next instruction address. Inside the Computer internal workings of computers Wednesday, July 18, 2018 47
    • 48. Inside the Computerinternal workings of computers •Address 1404H is put on the address bus and the code is fetched, decoded, and executed. –Again adding a value to Register A. •The program counter is updated to 1406H Inside the Computer internal workings of computers Wednesday, July 18, 2018 48
    • 49. Inside the Computerinternal workings of computers •The contents of address 1406 (HALT code) are fetched in and executed. –The HALT instruction tells the CPU to stop incrementing the program counter and asking for the next instruction. •Without HALT, the CPU would continue updating the program counter and fetching instructions. Wednesday, July 18, 2018 49 Inside the Computer internal workings of computers
    • 50. The Original IBM PCReprogrammable Microcomputer The Original IBM PC Reprogrammable Microcomputer Wednesday, July 18, 2018 50 •Introduced in mid-1981. •Leading personal computer architecture ever since. •Enormous amount of application software is available [>50000]. •Open system. Functionality can be expanded by adding boards to system. •Additional memory, modem, serial communication interface, local area network interface etc… [Through 8-bit expansion bus] •Industry Standard Architecture (ISA) / Peripheral Component Interface (PCI)
    • 51. General Architecture of a Microcomputer System General Architecture of a Microcomputer System Wednesday, July 18, 2018 51 Program Storage Memory Data Storage Memory Secondary Storage Memory MPU Input Unit Output Unit Primary storage memory Memory Unit •Four functional unit : (1) Input Unit (2) Micro-processing Unit (3) Memory Unit (4) Output Unit.
    • 52. Micro-processing Unit Micro-processing Unit Wednesday, July 18, 2018 52 •Microprocessor is a general purpose processing unit. •Built into a single integrated circuit (IC). •It is responsible for performing all arithmetic operations and making logical decisions. •It controls overall system operation. •8088 is a 16-bit microprocessor. It can directly process 16-bit wide data. Intel Corporation’s 8088 Microprocessor
    • 53. Evolution of Mic. Architecture Evolution of Mic. Architecture •Microprocessors can be categorized in terms of max. number of binary bits in the data they process. •4-bit: the 4004, 4-bit words or nibble of data. [Calculators]; 1972 •8-bit: the 8008, 8080, 8085. [Cash registers, printers];1975 •16-bit: the 8086, 8088 (8-bit bus version); 1979 •32-bit: the 80386DX, 1985 the Pentium, 1993 ØTransistor Count Wednesday, July 18, 2018 53