Presentation is loading. Please wait.

Presentation is loading. Please wait.

Instructor: Yuzhuang Hu Midterm The midterm is schedule on June 17 th, 17:30-19:30 pm. It covers the following:  VHDL Programming. 

Similar presentations


Presentation on theme: "Instructor: Yuzhuang Hu Midterm The midterm is schedule on June 17 th, 17:30-19:30 pm. It covers the following:  VHDL Programming. "— Presentation transcript:

1 Instructor: Yuzhuang Hu yhu1@cs.sfu.ca

2 Midterm The midterm is schedule on June 17 th, 17:30-19:30 pm. It covers the following:  VHDL Programming.  Number Systems.  Sequential Circuit Design. This includes State-Machine Diagrams, ASM chart, control unit, data path, etc.  The Simple Single-Cycle Computer. Its Datapath, the Control Word, Instruction Formats, Single Cycle Hardwired Control, etc.

3 Block Diagram for a Single-Cycle Computer

4 Instruction Specifications for the Simple Computer

5 Control Unit of the Single Cycle Simple Computer We have described the design of its datapath. The block diagram for this computer has a hardwired control unit that fetches and executes an instruction in a single clock cycle. We do not write to the instruction memory, making it appear in this model to be a combinational rather than a sequential component.

6 The Program Counter (PC) The PC provides the instruction address to the instruction memory. The PC is updated in each clock cycle. The behaviour of the PC is determined by the opcode, N, and Z. PC OperationPLJBBC Count Up0XX Jump11X Branch on Negative (else Count Up)101 Branch on Zero (else Count Up)100

7 Instruction Decoder The instruction decoder is a combinational circuit that provides all of the control words for the datapath, based on the contents of the fields of the instruction. TruthTable for Instruction Decoder Logic Instruction Function Type Instruction BitsControlWord Bits 1514139MBMDRWMWPLJBBC Function unit operations using registers 0 0 0X 0 0 1 00X Memory read 0 01X 0 1 1 00X Memory write 0 10X 0 X 0 10X Function unit operations using register and constant 1 0 0X 1 0 1 00X Conditional branch on zero (Z) 1100 X X 0 0 1 0 0 Conditional branch on negative (N) 1101 X X 0 0 1 0 1 Unconditional Jump 111X X 0 0 1 1X

8 Instruction Decoder contd. The 13 th, 14 th and 15 th bits of the instruction are set to 1 respectively, to distinguish the memory read, memory write and constant involved instructions from the register only instructions. For this reason MB=15 th bit, MD=13 th bit, and the 14 th bit is involved in generating MW. There is some additional logic to prevent RW and MW to be 1 at the same time.

9 Instruction Decoder contd. The 15 th bit of the instructions is used mainly for jumping and branching instructions. However to distinguish them from the instructions involving constants, the 14 th bit is also needed to generate PL. BC uses the 9 th bit. JB uses the 13 th bit, however as PL=1 when JB=1, there is no conflict with MD. For conditional branching, it is required that FS=0000. That’s the reason PL is involved in generating FS.

10 Instruction Decoder Logic

11 Sample Instructions  Six Instructionsfor theSingle-Cycle Computer Operation code Symbolic nameFormatDescriptionFunctionMBMDRWMWPLJBBC 1000010ADIImmediateAdd immediate operand 1010 0 0010000LDRegisterLoad memory content into register 0110 0 1 0 0100000STRegisterStore register content in memory 0101 0 0 0 0001110SLRegisterShift left0010 0 1 0 0001011NOTRegisterComplement register 0 010 0 0 1 1100000BRZJump/BranchIfR[SA]= 0, branch to PC+ se AD If R[SA] = 0,, If R[SA]  0, 10 00 1 0 0 RDR  RSA  zfI(2:0) +  RDR  M RSA  M RSARSB  RDR  slRSB  RDR  RSA  PCPCseAD +  PC 1 + 

12 Shortcomings of the Single-Cycle Computer The single cycle computer can not perform more complex operations. For example, unsigned binary multiplications. The single cycle computer has two distinct 16-bit memories, one for instructions and one for data. Every instruction, no matter it is simple or complex (e.g., jmp), is executed in a clock cycle. Therefore It has a lower limit on the clock period.

13 Worst-Case Delay Path in Single- Cycle Computer PC Instruction Memory Register File (Read) MUX B FU or Data Memory Register File (Write) MUX D 0.2 ns 4.0 0.6 0.2 4.0 0.2 0.6

14 Store Instructions and Data in a Single Memory Datapath : a single memory, and an MUX M. Add 8 temporary registers to the register file. Control Unit:  Instruction Register (IR) to store the instruction fetched from the memory.  Control State. The control unit is now a sequential circuit.  Control Logic : different control words. Branch logic is moved to here.

15

16 Control Word Format for Multi- Cycle Computer The addressing of the registers needs 4 bits (DX, AX, BX). NSPS I L M B M D R W M M M W DX AXBXFS 27242322212017161312 98743210 Datapath Sequencing NSPSIL Next StateActionCodeActionCode Gives next state of Control State Register Hold PC00No load0 Inc PC01Load IR1 Branch10 Jump11 Sequence Control NS: next state PS: control PC IL: control IR

17 Sequential Control Design Now the computer has two stages: instruction fetch (INF stage) and instruction execution (EX0 stage). IR Register File (Read) MUX B FU or Data Memory Register File (Write) MUX D 0.2 ns 0.6 0.2 4.0 0.2 0.6 PC MUX M Memory IR 0.2 ns 0.2 4.0 0.2 INFEX0

18 Instruction Specifications

19 Partial State Machine Diagram for Multiple-Cycle Computer

20 Deriving Logic Expressions For PC <- PC +1, we must set PS to 01. We can write PS(0) = EX0·MOVA + EX0 ∙ INC + EX0 ∙ ADD + … + EX0·BRZ·(not Z). Each combination of state, opcode, and condition codes where the signal should be 1 introduces a product term to the final expression.

21 Multiplication in the Multiple-Cycle Computer For simple instructions, we need more time to finish them in the multi-cycle computer. Multiplication shows the advantage.  Assume multiplication in the function unit needs 10 ns. For the single cycle-cpu, the clock cycle must be increased to 15.8 ns.  The clock cycle would remain 5.8 ns, if we give one more clock cycle for multiplication.

22 State Diagram for Multiplication INF IR <- M[PC] EX0 Multiply R[SA]*R[SB] IMUL1 R[DR] <- R[SA]*R[SB], PC <- PC + 1

23 Register Indirect Instructions R[DR] <- M[M[R[SA]]]. INF IR <- M[PC] EX0 Opcode = 0010001 R8 <- M[R[SA]] EX1 Opcode = 0010001 R[DR]<-R8, PC <- PC+1

24 Partial State Machine Diagram for Right- Shift and Left-Shift Multiple Instructions

25 Micro-programmed Control A control unit with its binary control values stored as words in memory is called a micro-programmed control. Each word in the control memory contains a microinstruction that specifies one or more micro-operations for the system. The micro-program is usually fixed at the system design time and so is stored in ROM.

26 CAR: Control Address Register.

27 THANKS!


Download ppt "Instructor: Yuzhuang Hu Midterm The midterm is schedule on June 17 th, 17:30-19:30 pm. It covers the following:  VHDL Programming. "

Similar presentations


Ads by Google