1048: Computer Organization

Size: px
Start display at page:

Download "1048: Computer Organization"

Transcription

1 48: Compter Organization Lectre 5 Datapath and Control Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-

2 Recap: A Single-Cycle Processor PCSrc 4 Add Shift left 2 Add ALU reslt PC address memory register register 2 Write register Write data Registers data data 2 RegWrite 6 Sign 32 etend ALUSrc 4 3 ALU operation Zero ALU ALU reslt Address Write data em emwrite data Data memory emtoreg CPI= Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-2

3 What s Wrong with Single-cycle? Arithmetic & Logical PC Inst emory Reg File m ALU m setp Load PC Inst emory Reg File m ALU Data em m Critical Path Store PC Inst emory Reg File m ALU Data em setp Branch PC Inst emory Reg File cmp m Long cycle time All instrctions take same time as the slowest path Real memory is not so ideal cannot always get job done in one (short) cycle An FU can only be sed once => higher cost Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-3

4 lticycle Approach Break p the instrctions into steps, each step takes a cycle balance the amont of work to be done restrict each cycle to se only one major fnctional nit share fnction nits within the eection of a single instrctions Add mltipleor for sharing datapath At the end of a cycle store vales for se in later cycles (easiest thing to do) introdce additional internal registers Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-4

5 Otline Part A: Designing a Single-Cycle Processor Part B: Designing a lticycle Processor Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-5

6 Part B Otline A mlticycle implementation lticycle datapath lticycle eection steps lticycle control (Appendi C.3) icroprogramming: simplifying control (Appendi C.4) Eceptions Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-6

7 lticycle Implementation Redce cycle time Diff. Inst. take diff. cycles Share fnctional nits storage element storage element Acyclic Combinational Logic => Acyclic Combinational Logic (A) storage element Acyclic Combinational Logic (B) storage element storage element 5B-7

8 Partition Single-Cycle Datapath Add registers between smallest steps Ins. fetch RF access ALU operation memory access PCSrc 4 Add Shift left 2 Add ALU reslt PC address memory register register 2 Write register Write data Registers data data 2 RegWrite 6 Sign 32 etend ALUSrc 4 3 ALU operation Zero ALU ALU reslt Address Write data em emwrite data Data memory emtoreg

9 lticycle Datapath memory (instr. & data), ALU (addr, PC+4, add, ), registers (IR, DR, A, B, ALUOt) Storage for sbseqent inst. (arch.-visible) vs. storage for same inst. bt in a sbseqent cycle Fig PC Address emory Data or data register emory data register Data Register # Registers Register # Register # A B ALU ALUOt Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-9

10 lticycle Datapath for Basic Instr. IorD em emwrite IRWrite RegDst RegWrite ALUSrcA PC Address Write data emory emdata [25 2] [2 6] [5 ] register [5 ] emory data register [5 ] 6 register register 2 Registers Write register Write data Sign etend data data 2 32 Shift left 2 A B ALU control Zero ALU ALU reslt ALUOt [5 ] Fig emtoreg ALUSrcB ALUOp IR and PC need write control, bt others don t UX to select 2 sorces to memory; memory needs read signal PC and A to one ALU inpt; for sorces to another inpt 5B-

11 Adding Branch/Jmp Fig PC Address Write data emory emdata [3-26] [25 2] [2 6] [5 ] register [5 ] emory data register PCWriteCond PCWrite IorD Otpts em emwrite Control emtoreg IRWrite [25 ] [5 ] Op [5 ] PCSorce ALUOp ALUSrcB ALUSrcA RegDst 6 RegWrite register register 2 Registers Write register Write data Sign etend data data 2 32 Shift left 2 A B Shift 28 left 2 ALU control PC [3-28] Zero ALU ALU reslt Jmp address [3-] ALUOt 2 [5 ] Three sorces to PC Two PC write signals 5B-

12 Different Register Types Data reqired by sbseqent instrctions stored in programmable-visible state elements register file ($s, $t, ), PC, data memory Data sed by the same instrction in later cycles stored in additional temporary registers not programmer-visible implementation-independent Where to insert additional temporary registers? to evenly partition the combinational logic (ideal case) what data are needed in later cycles Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-2

13 Otline A mlticycle implementation lticycle datapath lticycle eection steps lticycle control (Appendi C.3) icroprogramming: simplifying control (Appendi C.4) Eceptions Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-3

14 Five Eection Steps Fetch Decode and Register Fetch Eection, emory Address Comptation, or Branch Completion emory Access or R-type Completion emory Completion (Write-back) INSTRUCTIONS TAKE FRO 3 ~ 5 CYCLES! Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-4

15 Step : Fetch Use PC to get instrction and pt it in the Register (IR) Increment the PC by 4 and pt the reslt back in the PC Can be described sccinctly sing RTL (Register-Transfer Langage) IR = emory[pc]; PC = PC + 4; Can yo figre ot the vales of the control signals? What is the advantage of pdating the PC now? Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-5

16 Step 2: Decode and Register Fetch registers rs and rt in case needed Compte the branch address in case the instrction is a branch RTL: A = Reg[IR[25-2]]; B = Reg[IR[2-6]]; ALUOt=PC+(sign-et(IR[5-])<<2); We aren't setting any control lines based on the instrction type yet (we are bsy "decoding" it in control logic) Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-6

17 Step 3: Eection ALU is performing one of three fnctions, based on instrction type: emory Reference: ALUOt = A + sign-etend(ir[5-]); R-type: ALUOt = A op B; Branch: if (A==B) PC = ALUOt; Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-7

18 Step 4: R-type or emory-access Loads and stores access memory DR = emory[aluot]; or emory[aluot] = B; R-type instrctions finish Reg[IR[5-]] = ALUOt; The write actally takes place at the end of the cycle on the edge Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-8

19 Step 5: Write-back Loads write to register Reg[IR[2-6]]= DR; What abot all the other instrctions? Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-9

20 Smmary of the Steps Step name fetch decode/register fetch Action for R-type instrctions Action for memory-reference Action for instrctions branches IR = emory[pc] PC = PC + 4 A = Reg [IR[25-2]] B = Reg [IR[2-6]] ALUOt = PC + (sign-etend (IR[5-]) << 2) Action for jmps Eection, address ALUOt = A op B ALUOt = A + sign-etend if (A ==B) then PC = PC [3-28] II comptation, branch/ (IR[5-]) PC = ALUOt (IR[25-]<<2) jmp completion emory access or R-type Reg [IR[5-]] = Load: DR = emory[aluot] completion ALUOt or Store: emory [ALUOt] = B emory read completion Load: Reg[IR[2-6]] = DR Fig. 5.3 Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-2

21 Cycle of add IR = emory[pc]; PC = PC + 4; IorD em emwrite IRWrite RegDst RegWrite ALUSrcA PC Address Write data emory emdata [25 2] [2 6] [5 ] register [5 ] emory data register [5 ] 6 register register 2 Registers Write register Write data Sign etend data data 2 32 Shift left 2 A B ALU control Zero ALU ALU reslt ALUOt [5 ] emtoreg ALUSrcB ALUOp

22 Cycle 2 of add A=Reg[IR[25-2]]; B=Reg[IR[2-6]]; ALUOt=PC+(sign-et(IR[5-])<<2); IorD em emwrite IRWrite RegDst RegWrite ALUSrcA PC Address Write data emory emdata [25 2] [2 6] [5 ] register [5 ] emory data register [5 ] 6 register register 2 Registers Write register Write data Sign etend data data 2 32 Shift left 2 A B ALU control Zero ALU ALU reslt ALUOt [5 ] emtoreg ALUSrcB ALUOp

23 Cycle 3 of add ALUOt = A op B; IorD em emwrite IRWrite RegDst RegWrite ALUSrcA PC Address Write data emory emdata [25 2] [2 6] [5 ] register [5 ] emory data register [5 ] 6 register register 2 Registers Write register Write data Sign etend data data 2 32 Shift left 2 A B ALU control Zero ALU ALU reslt ALUOt [5 ] emtoreg ALUSrcB ALUOp

24 Cycle 4 of add Reg[IR[5-]] = ALUOt; IorD em emwrite IRWrite RegDst RegWrite ALUSrcA PC Address Write data emory emdata [25 2] [2 6] [5 ] register [5 ] emory data register [5 ] 6 register register 2 Registers Write register Write data Sign etend data data 2 32 Shift left 2 A B ALU control Zero ALU ALU reslt ALUOt [5 ] emtoreg ALUSrcB ALUOp

25 Simple Qestion How many cycles will it take to eecte this code? lw $t2, ($t3) lw $t3, 4($t3) assme not beq $t2, $t3, Label add $t5, $t2, $t3 sw $t5, 8($t3) Label:... What is going on dring the 8th cycle of eection? In what cycle does the actal addition of $t2 and $t3 takes place? Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-25

26 Simple Qestion How many cycles will it take to eecte this code? lw $t2, ($t3) assme not lw $t3, 4($t3) beq $t2, $t3, Label add $t5, $t2, $t3 sw $t5, 8($t3) Label:... What is going on dring the 8th cycle of eection? In what cycle does the actal addition of $t2 and $t3 takes place? Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-26

27 Otline A mlticycle implementation lticycle datapath lticycle eection steps lticycle control (Appendi C.3) icroprogramming: simplifying control (Appendi C.4) Eceptions Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-27

28 Implementing the Control Vale of control signals is dependent pon: What instrction is being eected Which step is being performed Control mst specify both the signals to be set in any step and the net step in the seqence Control specification Use a finite state machine (graphically) Use microprogramming Implementation can be derived from the specification and se gates, RO, or PLA Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-28

29 Controller Design: An Overview Several possible initial representations, seqence control and logic representation, and control implementation => all may be determined indep. Initial Rep. Finite State Diagram icroprogram Seqencing Eplicit Net State icroprogram Control Fnction Conter + Dispatch ROs Logic Rep. Logic Eqations Trth Tables Implementation PLA RO hardwired control microprogrammed control 5B-29

30 Review: Finite State achines Finite state machines: a set of states and net state (set by crrent state and inpt) otpt (set by crrent state and possibly inpt) Crrent state Net-state fnction Net state Inpts Clock Otpt fnction Otpts We will se a oore achine (otpt based only on the crrent state) Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-3

31 Or Control odel State specifies control points for RT Transfer at eiting state (same falling edge) One state takes one cycle inpts (conditions) Net State Logic Control State State X Register Transfer Control Points Depends on Inpt Otpt Logic otpts (control points) 5B-3

32 Smmary of the Steps Step name fetch decode/register fetch Action for R-type instrctions Action for memory-reference Action for instrctions branches IR = emory[pc] PC = PC + 4 A = Reg [IR[25-2]] B = Reg [IR[2-6]] ALUOt = PC + (sign-etend (IR[5-]) << 2) Action for jmps Eection, address ALUOt = A op B ALUOt = A + sign-etend if (A ==B) then PC = PC [3-28] II comptation, branch/ (IR[5-]) PC = ALUOt (IR[25-]<<2) jmp completion emory access or R-type Reg [IR[5-]] = Load: DR = emory[aluot] completion ALUOt or Store: emory [ALUOt] = B emory read completion Load: Reg[IR[2-6]] = DR Fig. 5.3 Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-32

33 Control Specification for lticycle IR = E[PC] PC = PC + 4 A = R[rs] B = R[rt] S = PC+s(Imm6) fetch Decode/register fetch R-type lw/sw beq jmp S = A op B S = A + s(imm6) lw sw If zero PC = S PC = IR... Eecte R[rd] = S = E[S] E[S] = B emory access R[rt] = emory read Completion Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-33

34 Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-34

35 Organization of lticycle Processor PC Address Write data emory emdata [25 2] [2 6] [5 ] register [5 ] emory data register PCWriteCond PCWrite IorD Otpts em emwrite Control emtoreg IRWrite [5 ] Op [5 ] PCSorce ALUOp ALUSrcB ALUSrcA RegDst 6 RegWrite [25 ] 26 Shift 28 left 2 [3-26] PC [3-28] register register 2 Registers Write register Write data Sign etend data data 2 32 Shift left 2 A B ALU control Zero ALU ALU reslt Jmp address [3-] ALUOt 2 [5 ] Fig Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-35

36 Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-36

37 Control Signals Fig Single Bit Control ltiple Bit Control Signal name Effect when deasserted Effect when asserted ALUSrcA st ALU operand = PC st ALU operand = Reg[rs] RegWrite None Reg file is written emtoreg Reg. data inpt = ALU Reg. write data inpt = DR RegDst Reg. write dest. no. = rt Reg. write dest. no. = rd em None emory at address is read emwrite None emory at address is written IorD emory address = PC emory address = ALUot IRWrite None IR = emory PCWrite None PC = PCSorce PCWriteCond None If zero then PC = PCSorce Signal name Vale Effect ALUOp ALU adds ALU sbtracts ALU operates according to fnc code ALUSrcB 2nd ALU inpt = B 2nd ALU inpt = 4 2nd ALU inpt = sign etended IR[5-] 2nd ALU inpt = sign et., shift left 2 IR[5-] PCSorce PC = ALU (PC + 4) PC = ALUot (branch target address) PC = PC+4[3-28] : IR[25-] << 2 5B-37

38 apping RT to Control Signals fetch and decode portion of every instrction is identical: IR = E[PC] PC = PC + 4 Start (Op = 'LW') or (Op = 'SW') fetch em ALUSrcA = IorD = IRWrite ALUSrcB = ALUOp = PCWrite PCSorce = (Op = R-type) (Op = 'BEQ') decode/ Register fetch ALUSrcA = ALUSrcB = ALUOp = (Op = 'JP') Fig A = R[rs] B = R[rt] S = PC+ s(imm6) emory reference FS (Figre 5.38) R-type FS (Figre 5.39) Branch FS (Figre 5.4) Jmp FS (Figre 5.4) Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-38

39 apping RT to Control Signals FS for controlling memory reference instrctions: 2 From state ALUSrcA = ALUSrcB = ALUOp = (Op = 'LW') or (Op = 'SW') emory address comptation Fig (Op = 'LW') emory access (Op = 'SW') 5 emory access em IorD = emwrite IorD = 4 Write-back step RegWrite emtoreg = RegDst = To state (Figre 5.37) 5B-39

40 Complete FS Fig emory address com ptation ALUSrcA = ALUSrcB = ALUOp = Start ( O p = 'L W ') o r ( O p = 'S W ') 6 em ALUSrcA = Io rd = IR W rite ALUSrcB = ALUOp = PCWrite PCSorce = Eection ALUSrcA = ALUSrcB = ALUOp= In strc tion fe tc h 8 (O p = R -ty p e ) Branch com pletion ALUSrcA = ALUSrcB = ALUOp = PCWriteCond PCSorce = decode/ register fetch (Op = 'BE Q ') 9 ALUSrcA = ALUSrcB = ALUOp = (Op = 'J') Jmp completion PCWrite PCSorce = 3 (Op = 'LW') emory access (O p = 'S W ') 5 emory access 7 R -ty pe c om p le tio n em IorD = emwrite Io rd = RegDst = RegWrite emtoreg = 4 W rite-back step RegDst= RegWrite emtoreg= State nmber assignment 5B-4

41 From FS to Trth Table Please reference the logic eqations in Fig. C.3.3 and the trth table in Fig. C.3.6 Otpt Eqation PCWrite state + state9 PCWriteCond state8 IorD state3 + state5 NetState Otpt state4 + state5 + state7 Crrent + state8 states +state NetState PCWrite state NetState2 PCWriteCond state ((op = lw ) + (op = sw )) NetState3 IorD state2 (op = lw )... Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-4

42 inpt otpt Trth Table op S Datapath control NS Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-42

43 Designing FS Controller state op cond net state control points Trth Table zero 6 net state control points 4 state Control signals op datapath state 5B-43

44 The Control Unit Fig. C.3.2 Control logic Otpts PCW rite PCW ritecond Io rd em emwrite IR W rite emtoreg PCSorce ALUOp ALUSrcB ALUSrcA RegWrite RegDst Op5 Op4 Op3 Op2 Op register opcode field Inpts Op S3 S2 S S State register NS3 NS2 NS NS Seqence Control 5B-44

45 PLA Implementation Fig. C.3.9 Op5 Op4 Op3 Op2 Op Op S3 S2 S S Seqence Control PCWrite PCWriteCond IorD em emwrite IRW rite emtoreg PCSorce PCSorce ALUOp ALUOp ALUSrcB ALUSrcB ALUSrcA RegWrite RegDst NS3 NS2 NS NS 5B-45

46 RO Implementation? RO = " Only emory" vales of memory locations are fied ahead of time A RO can be sed to implement a trth table if the address is m-bits, we can address 2 m entries in the RO. or otpts are the bits of data that the address points to. m n m is the "height", and n is the "width"

47 RO Implementation (Trth Table) Address RO content op S Datapath control NS -bit 6-bit 4-bit RO is 2 2 = 2K bits Rather wastefl, since for lots of entries, otpts are same or don t-care Cold break p into two smaller ROs (Fig. C.3.7, C.3.8) Control table: Inpt: 4-bit state Otpt:6 controls Net state table: Inpt: 4-bit state and 6- bit op-code Otpt: 4-bit state 5B-47

48 RO vs PLA RO: se two smaller ROs (Fig. C.3.7, C.3.8) 4 state bits give the 6 otpts, bits of RO bits (op + state) give 4 net state bits, 2 4 bits of RO Total = 4.3K bits of RO (compared to 2 2 bits of single RO implementation) PLA is mch smaller can share prodct terms only need entries that prodce an active otpt can take into accont don't-cares Size is (#inpts #prodct-terms) + (#otpts #prodct-terms) For this eample = (7)+(27) = 46 PLA cells PLA cells sally abot the size of a RO cell (slightly bigger) Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-48

49 Otline A mlticycle implementation lticycle datapath lticycle eection steps lticycle control (Appendi C.3) icroprogramming: simplifying control (Appendi C.4) Eceptions Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-49

50 Controller Design: An Overview Several possible initial representations, seqence control and logic representation, and control implementation => all may be determined indep. Initial Rep. Finite State Diagram icroprogram Seqencing Eplicit Net State icroprogram Control Fnction Conter + Dispatch ROs Logic Rep. Logic Eqations Trth Tables Implementation PLA RO hardwired control microprogrammed control 5B-5

51 icroprogram Control is the hard part of processor design Datapath is fairly reglar and well-organized emory is highly reglar Control is irreglar and global Bt, the state diagrams that define the controller for an instrction set processor are highly strctred Use this strctre to constrct a simple microseqencer Control redces to programming this simple device => microprogramming micro-pc seqencer control microinstrction seqencer datapath control.. control signals Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-5

52 icroinstrction Control signals : Think of the set of control signals that mst be asserted in a state as an instrction Eecting a microinstrction has the effect of asserting the control signal specified by the microinstrction Seqencing What microinstrction shold be eected net? Eecte seqentially (net state nconditionally) Branch (net state also depends on inpts) A microprogram is a seqence of microinstrctions eecting a program flow chart (finite state machine) Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-52

53 Designing a icroinstrction Set ) Start with a list of control signals 2) Grop signals together that make sense (vs. random): called fields 3) Places fields in some logical order (e.g., ALU operation & ALU operands first and microinstrction seqencing last) 4) Create a symbolic legend for the microinstrction format, showing name of field vales and how they set control signals Use compters to design compters 5) To minimize the width, encode operations that will never be sed at the same time Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-53

54 icroinstrction Interpretation ain emory eection nit ADD SUB AND DATA... User program pls Data this can change! one of these is mapped into one of these CPU control memory AND microseqence e.g., Fetch Calc Operand Addr Fetch Operand(s) Calclate Save Answer(s) 5B-54

55 icroprogramming Using RO Ease of design Fleibility Each to adapt to changes in organization, timing, technology Can make changes late in design cycle, or even in the field Generality Implement mltiple inst. sets on same machine Can tailor instrction set to application Can implement very powerfl instrction sets (jst more control memory) Compatibility any organizations, same instrction set Costly to implement and Slow Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-55

56 Smmary of Control Control is specified by a finite state diagram Specialized state-diagrams easily captred by microseqencer simple increment and branch fields datapath control fields Control can also be specified by microprogramming Control is more complicated with: comple instrction sets restricted datapaths Simple instrction set and powerfl datapath => simple control cold redce hardware Or go for speed => many instrctions at once! Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-56

57 Otline A mlticycle implementation lticycle datapath lticycle eection steps lticycle control (Appendi C.3) icroprogramming: simplifying control (Appendi C.4) Eceptions Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-57

58 Eceptions User Program Eception System Eception Handler retrn from eception Normal control flow: seqential, jmps, branches, calls, retrns Eception = nprogrammed control transfer system takes action to handle the eception mst record address of the offending instrction shold know case and transfer to proper handler if retrns to ser, mst save & restore ser state Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-58

59 User/System odes By providing two modes of eection (ser/system), compter may manage itself OS is a special program that rns in the privileged system mode and has access to all of the resorces of the compter Presents virtal resorces to each ser that are more convenient than the physical resorces files vs. disk sectors virtal memory vs. physical memory protects each ser program from others Eceptions allow the system to take action in response to events that occr while ser program is eecting OS begins at the handler Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-59

60 Two Types of Eceptions Interrpts: cased by eternal events and asynchronos to eection => may be handled between instrctions simply sspend and resme ser program Eceptions: cased by internal events and synchronos to eection, e.g., eceptional conditions (overflow), errors (parity), falts instrction may be retried or simlated and program contined or program may be aborted Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-6

61 IPS Convention of Eceptions IPS convention: eception means any nepected change in control flow, withot distingishing internal or eternal se interrpt only when the event is eternally cased Type of event From where? IPS terminology I/O device reqest Eternal Interrpt Invoke OS from ser program Internal Eception Hardware malfnctions Either Eception/Interrpt Arithmetic overflow Internal Eception Using an ndefined inst. Internal Eception Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-6

62 Precise Interrpts Precise: machine state is preserved as if program eected pto the offending inst. Same system code will work on different implementations of the architectre Position clearly established by IB, and taken by IPS Difficlt in the presence of pipelining, ot-ot-order eection,... Imprecise: system software has to figre ot what is where and pt it all back together Performance goals often lead designers to forsake precise interrpts system software developers, ser, markets etc., sally wish they had not done this Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-62

63 Handling Eceptions in or design Consider two types of eceptions: ndefined instrction & arithmetic overflow Basic actions on eception: Save state: save the address of the offending instrction in the eception program conter (EPC) Transfer control to OS at some specified address => need to know the case for the eception => then know the address of eception handler After service, OS can terminate the program or contine its eection, sing EPC to retrn Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-63

64 Saving States: General Approaches Psh it onto the stack Va, 68k, 886 Save it in special registers IPS EPC, BadVaddr, Stats, Case Shadow Registers 88k Save state in a shadow of the internal pipeline registers Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-64

65 Addressing the Eception Handler Traditional approach: interrpt vector The case of eception is a vector giving the address of the handler PC <- E[ IV_base + case ] 68, Va, 886,... iv_base case handler code RISC Handler Table PC <- IV_base + case Saves state and jmps Sparc, PA, 88K,... IPS approach: fied entry se a stats register (case register) to hold a field to indicate the case PC <- EXC_addr iv_base handler entry code case 5B-65

66 Datapath with Eception Handling Fig PC Address emory emdata Write data [25 2] [2 6] [5 ] register [5 ] emory data register PCWriteCond PCWrite IorD em emwrite emtoreg IRWrite [5 ] Otpts Control Op [5 ] [25 ] 26 Shift 28 left 2 [3-26] PC [3-28] 6 CaseWrite IntCase EPCWrite PCSorce ALUOp ALUSrcB ALUSrcA RegWrite RegDst register register 2 Registers Write register Write data Sign etend data data 2 32 Shift left 2 A B ALU control Zero ALU ALU reslt Jmp address [3-] CO 3 ALUOt 2 EPC Case [5 ] Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-66

67 Remarks EPC: reg. to hold address of affected inst. Case: reg. to record case of eception Assme LSB encodes the two possible eception sorces: ndefined instrction= and arithmetic overflow= Two control signals to write EPC (EPCWrite) and Case (CaseWrite), and one control signal (IntCase) to set LSB of Case register Be able to write eception address into PC, assming at C he => needs a 4-way UX to PC ay ndo PC = PC + 4 (PC = PC - 4), since want EPC to point to offending inst. (not its sccessor) Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-67

68 Eception Detection Undefined instrction: detected when no net state is defined from state for the op vale Handle this by defining the net state vale for all op vales other than lw, sw, (R-type), jmp, and beq as a new state, other Arithmetic overflow: detected with the Overflow signal ot of the ALU This signal is sed in the modified FS to specify an additional possible net state Note: challenge in designing control of a real machine is to handle different interactions between instrctions and other eception-casing events sch that control logic remains small and fast Comple interactions makes the control nit the most challenging aspect of hardware design Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-68

69 FS with Eception Handling Fig. 5.4 emory address comptation 2 ALUSrcA = ALUSrcB = ALUOp = Start (Op = 'LW') or (Op = 'SW') fetch em ALUSrcA = IorD = IRWrite ALUSrcB = ALUOp = PCWrite PCSorce = 6 Eection ALUSrcA = ALUSrcB = ALUOp = (Op = R-type) Branch completion 8 ALUSrcA = ALUSrcB = ALUOp = PCWriteCond PCSorce = decode/ Register fetch (Op = 'BEQ') 9 ALUSrcA = ALUSrcB = ALUOp = (Op = 'J') Jmp completion PCWrite PCSorce = (Op = other) 3 (Op = 'LW') em IorD = emory access 5 (Op = 'SW') emwrite IorD = emory access 7 R-type completion IntCase = CaseWrite RegDst = RegWrite emtoreg = Overflow ALUSrcA = ALUSrcB = ALUOp = EPCWrite PCWrite PCSorce = IntCase = CaseWrite ALUSrcA = ALUSrcB = ALUOp = EPCWrite PCWrite PCSorce = 4 Write-back step Overflow RegWrite emtoreg = RegDst = 5B-69

70 Smmary Specialize state diagrams easily captred by microseqencer simple increment and branch fields datapath control fields Control design redces to microprogramming Eceptions are the hard part of control Need to find convenient place to detect eceptions and to branch to state or microinstrction that saves PC and invokes OS Harder with pipelined CPUs that spport page falts on memory accesses, i.e., the instrction cannot complete AND yo mst restart program at eactly the instrction with the eception Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B-7

Computer Architecture Chapter 5. Fall 2005 Department of Computer Science Kent State University

Computer Architecture Chapter 5. Fall 2005 Department of Computer Science Kent State University Compter Architectre Chapter 5 Fall 25 Department of Compter Science Kent State University The Processor: Datapath & Control Or implementation of the MIPS is simplified memory-reference instrctions: lw,

More information

Exceptions and interrupts

Exceptions and interrupts Eceptions and interrpts An eception or interrpt is an nepected event that reqires the CPU to pase or stop the crrent program. Eception handling is the hardware analog of error handling in software. Classes

More information

The single-cycle design from last time

The single-cycle design from last time lticycle path Last time we saw a single-cycle path and control nit for or simple IPS-based instrction set. A mlticycle processor fies some shortcomings in the single-cycle CPU. Faster instrctions are not

More information

The extra single-cycle adders

The extra single-cycle adders lticycle Datapath As an added bons, we can eliminate some of the etra hardware from the single-cycle path. We will restrict orselves to sing each fnctional nit once per cycle, jst like before. Bt since

More information

CSE Introduction to Computer Architecture Chapter 5 The Processor: Datapath & Control

CSE Introduction to Computer Architecture Chapter 5 The Processor: Datapath & Control CSE-45432 Introdction to Compter Architectre Chapter 5 The Processor: Datapath & Control Dr. Izadi Data Processor Register # PC Address Registers ALU memory Register # Register # Address Data memory Data

More information

Review Multicycle: What is Happening. Controlling The Multicycle Design

Review Multicycle: What is Happening. Controlling The Multicycle Design Review lticycle: What is Happening Reslt Zero Op SrcA SrcB Registers Reg Address emory em Data Sign etend Shift left Sorce A B Ot [-6] [5-] [-6] [5-] [5-] Instrction emory IR RegDst emtoreg IorD em em

More information

The final datapath. M u x. Add. 4 Add. Shift left 2. PCSrc. RegWrite. MemToR. MemWrite. Read data 1 I [25-21] Instruction. Read. register 1 Read.

The final datapath. M u x. Add. 4 Add. Shift left 2. PCSrc. RegWrite. MemToR. MemWrite. Read data 1 I [25-21] Instruction. Read. register 1 Read. The final path PC 4 Add Reg Shift left 2 Add PCSrc Instrction [3-] Instrction I [25-2] I [2-6] I [5 - ] register register 2 register 2 Registers ALU Zero Reslt ALUOp em Data emtor RegDst ALUSrc em I [5

More information

The multicycle datapath. Lecture 10 (Wed 10/15/2008) Finite-state machine for the control unit. Implementing the FSM

The multicycle datapath. Lecture 10 (Wed 10/15/2008) Finite-state machine for the control unit. Implementing the FSM Lectre (Wed /5/28) Lab # Hardware De Fri Oct 7 HW #2 IPS programming, de Wed Oct 22 idterm Fri Oct 2 IorD The mlticycle path SrcA Today s objectives: icroprogramming Etending the mlti-cycle path lti-cycle

More information

Review: Computer Organization

Review: Computer Organization Review: Compter Organization Pipelining Chans Y Landry Eample Landry Eample Ann, Brian, Cathy, Dave each have one load of clothes to wash, dry, and fold Washer takes 3 mintes A B C D Dryer takes 3 mintes

More information

1048: Computer Organization

1048: Computer Organization 48: Compter Organization Lectre 5 Datapath and Control Lectre5A - simple implementation (cwli@twins.ee.nct.ed.tw) 5A- Introdction In this lectre, we will try to implement simplified IPS which contain emory

More information

EEC 483 Computer Organization

EEC 483 Computer Organization EEC 483 Compter Organization Chapter 4.4 A Simple Implementation Scheme Chans Y The Big Pictre The Five Classic Components of a Compter Processor Control emory Inpt path Otpt path & Control 2 path and

More information

Review. A single-cycle MIPS processor

Review. A single-cycle MIPS processor Review If three instrctions have opcodes, 7 and 5 are they all of the same type? If we were to add an instrction to IPS of the form OD $t, $t2, $t3, which performs $t = $t2 OD $t3, what wold be its opcode?

More information

PART I: Adding Instructions to the Datapath. (2 nd Edition):

PART I: Adding Instructions to the Datapath. (2 nd Edition): EE57 Instrctor: G. Pvvada ===================================================================== Homework #5b De: check on the blackboard =====================================================================

More information

COMP303 - Computer Architecture Lecture 10. Multi-Cycle Design & Exceptions

COMP303 - Computer Architecture Lecture 10. Multi-Cycle Design & Exceptions COP33 - Computer Architecture Lecture ulti-cycle Design & Exceptions Single Cycle Datapath We designed a processor that requires one cycle per instruction RegDst busw 32 Clk RegWr Rd ux imm6 Rt 5 5 Rs

More information

TDT4255 Friday the 21st of October. Real world examples of pipelining? How does pipelining influence instruction

TDT4255 Friday the 21st of October. Real world examples of pipelining? How does pipelining influence instruction Review Friday the 2st of October Real world eamples of pipelining? How does pipelining pp inflence instrction latency? How does pipelining inflence instrction throghpt? What are the three types of hazard

More information

Lecture 6: Microprogrammed Multi Cycle Implementation. James C. Hoe Department of ECE Carnegie Mellon University

Lecture 6: Microprogrammed Multi Cycle Implementation. James C. Hoe Department of ECE Carnegie Mellon University 8 447 Lectre 6: icroprogrammed lti Cycle Implementation James C. Hoe Department of ECE Carnegie ellon University 8 447 S8 L06 S, James C. Hoe, CU/ECE/CALC, 208 Yor goal today Hosekeeping nderstand why

More information

1048: Computer Organization

1048: Computer Organization 8: Compter Organization Lectre 6 Pipelining Lectre6 - pipelining (cwli@twins.ee.nct.ed.tw) 6- Otline An overview of pipelining A pipelined path Pipelined control Data hazards and forwarding Data hazards

More information

Lecture 9: Microcontrolled Multi-Cycle Implementations

Lecture 9: Microcontrolled Multi-Cycle Implementations 8-447 Lectre 9: icroled lti-cycle Implementations James C. Hoe Dept of ECE, CU Febrary 8, 29 S 9 L9- Annoncements: P&H Appendi D Get started t on Lab Handots: Handot #8: Project (on Blackboard) Single-Cycle

More information

Lecture 7. Building A Simple Processor

Lecture 7. Building A Simple Processor Lectre 7 Bilding A Simple Processor Christos Kozyrakis Stanford University http://eeclass.stanford.ed/ee8b C. Kozyrakis EE8b Lectre 7 Annoncements Upcoming deadlines Lab is de today Demo by 5pm, report

More information

EXAMINATIONS 2010 END OF YEAR NWEN 242 COMPUTER ORGANIZATION

EXAMINATIONS 2010 END OF YEAR NWEN 242 COMPUTER ORGANIZATION EXAINATIONS 2010 END OF YEAR COPUTER ORGANIZATION Time Allowed: 3 Hors (180 mintes) Instrctions: Answer all qestions. ake sre yor answers are clear and to the point. Calclators and paper foreign langage

More information

Pipelining. Chapter 4

Pipelining. Chapter 4 Pipelining Chapter 4 ake processor rns faster Pipelining is an implementation techniqe in which mltiple instrctions are overlapped in eection Key of making processor fast Pipelining Single cycle path we

More information

Chapter 3 & Appendix C Pipelining Part A: Basic and Intermediate Concepts

Chapter 3 & Appendix C Pipelining Part A: Basic and Intermediate Concepts CS359: Compter Architectre Chapter 3 & Appendi C Pipelining Part A: Basic and Intermediate Concepts Yanyan Shen Department of Compter Science and Engineering Shanghai Jiao Tong University 1 Otline Introdction

More information

What do we have so far? Multi-Cycle Datapath

What do we have so far? Multi-Cycle Datapath What do we have so far? lti-cycle Datapath CPI: R-Type = 4, Load = 5, Store 4, Branch = 3 Only one instrction being processed in datapath How to lower CPI frther? #1 Lec # 8 Spring2 4-11-2 Pipelining pipelining

More information

Instruction fetch. MemRead. IRWrite ALUSrcB = 01. ALUOp = 00. PCWrite. PCSource = 00. ALUSrcB = 00. R-type completion

Instruction fetch. MemRead. IRWrite ALUSrcB = 01. ALUOp = 00. PCWrite. PCSource = 00. ALUSrcB = 00. R-type completion . (Chapter 5) Fill in the vales for SrcA, SrcB, IorD, Dst and emto to complete the Finite State achine for the mlti-cycle datapath shown below. emory address comptation 2 SrcA = SrcB = Op = fetch em SrcA

More information

EEC 483 Computer Organization

EEC 483 Computer Organization EEC 83 Compter Organization Chapter.6 A Pipelined path Chans Y Pipelined Approach 2 - Cycle time, No. stages - Resorce conflict E E A B C D 3 E E 5 E 2 3 5 2 6 7 8 9 c.y9@csohio.ed Resorces sed in 5 Stages

More information

CS 251, Winter 2018, Assignment % of course mark

CS 251, Winter 2018, Assignment % of course mark CS 25, Winter 28, Assignment 4.. 3% of corse mark De Wednesday, arch 7th, 4:3P Lates accepted ntil Thrsday arch 8th, am with a 5% penalty. (6 points) In the diagram below, the mlticycle compter from the

More information

Computer Architecture

Computer Architecture Compter Architectre Lectre 4: Intro to icroarchitectre: Single- Cycle Dr. Ahmed Sallam Sez Canal University Based on original slides by Prof. Onr tl Review Compter Architectre Today and Basics (Lectres

More information

Computer Architecture

Computer Architecture Compter Architectre Lectre 4: Intro to icroarchitectre: Single- Cycle Dr. Ahmed Sallam Sez Canal University Spring 25 Based on original slides by Prof. Onr tl Review Compter Architectre Today and Basics

More information

Review. How to represent real numbers

Review. How to represent real numbers PCWrite PC IorD Review ALUSrcA emread Address Write data emory emwrite em Data IRWrite [3-26] [25-2] [2-6] [5-] [5-] RegDst Read register Read register 2 Write register Write data RegWrite Read data Read

More information

MIPS Architecture. Fibonacci (C) Fibonacci (Assembly) Another Example: MIPS. Example: subset of MIPS processor architecture

MIPS Architecture. Fibonacci (C) Fibonacci (Assembly) Another Example: MIPS. Example: subset of MIPS processor architecture Another Eample: IPS From the Harris/Weste book Based on the IPS-like processor from the Hennessy/Patterson book IPS Architectre Eample: sbset of IPS processor architectre Drawn from Patterson & Hennessy

More information

CS 251, Winter 2019, Assignment % of course mark

CS 251, Winter 2019, Assignment % of course mark CS 25, Winter 29, Assignment.. 3% of corse mark De Wednesday, arch 3th, 5:3P Lates accepted ntil Thrsday arch th, pm with a 5% penalty. (7 points) In the diagram below, the mlticycle compter from the corse

More information

EXAMINATIONS 2003 END-YEAR COMP 203. Computer Organisation

EXAMINATIONS 2003 END-YEAR COMP 203. Computer Organisation EXAINATIONS 2003 COP203 END-YEAR Compter Organisation Time Allowed: 3 Hors (180 mintes) Instrctions: Answer all qestions. There are 180 possible marks on the eam. Calclators and foreign langage dictionaries

More information

CSSE232 Computer Architecture I. Mul5cycle Datapath

CSSE232 Computer Architecture I. Mul5cycle Datapath CSSE232 Compter Architectre I Ml5cycle Datapath Class Stats Next 3 days : Ml5cycle datapath ing Ml5cycle datapath is not in the book! How long do instrc5ons take? ALU 2ns Mem 2ns Reg File 1ns Everything

More information

Lecture 5: The Processor

Lecture 5: The Processor Lecture 5: The Processor CSCE 26 Computer Organization Instructor: Saraju P. ohanty, Ph. D. NOTE: The figures, text etc included in slides are borrowed from various books, websites, authors pages, and

More information

Initial Representation Finite State Diagram. Logic Representation Logic Equations

Initial Representation Finite State Diagram. Logic Representation Logic Equations Control Implementation Alternatives Control may be designed using one of several initial representations. The choice of sequence control, and how logic is represented, can then be determined independently;

More information

CSE 2021 Computer Organization. Hugh Chesser, CSEB 1012U W10-M

CSE 2021 Computer Organization. Hugh Chesser, CSEB 1012U W10-M CSE 22 Computer Organization Hugh Chesser, CSEB 2U Agenda Topics:. ultiple cycle implementation - complete Patterson: Appendix C, D 2 Breaking the Execution into Clock Cycles Execution of each instruction

More information

CC 311- Computer Architecture. The Processor - Control

CC 311- Computer Architecture. The Processor - Control CC 311- Computer Architecture The Processor - Control Control Unit Functions: Instruction code Control Unit Control Signals Select operations to be performed (ALU, read/write, etc.) Control data flow (multiplexor

More information

Prof. Kozyrakis. 1. (10 points) Consider the following fragment of Java code:

Prof. Kozyrakis. 1. (10 points) Consider the following fragment of Java code: EE8 Winter 25 Homework #2 Soltions De Thrsday, Feb 2, 5 P. ( points) Consider the following fragment of Java code: for (i=; i

More information

ﻪﺘﻓﺮﺸﻴﭘ ﺮﺗﻮﻴﭙﻣﺎﻛ يرﺎﻤﻌﻣ MIPS يرﺎﻤﻌﻣ data path and ontrol control

ﻪﺘﻓﺮﺸﻴﭘ ﺮﺗﻮﻴﭙﻣﺎﻛ يرﺎﻤﻌﻣ MIPS يرﺎﻤﻌﻣ data path and ontrol control معماري كامپيوتر پيشرفته معماري MIPS data path and control abbasi@basu.ac.ir Topics Building a datapath support a subset of the MIPS-I instruction-set A single cycle processor datapath all instruction actions

More information

Animating the Datapath. Animating the Datapath: R-type Instruction. Animating the Datapath: Load Instruction. MIPS Datapath I: Single-Cycle

Animating the Datapath. Animating the Datapath: R-type Instruction. Animating the Datapath: Load Instruction. MIPS Datapath I: Single-Cycle nimating the atapath PS atapath : Single-Cycle npt is either (-type) or sign-etended lower half of instrction (load/store) op offset/immediate W egister File 6 6 + from instrction path beq,, offset if

More information

Enhanced Performance with Pipelining

Enhanced Performance with Pipelining Chapter 6 Enhanced Performance with Pipelining Note: The slides being presented represent a mi. Some are created by ark Franklin, Washington University in St. Lois, Dept. of CSE. any are taken from the

More information

Quiz #1 EEC 483, Spring 2019

Quiz #1 EEC 483, Spring 2019 Qiz # EEC 483, Spring 29 Date: Jan 22 Name: Eercise #: Translate the following instrction in C into IPS code. Eercise #2: Translate the following instrction in C into IPS code. Hint: operand C is stored

More information

Chapter 6 Enhancing Performance with. Pipelining. Pipelining. Pipelined vs. Single-Cycle Instruction Execution: the Plan. Pipelining: Keep in Mind

Chapter 6 Enhancing Performance with. Pipelining. Pipelining. Pipelined vs. Single-Cycle Instruction Execution: the Plan. Pipelining: Keep in Mind Pipelining hink of sing machines in landry services Chapter 6 nhancing Performance with Pipelining 6 P 7 8 9 A ime ask A B C ot pipelined Assme 3 min. each task wash, dry, fold, store and that separate

More information

Lecture 13: Exceptions and Interrupts

Lecture 13: Exceptions and Interrupts 18 447 Lectre 13: Eceptions and Interrpts S 10 L13 1 James C. Hoe Dept of ECE, CU arch 1, 2010 Annoncements: Handots: Spring break is almost here Check grades on Blackboard idterm 1 graded Handot #9: Lab

More information

Chapter 6: Pipelining

Chapter 6: Pipelining CSE 322 COPUTER ARCHITECTURE II Chapter 6: Pipelining Chapter 6: Pipelining Febrary 10, 2000 1 Clothes Washing CSE 322 COPUTER ARCHITECTURE II The Assembly Line Accmlate dirty clothes in hamper Place in

More information

Computer Organization & Design The Hardware/Software Interface Chapter 5 The processor : Datapath and control

Computer Organization & Design The Hardware/Software Interface Chapter 5 The processor : Datapath and control Computer Organization & Design The Hardware/Software Interface Chapter 5 The processor : Datapath and control Qing-song Shi http://.24.26.3 Email: zjsqs@zju.edu.cn Chapter 5 The processor : Datapath and

More information

CPE 335. Basic MIPS Architecture Part II

CPE 335. Basic MIPS Architecture Part II CPE 335 Computer Organization Basic MIPS Architecture Part II Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides http://www.abandah.com/gheith/courses/cpe335_s08/index.html CPE232 Basic MIPS Architecture

More information

Processor: Multi- Cycle Datapath & Control

Processor: Multi- Cycle Datapath & Control Processor: Multi- Cycle Datapath & Control (Based on text: David A. Patterson & John L. Hennessy, Computer Organization and Design: The Hardware/Software Interface, 3 rd Ed., Morgan Kaufmann, 27) COURSE

More information

EEC 483 Computer Organization. Branch (Control) Hazards

EEC 483 Computer Organization. Branch (Control) Hazards EEC 483 Compter Organization Section 4.8 Branch Hazards Section 4.9 Exceptions Chans Y Branch (Control) Hazards While execting a previos branch, next instrction address might not yet be known. s n i o

More information

ENE 334 Microprocessors

ENE 334 Microprocessors ENE 334 Microprocessors Lecture 6: Datapath and Control : Dejwoot KHAWPARISUTH Adapted from Computer Organization and Design, 3 th & 4 th Edition, Patterson & Hennessy, 2005/2008, Elsevier (MK) http://webstaff.kmutt.ac.th/~dejwoot.kha/

More information

Lecture 5 and 6. ICS 152 Computer Systems Architecture. Prof. Juan Luis Aragón

Lecture 5 and 6. ICS 152 Computer Systems Architecture. Prof. Juan Luis Aragón ICS 152 Computer Systems Architecture Prof. Juan Luis Aragón Lecture 5 and 6 Multicycle Implementation Introduction to Microprogramming Readings: Sections 5.4 and 5.5 1 Review of Last Lecture We have seen

More information

PS Midterm 2. Pipelining

PS Midterm 2. Pipelining PS idterm 2 Pipelining Seqential Landry 6 P 7 8 9 idnight Time T a s k O r d e r A B C D 3 4 2 3 4 2 3 4 2 3 4 2 Seqential landry takes 6 hors for 4 loads If they learned pipelining, how long wold landry

More information

Initial Representation Finite State Diagram Microprogram. Sequencing Control Explicit Next State Microprogram counter

Initial Representation Finite State Diagram Microprogram. Sequencing Control Explicit Next State Microprogram counter Control Implementation Alternatives Control may be designed using one of several initial representations. The choice of sequence control, and how logic is represented, can then be determined independently;

More information

4.13 Advanced Topic: An Introduction to Digital Design Using a Hardware Design Language 345.e1

4.13 Advanced Topic: An Introduction to Digital Design Using a Hardware Design Language 345.e1 .3 Advanced Topic: An Introdction to Digital Design Using a Hardware Design Langage 35.e.3 Advanced Topic: An Introdction to Digital Design Using a Hardware Design Langage to Describe and odel a Pipeline

More information

Chapter 6: Pipelining

Chapter 6: Pipelining Chapter 6: Pipelining Otline An overview of pipelining A pipelined path Pipelined control Data hazards and forwarding Data hazards and stalls Branch hazards Eceptions Sperscalar and dynamic pipelining

More information

Hardware Design Tips. Outline

Hardware Design Tips. Outline Hardware Design Tips EE 36 University of Hawaii EE 36 Fall 23 University of Hawaii Otline Verilog: some sbleties Simlators Test Benching Implementing the IPS Actally a simplified 6 bit version EE 36 Fall

More information

Multicycle Approach. Designing MIPS Processor

Multicycle Approach. Designing MIPS Processor CSE 675.2: Introduction to Computer Architecture Multicycle Approach 8/8/25 Designing MIPS Processor (Multi-Cycle) Presentation H Slides by Gojko Babić and Elsevier Publishing We will be reusing functional

More information

MIPS Architecture. An Example: MIPS. From the Harris/Weste book Based on the MIPS-like processor from the Hennessy/Patterson book

MIPS Architecture. An Example: MIPS. From the Harris/Weste book Based on the MIPS-like processor from the Hennessy/Patterson book An Eample: IPS From the Harris/Weste book Based on the IPS-like processor from the Hennessy/Patterson book IPS Architectre w Eample: sbset of IPS processor architectre n Drawn from Patterson & Hennessy

More information

Systems Architecture I

Systems Architecture I Systems Architecture I Topics A Simple Implementation of MIPS * A Multicycle Implementation of MIPS ** *This lecture was derived from material in the text (sec. 5.1-5.3). **This lecture was derived from

More information

Comp 303 Computer Architecture A Pipelined Datapath Control. Lecture 13

Comp 303 Computer Architecture A Pipelined Datapath Control. Lecture 13 Comp 33 Compter Architectre A Pipelined path Lectre 3 Pipelined path with Signals PCSrc IF/ ID ID/ EX EX / E E / Add PC 4 Address Instrction emory RegWr ra rb rw Registers bsw [5-] [2-6] [5-] bsa bsb Sign

More information

Computer Architecture. Lecture 6: Pipelining

Computer Architecture. Lecture 6: Pipelining Compter Architectre Lectre 6: Pipelining Dr. Ahmed Sallam Based on original slides by Prof. Onr tl Agenda for Today & Net Few Lectres Single-cycle icroarchitectres lti-cycle and icroprogrammed icroarchitectres

More information

CS 251, Spring 2018, Assignment 3.0 3% of course mark

CS 251, Spring 2018, Assignment 3.0 3% of course mark CS 25, Spring 28, Assignment 3. 3% of corse mark De onday, Jne 25th, 5:3 P. (5 points) Consider the single-cycle compter shown on page 6 of this assignment. Sppose the circit elements take the following

More information

ECE369. Chapter 5 ECE369

ECE369. Chapter 5 ECE369 Chapter 5 1 State Elements Unclocked vs. Clocked Clocks used in synchronous logic Clocks are needed in sequential logic to decide when an element that contains state should be updated. State element 1

More information

Lecture 10 Multi-Cycle Implementation

Lecture 10 Multi-Cycle Implementation Lecture 10 ulti-cycle Implementation 1 Today s enu ulti-cycle machines Why multi-cycle? Comparative performance Physical and Logical Design of Datapath and Control icroprogramming 2 ulti-cycle Solution

More information

CSE 2021 COMPUTER ORGANIZATION

CSE 2021 COMPUTER ORGANIZATION CSE 22 COMPUTER ORGANIZATION HUGH CHESSER CHESSER HUGH CSEB 2U 2U CSEB Agenda Topics:. Sample Exam/Quiz Q - Review 2. Multiple cycle implementation Patterson: Section 4.5 Reminder: Quiz #2 Next Wednesday

More information

Overview of Pipelining

Overview of Pipelining EEC 58 Compter Architectre Pipelining Department of Electrical Engineering and Compter Science Cleveland State University Fndamental Principles Overview of Pipelining Pipelined Design otivation: Increase

More information

CS 251, Winter 2018, Assignment % of course mark

CS 251, Winter 2018, Assignment % of course mark CS 25, Winter 28, Assignment 3.. 3% of corse mark De onday, Febrary 26th, 4:3 P Lates accepted ntil : A, Febrary 27th with a 5% penalty. IEEE 754 Floating Point ( points): (a) (4 points) Complete the following

More information

EECE 417 Computer Systems Architecture

EECE 417 Computer Systems Architecture EECE 417 Computer Systems Architecture Department of Electrical and Computer Engineering Howard University Charles Kim Spring 2007 1 Computer Organization and Design (3 rd Ed) -The Hardware/Software Interface

More information

The Processor: Datapath & Control

The Processor: Datapath & Control Chapter Five 1 The Processor: Datapath & Control We're ready to look at an implementation of the MIPS Simplified to contain only: memory-reference instructions: lw, sw arithmetic-logical instructions:

More information

ALUOut. Registers A. I + D Memory IR. combinatorial block. combinatorial block. combinatorial block MDR

ALUOut. Registers A. I + D Memory IR. combinatorial block. combinatorial block. combinatorial block MDR Microprogramming Exceptions and interrupts 9 CMPE Fall 26 A. Di Blas Fall 26 CMPE CPU Multicycle From single-cycle to Multicycle CPU with sequential control: Finite State Machine Textbook Edition: 5.4,

More information

Chapter 5: The Processor: Datapath and Control

Chapter 5: The Processor: Datapath and Control Chapter 5: The Processor: Datapath and Control Overview Logic Design Conventions Building a Datapath and Control Unit Different Implementations of MIPS instruction set A simple implementation of a processor

More information

Solutions for Chapter 6 Exercises

Solutions for Chapter 6 Exercises Soltions for Chapter 6 Eercises Soltions for Chapter 6 Eercises 6. 6.2 a. Shortening the ALU operation will not affect the speedp obtained from pipelining. It wold not affect the clock cycle. b. If the

More information

ECE 313 Computer Organization EXAM 2 November 9, 2001

ECE 313 Computer Organization EXAM 2 November 9, 2001 ECE 33 Computer Organization EA 2 November 9, 2 This exam is open book and open notes. You have 5 minutes. Credit for problems requiring calculation will be given only if you show your work. Choose and

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 3: OS model and Architectral Spport Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Last time/today

More information

Lab 8 (All Sections) Prelab: ALU and ALU Control

Lab 8 (All Sections) Prelab: ALU and ALU Control Lab 8 (All Sections) Prelab: and Control Name: Sign the following statement: On my honor, as an Aggie, I have neither given nor received nathorized aid on this academic work Objective In this lab yo will

More information

Computer Architecture Lecture 6: Multi-cycle Microarchitectures. Prof. Onur Mutlu Carnegie Mellon University Spring 2012, 2/6/2012

Computer Architecture Lecture 6: Multi-cycle Microarchitectures. Prof. Onur Mutlu Carnegie Mellon University Spring 2012, 2/6/2012 8-447 Compter Architectre Lectre 6: lti-cycle icroarchitectres Prof. Onr tl Carnegie ellon University Spring 22, 2/6/22 Reminder: Homeworks Homework soltions Check and stdy the soltions! Learning now is

More information

RISC Processor Design

RISC Processor Design RISC Processor Design Single Cycle Implementation - MIPS Virendra Singh Indian Institute of Science Bangalore virendra@computer.org Lecture 13 SE-273: Processor Design Feb 07, 2011 SE-273@SERC 1 Courtesy:

More information

Major CPU Design Steps

Major CPU Design Steps Datapath Major CPU Design Steps. Analyze instruction set operations using independent RTN ISA => RTN => datapath requirements. This provides the the required datapath components and how they are connected

More information

Lets Build a Processor

Lets Build a Processor Lets Build a Processor Almost ready to move into chapter 5 and start building a processor First, let s review Boolean Logic and build the ALU we ll need (Material from Appendix B) operation a 32 ALU result

More information

Implementing the Control. Simple Questions

Implementing the Control. Simple Questions Simple Questions How many cycles will it take to execute this code? lw $t2, 0($t3) lw $t3, 4($t3) beq $t2, $t3, Label add $t5, $t2, $t3 sw $t5, 8($t3) Label:... #assume not What is going on during the

More information

CSE 2021 COMPUTER ORGANIZATION

CSE 2021 COMPUTER ORGANIZATION CSE 2021 COMPUTER ORGANIZATION HUGH LAS CHESSER 1012U HUGH CHESSER CSEB 1012U W10-M Agenda Topics: 1. Multiple cycle implementation review 2. State Machine 3. Control Unit implementation for Multi-cycle

More information

Chapter 4 The Processor (Part 2)

Chapter 4 The Processor (Part 2) Department of Electr rical Eng ineering, Chapter 4 The Processor (Part 2) 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Feng-Chia Unive ersity Outline A Multicycle Implementation Mapping Control

More information

LECTURE 6. Multi-Cycle Datapath and Control

LECTURE 6. Multi-Cycle Datapath and Control LECTURE 6 Multi-Cycle Datapath and Control SINGLE-CYCLE IMPLEMENTATION As we ve seen, single-cycle implementation, although easy to implement, could potentially be very inefficient. In single-cycle, we

More information

CS152 Computer Architecture and Engineering Lecture 13: Microprogramming and Exceptions. Review of a Multiple Cycle Implementation

CS152 Computer Architecture and Engineering Lecture 13: Microprogramming and Exceptions. Review of a Multiple Cycle Implementation CS152 Computer Architecture and Engineering Lecture 13: Microprogramming and Exceptions March 3, 1995 Dave Patterson (patterson@cs) and Shing Kong (shing.kong@eng.sun.com) Slides available on http://http.cs.berkeley.edu/~patterson

More information

Points available Your marks Total 100

Points available Your marks Total 100 CSSE 3 Computer Architecture I Rose-Hulman Institute of Technology Computer Science and Software Engineering Department Exam Name: Section: 3 This exam is closed book. You are allowed to use the reference

More information

Mapping Control to Hardware

Mapping Control to Hardware C A P P E N D I X A custom format such as this is slave to the architecture of the hardware and the instruction set it serves. The format must strike a proper compromise between ROM size, ROM-output decoding,

More information

Winter 2013 MIDTERM TEST #2 Wednesday, March 20 7:00pm to 8:15pm. Please do not write your U of C ID number on this cover page.

Winter 2013 MIDTERM TEST #2 Wednesday, March 20 7:00pm to 8:15pm. Please do not write your U of C ID number on this cover page. page of 7 University of Calgary Departent of Electrical and Copter Engineering ENCM 369: Copter Organization Lectre Instrctors: Steve Noran and Nor Bartley Winter 23 MIDTERM TEST #2 Wednesday, March 2

More information

CSE 141 Computer Architecture Summer Session I, Lectures 10 Advanced Topics, Memory Hierarchy and Cache. Pramod V. Argade

CSE 141 Computer Architecture Summer Session I, Lectures 10 Advanced Topics, Memory Hierarchy and Cache. Pramod V. Argade CSE 141 Compter Architectre Smmer Session I, 2004 Lectres 10 Advanced Topics, emory Hierarchy and Cache Pramod V. Argade CSE141: Introdction to Compter Architectre Instrctor: TA: Pramod V. Argade (p2argade@cs.csd.ed)

More information

4.13. An Introduction to Digital Design Using a Hardware Design Language to Describe and Model a Pipeline and More Pipelining Illustrations

4.13. An Introduction to Digital Design Using a Hardware Design Language to Describe and Model a Pipeline and More Pipelining Illustrations .3 An Introdction to Digital Design Using a Hardware Design Langage to Describe and odel a Pipeline and ore Pipelining Illstrations This online section covers hardware description langages and then gives

More information

Lecture 8: Control COS / ELE 375. Computer Architecture and Organization. Princeton University Fall Prof. David August

Lecture 8: Control COS / ELE 375. Computer Architecture and Organization. Princeton University Fall Prof. David August Lecture 8: Control COS / ELE 375 Computer Architecture and Organization Princeton University Fall 2015 Prof. David August 1 Datapath and Control Datapath The collection of state elements, computation elements,

More information

CO Computer Architecture and Programming Languages CAPL. Lecture 18 & 19

CO Computer Architecture and Programming Languages CAPL. Lecture 18 & 19 CO2-3224 Computer Architecture and Programming Languages CAPL Lecture 8 & 9 Dr. Kinga Lipskoch Fall 27 Single Cycle Disadvantages & Advantages Uses the clock cycle inefficiently the clock cycle must be

More information

Multi-cycle Approach. Single cycle CPU. Multi-cycle CPU. Requires state elements to hold intermediate values. one clock cycle or instruction

Multi-cycle Approach. Single cycle CPU. Multi-cycle CPU. Requires state elements to hold intermediate values. one clock cycle or instruction Multi-cycle Approach Single cycle CPU State element Combinational logic State element clock one clock cycle or instruction Multi-cycle CPU Requires state elements to hold intermediate values State Element

More information

Inf2C - Computer Systems Lecture 12 Processor Design Multi-Cycle

Inf2C - Computer Systems Lecture 12 Processor Design Multi-Cycle Inf2C - Computer Systems Lecture 12 Processor Design Multi-Cycle Boris Grot School of Informatics University of Edinburgh Previous lecture: single-cycle processor Inf2C Computer Systems - 2017-2018. Boris

More information

Computer and Information Sciences College / Computer Science Department The Processor: Datapath and Control

Computer and Information Sciences College / Computer Science Department The Processor: Datapath and Control Computer and Information Sciences College / Computer Science Department The Processor: Datapath and Control Chapter 5 The Processor: Datapath and Control Big Picture: Where are We Now? Performance of a

More information

Topic #6. Processor Design

Topic #6. Processor Design Topic #6 Processor Design Major Goals! To present the single-cycle implementation and to develop the student's understanding of combinational and clocked sequential circuits and the relationship between

More information

ECE468 Computer Organization and Architecture. Designing a Multiple Cycle Controller

ECE468 Computer Organization and Architecture. Designing a Multiple Cycle Controller ECE468 Computer Organization and Architecture Designing a Multiple Cycle Controller ECE468 multicontroller Review of a Multiple Cycle Implementation The root of the single cycle processor s problems: The

More information

ECE 313 Computer Organization FINAL EXAM December 14, This exam is open book and open notes. You have 2 hours.

ECE 313 Computer Organization FINAL EXAM December 14, This exam is open book and open notes. You have 2 hours. This exam is open book and open notes. You have 2 hours. Problems 1-4 refer to a proposed MIPS instruction lwu (load word - update) which implements update addressing an addressing mode that is used in

More information

RISC Architecture: Multi-Cycle Implementation

RISC Architecture: Multi-Cycle Implementation RISC Architecture: Multi-Cycle Implementation Virendra Singh Associate Professor Computer Architecture and Dependable Systems Lab Department of Electrical Engineering Indian Institute of Technology Bombay

More information

EECS 322 Computer Architecture Improving Memory Access: the Cache

EECS 322 Computer Architecture Improving Memory Access: the Cache EECS 322 Computer Architecture Improving emory Access: the Cache Instructor: Francis G. Wolff wolff@eecs.cwru.edu Case Western Reserve University This presentation uses powerpoint animation: please viewshow

More information

RISC Architecture: Multi-Cycle Implementation

RISC Architecture: Multi-Cycle Implementation RISC Architecture: Multi-Cycle Implementation Virendra Singh Associate Professor Computer Architecture and Dependable Systems Lab Department of Electrical Engineering Indian Institute of Technology Bombay

More information