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

Size: px
Start display at page:

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

Transcription

1 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 w IPS is a 32-bit architectre with 32 s n Consider 8-bit sbset sing 8-bit path n Only implement 8 s ($ - $7) n $ hardwired to n 8-bit program conter Ø

2 Set Set What s missing from this instrction set? Ø 2

3 Set What s missing from this instrction set? Lots of things! One in particlar: Spport for sbrotine calls (JAL, STPC, etc.) Encoding w 32-bit instrction encoding (still 8-bit ) n Reqires for cycles to fetch on 8-bit path format eample encoding R add $rd, $ra, $rb ra rb rd fnct 5 5 I beq $ra, $rb, imm op ra rb imm 2 J j dest op dest Ø 3

4 Fibonacci (C) f = ; f - = - f n = f n- + f n-2 f =,,, 2, 3, 5, 8, 3, Fibonacci (Assembly) w st statement: int n = 8; w How do we translate this to assembly? n Decide which shold hold its vale n Load an immediate vale into that n Bt, there s no load immediate instrction n Bt, there is an addi instrction, and there s a convenient that s always pinned to w addi $3, $, 8 ; load +8 into 3 Ø 4

5 Fibonacci (Assembly) Fibonacci (Binary) w st statement: addi $3, $, 8 w How do we translate this to machine langage? n Hint: se instrction encodings below format eample encoding R add $rd, $ra, $rb ra rb rd fnct 5 5 I beq $ra, $rb, imm op ra rb imm 2 J j dest op dest Ø 5

6 Fibonacci (Binary) w achine langage program Fibonacci (Binary) format eample encoding R add $rd, $ra, $rb ra rb rd fnct 5 5 I beq $ra, $rb, imm op ra rb imm 2 J j dest op dest Ø

7 IPS icroarchitectre w lticycle microarchitectre from Patterson & Hennessy PCEn PCCond PC IorD em em emtoreg Otpts Control PCSorce ALUOp ALUSrcB ALUSrcA Reg PC Address emory emdata [3:2] [25 : 2] [2 : ] [5 : ] [7: ] emory IR[3:] [5: ] Op [5 : ] RegDst [5 : ] 8 Shift 2 Registers 2 A B 2 3 ALU control left 2 Zero ALU ALU reslt ALUControl Jmp address ALUOt 2 [5 : ] lticycle Controller fetch em ALUSrcA = IorD = IR3 ALUSrcB = ALUOp = PC PCSorce = em ALUSrcA = IorD = IR2 ALUSrcB = ALUOp = PC PCSorce = 2 em ALUSrcA = IorD = IR ALUSrcB = ALUOp = PC PCSorce = 3 em ALUSrcA = IorD = IR ALUSrcB = ALUOp = PC PCSorce = decode/ fetch 4 ALUSrcA = ALUSrcB = ALUOp = Reset emory address comptation 5 ALUSrcA = ALUSrcB = ALUOp = (Op = 'L B ') or (Op = 'S B ') Eection 9 ALUSrcA = ALUSrcB = ALUOp= (Op = R-type) Branch completion ALUSrcA = ALUSrcB = ALUOp = PCCond PCSorce = (Op = 'BEQ') (Op = 'J') Jmp completion 2 PC PCSorce = (Op = 'L B') (Op = 'S B') emory access 8 emory access R-type completion em IorD = em IorD = RegDst = Reg emtoreg = 7 -back step RegDst = Reg emtoreg = Ø 7

8 Logic Design w Start at top level n Hierarchically decompose IPS into nits w Top-level interface crystal oscillator Clk reset memread memwrite IPS processor adr write mem eternal memory Verilog Code // top level design incldes both mips processor and memory modle mips_mem #(parameter WIDTH = 8, REGBITS = 3)(clk, reset); inpt clk, reset; wire memread, memwrite; wire [WIDTH-:] adr, write; wire [WIDTH-:] mem; crystal oscillator Clk reset memread memwrite IPS processor adr write mem eternal memory // instantiate the mips processor mips #(WIDTH,REGBITS) mips(clk, reset, mem, memread, memwrite, adr, write); // instantiate memory for code and emem #(WIDTH) emem(clk, memwrite, adr, write, mem); Ø 8

9 PC PCEn Address emory emdata [3:2] [25 : 2] [2 : ] [5 : ] [7: ] emory PCCond PC IorD em em emtoreg IR[3:] [5: ] Otpts Control Op [5 : ] PCSorce ALUOp ALUSrcB ALUSrcA Reg RegDst [5 : ] 8 Shift 2 Registers [5 : ] 2 A B 2 3 ALU control left 2 Zero ALU ALU reslt ALUControl Jmp address ALUOt 2 Block Diagram memwrite memread controller alop[:] alcontrol ph op[5:] zero alsrca alsrcb[:] pcen pcsorce[:] memtoreg regdst iord regwrite irwrite[3:] fnct[5:] alcontrol[2:] ph2 reset adr[7:] path write[7:] mem[7:] // simplified IPS processor modle mips #(parameter WIDTH = 8, REGBITS = 3) (inpt clk, reset, inpt [WIDTH-:] mem, otpt memread, memwrite, otpt [WIDTH-:] adr, write); memwrite memread Top-level code controller alop[:] alcontrol wire [3:] instr; wire zero, alsrca, memtoreg, iord, pcen; wire regwrite, regdst; wire [:] alop,pcsorce,alsrcb; wire [3:] irwrite; wire [2:] alcont; ph ph2 reset adr[7:] write[7:] mem[7:] op[5:] zero alsrca alsrcb[:] pcen pcsorce[:] memtoreg regdst iord regwrite irwrite[3:] path fnct[5:] alcontrol[2:] controller cont(clk, reset, instr[3:2], zero, memread, memwrite, alsrca, memtoreg, iord, pcen, regwrite, regdst, pcsorce, alsrcb, alop, irwrite); alcontrol ac(alop, instr[5:], alcont); path #(WIDTH, REGBITS) dp(clk, reset, mem, alsrca, memtoreg, iord, pcen, regwrite, regdst, pcsorce, alsrcb, irwrite, alcont, zero, instr, adr, write); Ø 9

10 modle controller(inpt clk, reset, inpt [5:] op, inpt zero, otpt reg memread, memwrite, alsrca, memtoreg, iord, otpt pcen, otpt reg regwrite, regdst, otpt reg [:] pcsorce, alsrcb, alop, otpt reg [3:] irwrite); Controller (FS) fetch parameter FETCH = 4'b; parameter FETCH2 = 4'b; parameter FETCH3 = 4'b; parameter FETCH4 = 4'b; parameter DECODE = 4'b; parameter EADR = 4'b; parameter LBRD = 4'b; Reset parameter LBWR = 4'b; parameter SBWR = 4'b; parameter RTYPEEX = 4'b; parameter RTYPEWR = 4'b; parameter BEQEX = 4'b; parameter JEX = 4'b; parameter ADDIWR = 4'b; // added for ADDI parameter LB = 'b; parameter SB = 'b; parameter RTYPE = 'b; parameter BEQ = 'b; parameter J = 'b; parameter ADDI = 'b; /// added for ADDI reg [3:] state, netstate; reg pcwrite, pcwritecond; em ALUSrcA = IorD = IR3 ALUSrcB = ALUOp = PC PCSorce = em ALUSrcA = IorD = IR2 ALUSrcB = ALUOp = PC PCSorce = emory address comptation 5 ALUSrcA = ALUSrcB = ALUOp = (Op = 'L B') emory access em IorD = (Op = 'S B') -back step 7 RegDst = Reg emtoreg = 2 3 em em decode/ ALUSrcA = ALUSrcA = fetch IorD = IorD = 4 IR IR ALUSrcB = ALUSrcB = ALUSrcA = ALUOp = ALUOp = ALUSrcB = PC PC ALUOp = PCSorce = PCSorce = (Op = 'L B ') or (Op = 'S B ') Eection 9 ALUSrcA = ALUSrcB = ALUOp= emory access R-type completion 8 RegDst = em Reg IorD = emtoreg = (Op = R-type) Branch completion ALUSrcA = ALUSrcB = ALUOp = PCCond PCSorce = (Op = 'BEQ') (Op = 'J') Jmp completion 2 PC PCSorce = modle controller(inpt clk, reset, inpt [5:] op, inpt zero, otpt reg memread, memwrite, alsrca, memtoreg, iord, otpt pcen, otpt reg regwrite, regdst, otpt reg [:] pcsorce, alsrcb, alop, otpt reg [3:] irwrite); parameter FETCH = 4'b; parameter FETCH2 = 4'b; parameter FETCH3 = 4'b; parameter FETCH4 = 4'b; parameter DECODE = 4'b; parameter EADR = 4'b; parameter LBRD = 4'b; parameter LBWR = 4'b; parameter SBWR = 4'b; parameter RTYPEEX = 4'b; parameter RTYPEWR = 4'b; parameter BEQEX = 4'b; parameter JEX = 4'b; parameter ADDIWR = 4'b; // added for ADDI parameter LB = 'b; parameter SB = 'b; parameter RTYPE = 'b; parameter BEQ = 'b; parameter J = 'b; parameter ADDI = 'b; /// added for ADDI reg [3:] state, netstate; reg pcwrite, pcwritecond; State Encodings... Opcodes... Local reg variables... Controller Parameters Ø

11 ain state machine NS logic // state clk) if(reset) state <= FETCH; else state <= netstate; // net state logic (combinational) case(state) FETCH: netstate <= FETCH2; FETCH2: netstate <= FETCH3; FETCH3: netstate <= FETCH4; FETCH4: netstate <= DECODE; DECODE: case(op) LB: netstate <= EADR; SB: netstate <= EADR; ADDI: netstate <= EADR; RTYPE: netstate <= RTYPEEX; BEQ: netstate <= BEQEX; J: netstate <= JEX; // shold never happen defalt: netstate <= FETCH; case EADR: case(op) LB: netstate <= LBRD; SB: netstate <= SBWR; ADDI: netstate <= ADDIWR; // shold never happen defalt: netstate <= FETCH; case LBRD: netstate <= LBWR; LBWR: netstate <= FETCH; SBWR: netstate <= FETCH; RTYPEEX: netstate <= RTYPEWR; RTYPEWR: netstate <= FETCH; BEQEX: netstate <= FETCH; JEX: netstate <= FETCH; ADDIWR: netstate <= FETCH; // shold never happen defalt: netstate <= FETCH; case Setting Control Signal Otpts // set all otpts to zero, then // conditionally assert jst the // appropriate ones irwrite <= 4'b; pcwrite <= ; pcwritecond <= ; regwrite <= ; regdst <= ; memread <= ; memwrite <= ; alsrca <= ; alsrcb <= 2'b; alop <= 2'b; pcsorce <= 2'b; iord <= ; memtoreg <= ; case(state) FETCH: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; FETCH2: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; FETCH3: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; FETCH4: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; DECODE: alsrcb <= 2'b;... case Ø

12 IPS icroarchitectre - Datapath PC PCEn Address emory emdata [3:2] [25 : 2] [2 : ] [5 : ] [7: ] PCCond PC IorD em em emtoreg IR[3:] [5: ] Otpts Control Op [5 : ] PCSorce ALUOp ALUSrcB ALUSrcA Reg RegDst [5 : ] 8 Shift 2 Registers 2 A B 2 3 left 2 Zero ALU ALU reslt Jmp address ALUOt 2 emory ALU control ALUControl [5 : ] modle path #(parameter WIDTH = 8, REGBITS = 3) (inpt clk, reset, inpt [WIDTH-:] mem, inpt alsrca, memtoreg, iord, pcen, regwrite, regdst, inpt [:] pcsorce, alsrcb, // m select bits inpt [3:] irwrite, // InstReg write flags inpt [2:] alcont, // ALU control bits otpt zero, // ALU otpt is zero flag otpt [3:] instr, // 32-bit instrction otpt [WIDTH-:] adr, write); // 8-bit address and write- s // the size of the parameters mst be changed to match the WIDTH parameter localparam CONST_ZERO = 8'b; localparam CONST_ONE = 8'b; wire [REGBITS-:] ra, ra2, wa; // address bits wire [WIDTH-:] pc, netpc, md, rd, rd2, wd, a, src, src2, alreslt, alot, const4; // shift left constant field by 2 assign const4 = {instr[width-3:],2'b}; Verilog: Datapath // file address fields assign ra = instr[regbits+2:2]; assign ra2 = instr[regbits+5:]; m2 #(REGBITS) regm(instr[regbits+5:], instr[regbits+:], regdst, wa); Ø 2

13 // indepent of bit width, load instrction into for 8-bit s over for cycles flopen #(8) ir(clk, irwrite[], mem[7:], instr[7:]); flopen #(8) ir(clk, irwrite[], mem[7:], instr[5:8]); flopen #(8) ir2(clk, irwrite[2], mem[7:], instr[23:]); flopen #(8) ir3(clk, irwrite[3], mem[7:], instr[3:24]); // path flopenr #(WIDTH) pcreg(clk, reset, pcen, netpc, pc); flop #(WIDTH) wrd(clk, rd2, write); flop flop #(WIDTH) mdr(clk, mem, md); #(WIDTH) res(clk, alreslt, alot); flop #(WIDTH) areg(clk, rd, a); Verilog: Datapath 2 m2 #(WIDTH) adrm(pc, alot, iord, adr); m2 #(WIDTH) srcm(pc, a, alsrca, src); m4 #(WIDTH) src2m(write, CONST_ONE, instr[width-:], const4, alsrcb, src2); m4 #(WIDTH) pcm(alreslt, alot, const4, CONST_ZERO, pcsorce, netpc); m2 #(WIDTH) wdm(alot, md, memtoreg, wd); regfile #(WIDTH,REGBITS) rf(clk, regwrite, ra, ra2, wa, wd, rd, rd2); al #(WIDTH) alnit(src, src2, alcont, alreslt); zerodetect #(WIDTH) zd(alreslt, zero); IPS icroarchitectre - ALU PC PCEn Address emory emdata [3:2] [25 : 2] [2 : ] [5 : ] [7: ] PCCond PC IorD em em emtoreg IR[3:] [5: ] Otpts Control Op [5 : ] PCSorce ALUOp ALUSrcB ALUSrcA Reg RegDst [5 : ] 8 Shift 2 Registers 2 A B 2 3 left 2 Zero ALU ALU reslt Jmp address ALUOt 2 emory ALU control ALUControl [5 : ] Ø 3

14 modle al #(parameter WIDTH = 8) (inpt [WIDTH-:] a, b, inpt [2:] alcont, otpt reg [WIDTH-:] reslt); wire [WIDTH-:] b2, sm, slt; Verilog: al assign b2 = alcont[2]? ~b:b; // pre-compte B-inv for sbtraction assign sm = a + b2 + alcont[2]; // A + B or A + Binv + (i.e. sbtraction) // slt shold be if most significant bit of sm is assign slt = sm[width-]; always@(*) case(alcont[:]) 2'b: reslt <= a & b; 2'b: reslt <= a b; 2'b: reslt <= sm; 2'b: reslt <= slt; case // compte ALU reslt (based on alcont bits) IPS icroarchitectre - ALUctl PC PCEn Address emory emdata [3:2] [25 : 2] [2 : ] [5 : ] [7: ] PCCond PC IorD em em emtoreg IR[3:] [5: ] Otpts Control Op [5 : ] PCSorce ALUOp ALUSrcB ALUSrcA Reg RegDst [5 : ] 8 Shift 2 Registers 2 A B 2 3 left 2 Zero ALU ALU reslt Jmp address ALUOt 2 emory ALU control ALUControl [5 : ] Ø 4

15 Verilog: alcontrol modle alcontrol(inpt [:] alop, inpt [5:] fnct, otpt reg [2:] alcont); case(alop) 2'b: alcont <= 3'b; // add for lb/sb/addi 2'b: alcont <= 3'b; // sb (for beq) defalt: case(fnct) // R-Type instrctions 'b: alcont <= 3'b; // add (for add) 'b: alcont <= 3'b; // sbtract (for sb) 'b: alcont <= 3'b; // logical and (for and) 'b: alcont <= 3'b; // logical or (for or) 'b: alcont <= 3'b; // set on less (for slt) defalt: alcont <= 3'b; // shold never happen case case IPS icroarchitectre - Regfile PC PCEn Address emory emdata [3:2] [25 : 2] [2 : ] [5 : ] [7: ] PCCond PC IorD em em emtoreg IR[3:] [5: ] Otpts Control Op [5 : ] PCSorce ALUOp ALUSrcB ALUSrcA Reg RegDst [5 : ] 8 Shift 2 Registers 2 A B 2 3 left 2 Zero ALU ALU reslt Jmp address ALUOt 2 emory ALU control ALUControl [5 : ] Ø 5

16 Verilog: regfile modle regfile #(parameter WIDTH = 8, REGBITS = 3) (inpt clk, inpt regwrite, inpt [REGBITS-:] ra, ra2, wa, inpt [WIDTH-:] wd, otpt [WIDTH-:] rd, rd2); reg [WIDTH-:] RA [(<<REGBITS)-:]; // three ported file // read two ports (combinational) // write third port on rising edge of clock clk) if (regwrite) RA[wa] <= wd; assign rd = ra? RA[ra] : ; // is hardwired to assign rd2 = ra2? RA[ra2] : ; // is hardwired to Verilog: Spport Strctres modle zerodetect #(parameter WIDTH = 8) (inpt [WIDTH-:] a, otpt y); assign y = (a==); modle flop #(parameter WIDTH = 8) (inpt clk, inpt [WIDTH-:] d, otpt reg [WIDTH-:] q); clk) q <= d; modle flopen #(parameter WIDTH = 8) (inpt clk, en, inpt [WIDTH-:] d, otpt reg [WIDTH-:] q); clk) if (en) q <= d; modle flopenr #(parameter WIDTH = 8) (inpt clk, reset, en, inpt [WIDTH-:] d, otpt reg [WIDTH-:] q); clk) if (reset) q <= ; else if (en) q <= d; modle m2 #(parameter WIDTH = 8) (inpt [WIDTH-:] d, d, inpt s, otpt [WIDTH-:] y); assign y = s? d : d; modle m4 #(parameter WIDTH = 8) (inpt [WIDTH-:] d, d, d2, d3, inpt [:] s, otpt reg [WIDTH-:] y); case(s) 2'b: y <= d; 2'b: y <= d; 2'b: y <= d2; 2'b: y <= d3; case Ø

17 Logic Design w Start at top level n Hierarchically decompose IPS into nits w Top-level interface crystal oscillator Clk reset memread memwrite IPS processor adr write mem eternal memory Verilog: ememory simlation // eternal memory accessed by IPS modle ememory #(parameter WIDTH = 8) (clk, memwrite, adr, write, mem); inpt clk; inpt memwrite; inpt [WIDTH-:] adr, write; otpt reg [WIDTH-:] mem; reg [3:] RA [(<<WIDTH-2)-:]; wire [3:] word; initial $readmemh("memfile.dat",ra); // read and write bytes from 32-bit word clk) if(memwrite) case (adr[:]) 2'b: RA[adr>>2][7:] <= write; 2'b: RA[adr>>2][5:8] <= write; 2'b: RA[adr>>2][23:] <= write; 2'b: RA[adr>>2][3:24] <= write; case assign word = RA[adr>>2]; case (adr[:]) 2'b: mem <= word[7:]; 2'b: mem <= word[5:8]; 2'b: mem <= word[23:]; 2'b: mem <= word[3:24]; case Ø 7

18 Synthesized memory? w If yo synthesize the Verilog, yo ll get a memory n Bt it will be hge! n It will be made of yor DFF cells n pls synthesized address decoders n Cstom memory is mch smaller n bt mch trickier to get right n see details in VGA slides Verilog: ememory // eternal memory accessed by IPS modle emem #(parameter WIDTH = 8) (clk, memwrite, adr, write, mem); inpt inpt inpt otpt clk; memwrite; [WIDTH-:] adr, write; [WIDTH-:] mem; wire memwriteb, clkb; // UC RA has active low write enable... not(memwriteb, memwrite); // Looks like yo need to clock the memory early // to make it work with the crrent control... not(clkb, clk); // Instantiate the UC SPRA modle UC3SPRA_8_8 mips_ram (.CK(clkB),.CEN('b),.WEN(memwriteB),.OEN('b),.ADR(adr),.DI(write),.DOUT(mem)); Ø 8

19 IPS (8-bit) size comparison One big EDI rn of the whole thing With some work, cold probably get this in a single TCU... IPS (8-bit) size comparison Separate EDI for controller, alcontrol, path and cstom RF, assembled with ccar Ø 9

20 IPS (8-bit) whole chip Incldes poly/m/m2/m3 fill, and logos Roted to the pads sing ccar System Verilog w Enhanced version of classic Verilog n ore types l typedef, strct, nion, enm n Some OO featres n Adds better spport for verification w Backward compatible with Verilog Ø 2

21 New type: logic w logic as a type is like a reg n Bt can be sed everywhere, not jst in seqential blocks (always, initial) n It mst have a single driver only one gate driving the vale (like a logic vale!) n If yo have more than one driver (think tri-state), then it mst be a wire logic [7:] my_var; // 8-bit logic type variable mips modle definition // simplified IPS processor modle mips #(parameter WIDTH = 8, REGBITS = 3) (inpt logic clk, reset, inpt logic [WIDTH-:] mem, otpt logic memread, memwrite, otpt logic [WIDTH-:] adr, write); logic [3:] instr; logic zero, alsrca, memtoreg, iord, pcen, regwrite, regdst; logic [:] pcsrc, alsrcb; logic [3:] irwrite; logic [2:] alcontrol; logic [5:] op, fnct; assign op = instr[3:2]; assign fnct = instr[5:]; controller cont(clk, reset, op, fnct, zero, memread, memwrite, alsrca, memtoreg, iord, pcen, regwrite, regdst, pcsrc, alsrcb, alcontrol, irwrite); path #(WIDTH, REGBITS) dp(clk, reset, mem, alsrca, memtoreg, iord, pcen, regwrite, regdst, pcsrc, alsrcb, irwrite, alcontrol, zero, instr, adr, write); Ø 2

22 C-type Data Strctring w Enmerated types allow nmeric qantities to be assigned meaningfl names n Like parameters in Verilog typedef enm logic [2:] { RED, GREEN, BLUE, CYAN, AGENTA, YELLOW } color_t; color_t my_color = GREEN; initial $display("the color is %s, my_color.name()); // note the se of the name() bilt-in fnction C-type Data Strctring w Strcts are like C strcts typedef strct { byte a; reg b; shortint nsigned c; } mystrct; modle strct_ (); // Define a local strct. strct { byte a; reg b; shortint nsigned c; } mylocalstrct = '{,,}; Disclaimer I don t know mch abot how these interact with synthesis // When defined typedef, we can be sed as new type mystrct object = '{,,}; initial $display ("a = %b b = %b c = %h", object.a, object.b, object.c); $display ("a = %b b = %b c = %h", mylocalstrct.a, mylocalstrct.b, mylocalstrct.c); # $finish; Ø 22

23 modle controller(inpt clk, reset, inpt [5:] op, inpt zero, otpt reg memread, memwrite, alsrca, memtoreg, iord, otpt pcen, otpt reg regwrite, regdst, otpt reg [:] pcsorce, alsrcb, alop, otpt reg [3:] irwrite); parameter FETCH = 4'b; parameter FETCH2 = 4'b; parameter FETCH3 = 4'b; parameter FETCH4 = 4'b; parameter DECODE = 4'b; parameter EADR = 4'b; parameter LBRD = 4'b; parameter LBWR = 4'b; parameter SBWR = 4'b; parameter RTYPEEX = 4'b; parameter RTYPEWR = 4'b; parameter BEQEX = 4'b; parameter JEX = 4'b; parameter ADDIWR = 4'b; // added for ADDI parameter LB = 'b; parameter SB = 'b; parameter RTYPE = 'b; parameter BEQ = 'b; parameter J = 'b; parameter ADDI = 'b; /// added for ADDI reg [3:] state, netstate; reg pcwrite, pcwritecond; State Encodings... Opcodes... Local reg variables... Controller Parameters: Verilog System Verilog Version // states and instrctions typedef enm logic [3:] {FETCH = 4'b, FETCH2, FETCH3, FETCH4, DECODE, EADR, LBRD, LBWR, SBWR, RTYPEEX, RTYPEWR, BEQEX, JEX} statetype; typedef enm logic [5:] {LB = 'b, SB = 'b, RTYPE = 'b, BEQ = 'b, J = 'b} opcode; typedef enm logic [5:] {ADD = 'b, SUB = 'b, AND = 'b, OR = 'b, SLT = 'b} fnctcode; Ø 23

24 SystemVerilog Version modle controller(inpt logic clk, reset, inpt logic [5:] op, fnct, inpt logic zero, otpt logic memread, memwrite, alsrca, otpt logic memtoreg, iord, pcen, otpt logic regwrite, regdst, otpt logic [:] pcsrc, alsrcb, otpt logic [2:] alcontrol, otpt logic [3:] irwrite); statetype state; logic pcwrite, branch; logic [:] alop; // control FS statelogic statelog(clk, reset, op, state); otptlogic otptlog(state, memread, memwrite, alsrca, memtoreg, iord, regwrite, regdst, pcsrc, alsrcb, irwrite, pcwrite, branch, alop); // other control decoding aldec ac(alop, fnct, alcontrol); assign pcen = pcwrite (branch & zero); // program conter enable w Old: Verilog n n New Seqential Blocks // combinational clk) // seqential (latch or ff) w New: SystemVerilog n n n always_comb // combinational clk) // seqential with ff always_latch // level-sensitive latch // gate inferred from the code // don t se this one Ø 24

25 NS logic: Verilog // state clk) if(reset) state <= FETCH; else state <= netstate; // net state logic (combinational) case(state) FETCH: netstate <= FETCH2; FETCH2: netstate <= FETCH3; FETCH3: netstate <= FETCH4; FETCH4: netstate <= DECODE; DECODE: case(op) LB: netstate <= EADR; SB: netstate <= EADR; ADDI: netstate <= EADR; RTYPE: netstate <= RTYPEEX; BEQ: netstate <= BEQEX; J: netstate <= JEX; // shold never happen defalt: netstate <= FETCH; case EADR: case(op) LB: netstate <= LBRD; SB: netstate <= SBWR; ADDI: netstate <= ADDIWR; // shold never happen defalt: netstate <= FETCH; case LBRD: netstate <= LBWR; LBWR: netstate <= FETCH; SBWR: netstate <= FETCH; RTYPEEX: netstate <= RTYPEWR; RTYPEWR: netstate <= FETCH; BEQEX: netstate <= FETCH; JEX: netstate <= FETCH; ADDIWR: netstate <= FETCH; // shold never happen defalt: netstate <= FETCH; case NS logic: SystemVerilog modle statelogic(inpt logic clk, reset, inpt logic [5:] op, otpt statetype state); statetype netstate; clk) if (reset) state <= FETCH; else state <= netstate; always_comb case (state) FETCH: netstate = FETCH2; FETCH2: netstate = FETCH3; FETCH3: netstate = FETCH4; FETCH4: netstate = DECODE; DECODE: case(op) LB: netstate = EADR; SB: netstate = EADR; RTYPE: netstate = RTYPEEX; BEQ: netstate = BEQEX; J: netstate = JEX; defalt: netstate = FETCH; // shold never happen case EADR: case(op) LB: netstate = LBRD; SB: netstate = SBWR; defalt: netstate = FETCH; // shold never happen case LBRD: netstate = LBWR; LBWR: netstate = FETCH; SBWR: netstate = FETCH; RTYPEEX: netstate = RTYPEWR; RTYPEWR: netstate = FETCH; BEQEX: netstate = FETCH; JEX: netstate = FETCH; defalt: netstate = FETCH; // shold never happen case Ø 25

26 Otpts: Verilog // set all otpts to zero, then // conditionally assert jst the // appropriate ones irwrite <= 4'b; pcwrite <= ; pcwritecond <= ; regwrite <= ; regdst <= ; memread <= ; memwrite <= ; alsrca <= ; alsrcb <= 2'b; alop <= 2'b; pcsorce <= 2'b; iord <= ; memtoreg <= ; case(state) FETCH: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; FETCH2: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; FETCH3: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; FETCH4: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; DECODE: alsrcb <= 2'b;... case Otpts: SystemVerilog modle otptlogic(inpt statetype state, otpt logic memread, memwrite, alsrca, otpt logic memtoreg, iord, otpt logic regwrite, regdst, otpt logic [:] pcsrc, alsrcb, otpt logic [3:] irwrite, otpt logic pcwrite, branch, otpt logic [:] alop); always_comb // set all otpts to zero, then // conditionally assert jst the appropriate ones irwrite = 4'b; pcwrite = ; branch = ; regwrite = ; regdst = ; memread = ; memwrite = ; alsrca = ; alsrcb = 2'b; alop = 2'b; pcsrc = 2'b; iord = ; memtoreg = ; case (state) FETCH: memread = ; irwrite = 4'b; alsrcb = 2'b; pcwrite = ; FETCH2: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; FETCH3: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; FETCH4: memread <= ; irwrite <= 4'b; alsrcb <= 2'b; pcwrite <= ; DECODE: alsrcb <= 2'b;... case Ø 2

27 Otpts: SystemVerilog modle aldec(inpt logic [:] alop, inpt logic [5:] fnct, otpt logic [2:] alcontrol); always_comb case (alop) 2'b: alcontrol = 3'b; // add for lb/sb/addi 2'b: alcontrol = 3'b; // sbtract (for beq) defalt: case(fnct) // R-Type instrctions ADD: alcontrol = 3'b; SUB: alcontrol = 3'b; AND: alcontrol = 3'b; OR: alcontrol = 3'b; SLT: alcontrol = 3'b; defalt: alcontrol = 3'b; // shold never happen case case Flops, etc.: SystemVerilog modle flop #(parameter WIDTH = 8) (inpt logic clk, inpt logic [WIDTH-:] d, otpt logic [WIDTH-:] q); clk) q <= d; modle flopen #(parameter WIDTH = 8) (inpt logic clk, en, inpt logic [WIDTH-:] d, otpt logic [WIDTH-:] q); clk) if (en) q <= d; Ø 27

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

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

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

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

1048: Computer Organization

1048: Computer Organization 48: Compter Organization Lectre 5 Datapath and Control Lectre5B - mlticycle implementation (cwli@twins.ee.nct.ed.tw) 5B- Recap: A Single-Cycle Processor PCSrc 4 Add Shift left 2 Add ALU reslt PC address

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

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

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

Digital Design & Computer Architecture (E85) D. Money Harris Fall 2007

Digital Design & Computer Architecture (E85) D. Money Harris Fall 2007 Digital Design & Computer Architecture (E85) D. Money Harris Fall 2007 Final Exam This is a closed-book take-home exam. You are permitted a calculator and two 8.5x sheets of paper with notes. The exam

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

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 2: MIPS Processor Example

Lecture 2: MIPS Processor Example Introduction to CMOS VLSI Design Lecture 2: MIPS Processor Example Outline Design Partitioning MIPS Processor Example Architecture t Microarchitecture Logic Design Circuit Design Physical Design Fabrication,

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

CMOS VLSI Design. MIPS Processor Example. Outline

CMOS VLSI Design. MIPS Processor Example. Outline COS VLSI Design IPS Processor Example Outline Design Partitioning IPS Processor Example Architecture icroarchitecture Logic Design Circuit Design Physical Design Fabrication, Packaging, Testing Slide 2

More information

Introduction to CMOS VLSI Design Lecture 2: MIPS Processor Example

Introduction to CMOS VLSI Design Lecture 2: MIPS Processor Example Introduction to CMOS VLSI Design Lecture 2: MIPS Processor Example David Harris Harvey Mudd College Spring 2004 Outline Design Partitioning MIPS Processor Example Architecture Microarchitecture Logic Design

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

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

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

Digital Integrated Circuits Lecture 2: MIPS Processor Example

Digital Integrated Circuits Lecture 2: MIPS Processor Example Digital Integrated Circuits Lecture 2: MIPS Processor Example Chih-Wei Liu VLSI Signal Processing LAB National Chiao Tung University cwliu@twins.ee.nctu.edu.tw DIC-Lec2 cwliu@twins.ee.nctu.edu.tw 1 Outline

More information

Digital Design and Computer Architecture

Digital Design and Computer Architecture Digital Design and Computer Architecture Lab 0: Multicycle Processor (Part ) Introduction In this lab and the next, you will design and build your own multicycle MIPS processor. You will be much more on

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

Digital Design and Computer Architecture Harris and Harris

Digital Design and Computer Architecture Harris and Harris Digital Design and Computer Architecture Harris and Harris Lab 0: Multicycle Processor (Part ) Introduction In this lab and the next, you will design and build your own multicycle MIPS processor. You will

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

Lecture 4: MIPS Processor Example

Lecture 4: MIPS Processor Example Lecture 4: MIPS Processor Example Slides courtesy of Deming Chen Slides based on the initial set from David Harris CMOS VLSI Design Outline Design Partitioning MIPS Processor Example Architecture Microarchitecture

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

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

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

ﻪﺘﻓﺮﺸﻴﭘ ﺮﺗﻮﻴﭙﻣﺎﻛ يرﺎﻤﻌﻣ 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

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

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

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

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

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

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

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

Control Unit for Multiple Cycle Implementation

Control Unit for Multiple Cycle Implementation Control Unit for Multiple Cycle Implementation Control is more complex than in single cycle since: Need to define control signals for each step Need to know which step we are on Two methods for designing

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

CSE 2021: Computer Organization Fall 2010 Solution to Assignment # 3: Multicycle Implementation

CSE 2021: Computer Organization Fall 2010 Solution to Assignment # 3: Multicycle Implementation CSE 2021: Computer Organization Fall 2010 Solution to Assignment # 3: Multicycle Implementation Note that these questions are taken from the previous final exmas of CSE2021 and should serve as practice

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

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

ECE 313 Computer Organization FINAL EXAM December 11, Multicycle Processor Design 30 Points

ECE 313 Computer Organization FINAL EXAM December 11, Multicycle Processor Design 30 Points This exam is open book and open notes. Credit for problems requiring calculation will be given only if you show your work. 1. Multicycle Processor Design 0 Points In our discussion of exceptions in the

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

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

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

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

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

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

Using a Hardware Description Language to Design and Simulate a Processor 5.8

Using a Hardware Description Language to Design and Simulate a Processor 5.8 5.8 Using a Hardware Description Language to Design and Simulate a Processor 5.8 As mentioned in Appix B, Verilog can describe processors for simulation or with the intention that the Verilog specification

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

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

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

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

Quick Verilog. Levels of Design Modeling

Quick Verilog. Levels of Design Modeling Introduction to CMOS VLSI Design Quick Lecture by Peter Kogge Fall 29, 2, 22, 25, 28 University of Notre Dame Using some slides by Jay Brockman Notre Dame 28, and David Harris, Harvey Mudd College http://www.cmosvlsi.com/coursematerials.html

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

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

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

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

ECE 313 Computer Organization Name SOLUTION EXAM 2 November 3, Floating Point 20 Points

ECE 313 Computer Organization Name SOLUTION EXAM 2 November 3, Floating Point 20 Points ECE Computer Organization Name SOLTION EA November, This exam is open book and open notes. Credit for problems requiring calculation will be given only if you show your work.. Floating Point Points Translate

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

COMP303 - Computer Architecture Lecture 8. Designing a Single Cycle Datapath

COMP303 - Computer Architecture Lecture 8. Designing a Single Cycle Datapath COMP33 - Computer Architecture Lecture 8 Designing a Single Cycle Datapath The Big Picture The Five Classic Components of a Computer Processor Input Control Memory Datapath Output The Big Picture: The

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

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

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

RISC Design: Multi-Cycle Implementation

RISC Design: Multi-Cycle Implementation RISC Design: Multi-Cycle Implementation Virendra Singh Associate Professor Computer Architecture and Dependable Systems Lab Department of Electrical Engineering Indian Institute of Technology Bombay http://www.ee.iitb.ac.in/~viren/

More information

Example Sketch a stick diagram for a CMOS gate computing Y = (A + B + C) D (see Figure 1.18) and estimate the cell width and height.

Example Sketch a stick diagram for a CMOS gate computing Y = (A + B + C) D (see Figure 1.18) and estimate the cell width and height. V DD A B C D.6 DESIGN PARTITIONING 35 Example Sketch a stick diagram for a CMOS gate computing Y = (A + B + C) D (see Figure.8) and estimate the cell width and height. Solution: Figure.47shows a stick

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

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

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

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

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

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

ECE232: Hardware Organization and Design

ECE232: Hardware Organization and Design ECE232: Harware Organization an Design ectre 11: Introction to IPs path apte from Compter Organization an Design, Patterson & Hennessy, CB IPS-lite processor Compter Want to bil a processor for a sbset

More information

LECTURE 5. Single-Cycle Datapath and Control

LECTURE 5. Single-Cycle Datapath and Control LECTURE 5 Single-Cycle Datapath and Control PROCESSORS In lecture 1, we reminded ourselves that the datapath and control are the two components that come together to be collectively known as the processor.

More information

Chapter 5 Solutions: For More Practice

Chapter 5 Solutions: For More Practice Chapter 5 Solutions: For More Practice 1 Chapter 5 Solutions: For More Practice 5.4 Fetching, reading registers, and writing the destination register takes a total of 300ps for both floating point add/subtract

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

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Data Paths and Microprogramming

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Data Paths and Microprogramming Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Data Paths and Microprogramming We have spent time looking at the MIPS instruction set architecture and building

More information

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Chapter 4. The Processor. Computer Architecture and IC Design Lab Chapter 4 The Processor Introduction CPU performance factors CPI Clock Cycle Time Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS

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

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

Winter 2006 FINAL EXAMINATION Auxiliary Gymnasium Tuesday, April 18 7:00pm to 10:00pm

Winter 2006 FINAL EXAMINATION Auxiliary Gymnasium Tuesday, April 18 7:00pm to 10:00pm University of Calgary Department of Electrical and Computer Engineering ENCM 369: Computer Organization Lecture Instructor for L01 and L02: Dr. S. A. Norman Winter 2006 FINAL EXAMINATION Auxiliary Gymnasium

More information

Introduction to CMOS VLSI Design (E158) Lab 4: Controller Design

Introduction to CMOS VLSI Design (E158) Lab 4: Controller Design Harris Introduction to CMOS VLSI Design (E158) Lab 4: Controller Design The controller for your MIPS processor is responsible for generating the signals to the datapath to fetch and execute each instruction.

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

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

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

Processor (I) - datapath & control. Hwansoo Han

Processor (I) - datapath & control. Hwansoo Han Processor (I) - datapath & control Hwansoo Han Introduction CPU performance factors Instruction count - Determined by ISA and compiler CPI and Cycle time - Determined by CPU hardware We will examine two

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

ECE 3056: Architecture, Concurrency and Energy of Computation. Single and Multi-Cycle Datapaths: Practice Problems

ECE 3056: Architecture, Concurrency and Energy of Computation. Single and Multi-Cycle Datapaths: Practice Problems ECE 3056: Architecture, Concurrency and Energy of Computation Single and Multi-Cycle Datapaths: Practice Problems 1. Consider the single cycle SPIM datapath. a. Specify the values of the control signals

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

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu CENG 342 Computer Organization and Design Lecture 6: MIPS Processor - I Bei Yu CEG342 L6. Spring 26 The Processor: Datapath & Control q We're ready to look at an implementation of the MIPS q Simplified

More information

The Big Picture: Where are We Now? EEM 486: Computer Architecture. Lecture 3. Designing a Single Cycle Datapath

The Big Picture: Where are We Now? EEM 486: Computer Architecture. Lecture 3. Designing a Single Cycle Datapath The Big Picture: Where are We Now? EEM 486: Computer Architecture Lecture 3 The Five Classic Components of a Computer Processor Input Control Memory Designing a Single Cycle path path Output Today s Topic:

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

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control ELEC 52/62 Computer Architecture and Design Spring 217 Lecture 4: Datapath and Control Ujjwal Guin, Assistant Professor Department of Electrical and Computer Engineering Auburn University, Auburn, AL 36849

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

Lab 8: Multicycle Processor (Part 1) 0.0

Lab 8: Multicycle Processor (Part 1) 0.0 Lab 8: ulticycle Processor (Part ). Introduction In this lab and the next, you will design and build your own multicycle IPS processor! Your processor should match the design from the text reprinted below

More information

CMOS VLSI Design Lab 3: Controller Design and Verification

CMOS VLSI Design Lab 3: Controller Design and Verification CMOS VLSI Design Lab 3: Controller Design and Verification The controller for your MIPS processor is responsible for generating the signals to the datapath to fetch and execute each instruction. It lacks

More information

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization CS/COE0447: Computer Organization and Assembly Language Datapath and Control Sangyeun Cho Dept. of Computer Science A simple MIPS We will design a simple MIPS processor that supports a small instruction

More information