DigitalLogic ComputerOrganization L16 SingleCycleProcessorP2 Handout
DigitalLogic ComputerOrganization L16 SingleCycleProcessorP2 Handout
COMPUTER ORGANIZATION
Lecture 16: Single Cycle Microprocessor (P2)
ELEC3010
ACKNOWLEGEMENT
2
COVERED IN THIS COURSE
❑ Binary numbers and logic gates
❑ Boolean algebra and combinational logic
❑ Sequential logic and state machines
❑ Binary arithmetic
Digital logic
❑ Memories
4
RF REVIEW
What need to be
changed if the RF
has 32 registers?
5
CONTROL UNIT (CU)
❑ Regulates the interaction between data and operations on
data (i.e., datapath)
❑ Series of control words control the datapath to perform a
sequence of operations
❑ The sequence of operations performed by the CU may be
affected by the ALU Condition Codes
▪ Z: Zero
▪ N: Negative
▪ Also V: Overflow and C: Carry out
6
DATAPATH + CONTROL UNIT
7
SEQUENCE OF OPERATIONS
8
SEQUENCE OF OPERATIONS
9
SEQUENCE OF OPERATIONS
10
SEQUENCE OF OPERATIONS
11
CAN YOU DO IT?
What are the values of different fields in the instruction when executing the following instructions:
ADD R2, R3, R7
ADDI R4, R6, 2
LOAD R2, 2(R1)
12
UNSIGNED MULTIPLICATION
❑ Form each partial product by multiplying a single digit of
the multiplier by the multiplicand
❑ Add shifted partial products to get result
13
ITERATIVE (SHIFT AND ADD) MULTIPLICATION
14
ITERATIVE (SHIFT AND ADD) MULTIPLICATION
15
CAN YOU DO IT?
16
OPERATION SEQUENCE FOR ITERATIVE MULTIPLICATION
17
PROGRAMMABLE CONTROL UNIT
❑ Datapath (RF, ALU, RAM, muxes) is flexible
❑ However, FSM-based multiplier control unit is “hardwired”
▪ New operation sequence would require new state machine
❑ Programmable control unit
▪ Control words stored in RAM
▪ State machine replaced by a Program Counter plus branch
operations
▪ Flexible: Can run different sequences of control words
(programs)
18
PROGRAM COUNTER (PC)
❑ Special register that points to the location (address) in
RAM of the next control word
❑ Updated every clock cycle
❑ Sequential execution (default behavior)
▪ Control words read from sequential RAM locations
▪ PC increments after each control word read
❑ Branch operations
▪ Special control flow operations
▪ Condition code determines whether to branch or not
▪ If so, next RAM address is PC + branch offset
19
PC-BASED CONTROL UNIT
21
BRANCH OPERATIONS
22
BRANCH OPERATIONS
23
CAN YOU DO IT?
24
PROGRAMMABLE MULTIPLICATION
25
PROVIDING EVEN MORE FLEXIBILITY
❑ Replace control words with
instructions
▪ More intuitive and not specific to
particular hardware
▪ Shorter than control words
▪ Instruction decoder (hardwired
logic) creates the control words
from the instruction
26
OUR INSTRUCTION FORMATS
27
R-TYPE INSTRUCTIONS
28
I-TYPE: ALU WITH IMMEDIATE
29
I-TYPE: LOAD AND STORE
30
MEMORY OPERATIONS
❑ The smallest addressable quantity in a modern memory
system is a byte (8 bits)
▪ A memory address points to a byte
31
I-TYPE: BRANCH
32
ITERATIVE MULTIPLICATION REVISITED
Assumption: One
instruction is stored in 2
rows (i.e., 2 bytes) of
the instruction memory
33
PROGRAMMABLE SINGLE-CYCLE PROCESSOR
• Textbook: 7.5.1-7.5.2
• Next time:
Pipelined Microprocessor
35