Instruction Set Architecture simplified DLX – A RISC architecture with only two instruction formats. 32 general purpose registers, each 32 bits wide: R0-R31.

Slides:



Advertisements
Similar presentations
ARITHMETIC LOGIC SHIFT UNIT
Advertisements

ELEN 468 Advanced Logic Design
331 W08.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 8: Datapath Design [Adapted from Dave Patterson’s UCB CS152.
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.
CS-447– Computer Architecture Lecture 12 Multiple Cycle Datapath
Execution of an instruction
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
The simplified DLX The datapath & control story: What happens in each control state.
Levels in Processor Design
Computer ArchitectureFall 2007 © October 3rd, 2007 Majd F. Sakr CS-447– Computer Architecture.
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.
The Processor 2 Andreas Klappenecker CPSC321 Computer Architecture.
Henry Hexmoor1 Chapter 10- Control units We introduced the basic structure of a control unit, and translated assembly instructions into a binary representation.
Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures1 Machine instructions execution steps (1) FETCH = Read the instruction.
Processor I CPSC 321 Andreas Klappenecker. Midterm 1 Thursday, October 7, during the regular class time Covers all material up to that point History MIPS.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Micro-operations Are the functional, or atomic, operations of a processor. A single micro-operation generally involves a transfer between registers, transfer.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use ECE/CS 352: Digital Systems.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Chapter 4 MARIE: An Introduction to a Simple Computer.
Chapter 4 The Von Neumann Model
Execution of an instruction
Lecture 14 Today’s topics MARIE Architecture Registers Buses
ECE 445 – Computer Organization
C HAPTER 5 T HE PROCESSOR : D ATAPATH AND C ONTROL M ULTICYCLE D ESIGN.
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]
Team DataPath Research Computer Architechture. PC and IF in the Processor.
1 A single-cycle MIPS processor  An instruction set architecture is an interface that defines the hardware operations which are available to software.
December 26, 2015©2003 Craig Zilles (derived from slides by Howard Huang) 1 A single-cycle MIPS processor  As previously discussed, an instruction set.
Microarchitecture. Outline Architecture vs. Microarchitecture Components MIPS Datapath 1.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
EE 3755 Datapath Presented by Dr. Alexander Skavantzos.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
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.
Computer Organization Instructions Language of The Computer (MIPS) 2.
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.
BASIC COMPUTER ARCHITECTURE HOW COMPUTER SYSTEMS WORK.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Single-Cycle Datapath and Control
Control Unit Lecture 6.
ELEN 468 Advanced Logic Design
Chapter 4 The Von Neumann Model
Processor Architecture: Introduction to RISC Datapath (MIPS and Nios II) CSCE 230.
Prof. Sirer CS 316 Cornell University
Instruction Format MIPS Instruction Set.
Processor (I).
CS/COE0447 Computer Organization & Assembly Language
The Processor and Machine Language
Computer Organization “Central” Processing Unit (CPU)
MIPS Processor.
ECE232: Hardware Organization and Design
MARIE: An Introduction to a Simple Computer
Rocky K. C. Chang 6 November 2017
The Processor Lecture 3.1: Introduction & Logic Design Conventions
Guest Lecturer TA: Shreyas Chand
COMS 361 Computer Organization
Prof. Sirer CS 316 Cornell University
COMP541 Datapaths I Montek Singh Mar 18, 2010.
Instruction Format MIPS Instruction Set.
The Stored Program Computer
The Processor: Datapath & Control.
COMS 361 Computer Organization
MIPS Processor.
Chapter 4 The Von Neumann Model
Presentation transcript:

Instruction Set Architecture simplified DLX – A RISC architecture with only two instruction formats. 32 general purpose registers, each 32 bits wide: R0-R31. Register R0 always stores the value of 0. Load and Store operations move data between the general purpose registers and the main memory. All instructions are represented by a word = 4 bytes = 32 bits. The DLX architecture also has a few special purpose registers mainly used for handling interrupts. Special move instructions transfer data between general and special purpose registers.

The Simplified DLX An overview of the execution cycle ©Dr. Guy Even Tel Aviv Univ.

The Registers Registers are clock-enabled flip-flops. Their goal is to store binary data. The registers are divided into two major groups: General Purpose Registers Special Registers In the Special Registers environment In other environments In the General Purpose Registers (GPR) environment

The General Purpose Registers The General Purpose Registers R0-R31: The GPR environment contains 32 registers; each 32 bits long. Store data (arguments and results of instructions). GPR environment functionality: in every clock cycle: may read the values of 2 registers (values appear in A & B). may write the value of 1 register (value given via C). implemented via a dual-port RAM. registers A,B,C are not part of ISA (they are part of datapath). GPR Env. AB C

Responsible for storing information that is essential for running DLX programs. List of special registers: 1.Program Counter (PC) - stores the address of the current instruction. 2.Instruction Register (IR) - stores the current instruction. 3.More Special Purpose Registers – needed to support interrupt handling. Datapath registers (not part of ISA): 1.Memory Data Register (MDR) - stores data that is written to the memory or read from the memory. The MDR holds data for store/load instructions. 2.Memory Address Register (MAR) -stores the memory address that is accessed in load/store instructions. Special Registers

The Instruction Formats Two formats of instructions I-Type (Immediate) R-Type (Register) Opcode, two registers & a 16-bit constant Opcode, three registers & an additional 6-bit opcode (function) Opcode RS1 RD Immediate Opcode RS1 RS2 RD Function

The Instruction Formats (Cont.) Let’s see some examples: 1) This is an I-type instruction because IR[31:26] is not is the opcode of the addi instruction is the binary representation of is the binary representation of – 2’s complement representation of 63. The instruction is: addi R6 R9 63 and in other words: [ R9 ]  [R6] + 63 representation: 2’s complement representation is used for the immediate field and for the general purpose registers. Opcode RS1 RD Immediate Assembly Semantics

The Instruction Formats (Cont.) 2) Again, This is an I-type instruction because IR[31:26] is not is the opcode of the seqi instruction is the binary representation of is the binary representation of – 2’s complement representation of 3. The instruction is: seqi R3 R25 3 and in other words: Opcode RS1 RD Immediate Assembly Semantics [R25]  ([R3] = 3) ? 1 : 0

The Instruction Formats (Cont.) 3) This is a R-type instruction because IR[31:26] is is the opcode of the R-Type instructions is the binary representation of is the representation of the add instruction. The instruction is: add R5 R7 R13 and in other words: [R13]  [R5] + [R7] Assembly Semantics Opcode RS1 RS2 RD Function

The Instructions’ Types Several Types of instructions Load/StoreImmediateShift/Compute Test Jump

Simplified DLX instruction set

From the programmer’s point of view (ISA): DLX is a universal machine that executes programs stored in the main memory written in the DLX instructions set. What is the DLX?

The DLX Implementation The general idea: Fetch Decode Execute Memory Access Write- Back IR M[PC] decode the instruction stored in the IR. prepare the operands from the GPR (if necessary) A calculation (e.g. add, compare) Memory access in load/store instructions Store the result of the operation in the destination register in the GPR Env. Increment PC

The Datapath & the Control Datapath - A collection of functional units, registers and multiplexers connected by buses. Control – A state machine that manages: operation of functional units, drivers that write to buses, clock-enable signals. The Control produces signals whose name is: “Control Signals”. Datapath Control

The Datapath & the Control Signals An example of data-flow: C  op(A,B) - control is in state ALU - ALU inputs are fed from registers A & B. (corresponding drivers are enabled) - write result in register C. (driver of ALU output is enabled) - timing : within one clock cycle. AB ALU Env. C C CE Sampling C CLK stable X,Y-ALU’s inputs not stable stable ALU’s output stable C CE

The DLX Commands Implementation General Remarks: 1)Execution of an instruction requires more than one clock cycle. 2)Instructions do not have equal running time. The DLX The Datapath General Purpose Registers Functional Units (ALU) Main Memory (interface) buses Notes: Very few Control states. Even in modern processors: #states < 200. The Control Controls the data flow in the datapath.

A reminder: What is the RAM? RAM = Random Access Memory The term “Random” means that one may access any word (as oppose to tape in which only next / previous word may be accessed). The memory is modeled as an array of words. The index of each word is called the address of the word. M[i] is the word stored in the address of i.

RAM Write Adr. Data inData out Input / Output ports: 1 A bit indicating if reading or writing The functionality is: Write = 0 (Reading operation): Data out M[ ] Write = 1 (Writing operation): M[ ] Data in Data out Logical A reminder: What is the RAM (Cont.) ?

In the following slides we will zoom into each of the five types of Control states, describing what happens in each type. Let’s get deeper

What happens during Fetch state? Din Adr Dout W Busy Memory Env. Control IR Env. IR PC MR Was the mission completed? Sample! 1) The PC register contains the address. 2) The desired functionality: IR M[PC] Fetch The Control usually stays in fetch state for more than one clock cycle 3) The memory is very slow. It announces: “I’m busy” after getting a read / write request. When busy, no new requests are allowed. As Dout stablizes, the memory announces: “I’m done”. Only then the control asks the IR Env. to sample Dout’s value and update the IR register.

The string dealt with is the one located in the IR register and may be of two types: 1) I-Type: Opcode RS1 RD Immediate Determine: I-Type? Next state. General Purpose Registers (GPR) Env. A B A operand (Copy of RS1) Adr. 1 Read! Sign-Extension The constant (sign-extended) What happens during Decode state?

2) R-Type: Opcode RS1 RS2 RD Function Not use d Determine: 1) R-Type? 2) Next state. General Purpose Registers (GPR) Env. A B A operand (Copy of RS1) Adr. 1 Adr. 2 B operand (Copy of RS2) Read! What happens during Decode state (Cont.)? A continuation of the Opcode field.

Notes: 1)IR[25:21] represent RS1. IR[20:16] represent RS2. 2)The GPR Env. Is able to perform two read operations at the same clock period (Dual Port RAM). 3)The PC register is advanced in the decode stage: PC PC+1. This is done in order to avoid the use of another Control state and because this increment can be done in the decode stage (buses and ALU are free). What happens during Decode state (Cont.)? Opcode RS1 RS2 RD Function

Some kinds of instructions: 1)Instructions which use the ALU (Arithmetic instructions, Logic instructions and Test&Set instructions): A reminder: RD RS1 + Sext(Imm)RD RS1 + RS2 RD (RS1 > Sext(Imm) ? 1 : 0)RD (RS1 > RS2 ? 1 : 0) R-Type I-Type 2 operands: The first is always RS1 and the second is either RS2 or Sext(Imm). What happens during Execute state?

GPR Env. AB C Cce IR Env. 0 1 ITYPE ALU Env. ALU Control signals Result A. Arithmetic/Logic instructions: What happens during Execute state (Cont.)? Sext (Imm.)

B. Test&Set instructions: Sgri: RD (RS1 > Sext(Imm) ? 1 : 0) GPR Env. AB C Cce IR Env. 0 1 ITYPE ALU Env. TEST Result Sext (Imm.) Two stages: 1) execute C (RS1 > RS2 ? 1:0) 2) writeback RD C In this way the period time is shorter. What happens during Execute state (Cont.)? Alway s 0 / 1

2) Shift instructions: These instructions are always in R-Type structure. Slli: RD RS1 << 1 Srli: RD RS1 >> 1 The word to be shifted is stored in RS1 The shift amount is 1 GPR Env. AB C Cce Shifter RIGHT Result 1 From The PC Env. IR Env. According to Func. What happens during Execute state (Cont.)? Generally, the “1” constant may be any other constant and the shift may be of more than one place

3) Jump instructions: A. Unconditional jump: Jump Reg (jr): PC A What happens during Execute state (Cont.)? No direct path from A to PC. Instead: GPR Env. A IR Env. 0 ALU Env. ADD PC Env. PC Cce

B. Branch: “Jump only if a condition is satisfied” beqz: PC PC+1+(RS1=0 ? Sext (Imm.) : 0) bnez: PC PC+1+(RS1=0 ? 0 : Sext (Imm.)) We’ll demonstrate the beqz instruction. Two states are needed: State I - Branch: Check the condition – RS1=0 ? Sext (Imm.) : 0 GPR Env. A IR Env. 0 ALU Env. TEST Comparison result To the Control What happens during Execute state (Cont.)?

The next state BTaken Fetch State II - BTaken: Calculating the jump – PC PC+1+Sext(Imm) IR Env. ALU Env. PC Env. PC PCce PC Sext (Imm.) ADD What happens during Execute state (Cont.)? Jump No Jump

C. Calling a routine: ”Jump, remember your address so it will be possible to get back to this address” jalr: R31 PC+1 PC RS1 We use two Control states in order to execute this instruction because we want to avoid a collision in the buses (to be elaborated). What happens during Execute state (Cont.)?

State I: Copying the PC (2 clock cycles) GPR Env. C PC Env. PC Cce Clock cycle 1: GPR Env. C R31 Clock cycle 2 (like in the Write-Back state): Write! The address=31 What happens during Execute state (Cont.)?

State II: Calculating the jump address PC Env. PC ALU Env. IR Env. 0 GPR Env. A ADD Cce What happens during Execute state (Cont.)?

Reading From Memory - Load Load Word (lw): RD M(Sext(imm.) + RS1) Four states are needed for finishing the load instruction: State I: Effective Address Computation – MAR A+C0 GPR Env. A IR Env. ALU Env. MAR C0 ADD Sext(imm) + RS1 Sext(imm)

State II: Memory Access (Load). This state lasts till the value is returned – MDR M(MAR) Reading From Memory – Load (Cont.) Adr Dout W Memory Env. MAR Read! MDR Notes: 1) Busy signal informs the Control when the operation is over (Dout is stable). 2) MDR samples Dout every clock cycle, no need to compute CE (Simplifies Control). 3) Dout must be logical even if its value is incorrect! Busy Tells the Control when readung is over

State III: Writing MDR’s value to C in the GPR – C MDR Reading From Memory – Load (Cont.) MDR GPR Env. C Cce State IV: Write-Back: RD C

Writing To Memory - Store Store Word (sw): M(Sext(imm.) + RS1) RD Three states are needed for finishing the store instruction: State I: Effective Address Computation – MAR A+C0 GPR Env. A IR Env. ALU Env. MAR C0 ADD Sext(imm.) + RS1 Sext(imm.)

GPR Env. B Writing To Memory – Store (Cont.) MDR State II: Copying the B register’s (this is RD) value to the MDR – MDR B State III: Memory Access (Store) – M(MAR) MDR Adr W Memory Env. MAR Write! MDR Din Busy Tells the Control when writing is over

Write-Back The Write-Back stage occur in the following instruction types: ArithmeticLogicShift Test & Set Load In this stage, the following happens: RD C GPR Env. C R0-31 Write! RD RD’s value is determined according to a I-Type/R-Type structure. This is the reason for having two different Write-Back states (WBI & WBR).

RD ITYPE IR The RD field possibilities Write-Back (Cont.) The RD’s field may be either one of two candidates, according to the instruction’s type (I-Type/R-Type). The decision is based on the string located in the IR register: