ECE 445 - Fall 2020 - Lecture 7 - The MIPS One-Bus Implementation
ECE 445 - Fall 2020 - Lecture 7 - The MIPS One-Bus Implementation
Topics Covered
• Datapath for the MIPS One-bus implementation
• Internal CPU bus
• Datapath components
• Control unit for the MIPS One-bus implementation
• Tri-state buffers
• Control signals
• Instruction Cycle
• Fetch, decode, execute
• Instruction processing on the MIPS One-bus implementation
• Instruction Fetch
• Execute: ADD instruction
• Execute: LOAD WORD instruction
Fall 2020 ECE 445 - Computer Organization 3
Reading Assignment
• Hennessey/Patterson: 4.1 – 4.4
• Hennessey/Patterson: 3rd Edition, 5.5 (on Blackboard)
• Additional reading posted on Blackboard.
Fall 2020 ECE 445 - Computer Organization 4
PROCESSOR DESIGN
Datapath and Control Unit
Internal busses.
Fall 2020 ECE 445 - Computer Organization 5
Computer Organization
• The processor can be partitioned into the:
1. Datapath
• Composed of functional blocks.
• Implements the actions necessary to fetch and execute all of the
instructions specified in the instruction set of the processor.
2. Control Unit
• Generates the control signals.
• Controls the components in the datapath.
• Value of each control signal determined during instruction decoding.
Fall 2020 ECE 445 - Computer Organization 6
Processor Design
• Design both the datapath and the control unit.
• Consider all instructions that are executed by the processor.
• Determines the components required in the datapath.
• Determines the required control signals.
• Consider cost, performance, and power consumption.
• Determines technology choice.
• Determines component selection.
• Design a family of processors.
• All processors adhere to the specified instruction set architecture (ISA).
• Each is designed to meet a different cost/performance/power
consumption specification.
Fall 2020 ECE 445 - Computer Organization 7
DATAPATH
MIPS One-bus implementation.
Using one internal bus.
Datapath components: ALU, Register File, etc.
Fall 2020 ECE 445 - Computer Organization 9
Internal Bus
• The One-bus organization of the MIPS architecture uses a single 32-bit bus
to interconnect all of the datapath components.
• Data is transferred between datapath components in 32-bit words.
• Registers are 32-bits wide.
• ALU operands are 32-bits wide.
Fall 2020 ECE 445 - Computer Organization 12
Register File
Temporary Registers
• 32-bit registers.
• Register A stores one ALU operand (input).
• Register B stores the other ALU operand (input).
Fall 2020 ECE 445 - Computer Organization 17
• 32-bit register.
• Stores the address of the instruction to be fetched from (program) memory.
• Realizes the program counter (PC) specified in the MIPS architecture.
Fall 2020 ECE 445 - Computer Organization 18
• 32-bit register.
• Stores the address of the data to be read from or written to (data) memory.
• Part of the bus interface logic.
Fall 2020 ECE 445 - Computer Organization 20
• 32-bit register.
• Stores the data read from or written to (data) memory.
• Part of the bus interface logic.
Fall 2020 ECE 445 - Computer Organization 21
Control Unit
CONTROL UNIT
Decodes instruction. Generates control signals.
Enable (EN) and Output Enable (OE) control signals.
Control signals required for the MIPS one-bus implementation.
Fall 2020 ECE 445 - Computer Organization 25
To internal bus
To internal bus
Fall 2020 ECE 445 - Computer Organization 27
Register File
Datapath
Component Signal Description
Register File RFEN When asserted, RF inputs data from CPU bus.
RFOE When asserted, RF tri-state buffer is enabled and
RF outputs data to CPU bus.
Fall 2020 ECE 445 - Computer Organization 28
Datapath
Component Signal Description
Write register Mux RDorRT RDorRT = 0: Use Rd field to specify destination reg.
RDorRT = 1: Use Rt field to specify destination reg.
Fall 2020 ECE 445 - Computer Organization 29
Datapath
Component Signal Description
Read register Mux RSorRT RSorRT = 0: Use Rs field to specify source register.
RSorRT = 1: Use Rt field to specify source register.
Fall 2020 ECE 445 - Computer Organization 30
Datapath
Component Signal Description
ALU ALUOE When asserted, ALU tri-state buffer is enabled and
ALU outputs data to CPU bus.
ALUCNTL Controls the operation performed by the ALU.
Fall 2020 ECE 445 - Computer Organization 31
Temporary Registers
Datapath
Component Signal Description
Register A AEN When asserted, Reg A inputs data from CPU bus.
Register B BEN When asserted, Reg B inputs data from CPU bus.
Fall 2020 ECE 445 - Computer Organization 32
Datapath
Component Signal Description
Sign-extension Unit SEUOE When asserted, SEU tri-state buffer is enabled and
SEU outputs data to CPU bus.
Fall 2020 ECE 445 - Computer Organization 33
Program Counter
Datapath
Component Signal Description
Program Counter PCEN When asserted, PC inputs data from CPU bus.
PCOE When asserted, PC tri-state buffer is enabled and PC
outputs data to CPU bus.
Fall 2020 ECE 445 - Computer Organization 34
Instruction Register
Datapath
Component Signal Description
Instruction Register IREN When asserted, IR inputs data from CPU bus.
Fall 2020 ECE 445 - Computer Organization 35
Datapath
Component Signal Description
Memory Address Reg MAREN When asserted, MAR inputs data from CPU bus.
Fall 2020 ECE 445 - Computer Organization 36
Datapath
Component Signal Description
Memory Data Reg MDREN When asserted, MDR inputs data from CPU bus.
MDROE When asserted, MDR tri-state buffer is enabled and
MDR outputs data to CPU bus.
Fall 2020 ECE 445 - Computer Organization 37
• PC and MDR require bi-directional data transfer via the internal CPU bus.
• All other registers only need to read (input) from the internal CPU bus.
Fall 2020 ECE 445 - Computer Organization 38
INSTRUCTION CYCLE
Fetch, decode, and execute.
Processor clocking.
Fall 2020 ECE 445 - Computer Organization 41
Instruction Cycle
• Each machine language instruction is processed according to
the steps in the instruction cycle.
• Aka. the fetch-execute cycle and the CPU cycle.
Instruction
Fetch
Instruction
Decode
Execute
Instruction Cycle
Fall 2020 ECE 445 - Computer Organization 42
IF
Instruction Fetch
• PC contains address of ML instruction.
• Read (fetch) instruction from program
memory at address pointed to by PC.
ID
• Adjust PC to point to next instruction.
• Increment PC (by 4 for MIPS)
• Use Branch target address
Instruction Cycle
Fall 2020 ECE 445 - Computer Organization 43
IF
Instruction Decode
• Instruction is identified by the opcode
(and the funct bits for MIPS R-type
instructions).
ID • Control unit decodes instruction.
• Appropriate control signals are generated.
• Control the functional units in the datapath
IF
Execute
• Functional units in the datapath
implement the required actions for the
executed instruction.
ID • Functional units controlled by the control
signals.
• Different instructions require a different set
of actions and, thus, a different set of
EX functional units.
Instruction Cycle
Fall 2020 ECE 445 - Computer Organization 45
Clock period
Clock (cycles)
Data transfer
and computation
Update state
Processor Clocking
• Operation of the CPU is governed by a constant-rate clock.
Clock period
Clock (cycles)
Data transfer
and computation
Update state
INSTRUCTION PROCESSING
Instruction Fetch
Execute: Add instruction
Execute: Load Word instruction
Fall 2020 ECE 445 - Computer Organization 48
Clock
Cycle RTL Description Control Signals
1 MAR <- PC Copy contents of PC to MAR. MAREN, PCOE
2 MDR <- M[MAR] Read contents of memory into Read
MDR (using System Bus).
3 IR <- MDR Transfer contents of MDR to IR. IREN, MDROE
4 A <- PC Copy contents of PC to Reg A. AEN, PCOE
5 PC <- A + 4 Increment A by 4 and store in PC. PCEN, ALUCNTL = 0011
• Can the instruction fetch be implemented in fewer clock cycles?
• Which micro-operations can be completed in the same clock cycle?
Fall 2020 ECE 445 - Computer Organization 50
Clock
Cycle RTL Description Control Signals
1 A <- RF[Rs] Transfer contents of Rs register AEN, RFOE, RSorRT = 0
in RF to Reg A.
2 B <- RF[Rt] Transfer contents of Rt register BEN, RFOE, RSorRT = 1
in RF to Reg B.
3 RF[Rd] <- A + B Add A and B and store result in RFEN, RDorRT = 0, ALUOE,
Rd register in RF. ALUCNTL = 0010
Fall 2020 ECE 445 - Computer Organization 51
Clock
Cycle RTL Description Control Signals
1 A <- RF[Rs] Transfer contents of Rs register AEN, RFOE, RSorRT = 0
in RF to Reg A.
2 B <- SignExt[Imm] Sign-extend immediate value BEN, SEUOE
and store in Reg B.
3 MAR <- A + B Add A and B and store in MAR. MAREN, ALUOE, ALUCNTL = 0010
4 MDR <- M[MAR] Read contents of memory into Read
MDR (using System Bus).
5 RF[Rt] <- MDR Transfer contents of MDR to Rt RFEN, RDorRT = 1, MDROE
register in RF.
Fall 2020 ECE 445 - Computer Organization 52
Questions?