06-DigitalLogic
06-DigitalLogic
Program Counter
(PC)
Instruction
Memory Registers
Arithmetic
Data
Control (tell Logic Unit
Memory
the processor (add/
what to do) subtract/
AND/OR/
NOR/etc.)
CPU Overview
■ Can’t just join wires
together
■ Use multiplexers
Clocking Methodology
■ Combinational logic transforms data during
clock cycles
■ Between clock edges
■ Input from state elements, output to state
element
■ Longest delay determines clock period
Instruction Fetch
Increment by 4
for next
instruction
32-bit
register
■ Instruction fields
■ op: operation code (opcode)
■ rs: first source register number
■ rt: second source register number
■ rd: destination register number
■ shamt: shift amount (00000 for now)
■ funct: function code (extends opcode)
R-format Example
op rs rt rd shamt funct
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
0 17 18 8 0 32
000000100011001001000000001000002 = 0232402016
R-Type/Load/Store Datapath
op rs rt constant or address
6 bits 5 bits 5 bits 16 bits
Branch Instructions
■ Read register operands
■ Compare operands
■ Use ALU, subtract and check Zero output
■ Calculate target address
■ Sign-extend displacement
■ Shift left 2 places (word displacement)
■ Add to PC + 4
■ Already calculated by instruction fetch
Branch Instructions
Just
re-routes
wires
Sign-bit wire
replicated
Implementing Switches in Silicon
• In modern computers, switches are usually implemented in
chips made based on a semiconductor, which is simply a
material (typically some form of silicon) that is conducting in
some circumstances and insulating in others.
• One of the most common components in today’s computers is
the field-effect transistor (or FET ), which you can implement
in semiconductor using a structure that looks like this:
https://www.youtube.com/watch?v=F2KcZGwntgg
The End