ECE2030 Introduction to Computer Engineering Lecture 20: Datapath and Microcode Control Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering.

Slides:



Advertisements
Similar presentations
CS1104: Computer Organisation School of Computing National University of Singapore.
Advertisements

ELEN 468 Advanced Logic Design
Levels in Processor Design
Lec 17 Nov 2 Chapter 4 – CPU design data path design control logic design single-cycle CPU performance limitations of single cycle CPU multi-cycle CPU.
Computer ArchitectureFall 2007 © October 3rd, 2007 Majd F. Sakr CS-447– Computer Architecture.
S. Barua – CPSC 440 CHAPTER 5 THE PROCESSOR: DATAPATH AND CONTROL Goals – Understand how the various.
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 4: IT Students.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 4:
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Chapter 4 CSF 2009 The processor: Building the datapath.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 5:
Lec 15Systems Architecture1 Systems Architecture Lecture 15: A Simple Implementation of MIPS Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some.
Chapter 5 Processor Design. Spring 2005 ELEC 5200/6200 From Patterson/Hennessey Slides We're ready to look at an implementation of the MIPS Simplified.
Gary MarsdenSlide 1University of Cape Town Chapter 5 - The Processor  Machine Performance factors –Instruction Count, Clock cycle time, Clock cycles per.
Computer Organization CS224 Fall 2012 Lesson 22. The Big Picture  The Five Classic Components of a Computer  Chapter 4 Topic: Processor Design Control.
EECS 322: Computer Architecture
ECE 445 – Computer Organization
CDA 3101 Fall 2013 Introduction to Computer Organization
Electrical and Computer Engineering University of Cyprus LAB 2: MIPS.
CS2100 Computer Organisation The Processor: Datapath (AY2015/6) Semester 1.
1 A single-cycle MIPS processor  An instruction set architecture is an interface that defines the hardware operations which are available to software.
COMP541 Multicycle MIPS Montek Singh Mar 25, 2010.
CPU Overview Computer Organization II 1 February 2009 © McQuain & Ribbens Introduction CPU performance factors – Instruction count n Determined.
Elements of Datapath for the fetch and increment The first element we need: a memory unit to store the instructions of a program and supply instructions.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
MIPS Processor.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Design a MIPS Processor (II)
Single-cycle CPU Control
Electrical and Computer Engineering University of Cyprus
CS161 – Design and Architecture of Computer Systems
CS 230: Computer Organization and Assembly Language
COSC3330 Computer Architecture Lecture 7. Datapath and Performance
Introduction CPU performance factors
/ Computer Architecture and Design
ELEN 468 Advanced Logic Design
Morgan Kaufmann Publishers
Processor Architecture: Introduction to RISC Datapath (MIPS and Nios II) CSCE 230.
Prof. Sirer CS 316 Cornell University
Processor (I).
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
CSCE 212 Chapter 5 The Processor: Datapath and Control
Single-Cycle CPU DataPath.
CS/COE0447 Computer Organization & Assembly Language
MIPS Processor.
Morgan Kaufmann Publishers The Processor
Rocky K. C. Chang 6 November 2017
The Processor Lecture 3.2: Building a Datapath with Control
Vishwani D. Agrawal James J. Danaher Professor
The Processor Lecture 3.1: Introduction & Logic Design Conventions
Guest Lecturer TA: Shreyas Chand
COMS 361 Computer Organization
Lecture 14: Single Cycle MIPS Processor
Processor: Multi-Cycle Datapath & Control
Prof. Sirer CS 316 Cornell University
COMP541 Datapaths I Montek Singh Mar 18, 2010.
Computer Architecture Processor: Datapath
Review Fig 4.15 page 320 / Fig page 322
CS/COE0447 Computer Organization & Assembly Language
The Processor: Datapath & Control.
COMS 361 Computer Organization
What You Will Learn In Next Few Sets of Lectures
MIPS Processor.
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

ECE2030 Introduction to Computer Engineering Lecture 20: Datapath and Microcode Control Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech

2 2 ISA Implementation Putting everything together A Datapath Unit –Register File  A Collection of Registers –Operation Control Decoding Instruction Generating Control Signals to Orchestrate Hardware –Functional Units Arithmetic Units Logical Units Memory Units

3 3 Register File (32 32-bit Registers) 32-bit register R0 031 Data In Data Out 32-bit register R1 32-bit register R2 32-bit register R31 32-bit register R30 read w w w w w 30 Reg encoding Reg encoding En WriteRead

4 4 Register File with Multiple Ports Xra: X read address Yra: Y read address Xdo: X data out Ydo: Y data out Zwa: Z write address Zdi: Z data in we: write enable This register file has –2 read ports –1 write port –32 registers, each 32-bit XraYraZwa Ydo XdoZdi RegFile Clock we

5 5 Adder/Subtractor Unit 32 Carry in 32 Carry out En ā/s 0: add 1: subtract F Flags Overflow Zero flag A B AU

6 6 Logical Unit 32 En LF F A B 4 ABF0F0 F1F1 F2F2 F3F3 F4F4 F5F5 F6F6 F7F7 F8F8 F9F9 F 10 F 11 F 12 F 13 F 14 F A·B ABAB A+B A B Ā  B ABAB A·B LU

7 7 Logical Unit Bit Slice Implementation LF0 LF1 LF2 LF3 AnBn An·Bn 4-to-1 Mux LF0 LF1 LF2 LF3 AnBn 4-to-1 Mux An  Bn

8 8 Logical Unit Bit Slice Alternative LF0 LF1 LF2 LF An Bn Fn 4-to-16 Decoder

9 9 Shift Unit B = shift amount Shift Type (ST) –00 = no shift –01 = logical shift –10 = arithmetic shift –11 = rotate Shift Direction (SD) –0 = left –1 = right 32 En ST F A B 2 SD SU

10 Combined with Register File XraYraZwa Ydo XdoZdi RegFile Clock we 32 Cin 32 Cout En ā/s Flags A B 32 Datapath AU

11 Single Cycle Datapath XraYraZwa Ydo XdoZdi RegFile Clock we Cin 32 Cout En ā/s Flags AB 32 AU LF AB LU ST AB SU SD

12 Arithmetic and Logic Unit (ALU) 32 ā/s A B ALU LF ST SD ALS 00: AU 01: LU 10: SU 11: disable ALU I omit some input/output e.g. carry, flags etc. Cin Cout En ā/s Flags AB AU LF AB LU ST AB SU SD

13 Single Cycle DataPath XraYraZwa Ydo XdoZdi RegFile Clock we 32 A B ALU ā/s LF ST SD 4 2 ALS 2

14 32 DataPath with Immediate Input XraYraZwa Ydo XdoZdi RegFile Clock we 32 A B ALU ā/s LF ST SD 4 2 ALS 2 Sign-extended immediate Immediate Enable

15 DataPath with Memory 32 XraYraZwa Ydo Xdo Zdi RegFile Clock we 32 AB ALU ā/s LF ST SD 4 2 ALS 2 Sign-extended immediate Memory Address Data msel r/w ld enable load $Z, ($X) st enable store $Y, ($X)

16 Instruction Execution Instruction Fetch –Given a PC address –Retrieve instruction from memory (or cache) Instruction Decode –Instruction type, operands, etc. –Control signals Instruction Execute –Functional unit binding Instruction Complete –Writeback to register or memory Can be done in single cycle or multiple cycles –Instruction complexity (CISC vs. RISC) –Pipelining

17 Microcode Sequencer For a multi-cycle implementation or a CISCy ISA –Think about an x86 “ string copy ” instruction An ISA instruction is translated into several microinstructions or microcode These microinstructions –One per cycle –Harness the detailed signals inside a processor –Define low-level control signals in a given state Microcode Sequencer –A finite state machine –Generate microinstruction sequence Most of RISC instructions is one-to-one mapping Could be implemented as a ROM or a PLA

18 Microcode Memory Datapath Control Signals State register Needed for a multi-cycle instruction implementation Microcode Memory (ROM or PLA) Combinational Logic Instruction Register

19 Microcode Memory Datapath Control Signals Microcode Memory (ROM or PLA) Combinational Logic Instruction Register Our Single-Cycle Microcode Memory  Assume all steps finish within one cycle  No state needed  Not really a microcode sequencer

20 A Simple Processor X 5 Y 5 Z 5 imm 16 imm_en we ALS 2 ā/s LF 4 ST 2 SD ld_en st_en ṝ/w msel Instruction Register Microcode Memory (Single-Cycle Implementation) Memory 32 Program Counter 32 Next PC gen Single Cycle Datapath

21 A Simple Processor X=00011 Y=00010 Z=00100 imm=0 imm_en=0 we=1 ALS=00 ā/s=0 LF=0000 ST=00 SD=0 ld_en=0 st_en=0 ṝ/w=0 msel=0 Microcode Memory Single Cycle Datapath opcode rs rtrd shamtfunct add $4, $3, $2 add $4, $3, $2

22 Datapath Control Signals 32 XraYraZwa Ydo Xdo Zdi RegFile Clock we 32 AB ALU ā/s LF ST SD 4 2 ALS 2 Sign-extended immediate Memory Address Data msel r/w ld enable st enable imm enable 00: AU 01: LU 10: SU 11: Disable ALU Shift Type (ST) 00: No Shift 01: Logical 10: Arithmetic 11: Rotate Shift Direction (SD) 0: Left 1: Right Logical Flag 0001: AND 0011: A 0101: B 0110: XOR 0111: OR

23 Microcode Control (1) Clear memory location 100, 104 (r0 hardwired to 0)  instruction sequence X (5)Y (5)Z (5)wewe Imm_enImm_valALSā/sLFSTSDld_enst_en ṝ /w msel li r1,100 sw r0, (r1) addi r1,r1,4 sw r0, (r1) ALS 00: AU 01: LU 10: SU 11: Disable ALU Shift Type (ST) 00: No Shift 01: Logical 10: Arithmetic 11: Rotate Shift Direction (SD) 0: Left 1: Right Logical Flag (LF) 0001: AND 0011: A 0101: B 0110: XOR 0111: OR Datapath Control Signals

24 Microcode Control (1) Clear memory location 100, 104 (r0 hardwired to 0)  instruction sequence X (5)Y (5)Z (5)wewe Imm_enImm_valALSā/sLFSTSDld_enst_en ṝ /w msel li r1,100 xx x006401x0101xx00x0 sw r0, (r1) x00x11xxxx0111 addi r1,r1, x 110x xxx00X0 sw r0, (r1) x00x11xxxx0111 ALS 00: AU 01: LU 10: SU 11: Disable ALU Shift Type (ST) 00: No Shift 01: Logical 10: Arithmetic 11: Rotate Shift Direction (SD) 0: Left 1: Right Logical Flag (LF) 0001: AND 0011: A 0101: B 0110: XOR 0111: OR

25 Microcode Control (2) copy 4-byte data from 0xF000 to 0xA100 clear data at 0xF000  instruction sequence X (5)Y (5)Z (5)wewe Imm_enImm_valALSā/sLFSTSDld_enst_en ṝ /w msel li r5, 0xF000 lw r6, (r5) li r7, 0xA100 sw r6, (r7) sw r0, (r5) ALS 00: AU 01: LU 10: SU 11: Disable ALU Shift Type (ST) 00: No Shift 01: Logical 10: Arithmetic 11: Rotate Shift Direction (SD) 0: Left 1: Right Logical Flag (LF) 0001: AND 0011: A 0101: B 0110: XOR 0111: OR

26 Microcode Control (2) copy 4-byte data from 0xF000 to 0xA100 clear data at 0xF000  instruction sequence X (5)Y (5)Z (5)wewe Imm_enImm_valALSā/sLFSTSDld_enst_en ṝ /w msel li r5, 0xF000 XX xF00001X0101XX00X0 lw r6, (r5) 00101X X11XXXX1001 li r7, 0xA100 XX xA10001X0101XX00X0 sw r6, (r7) X00X11XXXX0111 sw r0, (r5) X00X11XXXX0111 ALS 00: AU 01: LU 10: SU 11: Disable ALU Shift Type (ST) 00: No Shift 01: Logical 10: Arithmetic 11: Rotate Shift Direction (SD) 0: Left 1: Right Logical Flag (LF) 0001: AND 0011: A 0101: B 0110: XOR 0111: OR

27 Microcode Control (3) Perform r2 = 5  *(r2 – 2*r3) + 3*r4 store r2 to location stored in r10  instruction sequence X (5)Y (5)Z (5)wewe Imm_enImm_valALSā/sLFSTSDld_enst_en ṝ /w msel sll r3, r3, 1 sub r2, r2, r3 sll r5, r2, 2 add r2, r5, r2 sll r6, r4, 1 add r4, r6, r4 add r2, r2, r4 sw r2, (r10) ALS 00: AU 01: LU 10: SU 11: Disable ALU Shift Type (ST) 00: No Shift 01: Logical 10: Arithmetic 11: Rotate Shift Direction (SD) 0: Left 1: Right Logical Flag (LF) 0001: AND 0011: A 0101: B 0110: XOR 0111: OR

28 Microcode Control (3) Perform r2 = 5  *(r2 – 2*r3) + 3*r4 store r2 to location stored in r10  instruction sequence X (5)Y (5)Z (5)wewe Imm_enImm_valALSā/sLFSTSDld_enst_en ṝ /w msel sll r3, r3, X 110x000110XX01000X0 sub r2, r2, r X001XXX00X0 sll r5, r2, X x000210XX01000X0 add r2, r5, r X000XXX00X0 sll r6, r4, X x000110XX01000X0 add r4, r6, r X000XXX00X0 add r2, r2, r X000XXX00X0 sw r2, (r10) X00X11XXXX0111 ALS 00: AU 01: LU 10: SU 11: Disable ALU Shift Type (ST) 00: No Shift 01: Logical 10: Arithmetic 11: Rotate Shift Direction (SD) 0: Left 1: Right Logical Flag (LF) 0001: AND 0011: A 0101: B 0110: XOR 0111: OR

29 Instruction Fetching (PC Update) Program Counter 32 Memory Instruction Register 32 Microcode ROMDatapath 32x32 RegFile Next PC generation addr data

30 Sequential Instruction Fetch Program Counter Instruction Register 32 Microcode ROMDatapath 32x32 RegFile Memory addr data

31 Branch Support Program Counter beq bne (if true) ext 0 1 mux Instruction Register 32 Microcode ROMDatapath 32x32 RegFile Memory addr data Offset (from  ROM)

32 Branch and Jump Support Program Counter beq bne (if true) ext Offset (from  ROM) mux 0 1 ext Target addr (from  ROM) jr j jr/j Instruction Register 32 Microcode ROMDatapath 32x32 RegFile rs Memory addr data