RISC Processor Design

Size: px
Start display at page:

Download "RISC Processor Design"

Transcription

1 RISC Processor Design Single Cycle Implementation - MIPS Virendra Singh Indian Institute of Science Bangalore virendra@computer.orgorg Lecture 13 SE-273: Processor Design

2 Courtesy: Prof. Vishwani Agrawal Feb 13,

3 MIPS Instructions ti MIPS assembly language Category Instruction Example Meaning Comments add add $s1, $s2, $s3 $s1 = $s2 + $s3 Three operands; data in registers Arithmetic subtract sub $s1, $s2, $s3 $s1 = $s2 - $s3 Three operands; data in registers add immediate addi $s1, $s2, 100 $s1 = $s Used to add constants load w ord lw $s1, 100($s2) $s1 = Memory[$s Word from memory to register store w ord sw $s1, 100($s2) Memory[$s ] = $s1 Word from register to memory Data transfer load byte lb $s1, 100($s2) $s1 = Memory[$s Byte from memory to register store byte sb $s1, 100($s2) Memory[$s ] = $s1 Byte from register to memory load upper lui $s1, 100 $s1 = 100 * 2 16 Loads constant in upper 16 bits immediate branch on equal beq $s1, $s2, 25 if ($s1 == $s2) go to PC branch on not equal bne $s1, $s2, 25 if ($s1!= $s2) go to Conditional PC branch set on less than slt $s1, $s2, $s3 if ($s2 < $s3) $s1 = 1; else $s1 = 0 set less than immediate slti $s1, $s2, 100 if ($s2 < 100) $s1 = 1; else $s1 = 0 Equal test; PC-relative branch Not equal test; PC-relative Compare less than; for beq, bne Compare less than constant jump j 2500 go to Jump to target address Uncondi- jump register jr $ra go to $ra For sw itch, procedure return tional jump jump and link jal 2500 $ra = PC + 4; go to For procedure call Feb 13, 2010 SE-273@SERC 3

4 MIPS Registers and Memory $s0-$s7, $t0-$t9, $zero, Fast locations for data. In MIPS, data must be in registers to perform 32 registers $a0-$a3, $v0-$v1, $gp, arithmetic. MIPS register $zero always ays equals 0. Register $at is $fp, $sp, $ra, $at reserved for the assembler to handle large constants. Memory[0], Accessed only by data transfer instructions. MIPS uses byte 2 30 memorymemory[4],..., addresses, so sequential words differ by 4. Memory holds data words Memory[ ] structures, such as arrays, and spilled registers, such as those saved on procedure calls. Feb 13, 2010 SE-273@SERC 4

5 Example Addressing Modes addi 1. Im mediate addressing op rs rt Immediate add 2. Register addressing o p rs r t rd... fu n c t R egis ters Register lw, sw 3. Base addressing op rs rt Address Register + Memory Byte Halfword Word beq, bne 4. P C -re la tiv e a d d re s s in g op rs rt Address Memory PC + Word j 5. Pseudodirect addressing op Address PC Memory Word 2004 Morgan Kaufman Publishers Feb 13, 2010 SE-273@SERC 5

6 MIPS Instruction Set MIPS Instruction Subset Arithmetic and Logical Instructions add, sub, or, and, slt Memory reference Instructions lw, sw Branch beq, j Feb 13, 2010 SE-273@SERC 6

7 Overview of MIPS simple instructions, ti all 32 bits wide very structured, no unnecessary baggage only three instruction formats R I J op rs1 rs2 rd shmt op rs1 rd 16 bit address op 26 bit address funct rely on compiler to achieve performance 2004 Morgan Kaufman Publishers Feb 13, 2010 SE-273@SERC 7

8 Where Does It All Begin? In a register called program counter (PC). PC contains the memory address of the next instruction to be executed. In the beginning, PC contains the address of the memory location where the program begins. Feb 13, 2010 SE-273@SERC 8

9 Where is the Program? Processor Memory Program counter (register) Start address Machine code of program Feb 13,

10 How Does It Run? Start PC has memory address where program begins Fetch instruction word from memory address in PC and increment PC PC + 4 for next instruction Decode and execute instruction No Program complete? Yes STOP Feb 13, 2010 SE-273@SERC 10

11 Datapath and Control Datapath: Memory, registers, adders, ALU, and communication buses. Each step (fetch, decode, execute) requires communication (data transfer) paths between memory, registers and ALU. Control: Datapath for each step is set up by control signals that set up dataflow directions on communication buses and select ALU and memory functions. Control signals are generated by a control unit consisting of one or more finite-state machines. Feb 13, 2010 SE-273@SERC 11

12 Datapath for Instruction Fetch 4 Add PC Address Instruction Memory Instruction word to control unit and registers Feb 13, 2010 SE-273@SERC 12

13 Register File: A Datapath Component Read registers Write register reg 1 reg 2 32 Registers (reg. file) reg 1 data reg 2 data Write data 32 RegWrite from control Feb 13, 2010 SE-273@SERC 13

14 Multi-Operation ALU Operation select ALU function 000 AND 001 OR 010 Add 110 Subtract 111 Set on less than Operation select from control 3 zero ALU result overflow zero = 1, when all bits of result are 0 Feb 13, 2010 SE-273@SERC 14

15 R-Type Instructions Also known as arithmetic-logical instructions add, sub, slt Example: add $t0, $s1, $s2 Machine instruction word opcode $s1 $s2 $t0 function Read two registers Write one register Opcode and function code go to control unit that generates RegWrite and ALU operation code. Feb 13,

16 Datapath for R-Type Instruction Operation opcode $s1 $s2 $t0 function (add) select from control (add) Read 5 $s1 register 32 3 numbers 5 zero $s2 32 Registers ALU Write reg. (reg. file) number 32 5 overflow $t result Write data 32 RegWrite from control activated Feb 13, 2010 SE-273@SERC 16

17 Load and Store Instructions I-type instructions lw $t0, 1200 ($t1) # incr. in bytes opcode $t1 $t sw $t0, 1200 ($t1) # incr. in bytes opcode $t1 $t Feb 13, 2010 SE-273@SERC 17

18 Datapath for lw Instruction Read register numbers opcode $t1 $t Write reg. number 5 Write data $t1 $t0 32 Registers (reg. file) 032 RegWrite from control activated 16 Sign extend 32 ALU 3 Operation select from control (add) zero overflow result mem. data to $t0 Addr. Write data MemWrite Read data Data memory MemRead activated Feb 13, 2010 SE-273@SERC 18

19 Datapath for sw Instruction Read register numbers Write reg. number opcode $t1 $t Write data $t1 $t Registers (reg. file) RegWrite from control Sign extend ALU 3 Operation select from control (add) zero overflow 32 result $t0 data to mem. MemWrite activated Addr. Write data Read data Data memory MemRead Feb 13, 2010 SE-273@SERC 19

20 Branch Instruction (I-Type) beq $s1, $s2, 25 # if $s1 = $s2, advance PC through 25 instructions 16-bits opcode $s1 $s2 25 Note: Can branch within ± 2 15 words from the current instruction address in PC. Feb 13, 2010 SE-273@SERC 20

21 Datapath for beq Instruction Read register numbers Write reg. number Write data $s1 $s2 Sign extend 32 Registers (reg. file) RegWrite from control 32 Shift left opcode $s1 $s Operation select from control (subtract) 3 ALU zero overflow PC+4 From instruction fetch datapath 32 result 32 To branch control logic Add Branch target 32 Feb 13, 2010 SE-273@SERC 21

22 J-Type Instruction j 2500 # jump to instruction 2, bits opcode 2, bit jump address bits from PC+4 Feb 13, 2010 SE-273@SERC 22

23 Datapath for Jump Instruction Branch Branch 4 addr. 1 mux Add 32 0 PC+4 Jump mux 1 4 PC Address Instruction Memory Shift left 2 28 opcode (bits 26-31) to control 6 Instruction word to control and registers Feb 13, 2010 SE-273@SERC 23

24 PC 4 Ad dd Instr. mem. Combined Datapaths Reg gdst Shift Jump opcode left 2 CON NTROL mux 0 1 Reg. File Sign Shift ext. left 2 Branch 1 mux 0 ALU AL LU ALU Cont. 1 mux 0 0 mux 1 zero MemWrite MemRead Data mem. MemtoReg 0 mux 1 Feb 13, 2010 SE-273@SERC 24

25 Control Instruction bits opcode Instruction bits 0-5 funct. Control Logic ALUOp 2 RegDst Jump Branch MemRead MemtoReg MemWrite ALUSrc RegWrite ALU Control Feb 13, 2010 SE-273@SERC 25 to ALU

26 Control Logic: Truth Table Instr type Inputs: instr. opcode bits Outputs: t control signals RegD st Jump ALUS rc MemtoR Reg RegWr rite MemRe ead MemW Write Branc ch ALOO p1 ALUOp p2 R lw sw X 0 1 X beq X 0 0 X j X 1 X X X X X X X X Feb 13, 2010 SE-273@SERC 26

27 How Long Does It Take? Assume control logic is fast and does not affect the critical timing. Major time delay components are ALU, memory read/write, and register read/write. Arithmetic-type type (R-type) Fetch (memory read) Register read ALU operation Register write Total 2ns 1ns 2ns 1ns 6ns Feb 13,

28 Time for lw and sw (I-Types) ALU (R-type) Load word (I-type) Fetch (memory read) 2ns Register read 1ns ALU operation 2ns Get data (mem. Read) 2ns Register write 1ns Total Store word (no register write) 7ns 6ns 8ns Feb 13,

29 Time for beq (I-Type) ALU (R-type) Load word (I-type) Store word (I-type) Branch on equal (I-type) Fetch (memory read) Register read ALU operation Total 6ns 8ns 7ns 2ns 1ns 2ns 5ns Feb 13,

30 Time for Jump (J-Type) ALU (R-type) 6ns Load word (I-type) 8ns Store word (I-type) 7ns Branch on equal (I-type) 5ns Jump (J-type) Fetch (memory read) 2ns Total 2ns Feb 13,

31 How Fast Can the Clock Be? If every instruction is executed in one clock cycle, then: Clock period must be at least 8ns to perform the longest instruction, i.e., lw. This is a single cycle machine. It is slower because many instructions take less than 8ns but are still allowed that t much time. Method of speeding up: Use multicycle datapath. th Feb 13, 2010 SE-273@SERC 31

32 A Single Cycle Example a31... a2 a1 a0 b31... b2 b1 b0 0 Delay of 1-bit full adder = 1ns Clock period 32ns 1-b full adder 1-b full adder 1-b full adder 1-b full adder Time of adding words ~ 32ns Time of adding bytes ~ 32ns c32 s31... s2 s1 s0 Feb 13, 2010 SE-273@SERC 32

33 A Multicycle Implementation Sh hift Shift a31... a2 a1 a0 b31... b2 b1 b0 Delay of 1-bit full adder = 1ns Clock period 1ns Time of adding words ~ 32ns Time of adding bytes ~ 8ns c32 1-b bfull adder FF Initialize to 0 s31... s2 s1 s0 Feb 13, 2010 SE-273@SERC 33 Shift

34 Multicycle Datapath PC Memory Instr. reg. Data (MDR) Register file ALU A Reg. ALUOut Reg. (IR) Addr. Data 4 Mem. B Reg. One-cycle data transfer paths (need registers to hold data) Feb 13, 2010 SE-273@SERC 34

35 Multicycle Datapath Requirements Only one ALU, since it can be reused. Single memory for instructions and data. Five registers added: Instruction register (IR) Memory data register (MDR) Three ALU registers, A and B for inputs and ALUOut for output Feb 13, 2010 SE-273@SERC 35

36 Multicycle Datapath Shift left 2 PCSource C Memory Instr. reg. (IR) Register file A Reg. PCWrite etc. ALUOut Reg to Control FSM RegWrite B Reg. (MDR) ALU P Addr ALUSrcA ALUSrcB IorD Mem. Data MUX out in1 in2 control Data IRWrite RegDst 4 MemRead MemWrite MemtoReg Sign extend Shift left 2 ALU control Feb 13, 2010 SE-273@SERC 36 ALUOp

37 Step Instruction fetch 3 to 5 Cycles for an Instruction R-type Mem. Ref. Branch type J-type (4 cycles) (4 or 5 cycles) (3 cycles) (3 cycles) IR Memory[PC]; PC PC+4 Instr. decode/ A Reg(IR[21-25]); B Reg(IR[16-20]) Reg. fetch ALUOut PC + (sign extend IR[0-15]) << 2 Execution, addr. Comp., branch & jump completion ALUOut A op B Mem. Access Reg(IR[11- MDR M[ALUout] or R-type 15]) or M[ALUOut] B completion ALUOut Memory read Reg(IR[16-20]) completion MDR ALUOut A+sign extend If (A= =B) then PC PC[28-31] (IR[0-15]) PC ALUOut (IR[0-25]<<2) Feb 13, 2010 SE-273@SERC 37

38 Cycle 1 of 5: Instruction Fetch (IF) Read instruction into IR, M[PC] IR Control signals used: IorD = 0 select PC MemRead = 1 read memory IRWrite = 1 write IR Increment PC, PC + 4 PC Control signals used: ALUSrcA = 0 select PC into ALU ALUSrcB = 01 select constant 4 ALUOp = 00 ALU adds PCSource = 00 select ALU output PCWrite = 1 write PC Feb 13, 2010 SE-273@SERC 38

39 Cycle 2 of 5: Instruction Decode (ID) R I opcode reg 1 reg 2 reg 3 shamt fncode opcode reg 1 reg 2 word address increment J opcode word address jump Control unit decodes instruction Datapath prepares for execution R and I types, reg 1 A reg, reg 2 B reg No control signals needed Branch type, compute branch address in ALUOut ALUSrcA = 0 select PC into ALU ALUSrcB = 11 Instr. Bits 0-15 shift 2 into ALU ALUOp = 00 ALU adds Feb 13, 2010 SE-273@SERC 39

40 Cycle 3 of 5: Execute (EX) R type: execute function on reg A and reg B, result in ALUOut Control signals used: ALUSrcA = 1 A reg into ALU ALUsrcB = 00 B reg into ALU ALUOp = 10 instr. Bits 0-5 control ALU I type, lw or sw: compute memory address in ALUOut A reg + sign extend IR[0-15] Control signals used: ALUSrcA = 1 A reg into ALU ALUSrcB = 10 Instr. Bits 0-15 into ALU ALUOp = 00 ALU adds Feb 13, 2010 SE-273@SERC 40

41 Cycle 3 of 5: Execute (EX) I type, beq: subtract reg A and reg B, write ALUOut to PC Control signals used: ALUSrcA = 1 A reg into ALU ALUsrcB = 00 B reg into ALU ALUOp = 01 ALU subtracts If zero = 1, PCSource = 01 ALUOut to PC If zero = 1, PCwriteCond =1 write PC Instruction complete, go to IF J type: write jump address to PC IR[0-25] shift 2 and four leading bits of PC Control signals used: PCSource = 10 PCWrite = 1 write PC Instruction complete, go to IF Feb 13, 2010 SE-273@SERC 41

42 Cycle 4 of 5: Reg Write/Memory R type, write destination register from ALUOut Control signals used: RegDst = 1 Instr. Bits specify reg. MemtoReg = 0 ALUOut into reg. RegWrite = 1 write register Instruction complete, go to IF I type, lw: read M[ALUOut] into MDR Control signals used: IorD = 1 select ALUOut into mem adr. MemRead ead = 1 read memory to MDR I type, sw: write M[ALUOut] from B reg Control signals used: IorD = 1 select ALUOut into mem adr. MemWrite = 1 write memory Feb 13, 2010 SE-273@SERC 42 Instruction complete, go to IF

43 Cycle 5 of 5: Reg Write I type, lw: write MDR to reg[ir(16-20)] Control signals used: RegDst = 0 instr. Bits are write reg MemtoReg = 1 MDR to reg file write input RegWrite = 1 read memory to MDR Instruction complete, go to IF For an alternative method of designing datapath, see N. Tredennick, Microprocessor Logic Design, the Flowchart Method, Digital Press, Feb 13, 2010 SE-273@SERC 43

44 1-bit Control Signals Signal name Value = 0 Value =1 RegDst Write reg. # = bit Write reg. # = bit RegWrite No action Write reg. Write data ALUSrcA First ALU Operand PC First ALU Operand Reg. A MemRead No action Mem.Data Output M[Addr.] t MemWrite No action M[Addr.] Mem. Data Input MemtoReg Reg.File Write In ALUOut Reg.File Write In MDR IorD Mem. Addr. PC Mem. Addr. ALUOut IRWrite No action IR Mem.Data Output PCWrite No action PC is written PCWriteCond No action PC is written if zero(alu)=1 zero(alu) PCWriteCond PCWrite PCWrite etc. Feb 13, 2010 SE-273@SERC 44

45 2-bit Control Signals Signal name Value Action ALUOp ALUSrcB PCSource 00 ALU performs add 01 ALU performs subtract 10 Funct. field (0-5 bits of IR ) determines ALU operation 00 Second input of ALU B reg. 01 Second input of ALU 4 (constant) 10 Second input of ALU 0-15 bits of IR sign ext. to 32b 11 Second input of ALU 0-15 bits of IR sign ext. and left shift 2 bits 00 ALU output (PC +4) sent to PC 01 ALUOut (branch target addr.) sent to PC 10 Jump address IR[0-25] shifted left 2 bits, concatenated with PC+4[28-31], sent to PC Feb 13, 2010 SE-273@SERC 45

46 Control: Finite State Machine Clock cycle 1 Clock cycle 2 State 1 State 0 Start Instruction fetch Instruction decode and register fetch Clock cycles 3-5 FSM-M Memory access instr. FSM-R FSM-B FSM-J R-type instr. Branch instr. Jump instr. Feb 13, 2010 SE-273@SERC 46

47 State 0: Instruction Fetch (CC1) PCSource=00 MUX in1 PCW Write etc..=1 C P IorD=0 out in2 control Addr. Data Me emory to Control FSM Instr. re eg. (IR) IRWrite = Me em. Data (MDR) Re egister fil le RegDst RegWrite A Reg. B Reg g. AL LUSrcA=0 Shift left AL LUSrcB=01 4 ALU Add ALU UOut Reg g. MemRead = 1 MemWrite MemtoReg Sign extend Shift left 2 ALU control Feb 13, 2010 SE-273@SERC 47 ALUOp =00

48 State 0 Control FSM Outputs State0 Instruction fetch Start MemRead =1 ALUSrcA = 0 IorD = 0 IRWrite = 1 ALUSrcB = 01 ALUOp = 00 PCWrite = 1 PCSource = 00 State 1 Instruction decode/ Register fetch/ Branch addr. Outputs? Feb 13, 2010 SE-273@SERC 48

49 State 1: Instr. Decode/Reg. Fetch/ Branch Address (CC2) PCSource MUX in1 IorD PCW Write etc c. out C P in2 control Addr. Data Me emory to Control FSM Instr. re eg. (IR) IRWrite Me em. Data (MDR) Re egister fil le RegDst RegWrite A Reg. B Reg g. ALUSrcA=0 Shift left AL LUSrcB=11 4 ALU Add ALU UOut Reg g. MemRead MemWrite MemtoReg Sign extend Shift left 2 ALU control Feb 13, 2010 SE-273@SERC 49 ALUOp = 00

50 State 1 Control FSM Outputs State0 Instruction fetch (IF) Start MemRead =1 ALUSrcA = 0 IorD = 0 IRWrite = 1 ALUSrcB = 01 ALUOp = 00 PCWrite = 1 PCSource = 00 State 1 Instruction ti decode d (ID) / Register fetch / Branch addr. ALUSrcA = 0 ALUSrcB = 11 ALUOp = 00 Opcode = BEQ Opcode = J-type FSM-M FSM-R FSM-B FSM-J Feb 13, 2010 SE-273@SERC 50

51 State 1 (Opcode = lw) FSM-M (CC3-5) CC4 PCSource MUX in1 PCW Write etc c. C P IorD=1 out in2 control Addr. Data Me emory to Control FSM Instr. re eg. (IR) IRWrite Me em. Data (MDR) Re egister fil le RegWrite=1 CC5 RegDst=0 A Reg. B Reg g. ALUSrcA=1 Shift left AL LUSrcB=10 4 CC3 ALU Add ALU UOut Reg g. MemRead=1 MemWrite MemtoReg= Sign extend Shift left 2 ALU control Feb 13, 2010 SE-273@SERC 51 ALUOp = 00

52 State 1 (Opcode= sw) FSM-M (CC3-4) CC4 Shift left 2 PCSource C Instr. reg. (IR) Register file A Reg. PCWrite etc. ALUOut Reg to Control FSM RegWrite CC3 P Memory B Reg. Addr. (MDR) ALUSrcA=1 ALUSrcB=10 ALU IorD=1 Mem. Data out Data IRWrite RegDst=0 MUX control Add in1 in2 CC4 4 MemRead MemWrite=1 MemtoReg Sign extend Shift left 2 ALU control Feb 13, 2010 SE-273@SERC 52 ALUOp = 00

53 FSM-M (Memory Access) From state 1 Opcode = lw or sw Read Memory data Opcode Compute mem addrress ALUSrcA =1 ALUSrcB = 10 ALUOp = 00 = lw = sw Opcode Write memory MemRead = 1 IorD = 1 MemWrite = 1 IorD = 1 Write register RegWrite = 1 MemtoReg = 1 RegDst = 0 To state 0 (Instr. Fetch) Feb 13, 2010 SE-273@SERC 53

54 State 1(Opcode=R-type) FSM-R R (CC3-4) PCSource MUX in1 IorD PCW Write etc c. out C P in2 control Addr. Data Me emory to Control FSM Instr. re eg. (IR) IRWrite Me em. Data (MDR) Re egister fil le RegWrite A Reg CC3 RegDst=0 CC4 B Reg g. ALUSrcA=1 Shift left AL LUSrcB=00 0 ALU ALU UOut Reg g. 4 funct. code MemRead MemWrite MemtoReg= Sign extend Shift left 2 ALU control Feb 13, 2010 SE-273@SERC 54 ALUOp = 10

55 FSM-R (R-type Instruction) From state t 1 Opcode = R-type ALU operation ALUSrcA =1 ALUSrcB = 00 ALUOp = 10 Write register RegWrite = 1 MemtoReg = 0 RegDst = 1 To state 0 (Instr. Fetch) Feb 13, 2010 SE-273@SERC 55

56 State 1 (Opcode = beq ) FSM-B (CC3) If(zero) Shift left 2 PCSource 01 C Instr. reg. (IR) to Control FSM Register file A Reg. ALUOut Reg. PCWrite etc..= RegWrite P Memory B Reg. Addr. (MDR) ALUSrcA=1 ALUSrcB=000 ALU IorD CC3 Mem. Data zero MUX out in1 in2 control Data IRWrite RegDst 4 subtract MemRead MemWrite MemtoReg Sign extend Shift left 2 ALU control ALUOp = 01 Feb 13, 2010 SE-273@SERC 56

57 Write PC on zero zero=1 PCWriteCond=1 PCWrite PCWrite etc.=1 Feb 13,

58 FSM-B (Branch) From state 1 Opcode = beq Write PC on branch condition ALUSrcA =1 ALUSrcB = 00 ALUOp = 01 PCWriteCond=1 PCSource=01 Branch condition: If A B=0 zero = 1 To state 0 (Instr. Fetch) Feb 13, 2010 SE-273@SERC 58

59 MUX in1 PCWrite etc. IorD PC out in2 State 1 (Opcode = j) FSM-J (CC3) Dat a control Addr. Mem MemRead MemWrite to Control moryfsm In nstr. reg. (IR) IRWrite Mem m. Data (M MDR) MemtoReg CC3 RegWrite Regis ster file RegDst A Reg. B Reg. SrcA ALU Shift left ALUS SrcB 4 LU AL zero Sign Shift extend left 2 ALU control Feb 13, 2010 SE-273@SERC PCSource 10 ALUOu ut Reg. ALUOp

60 Write PC zero PCWriteCond PCWrite=1 PCWrite etc.=1 Feb 13,

61 FSM-J (Jump) From state 1 Opcode = jump Write jump addr. In PC PCWrite=1 PCSource=10 To state 0 (Instr. Fetch) Feb 13, 2010 SE-273@SERC 61

62 Control FSM 3 Read memory data Start State 0 Instr. fetch/ adv. PC lw 2 Compute memory addr. sw Write Write register memory data 6 1 Instr. decode/reg. fetch/branch addr. R B ALU Write PC Write operation on branch jump addr. condition to PC 8 9 Write register J Feb 13, 2010 SE-273@SERC 62

63 Control FSM (Controller) 6 inputs (opcode) Combinational logic 16 control outputs Present state Next state Reset Clock FF FF FF FF Feb 13, 2010 SE-273@SERC 63

64 Designing the Control FSM Encode states; need 4 bits for 10 states, e.g., State 0 is 0000, state 1 is 0001, and so on. Write a truth table for combinational logic: Opcode Present state Control signals Next state Synthesize a logic circuit from the truth table. Connect four flip-flops between the next state outputs and present state inputs. Feb 13, 2010 SE-273@SERC 64

65 MemWrite Block Diagram of a Processor ALU control MemRead Controller (Control FSM) ALUOp 2-bits funct. [0,5] ALUOp 3-bits Opcode 6-bits zero Overflow ALUSrcAA ALUSrcB 2-bits PCSource 2-bits RegDst RegWritee MemtoReg IorD IRWrite PCWrite PCWriteCon nd Reset Clock Mem. Addr. Datapath (PC, register file, registers, ALU) Mem. write data Mem. data out Feb 13, 2010 SE-273@SERC 65

66 Exceptions or Interrupts Conditions under which h the processor may produce incorrect result or may hang. Illegal or undefined opcode. Arithmetic overflow, divide by zero, etc. Out of bounds memory address. EPC: 32-bit register holds the affected instruction address. Cause: 32-bit register holds an encoded exception type. For example, 0 for undefined instruction 1f for arithmetic ti overflow Feb 13, 2010 SE-273@SERC 66

67 PCWrite etc.=1 PC MUX in1 out Implementing Exceptions in2 control to Control FSM R) r. reg. (I Inst 0 1 CauseWrite=1 Cause 32-bit register (hex) ALUSrc ca=0 ALUSrcB B=01 4 ALU ALU control Feb 13, 2010 SE-273@SERC 67 PCSource 11 EPCWrite=1 EPC Overflow to Control FSM Subtract ALUOp =01

68 How Long Does It Take? Again Assume control logic is fast and does not affect the critical timing. Major time components are ALU, memory read/write, and register read/write. Time for hardware operations, suppose Memory read or write Register read ALU operation Register write 2ns 1ns 2ns 1ns Feb 13,

69 Single-Cycle Datapath R-type 6ns Load word (I-type) 8ns Store word (I-type) 7ns Branch on equal (I-type) 5ns Jump (J-type) 2ns Clock cycle time = 8ns Each instruction takes one cycle Feb 13, 2010 SE-273@SERC 69

70 Multicycle Datapath Clock cycle time is determined by the longest operation, ALU or memory: Clock cycle time = 2ns Cycles per instruction (CPI): lw 5 (10ns) sw 4 (8ns) R-type 4 (8ns) beq 3 (6ns) j 3 (6ns) Feb 13, 2010 SE-273@SERC 70

71 CPI of a Computer k (Instructions of type k) CPI k CPI = k (instructions ti of type k) where CPI k = Cycles for instruction of type k Note: CPI is dependent on the instruction mix of the program being run. Standard benchmark programs are used for specifying the performance of CPUs. Feb 13, 2010 SE-273@SERC 71

72 Example Consider a program containing: i loads 25% stores 10% branches 11% jumps 2% Arithmetic 52% CPI = = 4.12 for multicycle datapath CPI = 1.00 for single-cycle datapath Feb 13, 2010 SE-273@SERC 72

73 Multicycle vs. Single-Cycle Performance ratio = Single cycle time / Multicycle time (CPI cycle time) for single-cycle = (CPI cycle time) for multicycle ns = = ns Single cycle is faster in this case, but remember, performance ratio depends on the instruction mix. Feb 13, 2010 SE-273@SERC 73

74 Thank You Feb 13,

Review: MIPS Addressing Modes/Instruction Formats

Review: MIPS Addressing Modes/Instruction Formats Review: Addressing Modes Addressing mode Example Meaning Register Add R4,R3 R4 R4+R3 Immediate Add R4,#3 R4 R4+3 Displacement Add R4,1(R1) R4 R4+Mem[1+R1] Register indirect Add R4,(R1) R4 R4+Mem[R1] Indexed

More information

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek Instruction Set Architecture or How to talk to computers if you aren t in Star Trek The Instruction Set Architecture Application Compiler Instr. Set Proc. Operating System I/O system Instruction Set Architecture

More information

Computer organization

Computer organization Computer organization Computer design an application of digital logic design procedures Computer = processing unit + memory system Processing unit = control + datapath Control = finite state machine inputs

More information

Solutions. Solution 4.1. 4.1.1 The values of the signals are as follows:

Solutions. Solution 4.1. 4.1.1 The values of the signals are as follows: 4 Solutions Solution 4.1 4.1.1 The values of the signals are as follows: RegWrite MemRead ALUMux MemWrite ALUOp RegMux Branch a. 1 0 0 (Reg) 0 Add 1 (ALU) 0 b. 1 1 1 (Imm) 0 Add 1 (Mem) 0 ALUMux is the

More information

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the ISA. RISC Goals RISC: Simplify ISA Simplify CPU Design Better CPU Performance Motivated by simplifying

More information

Instruction Set Architecture

Instruction Set Architecture Instruction Set Architecture Consider x := y+z. (x, y, z are memory variables) 1-address instructions 2-address instructions LOAD y (r :=y) ADD y,z (y := y+z) ADD z (r:=r+z) MOVE x,y (x := y) STORE x (x:=r)

More information

Computer Organization and Components

Computer Organization and Components Computer Organization and Components IS5, fall 25 Lecture : Pipelined Processors ssociate Professor, KTH Royal Institute of Technology ssistant Research ngineer, University of California, Berkeley Slides

More information

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu.

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu. Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu.tw Review Computers in mid 50 s Hardware was expensive

More information

Design of Digital Circuits (SS16)

Design of Digital Circuits (SS16) Design of Digital Circuits (SS16) 252-0014-00L (6 ECTS), BSc in CS, ETH Zurich Lecturers: Srdjan Capkun, D-INFK, ETH Zurich Frank K. Gürkaynak, D-ITET, ETH Zurich Labs: Der-Yeuan Yu dyu@inf.ethz.ch Website:

More information

Design of Pipelined MIPS Processor. Sept. 24 & 26, 1997

Design of Pipelined MIPS Processor. Sept. 24 & 26, 1997 Design of Pipelined MIPS Processor Sept. 24 & 26, 1997 Topics Instruction processing Principles of pipelining Inserting pipe registers Data Hazards Control Hazards Exceptions MIPS architecture subset R-type

More information

CSE 141 Introduction to Computer Architecture Summer Session I, 2005. Lecture 1 Introduction. Pramod V. Argade June 27, 2005

CSE 141 Introduction to Computer Architecture Summer Session I, 2005. Lecture 1 Introduction. Pramod V. Argade June 27, 2005 CSE 141 Introduction to Computer Architecture Summer Session I, 2005 Lecture 1 Introduction Pramod V. Argade June 27, 2005 CSE141: Introduction to Computer Architecture Instructor: Pramod V. Argade (p2argade@cs.ucsd.edu)

More information

Pipeline Hazards. Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. Based on the material prepared by Arvind and Krste Asanovic

Pipeline Hazards. Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. Based on the material prepared by Arvind and Krste Asanovic 1 Pipeline Hazards Computer Science and Artificial Intelligence Laboratory M.I.T. Based on the material prepared by and Krste Asanovic 6.823 L6-2 Technology Assumptions A small amount of very fast memory

More information

Pipeline Hazards. Structure hazard Data hazard. ComputerArchitecture_PipelineHazard1

Pipeline Hazards. Structure hazard Data hazard. ComputerArchitecture_PipelineHazard1 Pipeline Hazards Structure hazard Data hazard Pipeline hazard: the major hurdle A hazard is a condition that prevents an instruction in the pipe from executing its next scheduled pipe stage Taxonomy of

More information

Central Processing Unit (CPU)

Central Processing Unit (CPU) Central Processing Unit (CPU) CPU is the heart and brain It interprets and executes machine level instructions Controls data transfer from/to Main Memory (MM) and CPU Detects any errors In the following

More information

CS352H: Computer Systems Architecture

CS352H: Computer Systems Architecture CS352H: Computer Systems Architecture Topic 9: MIPS Pipeline - Hazards October 1, 2009 University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell Data Hazards in ALU Instructions

More information

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language 198:211 Computer Architecture Topics: Processor Design Where are we now? C-Programming A real computer language Data Representation Everything goes down to bits and bytes Machine representation Language

More information

(Refer Slide Time: 00:01:16 min)

(Refer Slide Time: 00:01:16 min) Digital Computer Organization Prof. P. K. Biswas Department of Electronic & Electrical Communication Engineering Indian Institute of Technology, Kharagpur Lecture No. # 04 CPU Design: Tirning & Control

More information

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc

More information

CPU Organisation and Operation

CPU Organisation and Operation CPU Organisation and Operation The Fetch-Execute Cycle The operation of the CPU 1 is usually described in terms of the Fetch-Execute cycle. 2 Fetch-Execute Cycle Fetch the Instruction Increment the Program

More information

WAR: Write After Read

WAR: Write After Read WAR: Write After Read write-after-read (WAR) = artificial (name) dependence add R1, R2, R3 sub R2, R4, R1 or R1, R6, R3 problem: add could use wrong value for R2 can t happen in vanilla pipeline (reads

More information

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010 Instruction Set Architecture Micro-architecture Datapath & Control CIT 595 Spring 2010 ISA =Programmer-visible components & operations Memory organization Address space -- how may locations can be addressed?

More information

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s) Addressing The problem Objectives:- When & Where do we encounter Data? The concept of addressing data' in computations The implications for our machine design(s) Introducing the stack-machine concept Slide

More information

150127-Microprocessor & Assembly Language

150127-Microprocessor & Assembly Language Chapter 3 Z80 Microprocessor Architecture The Z 80 is one of the most talented 8 bit microprocessors, and many microprocessor-based systems are designed around the Z80. The Z80 microprocessor needs an

More information

Chapter 2 Logic Gates and Introduction to Computer Architecture

Chapter 2 Logic Gates and Introduction to Computer Architecture Chapter 2 Logic Gates and Introduction to Computer Architecture 2.1 Introduction The basic components of an Integrated Circuit (IC) is logic gates which made of transistors, in digital system there are

More information

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2 Lecture Handout Computer Architecture Lecture No. 2 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2,Chapter3 Computer Systems Design and Architecture 2.1, 2.2, 3.2 Summary 1) A taxonomy of

More information

A FPGA Implementation of a MIPS RISC Processor for Computer Architecture Education

A FPGA Implementation of a MIPS RISC Processor for Computer Architecture Education A FPGA Implementation of a MIPS RISC Processor for Computer Architecture Education By: Victor P. Rubio, B.S. vrubio@gauss.nmsu.edu Advisor: Dr. Jeanine Cook jecook@gauss.nmsu.edu New Mexico State University

More information

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR AND MICROCOMPUTER BASICS Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

More information

Instruction Set Design

Instruction Set Design Instruction Set Design Instruction Set Architecture: to what purpose? ISA provides the level of abstraction between the software and the hardware One of the most important abstraction in CS It s narrow,

More information

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of CS:APP Chapter 4 Computer Architecture Wrap-Up William J. Taffe Plymouth State University using the slides of Randal E. Bryant Carnegie Mellon University Overview Wrap-Up of PIPE Design Performance analysis

More information

CPU Organization and Assembly Language

CPU Organization and Assembly Language COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015 Outline 1 2 3 4 5 6 7 8 Homework and announcements Reading: Chapter 12 Homework:

More information

Chapter 9 Computer Design Basics!

Chapter 9 Computer Design Basics! Logic and Computer Design Fundamentals Chapter 9 Computer Design Basics! Part 2 A Simple Computer! Charles Kime & Thomas Kaminski 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode)

More information

Introducción. Diseño de sistemas digitales.1

Introducción. Diseño de sistemas digitales.1 Introducción Adapted from: Mary Jane Irwin ( www.cse.psu.edu/~mji ) www.cse.psu.edu/~cg431 [Original from Computer Organization and Design, Patterson & Hennessy, 2005, UCB] Diseño de sistemas digitales.1

More information

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC Chapter 2 Topics 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC See Appendix C for Assembly language information. 2.4

More information

Q. Consider a dynamic instruction execution (an execution trace, in other words) that consists of repeats of code in this pattern:

Q. Consider a dynamic instruction execution (an execution trace, in other words) that consists of repeats of code in this pattern: Pipelining HW Q. Can a MIPS SW instruction executing in a simple 5-stage pipelined implementation have a data dependency hazard of any type resulting in a nop bubble? If so, show an example; if not, prove

More information

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995 UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering EEC180B Lab 7: MISP Processor Design Spring 1995 Objective: In this lab, you will complete the design of the MISP processor,

More information

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9. Code Generation I Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.7 Stack Machines A simple evaluation model No variables

More information

Giving credit where credit is due

Giving credit where credit is due CSCE 230J Computer Organization Processor Architecture VI: Wrap-Up Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due ost of slides for

More information

Intel 8086 architecture

Intel 8086 architecture Intel 8086 architecture Today we ll take a look at Intel s 8086, which is one of the oldest and yet most prevalent processor architectures around. We ll make many comparisons between the MIPS and 8086

More information

Summary of the MARIE Assembly Language

Summary of the MARIE Assembly Language Supplement for Assignment # (sections.8 -. of the textbook) Summary of the MARIE Assembly Language Type of Instructions Arithmetic Data Transfer I/O Branch Subroutine call and return Mnemonic ADD X SUBT

More information

EC 362 Problem Set #2

EC 362 Problem Set #2 EC 362 Problem Set #2 1) Using Single Precision IEEE 754, what is FF28 0000? 2) Suppose the fraction enhanced of a processor is 40% and the speedup of the enhancement was tenfold. What is the overall speedup?

More information

MACHINE ARCHITECTURE & LANGUAGE

MACHINE ARCHITECTURE & LANGUAGE in the name of God the compassionate, the merciful notes on MACHINE ARCHITECTURE & LANGUAGE compiled by Jumong Chap. 9 Microprocessor Fundamentals A system designer should consider a microprocessor-based

More information

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December 2009 23:59

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December 2009 23:59 COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December 2009 23:59 Overview: In the first projects for COMP 303, you will design and implement a subset of the MIPS32 architecture

More information

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Chapter 2 Basic Structure of Computers Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Outline Functional Units Basic Operational Concepts Bus Structures Software

More information

Computer Organization and Architecture

Computer Organization and Architecture Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal

More information

CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on

CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on CS 61C: Great Ideas in Computer Architecture Finite State Machines Instructors: Krste Asanovic & Vladimir Stojanovic hbp://inst.eecs.berkeley.edu/~cs61c/sp15 1 Levels of RepresentaKon/ InterpretaKon High

More information

LSN 2 Computer Processors

LSN 2 Computer Processors LSN 2 Computer Processors Department of Engineering Technology LSN 2 Computer Processors Microprocessors Design Instruction set Processor organization Processor performance Bandwidth Clock speed LSN 2

More information

Execution Cycle. Pipelining. IF and ID Stages. Simple MIPS Instruction Formats

Execution Cycle. Pipelining. IF and ID Stages. Simple MIPS Instruction Formats Execution Cycle Pipelining CSE 410, Spring 2005 Computer Systems http://www.cs.washington.edu/410 1. Instruction Fetch 2. Instruction Decode 3. Execute 4. Memory 5. Write Back IF and ID Stages 1. Instruction

More information

CHAPTER 7: The CPU and Memory

CHAPTER 7: The CPU and Memory CHAPTER 7: The CPU and Memory The Architecture of Computer Hardware, Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint slides

More information

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1 MICROPROCESSOR A microprocessor incorporates the functions of a computer s central processing unit (CPU) on a single Integrated (IC), or at most a few integrated circuit. It is a multipurpose, programmable

More information

PROBLEMS. which was discussed in Section 1.6.3.

PROBLEMS. which was discussed in Section 1.6.3. 22 CHAPTER 1 BASIC STRUCTURE OF COMPUTERS (Corrisponde al cap. 1 - Introduzione al calcolatore) PROBLEMS 1.1 List the steps needed to execute the machine instruction LOCA,R0 in terms of transfers between

More information

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions CS101 Lecture 26: Low Level Programming John Magee 30 July 2013 Some material copyright Jones and Bartlett 1 Overview/Questions What did we do last time? How can we control the computer s circuits? How

More information

EECS 427 RISC PROCESSOR

EECS 427 RISC PROCESSOR RISC PROCESSOR ISA FOR EECS 427 PROCESSOR ImmHi/ ImmLo/ OP Code Rdest OP Code Ext Rsrc Mnemonic Operands 15-12 11-8 7-4 3-0 Notes (* is Baseline) ADD Rsrc, Rdest 0000 Rdest 0101 Rsrc * ADDI Imm, Rdest

More information

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine This is a limited version of a hardware implementation to execute the JAVA programming language. 1 of 23 Structured Computer

More information

CHAPTER 4 MARIE: An Introduction to a Simple Computer

CHAPTER 4 MARIE: An Introduction to a Simple Computer CHAPTER 4 MARIE: An Introduction to a Simple Computer 4.1 Introduction 195 4.2 CPU Basics and Organization 195 4.2.1 The Registers 196 4.2.2 The ALU 197 4.2.3 The Control Unit 197 4.3 The Bus 197 4.4 Clocks

More information

Lecture Outline. Stack machines The MIPS assembly language. Code Generation (I)

Lecture Outline. Stack machines The MIPS assembly language. Code Generation (I) Lecture Outline Code Generation (I) Stack machines The MIPS assembl language Adapted from Lectures b Profs. Ale Aiken and George Necula (UCB) A simple source language Stack- machine implementation of the

More information

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches:

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches: Multiple-Issue Processors Pipelining can achieve CPI close to 1 Mechanisms for handling hazards Static or dynamic scheduling Static or dynamic branch handling Increase in transistor counts (Moore s Law):

More information

Let s put together a Manual Processor

Let s put together a Manual Processor Lecture 14 Let s put together a Manual Processor Hardware Lecture 14 Slide 1 The processor Inside every computer there is at least one processor which can take an instruction, some operands and produce

More information

The 104 Duke_ACC Machine

The 104 Duke_ACC Machine The 104 Duke_ACC Machine The goal of the next two lessons is to design and simulate a simple accumulator-based processor. The specifications for this processor and some of the QuartusII design components

More information

Preface. Any questions from last time? A bit more motivation, information about me. A bit more about this class. Later: Will review 1st 22 slides

Preface. Any questions from last time? A bit more motivation, information about me. A bit more about this class. Later: Will review 1st 22 slides Preface Any questions from last time? Will review 1st 22 slides A bit more motivation, information about me Research ND A bit more about this class Microsoft Later: HW 1 Review session MD McNally about

More information

Generating MIF files

Generating MIF files Generating MIF files Introduction In order to load our handwritten (or compiler generated) MIPS assembly problems into our instruction ROM, we need a way to assemble them into machine language and then

More information

Central Processing Unit

Central Processing Unit Chapter 4 Central Processing Unit 1. CPU organization and operation flowchart 1.1. General concepts The primary function of the Central Processing Unit is to execute sequences of instructions representing

More information

PART B QUESTIONS AND ANSWERS UNIT I

PART B QUESTIONS AND ANSWERS UNIT I PART B QUESTIONS AND ANSWERS UNIT I 1. Explain the architecture of 8085 microprocessor? Logic pin out of 8085 microprocessor Address bus: unidirectional bus, used as high order bus Data bus: bi-directional

More information

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals CPU Architectures Motorola 68000 Several CPU architectures exist currently: Motorola Intel AMD (Advanced Micro Devices) PowerPC Pick one to study; others will be variations on this. Arbitrary pick: Motorola

More information

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 1 - INTRODUCTION JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ Unit 1.MaNoTaS 1 Definitions (I) Description A computer is: A

More information

İSTANBUL AYDIN UNIVERSITY

İSTANBUL AYDIN UNIVERSITY İSTANBUL AYDIN UNIVERSITY FACULTY OF ENGİNEERİNG SOFTWARE ENGINEERING THE PROJECT OF THE INSTRUCTION SET COMPUTER ORGANIZATION GÖZDE ARAS B1205.090015 Instructor: Prof. Dr. HASAN HÜSEYİN BALIK DECEMBER

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture : Microprogrammed Control Microprogramming The control unit is responsible for initiating the sequence of microoperations that comprise instructions.

More information

Chapter 5 Instructor's Manual

Chapter 5 Instructor's Manual The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 5 Instructor's Manual Chapter Objectives Chapter 5, A Closer Look at Instruction

More information

EE282 Computer Architecture and Organization Midterm Exam February 13, 2001. (Total Time = 120 minutes, Total Points = 100)

EE282 Computer Architecture and Organization Midterm Exam February 13, 2001. (Total Time = 120 minutes, Total Points = 100) EE282 Computer Architecture and Organization Midterm Exam February 13, 2001 (Total Time = 120 minutes, Total Points = 100) Name: (please print) Wolfe - Solution In recognition of and in the spirit of the

More information

INSTRUCTION LEVEL PARALLELISM PART VII: REORDER BUFFER

INSTRUCTION LEVEL PARALLELISM PART VII: REORDER BUFFER Course on: Advanced Computer Architectures INSTRUCTION LEVEL PARALLELISM PART VII: REORDER BUFFER Prof. Cristina Silvano Politecnico di Milano cristina.silvano@polimi.it Prof. Silvano, Politecnico di Milano

More information

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

A s we saw in Chapter 4, a CPU contains three main sections: the register section, 6 CPU Design A s we saw in Chapter 4, a CPU contains three main sections: the register section, the arithmetic/logic unit (ALU), and the control unit. These sections work together to perform the sequences

More information

Introduction to MIPS Assembly Programming

Introduction to MIPS Assembly Programming 1 / 26 Introduction to MIPS Assembly Programming January 23 25, 2013 2 / 26 Outline Overview of assembly programming MARS tutorial MIPS assembly syntax Role of pseudocode Some simple instructions Integer

More information

EE361: Digital Computer Organization Course Syllabus

EE361: Digital Computer Organization Course Syllabus EE361: Digital Computer Organization Course Syllabus Dr. Mohammad H. Awedh Spring 2014 Course Objectives Simply, a computer is a set of components (Processor, Memory and Storage, Input/Output Devices)

More information

CPU Performance Equation

CPU Performance Equation CPU Performance Equation C T I T ime for task = C T I =Average # Cycles per instruction =Time per cycle =Instructions per task Pipelining e.g. 3-5 pipeline steps (ARM, SA, R3000) Attempt to get C down

More information

BASIC COMPUTER ORGANIZATION AND DESIGN

BASIC COMPUTER ORGANIZATION AND DESIGN 1 BASIC COMPUTER ORGANIZATION AND DESIGN Instruction Codes Computer Registers Computer Instructions Timing and Control Instruction Cycle Memory Reference Instructions Input-Output and Interrupt Complete

More information

The WIMP51: A Simple Processor and Visualization Tool to Introduce Undergraduates to Computer Organization

The WIMP51: A Simple Processor and Visualization Tool to Introduce Undergraduates to Computer Organization The WIMP51: A Simple Processor and Visualization Tool to Introduce Undergraduates to Computer Organization David Sullins, Dr. Hardy Pottinger, Dr. Daryl Beetner University of Missouri Rolla Session I.

More information

An Overview of Stack Architecture and the PSC 1000 Microprocessor

An Overview of Stack Architecture and the PSC 1000 Microprocessor An Overview of Stack Architecture and the PSC 1000 Microprocessor Introduction A stack is an important data handling structure used in computing. Specifically, a stack is a dynamic set of elements in which

More information

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine 7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change

More information

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad A. M. Niknejad University of California, Berkeley EE 100 / 42 Lecture 24 p. 1/20 EE 42/100 Lecture 24: Latches and Flip Flops ELECTRONICS Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad University of California,

More information

In the Beginning... 1964 -- The first ISA appears on the IBM System 360 In the good old days

In the Beginning... 1964 -- The first ISA appears on the IBM System 360 In the good old days RISC vs CISC 66 In the Beginning... 1964 -- The first ISA appears on the IBM System 360 In the good old days Initially, the focus was on usability by humans. Lots of user-friendly instructions (remember

More information

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Contents 3.1. Register Transfer Notation... 2 3.2. HCS12 Addressing Modes... 2 1. Inherent Mode (INH)... 2 2.

More information

An Introduction to the ARM 7 Architecture

An Introduction to the ARM 7 Architecture An Introduction to the ARM 7 Architecture Trevor Martin CEng, MIEE Technical Director This article gives an overview of the ARM 7 architecture and a description of its major features for a developer new

More information

8085 INSTRUCTION SET

8085 INSTRUCTION SET DATA TRANSFER INSTRUCTIONS Opcode Operand Description 8085 INSTRUCTION SET INSTRUCTION DETAILS Copy from source to destination OV Rd, Rs This instruction copies the contents of the source, Rs register

More information

CSE140: Components and Design Techniques for Digital Systems. Introduction. Prof. Tajana Simunic Rosing

CSE140: Components and Design Techniques for Digital Systems. Introduction. Prof. Tajana Simunic Rosing CSE4: Components and Design Techniques for Digital Systems Introduction Prof. Tajana Simunic Rosing Welcome to CSE 4! Instructor: Tajana Simunic Rosing Email: tajana@ucsd.edu; please put CSE4 in the subject

More information

Typy danych. Data types: Literals:

Typy danych. Data types: Literals: Lab 10 MIPS32 Typy danych Data types: Instructions are all 32 bits byte(8 bits), halfword (2 bytes), word (4 bytes) a character requires 1 byte of storage an integer requires 1 word (4 bytes) of storage

More information

Assembly Language Programming

Assembly Language Programming Assembly Language Programming Assemblers were the first programs to assist in programming. The idea of the assembler is simple: represent each computer instruction with an acronym (group of letters). Eg:

More information

Instruction Set Architecture (ISA)

Instruction Set Architecture (ISA) Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine

More information

TIMING DIAGRAM O 8085

TIMING DIAGRAM O 8085 5 TIMING DIAGRAM O 8085 5.1 INTRODUCTION Timing diagram is the display of initiation of read/write and transfer of data operations under the control of 3-status signals IO / M, S 1, and S 0. As the heartbeat

More information

Winter 2002 MID-SESSION TEST Friday, March 1 6:30 to 8:00pm

Winter 2002 MID-SESSION TEST Friday, March 1 6:30 to 8:00pm University of Calgary Department of Electrical and Computer Engineering ENCM 369: Computer Organization Instructors: Dr. S. A. Norman (L01) and Dr. S. Yanushkevich (L02) Winter 2002 MID-SESSION TEST Friday,

More information

Microprocessor/Microcontroller. Introduction

Microprocessor/Microcontroller. Introduction Microprocessor/Microcontroller Introduction Microprocessor/Microcontroller microprocessor - also known as a CU or central processing unit - is a complete computation engine that is fabricated on a single

More information

ASYNCHRONOUS COUNTERS

ASYNCHRONOUS COUNTERS LB no.. SYNCHONOUS COUNTES. Introduction Counters are sequential logic circuits that counts the pulses applied at their clock input. They usually have 4 bits, delivering at the outputs the corresponding

More information

MIPS Assembly Code Layout

MIPS Assembly Code Layout Learning MIPS & SPIM MIPS assembly is a low-level programming language The best way to learn any programming language is to write code We will get you started by going through a few example programs and

More information

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng Digital Logic Design Basics Combinational Circuits Sequential Circuits Pu-Jen Cheng Adapted from the slides prepared by S. Dandamudi for the book, Fundamentals of Computer Organization and Design. Introduction

More information

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? Inside the CPU how does the CPU work? what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? some short, boring programs to illustrate the

More information

A SystemC Transaction Level Model for the MIPS R3000 Processor

A SystemC Transaction Level Model for the MIPS R3000 Processor SETIT 2007 4 th International Conference: Sciences of Electronic, Technologies of Information and Telecommunications March 25-29, 2007 TUNISIA A SystemC Transaction Level Model for the MIPS R3000 Processor

More information

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands Ben Bruidegom, benb@science.uva.nl AMSTEL Instituut Universiteit van Amsterdam Kruislaan 404 NL-1098 SM Amsterdam

More information

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: 03-4227151 ext:34534 Email: jimmy@ee.ncu.edu.tw. Sequential Circuit

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: 03-4227151 ext:34534 Email: jimmy@ee.ncu.edu.tw. Sequential Circuit Modeling Sequential Elements with Verilog Prof. Chien-Nan Liu TEL: 03-4227151 ext:34534 Email: jimmy@ee.ncu.edu.tw 4-1 Sequential Circuit Outputs are functions of inputs and present states of storage elements

More information

Administrative Issues

Administrative Issues CSC 3210 Computer Organization and Programming Introduction and Overview Dr. Anu Bourgeois (modified by Yuan Long) Administrative Issues Required Prerequisites CSc 2010 Intro to CSc CSc 2310 Java Programming

More information

Translating C code to MIPS

Translating C code to MIPS Translating C code to MIPS why do it C is relatively simple, close to the machine C can act as pseudocode for assembler program gives some insight into what compiler needs to do what's under the hood do

More information

18-447 Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013

18-447 Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013 18-447 Computer Architecture Lecture 3: ISA Tradeoffs Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013 Reminder: Homeworks for Next Two Weeks Homework 0 Due next Wednesday (Jan 23), right

More information

Chapter 1 Computer System Overview

Chapter 1 Computer System Overview Operating Systems: Internals and Design Principles Chapter 1 Computer System Overview Eighth Edition By William Stallings Operating System Exploits the hardware resources of one or more processors Provides

More information