330 likes | 655 Views
Digital Logic. L15-16 Guilin Wang School of Computer Science The University of Birmingham [adapted from Ata Kaban]. Topics for This Lecture. Computer Architecture Gates and Boolean logic AND, OR, NOT, NAND, NOR… Integrated circuits SSI, MSI, LSI, VLSI Memory Flip-Flop
E N D
Digital Logic L15-16 Guilin Wang School of Computer Science The University of Birmingham [adapted from Ata Kaban]
Topics for This Lecture • Computer Architecture • Gates and Boolean logic • AND, OR, NOT, NAND, NOR… • Integrated circuits • SSI, MSI, LSI, VLSI • Memory • Flip-Flop • Arithmetic circuits • Half-adder, Full-adder, ALU
Computer Architecture Basically, no common language for computers and human. • How to solve this problem? - translation (translator) - interpretation (interpreter) • Multiple levels and virtual machines - a language <=> a virtual machine - Multiple-level structure reduces the complexity of computer design.
Computer Architecture There is a fundamental break here! A Six-level Computer (Book 2, Chapter 1)
Computer Architecture Essential difference between levels 3 and 4: • The users - L4, L5: for applications programmers - L1, L2, L3: for system programmers • The translation methods - L4, 5: usually supported by translation - L 2, 3: usually supported by interpretation • The nature of languages - L4, 5: symbolic languages - L1, L2, L3: numeric languages
Basics of Hardware Design • Components of a computer • CPU: ALU, adder, multiplier, instruction controller, data path, … • Memories: registers, cache, main memory, … • I/O devices • buses • The lowest logical design level • Digital circuits are built from gates • gates are built from transistors • Device level (physics) • N/P-type semiconductors (transistors)
Digital Circuits • In a digital circuit, only two logical values are present: 0 or 1. • continuous voltage range (within bounds) • 0 is low signal (voltage range 0 to 1) • 1 is high signal (voltage range 2 to 5) • Gates • electronic devices that compute functions of 0/1 • made from transistors (very fast & small switches)
How a Transistor Works - If Vin < Vcv, no current flows through; So, Vout is high. • If Vin > Vcv, current flows through; So, Vout is low. As input signal is inverted, this forms a NOT gate.
The Three Main Gates Truth Table A, B: inputs X: output X = f(A,B) NOT: invert (negate) single input. AND: 1 only if both inputs 1 OR: 1 if at least one input 1
Two More Gates NAND: Output 0 only if both inputs 1 (inverted AND) NOR: Output 0 if at least one input 1(inverted OR) Simpler - 2 instead of 3 transistors...
B A A C Boolean Algebra • A Boolean function can have N variables, eg. M = f (A, B, C). • Write AB for A AND B A+B for A OR B for NOT A • Write functions as a sum of product terms, e.g M = BC+ A C + AB + ABC (majority vote). • Such a formula leads directly to a possible circuit implementation.
Boolean Algebra A circuit for majority function of three variables.
Boolean Algebra Some identities of Boolean algebra.
Circuit Equivalence • Different circuits may implement the same function. 3 circuits for XOR (eXclusive OR):
Circuit Equivalence • Circuit designers often try to reduce the number of gates in their products. • AND, OR, NOT gates are enough to implement any Boolean function. • NAND itself has the above property. So, we say NAND is complete. • NOR is also complete. • How to prove the above statements?
Circuit Equivalence • For example, we can construct AND and OR gates using NAND gate as follows: • Exercises: • Can you do NOT? • How to construct AND, OR, and NOT gates from NOR gate?
Integrated Circuits (chips) SSI chip: 5mm x 5mm Standardised Pins Classification based on number of gates: Small Scale Integrated (SSI) circuit: 1-10 gates Medium Scale Integrated (MSI) circuit : 10-100 gates Large Scale Integrated (LSI) circuit : 100-100,000 gates Very Large Scale Integrated (VLSI) circuit: > 100,000 gates
Types of Chips • Combinational circuits • Boolean functions, transform inputs to output • Control circuits • data buses, clocks, etc • Memories • can store bits; contain feedback • Flip-Flop • Arithmetic circuits • Half-adder, Full-adder, ALU
Clock Signals • Clock signals are used to provide synchronization among events. • Clock is a circuit that emits a series of pulses with a precise pulse width and precise interval between consecutive pulses. • This precise time interval is called clock cycle time. Pulse frequencies: 1 to 500 MHz. Clock cycles: 1000 to 2 nsec. • The clock frequency is usually controlled by a crystal oscillator.
Clock Signals • Some events may happen during one single clock cycle and in a specific order. • In such cases, the clock cycle must be divided into subcycles. • A common way is to get a phase-shifted clock signal from the primary. • The example below provides four time references, i.e., rising (falling) edge of C1 (C2).
The Flip-Flop • A bistable device (also called a clocked D latch) • Has inputs D and clock signal, and output Q • When control is on, Q = D • When control is off, output is always available but cannot change. Hence, one bit value D is stored.
Memories • Registers • N-bit flip-flop gives N-bit register • N bits = one word • Memories • M registers gives M-word memory
Memories Logic diagram for a 4x3 memory (Book 2, p166) ■ 8 input lines: - Data: I0, I1, I2 - Address: A0, A1 - Control: CS, RD, OE ■ 3 output lines: D0, D1, D2 ■ Function: - Write 3 bits into a selected word or - Read 3 bits from a selected word.
Arithmetic Circuits • Addition • 1-bit addition yields 1-bit result and 1-bit carry 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 carry 1 • Adders • half-adder = 1-bit adder with 2 bit input • full-adder = 1-bit adder with additional carry input • N-bit adder requires N full-adders
Half-adder • 2 bits on input • 1 bit sum plus 1 bit carry on output • Half-adder cannot handle carry in the middle of the word...
Full-adder • 2 bits and carry on input • 1 bit sum plus 1 bit carry on output • Built from two half-adders • N-bit adder can be built from this 1-bit full adder. However, there is an ripple effect. • How to get faster adder without such a delay?
Arithmetic Logic Units (ALU) A 1-bit ALU
B Arithmetic Logic Units (ALU) • The above 1-bit ALU can perform any of the following operations: A AND B, A OR B, , A+B. • This depends on the values of the function-select inputs F0 and F1 , i.e., 00, 01, 10, or 11. • An 8-bit ALU can be built up from eight 1-bit ALU slices. (For simplicity, the enables and invert signals are not shown.)
Summary • We have discussed • Structured computer organization • Boolean function, gates • Flip-flop, memories • Adder, ALU • Further topics • How to use data buses transferring data/control info along wires, one wire per bit. • How to use control signals (clocks) avoiding conflicts.