CMPUT 329 - Computer Organization and Architecture II1 CMPUT229 - Fall 2003 TopicE: Building a Data Path and a Control Path for a Microprocessor José Nelson.

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
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2003 TopicI: Building a Multicycle Data Path and a Control Path for a Microprocessor.
Levels in Processor Design
331 Lec 14.1Fall 2002 Review: Abstract Implementation View  Split memory (Harvard) model - single cycle operation  Simplified to contain only the instructions:
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.
The Datapath Andreas Klappenecker CPSC321 Computer Architecture.
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
Gary MarsdenSlide 1University of Cape Town Chapter 5 - The Processor  Machine Performance factors –Instruction Count, Clock cycle time, Clock cycles per.
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.
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.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
PC Instruction Memory Address Instr. [31-0] 4 Fig 4.6 p 309 Instruction Fetch.
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.
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:
Single-cycle CPU Control
Access the Instruction from Memory
EE204 Computer Architecture
Single Cycle CPU.
CS 230: Computer Organization and Assembly Language
Single-Cycle Datapath and Control
Computer Architecture
Multi-Cycle CPU.
Multi-Cycle CPU.
ECS 154B Computer Architecture II Spring 2009
CS/COE0447 Computer Organization & Assembly Language
Design of the Control Unit for Single-Cycle Instruction Execution
Discussion Session Week 10
MIPS processor continued
CS/COE0447 Computer Organization & Assembly Language
Single-Cycle CPU DataPath.
CS/COE0447 Computer Organization & Assembly Language
Design of the Control Unit for One-cycle Instruction Execution
CSCI206 - Computer Organization & Programming
Topic 5: Processor Architecture Implementation Methodology
Rocky K. C. Chang 6 November 2017
Composing the Elements
Composing the Elements
The Processor Lecture 3.3: Single-cycle Implementation
The Processor Lecture 3.2: Building a Datapath with Control
Vishwani D. Agrawal James J. Danaher Professor
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)
The Processor: Datapath & Control.
COMS 361 Computer Organization
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

CMPUT Computer Organization and Architecture II1 CMPUT229 - Fall 2003 TopicE: Building a Data Path and a Control Path for a Microprocessor José Nelson Amaral

CMPUT Computer Organization and Architecture II2 Representing Instructions: R-Type Instructions add $8, $17, $18 This instruction has 3 operands. The data that is operates on is stored in registers. It adds the content of registers $17 and $18 and stores the result in register $8. Its meaning can be summarized as follows: $8  $17 + $ OpCodersrtDestinationshiftamtfunction R-Type Instruction Format

CMPUT Computer Organization and Architecture II3 Representing Instructions: Memory Instructions lw $7, 68($9) Read the memory location addressed by the value in register $9 plus 68 and store the value in register $7 Its meaning can be summarized as follows: $7  Memory[$9 + 68] OpCodersrtaddress I-Type Instruction Format

CMPUT Computer Organization and Architecture II4 Representing Instructions: Memory Instructions sw $13, 56($17) Write the value currently in register $13 in the memory location addressed by the value in register $17 plus 56 Its meaning can be summarized as follows: Memory[$ ]  $ OpCodersrtaddress I-Type Instruction Format

CMPUT Computer Organization and Architecture II5 Representing Instructions: Branch Instructions bne $1, $2, 100 Add 4 to the PC. If the value in register $1 is not equal the value in register $2, then add 100 to the PC before fetching the next instruction. Its meaning can be summarized as follows: PC  PC + 4 if($1  $2) PC  PC OpCodersrtaddress I-Type Instruction Format

CMPUT Computer Organization and Architecture II6 Building a Datapath: Instruction Memory Read address Instruction Memory PC Sum Adder Write Program CounterInstruction MemoryAdder

CMPUT Computer Organization and Architecture II7 Building a Datapath PC Incrementer Read address Instruction Memory Sum Adder PC Write 4

CMPUT Computer Organization and Architecture II8 Building a Data Path Register File and ALU ALU result Zero ALU Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers Register FileALU 32 Data ALU operation RegWrite

CMPUT Computer Organization and Architecture II9 A Two Read Port File with n Registers Reg. 0 Reg. 1 Reg. n-2 Reg. n-1 5-to-32 decoder RegWrite MuxMux MuxMux Read Register 1 Read Register 2 Write Data Write Register CDCD CDCD CDCD CDCD CDCD 32

CMPUT Computer Organization and Architecture II10 Reg. 0 Reg. 1 MuxMux Read Register 1 32 Read Register 1 MuxMux 1 R0_0 R1_0 R31_0 MuxMux 1 R0_1 R1_1 R31_1 MuxMux 1 R0_31 R1_31 R31_31 R31R0 R1 5

CMPUT Computer Organization and Architecture II11 Building a Data Path R-Type Instruction OpCodersrtDestinationshiftamtfunction add $8, $17, $18 Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 ALU result Zero ALU ALU operation Instruction I(25-21) I(15-11) I(20-16) RegWrite

CMPUT Computer Organization and Architecture II12 Building a Data Path Load/Store Instructions Read address Write address Write data MemData Data Memory MemWrite MemRead Data Memory Unit Sign ext Sign-extension Unit

CMPUT Computer Organization and Architecture II13 Building a DataPath Load/Store Instructions OpCodersrtaddress lw $7, 68($9) Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 ALU result Zero ALU ALU operation Read address Write address Write data MemData Data Memory MemRead Sign ext. RegWrite Instruction I(25-21) I(20-16)

CMPUT Computer Organization and Architecture II14 Building a DataPath Load/Store Instructions Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 ALU result Zero ALU ALU operation Read address Write address Write data MemData Data Memory MemWrite Sign ext. 32 sw $13, 56($17) OpCodersrtaddress Instruction I(25-21) 32 I(20-16)

CMPUT Computer Organization and Architecture II15 Combining Memory and Register Instr. Datapaths Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Instruction Read address Write address Write data MemData Data Memory MemWrite MemRead Sign ext. 16 ALU result Zero ALU ALU operation RegWrite sw $13, 56($17) OpCodersrtaddress 0 1 MuxMux 32 MuxMux 0 1 ALUSrc MemtoReg add $8, $17, $ OpCodersrtDestinationshiftamtfunction

CMPUT Computer Organization and Architecture II16 Building a DataPath Branch Instructions Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Zero ALU ALU operation Instruction Sign ext bne $1, $2, OpCodersrtaddress Sum Adder PC + 4 Shift left 2 Branch Target To branch control logic I(25-21) I(20-16)

CMPUT Computer Organization and Architecture II17 Building a DataPath Branch Instructions Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Zero ALU ALU operation Instruction Sign ext RegWrite bne $1, $2, OpCodersrtaddress Sum Adder PC + 4 Shift left 2 Branch Target To branch control logic I(25-21) I(20-16)

Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Instruction Read address Write address Write data MemData Data Memory MemWrite MemRead ALU result Zero ALU RegWrite 0 1 MuxMux MuxMux 0 1 ALUSrc MemtoReg Read address Instruction Memory Sum Adder PC Write 4 Sum Adder Shift left MuxMux PCSrc Sign ext. ALU control I(5-0)

CMPUT Computer Organization and Architecture II19 Destination Register for Load and R-Type Instr OpCodersrtaddress lw $7, 68($9) OpCodersrtDestinationshiftamtfunction add $8, $17, $18 The Destination register of a load is specified in I20-I16, but for an R-Type instruction the destination is specified by the bits I15-I11. Therefore we need a multiplex in the data path of the write register

Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Read address Write address Write data MemData Data Memory MemWrite MemRead ALU result Zero ALU RegWrite 0 1 MuxMux MuxMux 0 1 I(25-21) I(20-16) I(15-11) ALUSrc MemtoReg Read address Instruction Memory Sum Adder PC Write 4 Sum Adder Shift left MuxMux PCSrc MuxMux 0 1 RegDst I(15-0) Sign ext. ALU control ALUOp I(5-0)

CMPUT Computer Organization and Architecture II21 Four Steps of an R-type Instruction 1. Fetch Instruction from instruction memory, and increment PC. 2. Read two registers (I25-I21) and (I20-I16) from the register file. 3. Use bits I5-I0 from the instruction code to determine the function that the ALU performs on the data read from the register file. 4. Write the ALU result to the destination register (I15-I11).

Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Read address Write address Write data MemData Data Memory MemWrite MemRead ALU result Zero ALU RegWrite 0 1 MuxMux MuxMux 0 1 I(25-21) I(20-16) I(15-11) ALUSrc MemtoReg Read address Instruction Memory Sum Adder PC Write 4 Sum Adder Shift left MuxMux PCSrc MuxMux 0 1 RegDst R-Type Instruction First Step: Instruction Fetch Sign ext. ALU control ALUOp I(5-0)

Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Read address Write address Write data MemData Data Memory MemWrite MemRead ALU result Zero ALU RegWrite 0 1 MuxMux MuxMux 0 1 I(25-21) I(20-16) I(15-11) ALUSrc MemtoReg Read address Instruction Memory Sum Adder PC Write 4 Sum Adder Shift left MuxMux PCSrc MuxMux 0 1 RegDst R-Type Instruction Second Step: Read Source Registers Sign ext. ALU control ALUOp I(5-0)

Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Read address Write address Write data MemData Data Memory MemWrite MemRead ALU result Zero ALU RegWrite 0 1 MuxMux MuxMux 0 1 I(25-21) I(20-16) I(15-11) ALUSrc MemtoReg Read address Instruction Memory Sum Adder PC Write 4 Sum Adder Shift left MuxMux PCSrc MuxMux 0 1 RegDst R-Type Instruction Third Step: ALU Operates on Registers Sign ext. ALU control ALUOp I(5-0)

Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Read address Write address Write data MemData Data Memory MemWrite MemRead ALU result Zero ALU RegWrite 0 1 MuxMux MuxMux 0 1 I(25-21) I(20-16) I(15-11) ALUSrc MemtoReg Read address Instruction Memory Sum Adder PC Write 4 Sum Adder Shift left MuxMux PCSrc MuxMux 0 1 RegDst R-Type Instruction Final Step: Write the Result Sign ext. ALU control ALUOp I(5-0)

CMPUT Computer Organization and Architecture II26 Four Steps for a load Instruction 1. Fetch Instruction from instruction memory, and increment PC. 2. Read one register (I25-I21) from the register file. 3. The ALU computes the sum of the value read from the register file and the sign-extended lower 16 bits of the instruction (offset). 4. Use the result of the ALU as an address to the data memory. 5. Write the data from the memory unit to the destination register (I20-I16).

Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Read address Write address Write data MemData Data Memory MemWrite MemRead ALU result Zero ALU RegWrite 0 1 MuxMux MuxMux 0 1 I(25-21) I(20-16) I(15-11) ALUSrc MemtoReg Read address Instruction Memory Sum Adder PC Write 4 Sum Adder Shift left MuxMux PCSrc MuxMux 0 1 RegDst DataPath for a Load Instruction Sign ext. ALU control ALUOp I(5-0)

CMPUT Computer Organization and Architecture II28 Four Steps for a branch-on- equal Instruction 1. Fetch Instruction from instruction memory, and increment PC. 2. Read two registers (I25-I21) and (I20-I16) from the register file. 3. The ALU subtracts the data values read from the register. Add the value PC + 4 to the sign-extended lower 16 bits of the instruction (offset) --- the result is the branch target. 4. Use the zero result from the ALU to decide which adder result to store in the PC (either the branch target or PC+4).

Read register 1 Read register 2 Write register Write data Read data 1 Read data 2 Registers 32 Read address Write address Write data MemData Data Memory MemWrite MemRead ALU result Zero ALU RegWrite 0 1 MuxMux MuxMux 0 1 I(25-21) I(20-16) I(15-11) ALUSrc MemtoReg Read address Instruction Memory Sum Adder PC Write 4 Sum Adder Shift left MuxMux PCSrc MuxMux 0 1 RegDst DataPath for a Branch Instruction Sign ext. ALU control ALUOp Branch I(5-0)