The simplified DLX The datapath & control story: What happens in each control state.

Slides:



Advertisements
Similar presentations
Adding the Jump Instruction
Advertisements

Multicycle Datapath & Control Andreas Klappenecker CPSC321 Computer Architecture.
1  1998 Morgan Kaufmann Publishers We will be reusing functional units –ALU used to compute address and to increment PC –Memory used for instruction and.
ARITHMETIC LOGIC SHIFT UNIT
331 W08.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 8: Datapath Design [Adapted from Dave Patterson’s UCB CS152.
DLX Processor מבנה המחשב + מבוא למחשבים ספרתיים תרגול 13#
CS-447– Computer Architecture Lecture 12 Multiple Cycle Datapath
Homework #5 + solution. Question 1: Convert to DLX assembly (Assume that variables i, k correspond to registers 19 20, and that the array save starts.
L14 – Control & Execution 1 Comp 411 – Fall /04/09 Control & Execution Finite State Machines for Control MIPS Execution.
Instruction Set Architecture simplified DLX – A RISC architecture with only two instruction formats. 32 general purpose registers, each 32 bits wide: R0-R31.
VHDL Development for ELEC7770 VLSI Project Chris Erickson Graduate Student Department of Electrical and Computer Engineering Auburn University, Auburn,
CSE378 Multicycle impl,.1 Drawbacks of single cycle implementation All instructions take the same time although –some instructions are longer than others;
10/18/2005Comp 120 Fall October Questions? Instruction Execution.
Computer Structure - Datapath and Control Goal: Design a Datapath  We will design the datapath of a processor that includes a subset of the MIPS instruction.
The Processor 2 Andreas Klappenecker CPSC321 Computer Architecture.
L15 – Control & Execution 1 Comp 411 – Spring /25/08 Control & Execution Finite State Machines for Control MIPS Execution.
Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures1 Machine instructions execution steps (1) FETCH = Read the instruction.
CPU Architecture Why not single cycle? Why not single cycle? Hardware complexity Hardware complexity Why not pipelined? Why not pipelined? Time constraints.
Class 9.1 Computer Architecture - HUJI Computer Architecture Class 9 Microprogramming.
Processor I CPSC 321 Andreas Klappenecker. Midterm 1 Thursday, October 7, during the regular class time Covers all material up to that point History MIPS.
The Multicycle Processor CPSC 321 Andreas Klappenecker.
The GPR Environment (Mueller & Paul) GPR_WE. The GPR Environment (Cont.) GPR_WE Drivers to enable the writing of a value to the bus.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Lecture 16 Today’s topics: –MARIE Instruction Decoding and Control –Hardwired control –Micro-programmed control 1.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Processor: Datapath and Control
Lecture 14 Today’s topics MARIE Architecture Registers Buses
Computer Organization CS224 Fall 2012 Lesson 22. The Big Picture  The Five Classic Components of a Computer  Chapter 4 Topic: Processor Design Control.
1 CS/COE0447 Computer Organization & Assembly Language Multi-Cycle Execution.
CDA 3101 Fall 2013 Introduction to Computer Organization
Electrical and Computer Engineering University of Cyprus LAB 2: MIPS.
C HAPTER 5 T HE PROCESSOR : D ATAPATH AND C ONTROL M ULTICYCLE D ESIGN.
Team DataPath Research Computer Architechture. PC and IF in the Processor.
1. Building A CPU  We’ve built a small ALU l Add, Subtract, SLT, And, Or l Could figure out Multiply and Divide  What about the rest l How do.
By Wannarat Computer System Design Lecture 4 Wannarat Suntiamorntut.
Elements of Datapath for the fetch and increment The first element we need: a memory unit to store the instructions of a program and supply instructions.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
MIPS Processor.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 Part 3.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Multi-Cycle Datapath and Control
Electrical and Computer Engineering University of Cyprus
Single-Cycle Datapath and Control
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Control & Execution Finite State Machines for Control MIPS Execution.
Five Execution Steps Instruction Fetch
MIPS Instructions.
Processor (I).
CS/COE0447 Computer Organization & Assembly Language
Design of the Control Unit for Single-Cycle Instruction Execution
The Processor and Machine Language
Control & Execution Finite State Machines for Control MIPS Execution.
CSCE 212 Chapter 5 The Processor: Datapath and Control
Design of the Control Unit for One-cycle Instruction Execution
MIPS Processor.
Rocky K. C. Chang 6 November 2017
Multicycle Approach We will be reusing functional units
Fundamental Concepts Processor fetches one instruction at a time and perform the operation specified. Instructions are fetched from successive memory locations.
COMS 361 Computer Organization
Processor: Multi-Cycle Datapath & Control
Multicycle Design.
ECE 352 Digital System Fundamentals
Review Fig 4.15 page 320 / Fig page 322
Control Unit for Multiple Cycle Implementation
Control Unit for Multiple Cycle Implementation
The Processor: Datapath & Control.
COMS 361 Computer Organization
MIPS Processor.
CS161 – Design and Architecture of Computer Systems
Presentation transcript:

The simplified DLX The datapath & control story: What happens in each control state.

The Datapath The Datapath consists of several environments, buses, registers and multiplexers. At the right there is a general scheme of the entire Datapath (no drivers, only muxes). datapath.pdf

What is RTL? RTL = Register Transfer Language The RTL describes the operations done in each Control’s state in terms of “what is written to the registers”. Note: This description is just of the functionality and not of the way of implementation. Examples: IR=M[PC] A=RS1 B=RS2 PC=PC+1

The Control The Control is a state machine that consists of 20 states. The Control’s signals control the data flow. fsd_idlx.pdf

What happens during Fetch state? Din Adr Dout W Busy Memory Env. Control IR Env. IR PC MR Was the mission completed? Sample! 1) The PC register contains the address. 2) The desired functionality: IR M[PC] Fetch The Control usually stays in fetch state for more than one clock cycle 3) The memory is very slow. It announces: “I’m busy” after getting a read / write request. When busy, no new requests are allowed. As Dout stablizes, the memory announces: “I’m done”. Only then the control asks the IR Env. to sample Dout’s value and update the IR register. Reminder…

In our explanation about the different states we also describe the RTL instructions that correspond to each state of the Control. Let’s start: 1) Fetch. RTL Instruction: IR=M[PC] Action: The instruction pointed to by the PC is read from the memory and is stored to the IR register. The Fetch state might last more than one clock cycle. The DLX stays in this state as long the “busy” signal is active. The Control (Cont.) Active Control Signals: IRce, PCAOdoe, MR IR’s Clock Enable The PC Env. address out’s driver is enabled Memory Read

The Control (Cont.) 2) Decode. RTL Instructions: A=RS1 B=RS2 PC=PC+1 Actions: The contents of the RS1 and RS2 (if needed) registers are stored in the A and B registers (that are located in the GPR Env.) and the PC’s register value is incremented by 1 (to point to the next instruction). Active Control Signals: Ace, Bce, PCS1doe, 1S2doe, ALUDINTdoe, Add, PCce PC’s value’s driver is enabled and the PC is outputted to S1 1’s const value’s driver is enabled and this value is outputted to S2 The ALU’s output value’s (PC+1) driver is enabled PC’s clock enable (for storing the new PC)

GPR Env. AB C Cce IR Env. 1 0 ITYPE ALU Env. ALU Control signals Result A. Arithmetic/Logic instructions: What happens during Execute state (Cont.)? Sext (Imm.) Reminder…

3) ALU. RTL Instruction: C=A op B Action: An arithmetic operation is done on the arguments (which are the contents of the A and B registers). The result is stored in the C register in the GPR Env. Active Control Signals: AS1doe, BS2doe, OPALU, ALUDINTdoe, Cce The Control (Cont.) The name of a group of signals The A register’s value’s driver is enabled and its value is outputted to S1 The B register’s value’s driver is enabled and its value is outputted to S2

The Control (Cont.) 4) ALUI (Add). RTL Instruction: C=A + imm. Action: The sum of the addition of the value of the A register in the GPR Env. and the immediate’s value is stored in the C register in the GPR Env. Active Control Signals: AS1doe, IRS2doe, OPALU, ALUDINTdoe, Cce The IR register’s value’s driver is enabled and its value (=immediate) is outputted to S2

The Control (Cont.) 5) ShiftI. RTL Instruction: C=ShiftLeft A / ShiftRight A Action: The value of the A register is being shifted one step right or left. The direction is determined by IR[1]. Active Control Signals: AS1doe, Cce, shift (left or right). In a general shifter: the shift amount is coded in IR…

B. Test&Set instructions: Sgri: RD (RS1 > Sext(Imm) ? 1 : 0) GPR Env. AB C Cce IR Env. 1 0 ITYPE ALU Env. TEST Result Sext (Imm.) Two stages: 1) execute C (RS1 > RS2 ? 1:0) 2) writeback RD C In this way the period time is shorter. What happens during Execute state (Cont.)? Alway s 0 / 1 Reminder…

6) TestI RTL Instruction: C=A rel imm. Action: A logic operation is done on the arguments (which are the contents of the A register and the immediate value that is supplied by co in the IR Env.). The result is stored in the C register in the GPR Env. Active Control Signals: AS1doe, IRS2doe, Cce, ALUDINTdoe, test Comparison to be conducted: can be extracted from last 3 bits in the opcode. The Control (Cont.)

3) Jump instructions: A. Unconditional jump: Jump Reg (jr): PC A What happens during Execute state (Cont.)? No direct path from A to PC. Instead: GPR Env. A IR Env. 0 ALU Env. ADD PC Env. PC Cce Reminder…

8) JR. RTL Instruction: PC=A Action: In this state that deals with jumping, the PC register gets the address of the instruction to jump to. This address is stored in the A register in the GPR Env. Active Control Signals: AS1doe, 0S2doe, add, ALUDINTdoe, PCce The Control (Cont.)

C. Calling a routine: ”Jump, remember your address so it will be possible to get back to this address” jalr: R31 PC+1 PC RS1 We use two Control states in order to execute this instruction because we want to avoid a collision in the buses (to be elaborated). What happens during Execute state (Cont.)? Reminder…

State I: Copying the PC (2 clock cycles) GPR Env. C PC Env. PC Cce Clock cycle 1 (savePC): GPR Env. C R31 Clock cycle 2 (like in the Write-Back state): Write! The address=31 What happens during Execute state (Cont.)? Reminder…

State II (JALR): Calculating the jump address PC Env. PC ALU Env. IR Env. 0 GPR Env. A ADD Cce What happens during Execute state (Cont.)? Reminder…

The Control (Cont.) 9) SavePC. RTL Instruction: C=PC Action: The PC is stored in the C register in the GPR Env. Active Control Signals: PCS1doe, 0S2doe, add, ALUDINTdoe, Cce

The Control (Cont.) 17) JALR. RTL Instructions: PC=A R31=C (=old PC) Actions: In this state that deals with jumping, the PC’s current value is stored in the 31’st register in the GPR and the address of the instruction we jump to is stored in the PC and comes from the A register in the GPR. Active Control Signals:AS1doe, 0S2doe, ALUDINTdoe, add, PCce, GPR_WE, Jlink

B. Branch: “Jump only if a condition is satisfied” beqz: PC PC+1+(RS1=0 ? Sext (Imm.) : 0) bnez: PC PC+1+(RS1=0 ? 0 : Sext (Imm.)) We’ll demonstrate the beqz instruction. Two states are needed: State I - Branch: Check the condition – RS1=0 ? Sext (Imm.) : 0 GPR Env. A IR Env. 0 ALU Env. TEST Comparison result To the Control What happens during Execute state (Cont.)? Reminder…

10) Branch. RTL Instruction: Branch taken? Action: In the Beqz and Bnez instructions, when reaching this state, a check of the A register’s value is done. According to this check, a path to continue with is determined. The Control (Cont.) Active Control Signals: AS1doe, 0S2doe, test

The next state BTaken Fetch State II - BTaken: Calculating the jump – PC PC+1+(Result of state I) IR Env. ALU Env. PC Env. PC Cce PC Sext (Imm.) ADD What happens during Execute state (Cont.)? Jump No Jump Reminder…

18) BTaken. RTL Instruction: PC=PC+imm. Action: The PC gets the address of the next instruction to be executed. The address is based on the Branch state’s result. The value to be added to the PC comes from the co output of the IR Env. Active Control Signals: PCS1doe, IRS2doe, add, ALUDINTdoe, PCce The Control (Cont.)

11) WBR. RTL Instruction: RD=C (R-type) Action: The data which is stored in the C register in the GPR env. (after the arithmetic\shift operations are done) is being assigned to the instruction’s target register. Active Control Signal: GPR_WE

12) WBI. RTL Instruction: RD=C (I-type) Action: Copy the result stored in the C register in the GPR env. (after the arithmetic\logic operations are done) to the instruction’s target register. Active Control Signals: GPR_WE, ITYPE The Control (Cont.)

Reading From Memory - Load Load Word (lw): RD M(Sext(imm.) + RS1) Four states are needed for finishing the load instruction: State I: Effective Address Computation – MAR A+C0 GPR Env. A IR Env. ALU Env. MAR C0 ADD Sext(imm.) + RS1 Sext(imm.) Reminder…

The Control (Cont.) 7) AddressCmp. RTL Instruction: MAR=A+imm. Action: The memory address where a data should be written to is stored in the MAR register. The address itself is the sum of the immediate value supplied by the IR Env. and the A register in the GPR Env. Active Control Signals: AS1doe, IRS2doe, add, ALUDINTdoe, MARce.

State II: Memory Access (Load). This state lasts till the value is returned – MDR M(MAR) Reading From Memory – Load (Cont.) Adr Dout W Memory Env. MAR Read! MDR Notes: 1) Busy signal informs the Control when the operation is over (Dout is stable). 2) MDR samples Dout every clock cycle, no need to compute CE (Simplifies Control). 3) Dout must be logical even if its value is incorrect! Busy Tells the Control when readung is over Reminder…

The Control (Cont.) 13) Load. RTL Instruction: MDR=M[MAR] Action: Store M[MAR] in MDR Active Control Signals: MR, MDRce, Asel, MDRsel

State III (copy MDR to C): Writing MDR’s value to C in the GPR : C MDR Reading From Memory – Load (Cont.) MDR GPR Env. C Cce State IV: Write-Back: RD C Reminder…

16) CopyMDR2C. RTL Instruction: C=MDR Action: Copy MDR contents to C register in the GPR. The Control (Cont.) Active Control Signals: MDRS1doe, 0S2doe, add, ALUDINTdoe, Cce.

GPR Env. B Writing To Memory – Store (Cont.) MDR State II: Copying the B register’s (this is RD) value to the MDR : MDR B State III: Memory Access (Store) – M(MAR) MDR Adr W Memory Env. MAR Write! MDR Din Busy Tells the Control when writing is over Reminder…

The Control (Cont.) 15) CopyGPR2MDR. RTL Instruction: MDR=B Action: The value to be next written to the memory is stored in this state in the MDR. The value itself comes from the B register in the GPR. Active Control Signals: MDRS1doe, BS2doe

14) Store. RTL Instruction: M(MAR)=MDR Action: The instruction that is stored in the MDR is copied to the memory Env. The address in the memory Env. is taken from the MAR. Active Control Signals: MARS1doe, MW The Control (Cont.)