Professional Documents
Culture Documents
22CPU 2x2 PDF
22CPU 2x2 PDF
computer: CPU + display + optical disk + metal case + power supply + ...
the difference
between your computer
TOY machine.
• 256 16-bit words of memory. opcode Rs Rd1 Rd2 ! Arithmetic and Logic Unit (ALU)
• 16 16-bit registers.
• 1 8-bit program counter. opcode Rs addr
4 bits to specify
one of 16 registers
TOY-Lite machine.
Toy-Lite Registers
• 16 10-bit words of memory. opcode Rs Rd1 Rd2
“Control”
Goal: CPU circuit for TOY-Lite (same design extends to TOY, your computer)
3 4
A New Ingredient: Circuits With Memory SR Flip-Flop
• Ex: majority, adder, decoder, MUX, ALU. • A way to control the feedback loop.
OR gate NOR gate
5 6
Computers and TOY have several memory components. Processor register bit. Extend a flip-flop to allow easy access to values.
• Program counter and other processor registers.
• TOY registers (4 10-bit words in Toy-Lite).
• Main memory (16 10-bit words in Toy-Lite). write 0 write 1
memory bit
Implementation.
• Use one flip-flop for each bit of memory.
• Use buses and multiplexers to group bits into words.
read
7 8
Memory Bit Interface Memory Bit: Switch Level Implementation
Memory and TOY register bits: Add selection mechanism. Memory and TOY register bits: Add selection mechanism.
[ TOY PC, IR ] [ TOY main memory ] [ TOY registers ] [ TOY PC, IR ] [ TOY main memory ] [ TOY registers ]
9 10
Processor register. don't confuse with TOY register Processor register. don't confuse with TOY register
(4-bit)
11 12
Processor Register Memory Bank
2-bit
6-bit
15 16
Memory: Switch Level Implementation TOY-Lite Memory
16 10-bit words
(four 6-bit words) • input connected to registers for “store”
• output connected to registers for “load”
• addr connect to processor Instruction Register (IR)
to registers (in)
to registers (out)
to IR
17 18
Another Useful Combinational Circuit: Multiplexer Nuts and Bolts: Buses and Multiplexers
Multiplexer (MUX). Combinational circuit that selects among input buses. Multiplexer (MUX). Combinational circuit that selects among input buses.
• Exactly one select line i is activated. • Exactly one select line i is activated.
• Copies bits from input bus i to output bus. • Copies bits from input bus i to output bus.
19 20
Toy-Lite Registers Primary Components of Toy-Lite CPU
4 10-bit words
• Dual-ported to support connecting two different registers to ALU
• Input MUX to support input connection to ALU, memory, IR, PC ! ALU
to ALU (in) to ALU (out)
MUX select
! Memory
! Registers
“Control”
to memory, IR
to PC
21 22
How to design a digital device. Counter. Holds value that represents a binary number.
• Design interface: input buses, output buses, control wires. • Load: set value from input bus.
• Determine components. • Increment: add one to value.
• Determine datapath requirements: "flow" of bits. • Enable Write: make value available on output bus.
• Establish control sequence.
Ex. TOY-Lite program counter (4-bit).
23 24
Program Counter: Components Program Counter: Datapath and Control
Components. Datapath.
• Register. • Layout and interconnection of components.
• Incrementer. • Connect input and output buses.
• Multiplexer (to provide connections for both load and increment).
Control. Choreographs the "flow" of information on the datapath.
25 26
Program Counter: Datapath and Control Program Counter: Datapath and Control
Datapath. Datapath.
• Layout and interconnection of components. • Layout and interconnection of components.
• Connect input and output buses. • Connect input and output buses.
Control. Choreographs the "flow" of information on the datapath. Control. Choreographs the "flow" of information on the datapath.
27 28
Program Counter: Datapath and Control Primary Components of Toy-Lite CPU
! ALU
! Memory
1. load: 3. increment:
copy input to register output plus 1 available in MUX
copy to register
! Toy-Lite Registers
“Control”
2. enable write: 4. enable write:
register contents available on output register contents available on output
29 30
31 32
TOY-Lite: Components TOY-Lite: Layout
33 34
Basic machine operation is a cycle. Instructions determine datapaths and control sequences for execute
• Fetch Fetch
...
35 36
TOY-Lite: Datapaths and Control Datapath: Add
control wires
fetch:
Memory[PC] to IR
execute:
IR opcode to control
increment control to ALU
datapaths increment PC two registers to ALU
ALU to register MUX
37 38
clock
Solution 1: Use some other technology
fetch:
Memory[PC] to IR
CPU
CPU
execute:
IR opcode to control
IR to addr MUX
increment
memory to register MUX
increment PC
39 40
Clock How much does it Hert?
Solution 3?
Clock. Frequency is inverse of cycle time.
• Fundamental abstraction: regular on-off pulse. n
Expressed in hertz.
– on:fetch phase n
Frequency of 1 Hz means that there is 1 cycle per second.
– off: execute phase – 1 kilohertz (kHz) means 1000 cycles/sec.
• Synchronizes operations of different circuit elements. –1 gigahertz (GHz) means 1 billion cycles/sec.
• Requirement: clock cycle longer than max switching time. –1 terahertz (THz) means 1 trillion cycles/sec.
cycle time
on
Heinrich Rudolf Hertz
(1857-1894)
Clock off
41 42
control lines
to processor registers
Fetch
Fetch
opcode
Execute from IR
data bus
Clock control lines
from ALU
to ALU
43 44
Tick-Tock TOY "Classic", Back Of Envelope Design
Clock ticks
• fetch instruction from memory[PC] to IR
• increment PC
• execute instruction
[details of instruction execution differ]
Fetch
TOY-Lite CPU
Real Microprocessor (MIPS R10000)
47 48
Layers of Abstraction History + Future
49 50