1 / 70

Computer Organization

Computer Organization. Lecture Set – 05.1 Chapter 5 Huei-Yung Lin. Roadmap for the Term: Major Topics. Computer Systems Overview Technology Trends Performance Instruction Sets (and Software) Logic and Arithmetic Processor Implementation Memory Systems Input/Output.

truman
Download Presentation

Computer Organization

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

E N D

Presentation Transcript


  1. Computer Organization Lecture Set – 05.1 Chapter 5 Huei-Yung Lin

  2. Roadmap for the Term: Major Topics • Computer Systems Overview • Technology Trends • Performance • Instruction Sets (and Software) • Logic and Arithmetic • Processor Implementation \ • Memory Systems • Input/Output Computer Organization

  3. Outline - Processor Implementation • Overview \ • Review of Processor Operation • Steps in Processor Design • Implementation Styles • The “MIPS Lite” Instruction Subset • Single-Cycle Implementation • Multi-Cycle Implementation • Pipelined Implementation Computer Organization

  4. Input Output Processor Control Memory 1001010010110000 0010100101010001 Datapath 1111011101100110 1001010010110000 1001010010110000 1001010010110000 Review: The “Five Classic Components” • Processor • Datapath • Control • Memory • Input • Output Computer Organization

  5. Processor Control Memory 1001010010110000 0010100101010001 Datapath 1001010010110000 1111011101100110 1111011101100110 1001010010110000 1001010010110000 1001010010110000 Address Instruction Review: Processor Operation • Executing Programs - the “fetch/execute” cycle • Processor fetches instruction from memory • Processor executes“machine language” instruction • Perform calculation • Read/write data • Repeat with “next” instruction 1001010010110000 PC Computer Organization

  6. Processor Design Goals • Design hardware that: • Fetches instructions from memory • Executes instructions as specified by ISA • Design considerations • Cost • Speed • Power Computer Organization

  7. Steps in Processor Design 1. Analyze instruction set; get datapath requirements 2. Select datapath components andestablish clocking methodology 3. Assemble datapath that meets requirements 4. Determine control signal values for each instruction 5. Assemble control logic to generate control signals Computer Organization

  8. Processor Implementation Styles • Single Cycle • Perform each instruction in 1 clock cycle • Disadvantage: only as fast as “slowest” instruction • Multi-Cycle • Break fetch/execute cycle into multiple steps • Perform 1 step in each clock cycle • Pipelined • Execute each instruction in multiple steps • Perform 1 step / instruction in each clock cycle • Process multiple instructions in parallel - “assembly line” Computer Organization

  9. “MIPS Lite” - A Pedagogical Example • Use a MIPS to illustrate processor design • Limit initial design to a subset of instructions: • Memory access: lw, sw • Arithmetic/Logical: add, sub, and, or, slt • Branch/Jump: beq, j • Add instructions as we go along (e.g., addi) Computer Organization

  10. 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits R-Format op rs rt rd shamt funct 6 bits 5 bits 5 bits 16 bits I-Format op rs rt offset 6 bits 26 bits J-Format op address Review - MIPS Instruction Formats • Field definitions: • op: instruction opcode • rs, rt, rd: source (2) and destination (1) register numbers • shamt: shift amount • funct: function code (works with opcode to specify op) • offset/immediate: address offset or immediate value • address: target address for jumps Computer Organization

  11. MIPS Instruction Subset • Arithmetic & Logical Instructions add $s0, $s1, $s2 sub $s0, $s1, $s2 and $s0, $s1, $s2 or $s0, $s1, $s2 • Data Transfer Instructions lw $s1, offset($s0) sw $s2, offset($s3) • Branch beq $s0, offset j address Computer Organization

  12. MIPS Instruction Execution • General Procedure 1. Fetch Instruction from memory 2. Decode Instruction, read register values 3. If necessary, perform an ALU operation 4. If load or store, do memory access 5. Write results back to register file and increment PC • Register Transfers provide a concise description Computer Organization

  13. Register Transfers for the MIPS Subset • Instruction Fetch Instruction <= MEM[PC] • Instruction Execution Instr.Register Transfers add R[rd] <= R[rs] + R[rt]; PC <= PC + 4 sub R[rd] <= R[rs] – R[rt]; PC <= PC + 4 and R[rd] <= R[rs] & R[rt]; PC <= PC + 4 or R[rd] <= R[rs] | R[rt]; PC <= PC + 4 lw R[rt] <= MEM[R[rs] + s_extend(offset)]; PC<= PC + 4 sw MEM[R[rs] + sign_extend(offset)] <= R[rt]; PC <= PC + 4 beq if (R[rs] == R[rt]) then PC <= PC+4 + s_extend(offset<<2) else PC <= PC + 4 j PC <= upper(PC)@(address << 2) Computer Organization

  14. Outline - Processor Implementation • Overview • Single-Cycle Implementation 1. Analyze instruction set; get datapath requirements\ 2. Select datapath components andestablish clocking methodology 3. Assemble datapath that meets requirements 4. Determine control signal values for each instruction 5. Assemble control logic to generate control signals • Multi-Cycle Implementation • Pipelined Implementation Computer Organization

  15. 1. Instruction Set Requirements • Memory • Read Instructions • Read and Write Data • Registers - 32 • read (from rs field in instruction) • read (from rt field in instruction) • write (from rd or rt field in instruction) • PC • Sign Extender • Add and Subtract (register values) • Add 4 or extended immediate to PC Computer Organization

  16. Outline - Processor Implementation • Overview • Single-Cycle Implementation 1. Analyze instruction set; get datapath requirements 2. Select datapath components and \establish clocking methodology 3. Assemble datapath that meets requirements 4. Determine control signal values for each instruction 5. Assemble control logic to generate control signals • Multi-Cycle Implementation • Pipelined Implementation Computer Organization

  17. 2. (a) Choose Datapath Components • Combinational Components • Adder • ALU • Multiplexer • Sign Extender • Storage Components • Registers • Register File • Memory Computer Organization

  18. Multiplexer Adder ALU • NOTES: • - Blue-green inputs are control lines • - Blue lines often hidden to suppress detail Sign Extender Datapath Combinational Components Computer Organization

  19. Datapath Storage - Registers • Registers store multiple bit values • New value loaded on clock edge when EN asserted Computer Organization

  20. Datapath Storage: Idealized Memory • Data Read • Place Address on ADDR • Assert MemRead • Data Available on RD after memory “access time” • Data Write • Place address on ADDR • Place data input on WD • Assert MemWrite • Data written on clock edge Computer Organization

  21. Datapath Storage: Register File • Register File - 32 registers (including $zero) • Two data outputs RD1, RD2 • Assert register number RN1/RN2 • Read output RD1/RD2 after “access time” (propagation delay) • One data input WD • Assert register number WN • Assert value on WD • Assert RegWrite • Value loaded on clock edge • Implemented as a small multiport memory Computer Organization

  22. 2. (b) Choose Clocking Methodology • Clocking methodology defines • When signals can be read from storage elements • When signals can be written to storage elements • Typical clocking methodologies • Single-Phase Edge Triggered • Single-Phase Level Triggered • Multiple-Phase Level Triggered • Authors’ choice: Single-Phase Edge Triggered • All registers updated on one edge of clock cycle • Simplest to work with Computer Organization

  23. Register Output Combinational Logic Register Input Adder Mux Clock Review: Edge-Triggered Clocking • Controls sequential circuit operation • Register outputs change after first clock edge • Combinational logic determines “next state” • Storage elements store new state on next clock edge Computer Organization

  24. Register Output Combinational Logic Register Input Adder Mux Clock tprop tsetup Review: Edge-Triggered Clocking • Propagation delay - tprop • Logic (including register outputs) • Interconnect • Register setup time - tsetup tclock > tprop+ tsetup tclock = tprop+ tsetup + tslack Computer Organization

  25. Outline - Processor Implementation • Overview • Single-Cycle Implementation 1. Analyze instruction set; get datapath requirements 2. Select datapath components andestablish clocking methodology 3. Assemble datapath that meets requirements \ 4. Determine control signal values for each instruction 5. Assemble control logic to generate control signals • Multi-Cycle Implementation • Pipelined Implementation Computer Organization

  26. 3. Assemble Datapath • Tasks processor must implement 1. Fetch Instruction from memory 2. Decode Instruction, read register values 3. If necessary, perform an ALU operation 4. If memory address, perform load/store 5. Write results back to register file and increment PC • How can we do this with the datapath hardware? Computer Organization

  27. Datapath for Instruction Fetch Instruction <= MEM[PC] PC <= PC + 4 Computer Organization

  28. Datapath for R-Type Instructions add rd, rs, rt R[rd] <= R[rs] + R[rt]; Computer Organization

  29. Datapath for Load/Store Instructions lw rt, offset(rs) R[rt] <- MEM[R[rs] + s_extend(offset)]; Computer Organization

  30. Datapath for Load/Store Instructions sw rt, offset(rs) MEM[R[rs] + sign_extend(offset)] <= R[rt] Computer Organization

  31. Datapath for Branch Instructions beq rs, rt, offset • if (R[rs] == R[rt]) then PC <= PC+4 + s_extend(offset<<2) Computer Organization

  32. Goal: merge datapaths for each function Instruction Fetch R-Type Instructions Load/Store Instructions Branch instructions Add multiplexers to steer data as needed Putting It All Together … Computer Organization

  33. Select an ALU input from either Register File output RD2 (for R-Type) Sign-extender output (for LW/SW) Select Register File input WD1 from either ALU output (for R-Type) Memory output RD (for LW) Example: Combine R-Type and Load/Store Datapaths Computer Organization

  34. Combined Datapath: R-Type and Load/Store Instructions Computer Organization

  35. Combined Datapath: Executing an R-Type Instruction add rd,rs,rt Computer Organization

  36. Combined Datapath: Executing a load instruction lw rt,offset(rs) Computer Organization

  37. Combined Datapath: Executing a store instruction sw rt,offset(rs) Computer Organization

  38. Complete Single-Cycle Datapath Computer Organization

  39. Complete Datapath Executing add add rd, rs, rt Computer Organization

  40. Complete Datapath Executing load lw rt,offset(rs) Computer Organization

  41. Complete Datapath Executing store sw rt,offset(rs) Computer Organization

  42. Complete Datapath Executing branch beq r1,r2,offset Computer Organization

  43. 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits R-Format op rs rt rd shamt funct 6 bits 5 bits 5 bits 16 bits I-Format op rs rt offset Refining the Complete Datapath • Depending on the instruction, register file input WN is fed by different fields of the instruction • R-Type Instructions: rd field (bits 15:11) • Load Instructin: rt field (bits 21:16) • Result: need an additional multiplexer on WN input Computer Organization

  44. Complete Datapath (Refined) Computer Organization

  45. Complete Single-Cycle Datapath Control signals shown in blue Computer Organization

  46. Outline - Processor Implementation • Overview • Single-Cycle Implementation 1. Analyze instruction set; get datapath requirements 2. Select datapath components andestablish clocking methodology 3. Assemble datapath that meets requirements 4. Determine control signal values for each instruction\ 5. Assemble control logic to generate control signals • Multi-Cycle Implementation • Pipelined Implementation Computer Organization

  47. Control Unit Design • Desired function: • Given an instruction word…. • Generate control signals needed to execute instruction • Implemented as a combinational logic function: • Inputs • Instruction word - op and functfields • ALU status output - Zero • Outputs - processor control points • ALU control signals • Multiplexer control signals • Register File & memory control signal Computer Organization

  48. Determining Control Points • For each instruction type, determine proper value for each control point (control signal) • 0 • 1 • X ( don’t care - either 1 or 0 ) • Ultimately … use these values to build a truth table Computer Organization

  49. ALU control input Function 000 AND 001 OR 010 add 110 subtract 111 set on less than Review: ALU Control Signals • Functions: Figure B.5.13 (also in Ch. 5 - p. 301) Computer Organization

  50. Value depends on funct ??? Control Signals - R-Type Instruction 0 1 0 0 1 0 Control signals shown in blue 0 Computer Organization

More Related