Electrical and Computer Engineering University of Cyprus

Slides:



Advertisements
Similar presentations
CS/COE1541: Introduction to Computer Architecture Datapath and Control Review Sangyeun Cho Computer Science Department University of Pittsburgh.
Advertisements

Pipeline Example: cycle 1 lw R10,9(R1) sub R11,R2, R3 and R12,R4, R5 or R13,R6, R7.
ELEN 468 Advanced Logic Design
Lab Assignment 2: MIPS single-cycle implementation
The Processor: Datapath & Control
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
©UCB CS 162 Computer Architecture Lecture 3: Pipelining Contd. Instructor: L.N. Bhuyan
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.
Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures1 Machine instructions execution steps (1) FETCH = Read the instruction.
The Processor: Datapath & Control. Implementing Instructions Simplified instruction set memory-reference instructions: lw, sw arithmetic-logical instructions:
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
Electrical and Computer Engineering University of Cyprus LAB3: IMPROVING MIPS PERFORMANCE WITH PIPELINING.
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.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
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.
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
Access the Instruction from Memory
EE204 Computer Architecture
Multi-Cycle Datapath and Control
CS161 – Design and Architecture of Computer Systems
CS 230: Computer Organization and Assembly Language
Single-Cycle Datapath and Control
Computer Architecture
Introduction CPU performance factors
/ Computer Architecture and Design
ELEN 468 Advanced Logic Design
Processor Architecture: Introduction to RISC Datapath (MIPS and Nios II) CSCE 230.
Instruction Format MIPS Instruction Set.
ECS 154B Computer Architecture II Spring 2009
Processor (I).
CS/COE0447 Computer Organization & Assembly Language
MIPS processor continued
Designing MIPS Processor (Single-Cycle) Presentation G
CSCI206 - Computer Organization & Programming
CS/COE0447 Computer Organization & Assembly Language
Single-cycle datapath, slightly rearranged
Single-Cycle CPU DataPath.
CS/COE0447 Computer Organization & Assembly Language
CSCI206 - Computer Organization & Programming
Systems Architecture II
Levels in Processor Design
Topic 5: Processor Architecture Implementation Methodology
Rocky K. C. Chang 6 November 2017
The Processor Lecture 3.6: Control Hazards
The Processor Lecture 3.3: Single-cycle Implementation
The Processor Lecture 3.2: Building a Datapath with Control
Topic 5: Processor Architecture
COMS 361 Computer Organization
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Lecture 14: Single Cycle MIPS Processor
Processor: Multi-Cycle Datapath & Control
Control Unit (single cycle implementation)
Instruction Format MIPS Instruction Set.
MIPS processor continued
CS/COE0447 Computer Organization & Assembly Language
Control Unit (single cycle implementation)
The Processor: Datapath & Control.
COMS 361 Computer Organization
Processor: Datapath and Control
ELEC / Computer Architecture and Design Spring 2015 Pipeline Control and Performance (Chapter 6) Vishwani D. Agrawal James J. Danaher.
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

Electrical and Computer Engineering University of Cyprus 12-09-2007 LAB 2: MIPS Electrical and Computer Engineering University of Cyprus 12-09-2007

INTRODUCTION The MIPS processor, designed in 1984 by researchers at Stanford University. Is a RISC (Reduced Instruction Set Computer) processor. Compared with their CISC (Complex Instruction Set Computer) counterparts (such as the Intel Pentium processors), RISC processors typically support fewer and much simpler instructions. A RISC processor can be made much faster than a CISC processor because of its simpler design.

INTRODUCTION (…) RISC processors typically have a load-store architecture. Two instructions for accessing memory: a load (l) instruction to load data from memory and a store (s) instruction to write data to memory. None of the other instructions can access memory directly.

Single Cycle Datapath for MIPS Stage 5 PC Registers ALU Instruction Memory (Imem) Data Memory (Dmem) Stage 1 Stage 2 Stage 3 Stage 4 IFtch Dcd Exec Mem WB ALU IM Reg DM

STAGES OF EXECUTION IN MIPS 5 stage instruction pipeline 1) I-fetch: Fetch Instruction, Increment PC 2) Decode: Instruction, Read Registers 3) Execute: Mem-reference: Calculate Address R-format: Perform ALU Operation 4) Memory: Load: Read Data from Data Memory Store: Write Data to Data Memory 5) Write Back: Write Data to Register

SINGLE CYCLE DATAPATH Dmem Zero A L U Imem M u x << Read data 4 << 2 PCSrc 25:21 MemWrite Read Addr Read Reg1 P C Read data Read data1 Zero 31:0 20:16 Read Reg2 A L U Instruc- tion Address M u x Read data2 Write Reg M u x Imem Dmem Regs Write Data ALU- con Write Data 15:11 M u x RegDst ALU- src RegWrite Sign Extend MemRead 15:0 ALUOp

STAGE 1: INSTRUCTION FETCH Fetches the next instruction. It sends the contents of the PC register, which contains the address for the next instruction, to the instruction memory (1). The instruction memory will then respond by sending the correct instruction. This instruction is sent on to the next (instruction decode) phase.

STAGE 1: INSTRUCTION FETCH

STAGE 2: INSTRUCTION DECODE Two main tasks: calculate the next PC and fetch the operands for the current instruction. Three possibilities for the next PC: for all instructions that are not branches or jumps, we must simply calculate PC+4 to get the address of the next instruction. For jumps and branches (if the branch is taken), we might also have to add some immediate value (the branch offset) to the PC (ADDi). This branch offset is encoded in the instruction itself. For the jr and jalr instructions, we need to use the value of a register instead.

STAGE 2: INSTRUCTION DECODE MUX3 selects between the first two posibilities (+4 or +immediate), and MUX1 (in the IF phase) selects between MUX3 and the third posibility (value from the register file).

STAGE 2: INSTRUCTION DECODE The second main task is to fetch the operands for the next instruction. These operands come from the register file for all but two instructions. The two instructions that are the exception are jal and jalr. These two jump instructions save the address of the next instruction in a destination register, so instead of sending an operand from the register file, we need to send the contents of the PC+4.

STAGE 3: EXECUTION “Executes" the instruction. Any calculations necessary are done in this phase. These calculations are all done by the ALU (Arithmetic and Logic Unit). The ALU needs two operands. These either come from the ID phase and thus in turn from the register file (or PC+4 for jump and link instructions), or one operand comes from the ID phase and the other comes from the instruction register to supply an immediate value.

STAGE 3: EXECUTION

STAGE 4: MEMORY ACCESS Store operands into memory or load operands from memory. So, for all instructions except loads and stores, the MA simply passes on the value from the ALU on to the WB stage. For loads and stores, the MA needs to send the effective address calculated by the ALU to memory. For loads, the memory will then respond by sending the requested data back. For stores, we need to send the data to be stored along with the effective address, and the memory will respond by updating itself.

STAGE 4: MEMORY ACCESS

STAGE 5: WRITE BACK It simply takes the output of the MA phase, and sends it back to the write back phase to store the result into the destination register. For stores (and no-ops), the write-back does nothing.

ALU Some ALU operations: Big Picture: What’s in there?? How do we arithmetic logic “comparison” Big Picture: What’s in there?? How do we build it??

ALU - LOGIC OPERATIONS R-type (add, sub) instruction format: Logical Operations Logic Operations MIPS instructions shift left << sll $10, $16, 8 shift right >> srl $10, $16, 8 AND & and $3, $7, $8 OR | or $3, $7, $8 R-type (add, sub) instruction format: op rs rt rd shamt funct 6 bits 5 5 5 5 6 = 32 opcode 1st src 2nd src dest shift amount func --> fields  For shift instructions (shift left and shift right), the 1st source register is unused.

ALU – HARDWARE BUILDING BLOCKS

A SIMPLE ALU CELL A B add/subt 1-bit FA carry_in carry_out result op

TO SEE HOW TO IMPLEMENT A SIMPLE ALU UNIT SEE LAB RESOURSES AT THE COURSE SITE