Module 3 Computation Structure
Module 3 Computation Structure
SOLUTION:
• Harvard architecture
Structure of Von Neumann
Types of instructions
• The IAS computer had a total of 21 instructions, which can be grouped as
• Data transfer: Move data between memory and ALU registers or between two
ALU registers.
• Unconditional branch: Normally, the control unit executes instructions in
sequence from memory. This sequence can be changed by a branch instruction,
which facilitates repetitive operations.
• Conditional branch: The branch can be made dependent on a condition, thus
allowing decision points.
• Arithmetic: Operations performed by the ALU.
• Address modify: Permits addresses to be computed in the ALU and then
inserted into instructions stored in memory. This allows a program considerable
addressing flexibility.
v
IAS Computer
Instruction Set
12
IAS Instruction Cycle
• The IAS operates by repetitively
performing an instruction cycle.
• Each instruction cycle consists of
two sub-cycles
• Fetch
• Execute
13
Harvard Architecture
• Principles
• In Harvard architecture concept, Memory for data was separated from the
memory for instruction.
• This concept is known as the Parallel access of data and instructions are
possible Modern processors uses Harvard architecture
Harvard Architecture
Features of Harvard Architecture
Exec Decode
Clocking Methodologies
❑ The clocking methodology defines when signals can be
read and when they are written
An edge-triggered methodology
❑ Typical execution
read contents of state elements
send values through combinational logic
write results to one or more state elements
State State
Combinational
element element
logic
1 2
clock
Add
Instruction
Memory
Read
PC Instruction
Address
Control
Unit
Read Addr 1
Register Read
Read Addr 2 Data 1
Instruction
File
Write Addr Read
Data 2
Write Data
Read Addr 1
Register Read
Read Addr 2 Data 1 overflow
Instruction
File
ALU zero
Write Addr Read
Data 2
Write Data
The Register File is not written every cycle (e.g. sw), so we need
an explicit write control signal for the Register File
Executing Load and Store Operations
❑ Load and store operations involves
compute memory address by adding the base register (read from
the Register File during decode) to the 16-bit signed-extended
offset field in the instruction
store value (read from the Register File during decode) written to
the Data Memory
load value, read from the Data Memory, written to the Register
File RegWrite ALU control MemWrite
overflow
Read Addr 1 zero
Register Read Address
Read Addr 2 Data 1
Instruction Data
File Memory Read Data
ALU
Write Addr Read
Data 2 Write Data
Write Data
Sign MemRead
16 Extend 32
Executing Branch Operations
❑ Branch operations involves
compare the operands read from the Register File during decode
for equality (zero ALU output)
compute the branch target address by adding the updated PC to
the 16-bit signed-extended offset field in the instr
Add Branch
Add target
4 Shift address
left 2
ALU control
PC
Sign
16 Extend 32
Executing Jump Operations
❑ Jump operation involves
replace the lower 28 bits of the PC with the lower 26 bits of the
fetched instruction shifted left by 2 bits
Add
4
4
Jump
Instruction Shift address
Memory
left 2 28
Read
PC Instruction
Address 26
Creating a Single Datapath from the Parts
❑ Assemble the datapath segments and add control lines
and multiplexors as needed
❑ Single cycle design – fetch, decode and execute each
instructions in one clock cycle
no datapath resource can be used more than once per
instruction, so some must be duplicated (e.g., separate
Instruction Memory and Data Memory, several adders)
multiplexors needed at the input of shared elements with
control lines to do the selection
write signals to control writing to the Register File and Data
Memory
Add
RegWrite ALUSrc ALU control MemWrite MemtoReg
4
ovf
zero
Read Addr 1
Instruction
Register Read Address
Memory
Read Addr 2 Data 1 Data
Read File
PC Instruction ALU Memory Read Data
Address Write Addr Read
Data 2 Write Data
Write Data
MemRead
Sign
16 Extend 32
RegWrite
RegDst
ovf
Instr[25-21] Read Addr 1
Instruction
Register Read Address
Memory Instr[20-16] Read Addr 2 Data 1 zero
Data
Read
PC Instr[31-0] 0 File
ALU Memory Read Data 1
Address Write Addr
1 Read 0
Instr[15 Data 2 Write Data 0
Write Data
-11] 1
RegWrite
RegDst
ovf
Instr[25-21] Read Addr 1
Instruction
Register Read Address
Memory Instr[20-16] Read Addr 2 Data 1 zero
Data
Read
PC Instr[31-0] 0 File
ALU Memory Read Data 1
Address Write Addr
1 Read 0
Instr[15 Data 2 Write Data 0
Write Data
-11] 1
Cycle 1 Cycle 2
Clk
lw sw Waste
IR
Memory Read Addr 1
PC
A
Address Register Read
ALUout
Read Data Read Addr 2Data 1
File ALU
(Instr. or Data) Write Addr
Read
B
Write Data Data 2
MDR
Write Data
Instr[31-26]
PC[31-28]
Shift 28
Instr[25-0]
left 2 2
0
1
Memory 0
PC
0 Read Addr 1
Address
A
Register Read
IR
1 1 zero
Read Addr 2 Data 1
ALUout
Read Data
0 File
(Instr. or Data) ALU
Write Addr
1 Read
Write Data Data 2
B
1 Write Data 0
4
MDR
1
0 2
Instr[15-0] Sign Shift 3
Extend 32 left 2 ALU
Instr[5-0] control
Multicycle Advantages & Disadvantages
❑ Uses the clock cycle efficiently – the clock cycle is
timed to accommodate the slowest instruction step
Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9Cycle 10
Clk
lw sw R-type
IFetch Dec Exec Mem WB IFetch Dec Exec Mem IFetch
Cycle 1 Cycle 2
Clk
lw sw Waste
multicycle clock
slower than 1/5th of
Multiple Cycle Implementation: single cycle clock
due to state register
overhead
Clk Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9Cycle 10
lw sw R-type
IFetch Dec Exec Mem WB IFetch Dec Exec Mem IFetch