Instruction register. Data. Registers. Register # Memory data register

Similar documents
Designing MIPS Processor

Topics: A multiple cycle implementation. Distributed Notes

Review. Combined Datapath

Designing Single-Cycle MIPS Processor

Concepts Introduced. Digital Electronics. Logic Blocks. Truth Tables

CSE Computer Architecture I

CPU DESIGN The Single-Cycle Implementation

Pipelined Datapath. Reading. Sections Practice Problems: 1, 3, 8, 12 (2) Lecture notes from MKP, H. H. Lee and S.

L07-L09 recap: Fundamental lesson(s)!

Computer Architecture Lecture 5: ISA Wrap-Up and Single-Cycle Microarchitectures

Lecture 12: Pipelined Implementations: Control Hazards and Resolutions

Lecture 9: Control Hazard and Resolution. James C. Hoe Department of ECE Carnegie Mellon University

中村宏 工学部計数工学科 情報理工学系研究科システム情報学専攻 計算システム論第 2 1

Pipeline Datapath. With some slides from: John Lazzaro and Dan Garcia

Problem Class 4. More State Machines (Problem Sheet 3 con t)

Pipelining. Traditional Execution. CS 365 Lecture 12 Prof. Yih Huang. add ld beq CS CS 365 2

Project Two RISC Processor Implementation ECE 485

Computer Engineering Department. CC 311- Computer Architecture. Chapter 4. The Processor: Datapath and Control. Single Cycle

10.2 Solving Quadratic Equations by Completing the Square

CPU DESIGN The Single-Cycle Implementation

BLOOM S TAXONOMY. Following Bloom s Taxonomy to Assess Students

Fast Path-Based Neural Branch Prediction

Design of Digital Circuits Lecture 14: Microprogramming. Prof. Onur Mutlu ETH Zurich Spring April 2017

CPSC 3300 Spring 2017 Exam 2

Lecture 13: Sequential Circuits, FSM

UNCERTAINTY FOCUSED STRENGTH ANALYSIS MODEL

CSE Computer Architecture I

Processor Design & ALU Design

Change of Variables. f(x, y) da = (1) If the transformation T hasn t already been given, come up with the transformation to use.

Pipeline Datapath. With some slides from: John Lazzaro and Dan Garcia

1. Tractable and Intractable Computational Problems So far in the course we have seen many problems that have polynomial-time solutions; that is, on

Lecture 13: Sequential Circuits, FSM

61C In the News. Processor Design: 5 steps

[2] Predicting the direction of a branch is not enough. What else is necessary?

CSCI-564 Advanced Computer Architecture

Bayes and Naïve Bayes Classifiers CS434

Building a Computer. Quiz #2 on 10/31, open book and notes. (This is the last lecture covered) I wonder where this goes? L16- Building a Computer 1

[2] Predicting the direction of a branch is not enough. What else is necessary?

Lecture Notes On THEORY OF COMPUTATION MODULE - 2 UNIT - 2

Figure 4.9 MARIE s Datapath

Outcomes. Spiral 1 / Unit 2. Boolean Algebra BOOLEAN ALGEBRA INTRO. Basic Boolean Algebra Logic Functions Decoders Multiplexers

EC 413 Computer Organization

3. (2) What is the difference between fixed and hybrid instructions?

PhysicsAndMathsTutor.com

2

Andrew W. Moore Professor School of Computer Science Carnegie Mellon University

Math 144 Activity #10 Applications of Vectors

Linear System Theory (Fall 2011): Homework 1. Solutions

Lecture 3. (2) Last time: 3D space. The dot product. Dan Nichols January 30, 2018

1. (2 )Clock rates have grown by a factor of 1000 while power consumed has only grown by a factor of 30. How was this accomplished?

Chapter 3 MATHEMATICAL MODELING OF DYNAMIC SYSTEMS

Simple Instruction-Pipelining (cont.) Pipelining Jumps

Chapter 4 Supervised learning:

CHAPTER log 2 64 = 6 lines/mux or decoder 9-2.* C = C 8 V = C 8 C * 9-4.* (Errata: Delete 1 after problem number) 9-5.

Section 7.4: Integration of Rational Functions by Partial Fractions

Spiral 1 / Unit 3

Assignment Fall 2014

Pulses on a Struck String

A Second Datapath Example YH16

PREDICTABILITY OF SOLID STATE ZENER REFERENCES

4. (3) What do we mean when we say something is an N-operand machine?

FRÉCHET KERNELS AND THE ADJOINT METHOD

Second-Order Wave Equation

Introdction Finite elds play an increasingly important role in modern digital commnication systems. Typical areas of applications are cryptographic sc

Lecture 3, Performance

Lecture 3, Performance

Department of Industrial Engineering Statistical Quality Control presented by Dr. Eng. Abed Schokry

ECE290 Fall 2012 Lecture 22. Dr. Zbigniew Kalbarczyk

Quadratic and Rational Inequalities

Integration of Basic Functions. Session 7 : 9/23 1

MULTIPLE REGRESSION WITH TWO EXPLANATORY VARIABLES: EXAMPLE. ASVABC + u

Implementing the Controller. Harvard-Style Datapath for DLX

UNIVERSITY OF WISCONSIN MADISON

Technical Note. ODiSI-B Sensor Strain Gage Factor Uncertainty

FEA Solution Procedure

STEP Support Programme. STEP III Hyperbolic Functions: Solutions

A Macroscopic Traffic Data Assimilation Framework Based on Fourier-Galerkin Method and Minimax Estimation

Setting The K Value And Polarization Mode Of The Delta Undulator

Reflections on a mismatched transmission line Reflections.doc (4/1/00) Introduction The transmission line equations are given by

10.4 Solving Equations in Quadratic Form, Equations Reducible to Quadratics

sin u 5 opp } cos u 5 adj } hyp opposite csc u 5 hyp } sec u 5 hyp } opp Using Inverse Trigonometric Functions

Design. Dr. A. Sahu. Indian Institute of Technology Guwahati

Restricted Three-Body Problem in Different Coordinate Systems

Gen Hebb Learn PPaplinski Generalized Hebbian Learning and its pplication in Dimensionality Redction Illstrative Example ndrew P Paplinski Department

Modelling by Differential Equations from Properties of Phenomenon to its Investigation

Arithmetic and Logic Unit First Part

Discontinuous Fluctuation Distribution for Time-Dependent Problems

FRTN10 Exercise 12. Synthesis by Convex Optimization

1. State-Space Linear Systems 2. Block Diagrams 3. Exercises

Chapter 2 Difficulties associated with corners

Control. Control. the ALU. ALU control signals 11/4/14. Next: control. We built the instrument. Now we read music and play it...

What is fundamental? wwhat is it made of? whow is it all held together? The TWO most fundamental questions about the universe are: Fig. 15.1, p.

08.06 Shooting Method for Ordinary Differential Equations

Simple Instruction-Pipelining. Pipelined Harvard Datapath

3 2D Elastostatic Problems in Cartesian Coordinates

Uncertainties of measurement

6 PM Midnight A B C D. Time. T a s k. O r d e r. Computer Architecture CTKing/TTHwang. Pipelining-1. Pipelining-3 CTKing/TTHwang

Chem 4501 Introduction to Thermodynamics, 3 Credits Kinetics, and Statistical Mechanics. Fall Semester Homework Problem Set Number 10 Solutions

ECE 3401 Lecture 23. Pipeline Design. State Table for 2-Cycle Instructions. Control Unit. ISA: Instruction Specifications (for reference)

Classify by number of ports and examine the possible structures that result. Using only one-port elements, no more than two elements can be assembled.

Transcription:

Where we are headed Single Cycle Problems: what if we had a more complicated instrction like floating point? wastefl of area One Soltion: se a smaller cycle time have different instrctions take different nmbers of cycles a mlticycle path: PC Address emory Data or emory Data Register # Registers Register # Register # A B ALU ALUOt lticycle Approach We will be resing fnctional nits ALU sed to compte address and to increment PC emory sed for instrction and Or control signals will not be determined solely by instrction e.g., what shold the ALU do for a sbtract instrction? We ll se a finite state machine for control

Review: finite state machines Finite state machines: a set of states and net state fnction (determined by crrent state and the inpt) otpt fnction (determined by crrent state and possibly inpt) Crrent state Net-state fnction Net state Inpts Clock Otpt fnction Otpts We ll se a oore machine (otpt based only on crrent state) Review: finite state machines Eample: B. A friend wold like yo to bild an electronic eye for se as a fake secrity device. The device consists of three lights lined p in a row, controlled by the otpts Left, iddle, and Right, which, if asserted, indicate that a light shold be on. Only one light is on at a time, and the light moves from left to right and then from right to left, ths scaring away thieves who believe that the device is monitoring their activity. Draw the graphical representation for the finite state machine sed to specify the electronic eye. Note that the rate of the eye s movement will be controlled by the clock speed (which shold not be too great) and that there are essentially no inpts.

lticycle Approach Break p the instrctions into steps, each step takes a cycle balance the amont of work to be done restrict each cycle to se only one major fnctional nit At the end of a cycle store vales for se in later cycles (easiest thing to do) introdce additional internal s PC Address emory emdata [5 ] [ 6] [5 ] [5 ] emory [5 ] 6 Registers Sign etend Shift left A B Zero ALU ALU reslt ALUOt 5 lticycle Datapath with control signals IorD e m R e ad e m W rite IR W rite R eg D st R eg W r ite A L U S rca P C A d dr e ss em o ry e md a ta W rite da ta Instr ctio n [ 5 ] Instr ctio n [ 6 ] Instr ctio n [ 5 ] In str ctio n re g is ter In str ction [ 5 ] R e a d R e a d R e a d da ta R e g iste rs W rite R e a d r eg iste r da ta W rite d a ta A B Z e ro A L U A L U res lt A LU O t In str ctio n [ 5 ] e m o ry d a ta r eg is te r 6 S ig n e ten d S h ift le ft A L U c o ntro l In str ctio n [5 ] e m to R e g A L U S r cb A L U O p 6

lticycle Datapath & Control Cond PCSorce IorD em em emtoreg IR Otpts Control Op [5 ] ALUOp ALUSrcB ALUSrcA Reg RegDst PC Address emory emdata [-6] [5 ] [ 6] [5 ] [5 ] [5 ] 6 8 Shift [5 ] Registers A B left PC [-8] Zero ALU ALU reslt Jmp address [-] ALUOt emory 6 Sign etend Shift left ALU control [5 ] 7 Five Eection Steps Fetch Decode and Register Fetch Eection, emory Address Comptation, or Branch Completion emory Access or R-type instrction completion -back step INSTRUCTIONS TAKE FRO - 5 CYCLES! 8

High level view of finite state machine control Start fetch/decode and fetch (Figre 5.7) emory access instrctions (Figre 5.8) R-type instrctions (Figre 5.9) Branch instrction (Figre 5.) Jmp instrction (Figre 5.) 9 Step : Fetch Use PC to get instrction and pt it in the Register. Increment the PC by and pt the reslt back in the PC. Can be described sccinctly sing RTL "Register-Transfer Langage" IR = emory[pc]; PC = PC + ; Can we figre ot the vales of the control signals? What is the advantage of pdating the PC now?

Step : Decode and Register Fetch s rs and rt in case we need them Compte the branch address in case the instrction is a branch RTL: A = Reg[IR[5-]]; B = Reg[IR[-6]]; ALUOt = PC + (sign-etend(ir[5-]) << ); We aren't setting any control lines based on the instrction type (we are bsy "decoding" it in or control logic) Fetch & Decode Start (Op = 'LW') or (Op = 'SW') fetch em ALUSrcA = IorD = IR ALUSrcB = ALUOp = PCSorce = (Op = R-type) (Op = 'BEQ') decode/ Register fetch ALUSrcA = ALUSrcB = ALUOp = (Op = 'JP') emory reference FS (Figre 5.8) R-type FS (Figre 5.9) Branch FS (Figre 5.) Jmp FS (Figre 5.)

Step (instrction dependent) ALU is performing one of three fnctions, based on instrction type emory Reference: ALUOt = A + sign-etend(ir[5-]); R-type: ALUOt = A op B; Branch: if (A==B) PC = ALUOt; Step (R-type or memory-access) Loads and stores access memory DR = emory[aluot]; or emory[aluot] = B; R-type instrctions finish Reg[IR[5-]] = ALUOt; The write actally takes place at the end of the cycle on the edge

-back step Reg[IR[-6]]= DR; What abot all the other instrctions? 5 Finite state machine for memory access instrctions From state ALUSrcA = ALUSrcB = ALUOp = (Op = 'LW') or (Op = 'SW') emory address comptation (Op = 'LW') emory access (Op = 'SW') 5 emory access em IorD = em IorD = -back step Reg emtoreg = RegDst = To state (Figre 5.7) 6

Finite state machine for R-format instrctions From state (Op = R-type) 6 Eection ALUSrcA = ALUSrcB = ALUOp = 7 R-type completion RegDst = Reg emtoreg = To state (Figre 5.7) 7 Finite state machine for branch instrction 8 From state (Op = 'BEQ') ALUSrcA = ALUSrcB = ALUOp = Cond PCSorce = Branch completion To state (Figre 5.7) 8

Finite State achine for jmp From state (Op = 'J') 9 Jmp completion PCSorce = To state (Figre 5.7) 9 Smmary: Step name fetch decode/ fetch Action for R-type instrctions Action for memory-reference Action for instrctions branches IR = emory[pc] PC = PC + A = Reg [IR[5-]] B = Reg [IR[-6]] ALUOt = PC + (sign-etend (IR[5-]) << ) Action for jmps Eection, address ALUOt = A op B ALUOt = A + sign-etend if (A ==B) then PC = PC [-8] II comptation, branch/ (IR[5-]) PC = ALUOt (IR[5-]<<) jmp completion emory access or R-type Reg [IR[5-]] = Load: DR = emory[aluot] completion ALUOt or Store: emory [ALUOt] = B emory read completion Load: Reg[IR[-6]] = DR

Complete Finite State achine emory address comptation decode/ fetch fetch em ALUSrcA = IorD = ALUSrcA = Start IR ALUSrcB = ALUSrcB = ALUOp = ALUOp = PCSorce = Branch Eection completion Jmp completion 6 8 9 ALUSrcA = ALUSrcA = ALUSrcA = ALUSrcB = ALUSrcB = ALUSrcB = ALUOp = ALUOp = PCSorce = ALUOp = Cond PCSorce = (Op = 'LW') or (Op = 'SW') (Op = R-type) (Op = 'BE Q') (Op = 'J') (Op = 'LW') emory access (Op = 'SW') 5 emory access 7 R-type completion em IorD = em IorD = RegDst = Reg emtoreg = -back step RegDst = Reg emtoreg = Simple Qestions How many cycles will it take to eecte this code? lw $t, ($t) lw $t, ($t) beq $t, $t, Label add $t5, $t, $t sw $t5, 8($t) Label:... #assme not What is going on dring the 8th cycle of eection? In what cycle does the actal addition of $t and $t takes place?

Eceptions Hardest part of control is to implement eceptions & interrpts Type of event From where? IPS terminology I/O device reqest Eternal Interrpt Invoke the operating system from ser program Arithmetic overflow Internal Internal Eception Eception Using an ndefined instrction Hardware malfnctions Internal Internal or Eternal Eception Eception or interrpt How are eceptions handled? In or design, we will consider two types of eceptions Arithmetic overflow Eection of an ndefined instrction Actions on eception Save address of offending instrction in the Eception Program Conter (EPC) Transfer control to the operating system at a pre-specified address (eception handler) OS then takes appropriate action

Eception handling For the OS to take appropriate action, it mst know the reason for the eception Two ways to commnicate reason to OS Have a Stats which holds a field that indicates the reason for the eception Vectored interrpts Address to which control is transferred depends pon the case of the eception IPS ses first method above; it has a called Case (in addition to the EPC ) 5 Datapath & Control with spport for eceptions Cond IorD em em emtoreg IR Otpts Control Op [5 ] Case IntCase E PCSorce ALUOp ALUSrcB ALUSrcA Reg RegDst PC Address emory emdata [-6] [5 ] [ 6] [5 ] [5 ] emory [5 ] 6 8 Shift [5 ] 6 Registers Sign etend Shift left A B ALU control left PC [-8] ALU Zero ALU reslt Jmp address [-] CO ALUOt EPC Case [5 ] 6

Eception Handling Datapath additions EPC, Case (for ndefined instrction, Case =, arithmetic overflow Case = ) Control Signals E, Case IntCase (sets the Case ) PCSrc has to be modified so that one of its sorces is the OS entry point Three steps. Case. EPC = PC (Have to se ALU, so need to epand mltipleors for ALUSrcA and ALUSrcB. PC 7 Datapath & Control with spport for eceptions Cond IorD em em emtoreg IR Otpts Control Op [5 ] Case IntCase E PCSorce ALUOp ALUSrcB ALUSrcA Reg RegDst PC Address emory emdata [-6] [5 ] [ 6] [5 ] [5 ] emory [5 ] 6 8 Shift [5 ] 6 Registers Sign etend Shift left A B ALU control left PC [-8] ALU Zero ALU reslt Jmp address [-] CO ALUOt EPC Case [5 ] 8

States for handling eceptions IntCase = Case ALUSrcA = ALUSrcB = ALUOp = E PC++Sorce = IntCase = Case ALUSrcA = ALUSrcB = ALUOp = E PCSorce = PCSorce = To state to begin net instrction 9 Complete FS inclding spport for eceptions emory address comptation ALUSrcA = ALUSrcB = ALUOp = Start (Op = 'LW') or (Op = 'SW') 6 fetch em ALUSrcA = IorD = IR ALUSrcB = ALUOp = PCSorce = Eection ALUSrcA = ALUSrcB = ALUOp = 8 (Op = R-type) Branch completion ALUSrcA = ALUSrcB = ALUOp = Cond PCSorce = (Op = 'BEQ') decode/ Register fetch 9 ALUSrcA = ALUSrcB = ALUOp = (Op = 'J') (Op = other) Jmp completion PCSorce = (Op = 'LW') (Op = 'SW') emory access 5 em IorD = emory access R-type completion IntCase = 7 Case RegDst = ALUSrcA = em Reg Overflow ALUSrcB = IorD = emtoreg = ALUOp = E PCSorce = IntCase = Case ALUSrcA = ALUSrcB = ALUOp = E PCSorce = -back step Overflow Reg emtoreg = RegDst =

Implementing the Control Vale of control signals is dependent pon: what instrction is being eected which step is being performed Use the information we ve acclmated to specify a finite state machine specify the finite state machine graphically, or se microprogramming Implementation can be derived from specification Graphical Specification of FS emory address comptation A LUSrcA = ALUSrcB = ALUOp = decode/ fetch re gister fetch em Re ad ALUSrcA = IorD = ALUSrcA = Start IR ALUSrcB = ALUSrcB = ALUOp = ALUOp = PC Sorce = (Op = 'LW ') or (Op = 'SW ') (Op = R-type) Branch Eection co m pletion (Op = 'BEQ') Jmp comp letio n 6 8 9 AL USrcA = ALU SrcA = ALUSrcB = ALUSrcB = ALUOp = PCSorce = ALUOp = PC Co nd PC So rce = (Op = 'J') (Op = 'LW') emory access (Op = 'SW') 5 em ory access 7 R-type completion em IorD = em IorD = RegDst = Reg em toreg = -back step Reg Dst = Reg emtoreg =

Finite State achine for Control Implementation: Control logic Inpts Otpts Cond IorD em em IR em toreg PCSorce ALUOp ALUSrcB ALUSrcA Reg RegDst NS NS NS NS Op5 Op Op Op Op Op S S S S opcode field State PLA Implementation If I picked a horizontal or vertical line cold yo eplain it? Op5 Op Op Op Op Op S S S S Cond IorD em em IR emtoreg PCSorce PCSorce ALUOp ALUOp ALUSrcB ALUSrcB ALUSrcA Reg RegDst NS NS NS NS

RO Implementation RO = " Only emory" vales of memory locations are fied ahead of time A RO can be sed to implement a trth table if the address is m-bits, we can address m entries in the RO. or otpts are the bits of that the address points to. m n m is the "height", and n is the "width" 5 RO Implementation How many inpts are there? 6 bits for opcode, bits for state = address lines (i.e., = different addresses) How many otpts are there? 6 path-control otpts, state bits = otpts RO is = K bits (and a rather nsal size) Rather wastefl, since for lots of the entries, the otpts are the same i.e., opcode is often ignored 6

RO vs PLA Break p the table into two parts state bits tell yo the 6 otpts, 6 bits of RO bits tell yo the net state bits, bits of RO Total:.K bits of RO PLA is mch smaller can share prodct terms only need entries that prodce an active otpt can take into accont don't cares Size is (#inpts? #prodct-terms) + (#otpts? #prodct-terms) For this eample = (7)+(7) = 6 PLA cells PLA cells sally abot the size of a RO cell (slightly bigger) 7 The Big Pictre Initial representation Finite state diagram icroprogram Seqencing control Eplicit net state fnction icroprogram conter + dispatch ROS Logic representation Logic eqations Trth tables Implementation techniqe Programmable logic array only memory 8