ECE 366 -- Computer Architecture Lecture Notes # 6 Shantanu Dutt How to Add To & Use the Basic Processor Organization To Execute Different Instructions.

Slides:



Advertisements
Similar presentations
The Fetch – Execute Cycle
Advertisements

Slide 4-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 4 Computer Organization.
Control path Recall that the control path is the physical entity in a processor which: fetches instructions, fetches operands, decodes instructions, schedules.
Arithmetic Logic Unit (ALU)
CS1104: Computer Organisation School of Computing National University of Singapore.
Cs 152 L1 Intro.1 Patterson Fall 97 ©UCB ECE 366 Computer Architecture Lecture 3 Shantanu Dutt ( Decomposition of Computer.
Microprocessor Design Multi-cycle Datapath Nia S. Bradley Vijay.
CS-447– Computer Architecture Lecture 12 Multiple Cycle Datapath
VHDL Development for ELEC7770 VLSI Project Chris Erickson Graduate Student Department of Electrical and Computer Engineering Auburn University, Auburn,
Topics covered: CPU Architecture CSE 243: Introduction to Computer Architecture and Hardware/Software Interface.
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 ( )
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:
CPU Fetch/Execute Cycle
Microcode Source: Digital Computer Electronics (Malvino and Brown)
EXECUTION OF COMPLETE INSTRUCTION
Computer Architecture Lecture 09 Fasih ur Rehman.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 5:
1 COMP541 Multicycle MIPS Montek Singh Apr 4, 2012.
CPE232 Basic MIPS Architecture1 Computer Organization Multi-cycle Approach Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides
Fetch-execute cycle.
Let’s look at a normal lw instruction first… 1. 2 Register file addresscontent 6 (00110) (00111) OpcodeSource register Destination register.
Sample Code (Simple) Run the following code on a pipelined datapath: add1 2 3 ; reg 3 = reg 1 + reg 2 nand ; reg 6 = reg 4 & reg 5 lw ; reg.
CDA 3101 Fall 2013 Introduction to Computer Organization
1/8/ Data Path Design & Control Copyright Joanne DeGroat, ECE, OSU1 Processor Data Paths - ALU and Registers Incorporating the ALU into a.
Computer Architecture Lecture 03 Fasih ur Rehman.
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.
Microarchitecture. Outline Architecture vs. Microarchitecture Components MIPS Datapath 1.
Computer Architecture Lecture 9 MIPS ALU and Data Paths Ralph Grishman Oct NYU.
Chapter 3 Basic Processing Unit.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
Chapter 20 Computer Operations Computer Studies Today Chapter 20.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 Part 3.
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:
Electrical and Computer Engineering University of Cyprus
CS161 – Design and Architecture of Computer Systems
Computer Organization
IT 251 Computer Organization and Architecture
Computer Organization
Five Execution Steps Instruction Fetch
ECS 154B Computer Architecture II Spring 2009
Basic MIPS Architecture
Processor (I).
Simple Processor Control Unit
\course\cpeg323-08F\Topic6b-323
CS/COE0447 Computer Organization & Assembly Language
Design of the Control Unit for Single-Cycle Instruction Execution
CS/COE0447 Computer Organization & Assembly Language
Design of the Control Unit for One-cycle Instruction Execution
Topic 6 LC-3.
\course\cpeg323-05F\Topic6b-323
Pipeline control unit (highly abstracted)
The Processor Lecture 3.6: Control Hazards
Vishwani D. Agrawal James J. Danaher Professor
Fundamental Concepts Processor fetches one instruction at a time and perform the operation specified. Instructions are fetched from successive memory locations.
Processor: Multi-Cycle Datapath & Control
Pipeline control unit (highly abstracted)
Pipelining Appendix A and Chapter 3.
CS/COE0447 Computer Organization & Assembly Language
Basic components Instruction processing
Computer Architecture
COMS 361 Computer Organization
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:

ECE Computer Architecture Lecture Notes # 6 Shantanu Dutt How to Add To & Use the Basic Processor Organization To Execute Different Instructions

Instruction: lw ri x(16-bit offset) [r1 <= MEM[PC+X] Determine Phases (each may take >= 1cc and may be further decomposed): –1. Instruction Fetch: Same for all instr. of the same size (32 bits here) –2. Decode & Incr. PC (same as before). Note that X is offset from new PC value –3. Compute the address (PC+x) of the data to be fetched Requirements & Options: (I) F.U.: (a) Adder: Use adders avail (which?) OR Put in a new adder. (b) Need a sign extender for X (16 to 32 bits) (II) Registers: A data address reg. to store PC+X (III) (a) Connections from PC & X to Adder; (b) Connection from MAR to mem. address bus

Instruction: lw ri x(16-bit offset) [r1 <= MEM[PC+X] Phases: –4. Fetch Data Requirements & Options: (I) F.U.: None (II) Registers: A data reg. (MDR) to load data on the memory data bus (III) (a) Connections from mem data bus to MDR –5. ri <== MDR Requirements & Options: (I) F.U.: None (II) Registers: None (III) (a) Connections from MDR to write port of reg. file

Instruction Processing: Phase 1 -- Fetch Instruction: lw ri x(16-bit offset) [r1 <= MEM[PC+x] Memory Interface (Addr. + Data Bus) IRPC C.U. FSM PC Upd. Data Memory Memory Interface (Buses + Regs) Register File ALU O/P Reg. 1 1 Instruction Memory Connect PC to Addr. Bus & Read Mem. Onto Data Bus Load IR when Instr. Avail [IR <= Data Bus] Status signals Source & dest reg addr [PC=>Addr Bus; Mem[PC] => Data Bus]

Instruction Processing: Phase 2 -- Decode & Incr. PC Memory Interface (Addr. Bus) IRPC C.U. FSM PC Upd. Data Memory Memory Interface (Buses + Regs) Register File ALU O/P Reg. 2 Instruction Memory 2 Start State for lw Decode State Load PC w/ o/p of Update H/W [PC <= PC Upd o/p] Instruction: lw ri x(16-bit offset) [r1 <= MEM[PC+x]

Adding extra hardware for “lw”: MAR & MDR Instruction: lw ri x(16-bit offset) [ri <= MEM[PC+x] C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IR PC Instruction Memory Source & dest reg addr MDR MAR 4 MUX

Adding extra hardware for PC+X: Design 1 Design 1: Put in extra adder---(a) Expensive in logic and interconnects; (b) Time = 1cc (if + takes 1cc) C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext MUX

Instruction Processing: PC+X :Phase 3--Design 1 1cc operation (if + takes 1 cc) C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext MUX Load MAR

Adding extra hardware for PC+X: Design 2 Design 2: Use ALU adder---(a) Better but a little exp. in interconnects & MUXes; (b) Time = 3cc (if + takes 1cc) C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext MUX

Instruction Processing: PC+X :Phase 3(a)--Design 2 3cc entire operation: Phase 3(a) Load offset and PC in ALU reg (1cc) C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext MUX Select offset, PC Load ALU regs

Instruction Processing: PC+X :Phase 3(b)--Design 2 3cc entire operation: Phase 3(b) ADD in ALU, Load o/p reg. (1cc if + is 1cc) C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext MUX Select Add Load o/p reg.

Instruction Processing: PC+X :Phase 3(c)--Design 2 3cc entire operation: Phase 3(c) MAR <= o/p reg. C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext MUX Load MAR

Adding extra hardware for PC+X: Design 3 Design 3: Use PC adder---(a) Slightly less expensive than opt. 2; (b) Time = 1cc (if + takes 1cc) C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext MUX

Instruction Processing: PC+X :Phase 3--Design 3 1cc operation (if + takes 1cc) C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext MUX Read offset Load MAR

Adding extra hardware for PC+X: Design 4 Design 4: Use PC adder & Write Bus interconnection---(a) Least exp. & most general (applicable to other instr); (b) Time is slowest: 5cc for a 1 write port reg. file C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext Write Bus

Instruction Processing: PC+X :Phase 3(a)--Design 4 5 cc entire operation: Phase 3(a): Load scratchpad reg0 (sr0) from PC -- 1cc C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext Write Bus Load sr0 [sr0<=WB] Read PC [WB <=PC]

Instruction Processing: PC+X :Phase 3(b)--Design 4 5 cc entire operation: Phase 3(b): Load scratchpad reg1 (sr1) from offset-- 1cc C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext Write Bus Load sr1 [sr1<=WB] Read offset [WB<=offset]

Instruction Processing: PC+X :Phase 3(c)--Design 4 5 cc entire operation: Phase 3(c): Read sr0 and sr1 and load ALU I/p regs (1cc) C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext Write Bus Load ALU regs Read sr0 & sr1

Instruction Processing: PC+X :Phase 3(d)--Design 4 5 cc entire operation: Phase 3(d): ADD and load o/p reg. C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext Write Bus Select Add Load o/p reg. +

Instruction Processing: PC+X :Phase 3(e)--Design 4 5 cc entire operation: Phase 3(d): Read o/p reg. to WB, load MAR --1cc C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext Write Bus Load MAR [MAR <=WB] Read o/p reg. [WB <= o/p reg.]

Instruction Proc: Data Fetch in “lw”: Phase4 -- Design 4 >= 1cc operation (based on memory speed); will need to “wait” in this state until operation is completed C.U. FSM +. Data Memory Memory Interface (Addr + Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext Write Bus Read mem Read MAR to Addr. Bus Load MDR when data available

Instr Proc: Performing ri <= MDR: Phase 5 -- Design 4 1cc operation C.U. FSM +. Data Memory Memory Interface (Data Bus) Register File ALU O/P Reg. Status signals Memory Interface (Addr. + Data Bus) IRPC Instruction Memory Source & dest reg addr MDR MAR 4 16->32 ext Write Bus Read MDR onto WB [WB <= MDR] Write to ri using dest. reg. addr. from IR

Some Control Unit FSM Design Tips The CU FSM is a Moore M/C; it is easier to reason about and design since instruction processing actions (i.e., control signals, which are the o/ps of the CU FSM) are associated w/ states The sequence [reg(s) read --> processing of resulting data --> reg(s) write] needs to be performed in a single state Different sequences of the above type need to be performed in different states if either: (a) there is a data dependency between them or (b) they need to share hardware resources (e.g., the internal write bus, the ALU adder) A particular sequence of the above type can take > 1 cc (e.g., instruction or data fetch from memory) in which case the CU generally needs to loop in a single state until a status signal (which is an i/p to the FSM) is received indicating completion of the operation

Some Control Unit FSM Design Tips (contd.) If in the sequence [reg(s) read --> processing of resulting data -- > reg(s) write] the destination reg(s) can be the same as the source reg(s) (reg(s) read) AND this sequence can take > 1 cc, then a race condition can occur, which can give a final incorrect result A race condition is one in which the o/p feeds back to the i/p before the operation is completed. This results in the i/p to the operation changing midway during the operation, thus resulting potentially in an incorrect o/p.