1 A single-cycle MIPS processor  An instruction set architecture is an interface that defines the hardware operations which are available to software.

Slides:



Advertisements
Similar presentations
Pipeline Example: cycle 1 lw R10,9(R1) sub R11,R2, R3 and R12,R4, R5 or R13,R6, R7.
Advertisements

1 Today  All HW1 turned in on time, this is great!  HW2 will be out soon —You will work on procedure calls/stack/etc.  Lab1 will be out soon (possibly.
The Processor: Datapath & Control
Chapter 5 The Processor: Datapath and Control Basic MIPS Architecture Homework 2 due October 28 th. Project Designs due October 28 th. Project Reports.
Levels in Processor Design
CMPUT Computer Organization and Architecture II1 CMPUT229 - Fall 2003 TopicE: Building a Data Path and a Control Path for a Microprocessor José Nelson.
Computer ArchitectureFall 2007 © October 3rd, 2007 Majd F. Sakr CS-447– Computer Architecture.
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
Computer Structure - Datapath and Control Goal: Design a Datapath  We will design the datapath of a processor that includes a subset of the MIPS instruction.
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2003 TopicH: Building a Data Path and a Control Path for a Microprocessor José Nelson.
Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures1 Machine instructions execution steps (1) FETCH = Read the instruction.
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
1. 2 Multicycle Datapath  As an added bonus, we can eliminate some of the extra hardware from the single-cycle datapath. —We will restrict ourselves.
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Chapter 4 Sections 4.1 – 4.4 Appendix D.1 and D.2 Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Gary MarsdenSlide 1University of Cape Town Chapter 5 - The Processor  Machine Performance factors –Instruction Count, Clock cycle time, Clock cycles per.
ECE 445 – Computer Organization
CS2100 Computer Organisation The Processor: Datapath (AY2015/6) Semester 1.
Computer Architecture and Design – ECEN 350 Part 6 [Some slides adapted from A. Sprintson, M. Irwin, D. Paterson and others]
MIPS processor continued. In Class Exercise Question Show the datapath of a processor that supports only R-type and jr reg instructions.
D ATA P ATH OF A PROCESSOR (MIPS) Module 1.1 : Elements of computer system UNIT 1.
December 26, 2015©2003 Craig Zilles (derived from slides by Howard Huang) 1 A single-cycle MIPS processor  As previously discussed, an instruction set.
IT 251 Computer Organization and Architecture Multi Cycle CPU Datapath Chia-Chi Teng.
ECE-C355 Computer Structures Winter 2008 The MIPS Datapath Slides have been adapted from Prof. Mary Jane Irwin ( )
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
February 22, 2016©2003 Craig Zilles (derived from slides by Howard Huang) 1 A single-cycle MIPS processor  As previously discussed, an instruction set.
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.
MIPS processor continued
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.
1 Chapter 5: Datapath and Control (Part 2) CS 447 Jason Bakos.
MIPS Processor.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
1 The final datapath. 2 Control  The control unit is responsible for setting all the control signals so that each instruction is executed properly. —The.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Access the Instruction from Memory
CS161 – Design and Architecture of Computer Systems
CS 230: Computer Organization and Assembly Language
Single-Cycle Datapath and Control
Computer Architecture
IT 251 Computer Organization and Architecture
/ Computer Architecture and Design
Instruction Format MIPS Instruction Set.
CS/COE0447 Computer Organization & Assembly Language
MIPS processor continued
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
CSCI206 - Computer Organization & Programming
MIPS Processor.
Levels in Processor Design
Topic 5: Processor Architecture Implementation Methodology
Rocky K. C. Chang 6 November 2017
Composing the Elements
The Processor Lecture 3.2: Building a Datapath with Control
Topic 5: Processor Architecture
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Lecture 14: Single Cycle MIPS Processor
Control Unit (single cycle implementation)
MIPS processor continued
CS/COE0447 Computer Organization & Assembly Language
Control Unit (single cycle implementation)
A single-cycle MIPS processor
The Processor: Datapath & Control.
COMS 361 Computer Organization
MIPS Processor.
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

1 A single-cycle MIPS processor  An instruction set architecture is an interface that defines the hardware operations which are available to software  Any ISA can be implemented in many different ways  We will compare two important implementations: —A basic single-cycle implementation: all operations take the same amount of time — a single cycle (CPI = 1 in performance equation) —A pipelined implementation: the processor overlaps the execution of several instructions, potentially leading to big performance gains Slightly different formula for performance: N  CPI = total cycles  A datapath contains all the functional units and connections necessary to implement an instruction set architecture

2 Single-cycle implementation  We will implement a subset of MIPS supporting just these operations:  A computer is just a big fancy state machine —registers, memory, hard disks and other storage form the state —processor keeps reading and updating the state, according to the instructions in some program  We will use a Harvard architecture: instructions stored in a separate (read-only) memory, data stored in a read/write memory Arithmetic: addsubandorslt Data Transfer: lwsw Control: beq State CPU

3 Instruction fetching  The CPU is always in an infinite loop, fetching instructions from memory and executing them  The program counter or PC register holds the address of the current instruction  MIPS instructions are each four bytes long, so the PC should be incremented by four to read the next instruction in sequence Read address Instruction memory Instruction [31-0] PCPC Add 4

4 Decoding instructions (R-type)  A few weeks ago, we saw encodings of MIPS instructions as 32-bit values  Example: R-type instructions  Our register file stores thirty-two 32-bit values —Each register specifier is 5 bits long —You can read from two registers at a time —RegWrite is 1 if a register should be written —Opcode determines ALUOp oprsrtrdshamtfunc 6 bits5 bits 6 bits ALU ALUOp Read register 1 Read register 2 Write register Write data Read data 2 Read data 1 Registers RegWrite

5 Executing instructions (R-type) 1.Read an instruction from the instruction memory 2.The source registers, specified by instruction fields rs and rt, should be read from the register file 3.The ALU performs the desired operation 4.Its result is stored in the destination register, which is specified by field rd of the instruction word Read address Instruction memory Instruction [31-0] Read register 1 Read register 2 Write register Write data Read data 2 Read data 1 Registers RegWrite I [ ] I [ ] I [ ] Result Zero ALU ALUOp oprsrtrdshamtfunc

6 Decoding I-type instructions  The lw, sw and beq instructions all use the I-type encoding —rt is the destination for lw, but a source for beq and sw —address is a 16-bit signed constant (can be ALU source, sign-extended) oprsrtaddress 6 bits5 bits 16 bits Read address Write address Write data Data memory Read data MemWrite MemRead 1Mux01Mux0 MemToReg Read address Instruction memory Instruction [31-0] I [15 - 0] I [ ] I [ ] I [ ] 0Mux10Mux1 RegDst Read register 1 Read register 2 Write register Write data Read data 2 Read data 1 Registers RegWrite Sign extend 0Mux10Mux1 ALUSrc Result Zero ALU ALUOp

7 MemToReg  Another mux needed for the register file’s “write data”: it must be able to store either the ALU output of R-type instructions, or the data memory output for lw Read address Write address Write data Data memory Read data MemWrite MemRead 1Mux01Mux0 MemToReg Read address Instruction memory Instruction [31-0] I [15 - 0] I [ ] I [ ] I [ ] 0Mux10Mux1 RegDst Read register 1 Read register 2 Write register Write data Read data 2 Read data 1 Registers RegWrite Sign extend 0Mux10Mux1 ALUSrc Result Zero ALU ALUOp

8 RegDst  A final annoyance is the destination register of lw is in rt instead of rd  We’ll add one more mux, controlled by RegDst, to select the destination register from either instruction field rt (0) or field rd (1) oprsrtaddress lw $rt, address($rs) Read address Write address Write data Data memory Read data MemWrite MemRead 1Mux01Mux0 MemToReg Read address Instruction memory Instruction [31-0] I [15 - 0] I [ ] I [ ] I [ ] 0Mux10Mux1 RegDst Read register 1 Read register 2 Write register Write data Read data 2 Read data 1 Registers RegWrite Sign extend 0Mux10Mux1 ALUSrc Result Zero ALU ALUOp

9  For branch instructions, the constant is not an address but an instruction offset from the current program counter to the desired address beq$at, $0, L add$v1, $v0, $0 add$v1, $v1, $v1 jSomewhere L:add$v1, $v0, $v0  The target address L is three instructions past the beq, so the encoding of the branch instruction has for the address field  Instructions are four bytes long, so the actual memory offset is 12 bytes Branches oprsrtaddress

10 The steps in executing a beq 1.Fetch the instruction, like beq $at, $0, offset, from memory 2.Read the source registers, $at and $0, from the register file 3.Compare the values by XORing them in the ALU 4.If the XOR result is 0, the source operands were equal and the PC should be loaded with the target address, PC (offset x 4) 5.Otherwise the branch should not be taken, and the PC should just be incremented to PC + 4 to fetch the next instruction sequentially

11 Branching hardware

12 Datapath for a single-cycle MIPS implementation 4 Shift left 2 PC Add 0Mux10Mux1 PCSrc Read address Write address Write data Data memory Read data MemWrite MemRead 1Mux01Mux0 MemToReg Read address Instruction memory Instruction [31-0] I [15 - 0] I [ ] I [ ] I [ ] 0Mux10Mux1 RegDst Read register 1 Read register 2 Write register Write data Read data 2 Read data 1 Registers RegWrite Sign extend 0Mux10Mux1 ALUSrc Result Zero ALU ALUOp

13 Control  The control unit is responsible for setting all the control signals so that each instruction is executed properly —control unit’s input is the 32-bit instruction word —outputs are values for the blue control signals in the datapath —most signals can be generated from the instruction opcode alone  Our single-cycle implementation uses two separate memories, an ALU, some extra adders, and lots of multiplexers  On Friday, we’ll see the performance limitations of this single-cycle machine and discuss how to improve upon it