1 / 35

The simplified DLX

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.

ashby
Download Presentation

The simplified DLX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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

  3. 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

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

  5. What happens during Fetch state? Reminder… Din Adr PC Memory Env. Was the mission completed? W MR Dout Busy IR Env. Control IR 1) The PC register contains the address. Sample! 2) The desired functionality: IR M[PC] 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. The Control usually stays in fetch state for more than one clock cycle Fetch

  6. The Control (Cont.) 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. Action: The instruction pointed to by the PC is read from the memory and is stored to the IR register. RTL Instruction: IR=M[PC] The Fetch state might last more than one clock cycle. The DLX stays in this state as long the “busy” signal is active. Memory Read Active Control Signals: IRce, PCAOdoe, MR IR’s Clock Enable The PC Env. address out’s driver is enabled

  7. The Control (Cont.) RTL Instructions: A=RS1 B=RS2 PC=PC+1 2) Decode. 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). PC’s clock enable (for storing the new PC) The ALU’s output value’s (PC+1) driver is enabled 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

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

  9. The Control (Cont.) 3) ALU. 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. RTL Instruction: C=A op B Active Control Signals: AS1doe, BS2doe, OPALU, ALUDINTdoe, Cce 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

  10. The Control (Cont.) 4) ALUI (Add). 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. RTL Instruction: C=A + imm. 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

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

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

  13. The Control (Cont.) 6) TestI 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. RTL Instruction: C=A rel imm. Active Control Signals: AS1doe, IRS2doe, Cce, ALUDINTdoe, test Comparison to be conducted: can be extracted from last 3 bits in the opcode.

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

  15. The Control (Cont.) 8) JR. 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. RTL Instruction: PC=A Active Control Signals: AS1doe, 0S2doe, add, ALUDINTdoe, PCce

  16. What happens during Execute state (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). Reminder…

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

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

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

  20. The Control (Cont.) 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. 17) JALR. RTL Instructions: PC=A R31=C (=old PC) Active Control Signals:AS1doe, 0S2doe, ALUDINTdoe, add, PCce, GPR_WE, Jlink

  21. What happens during Execute state (Cont.)? B. Branch: “Jump only if a condition is satisfied” Reminder… 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. IR Env. A 0 ALU Env. TEST Comparison result To the Control

  22. The Control (Cont.) 10) Branch. 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. RTL Instruction: Branch taken? Active Control Signals: AS1doe, 0S2doe, test

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

  24. The Control (Cont.) 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. 18) BTaken. RTL Instruction: PC=PC+imm. Active Control Signals: PCS1doe, IRS2doe, add, ALUDINTdoe, PCce

  25. The Control (Cont.) 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. 11) WBR. RTL Instruction: RD=C (R-type) Active Control Signal: GPR_WE

  26. The Control (Cont.) 12) WBI. 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. RTL Instruction: RD=C (I-type) Active Control Signals: GPR_WE, ITYPE

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

  28. The Control (Cont.) 7) AddressCmp. 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. RTL Instruction: MAR=A+imm. Active Control Signals: AS1doe, IRS2doe, add, ALUDINTdoe, MARce.

  29. Reading From Memory – Load (Cont.) State II: Memory Access (Load). This state lasts till the value is returned – MDR M(MAR) Reminder… Adr MAR Memory Env. Read! W Busy Dout Tells the Control when readung is over 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!

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

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

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

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

  34. The Control (Cont.) 15) CopyGPR2MDR. 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. RTL Instruction: MDR=B Active Control Signals: MDRS1doe, BS2doe

  35. The Control (Cont.) 14) Store. 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. RTL Instruction: M(MAR)=MDR Active Control Signals: MARS1doe, MW

More Related