Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures1 Machine instructions execution steps (1) FETCH = Read the instruction.

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.
The Processor: Datapath & Control
1  1998 Morgan Kaufmann Publishers Chapter Five The Processor: Datapath and Control.
1 Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. The single cycle CPU.
Chapter 5 The Processor: Datapath and Control Basic MIPS Architecture Homework 2 due October 28 th. Project Designs due October 28 th. Project Reports.
CMPUT Computer Organization and Architecture II1 CMPUT229 - Fall 2003 TopicE: Building a Data Path and a Control Path for a Microprocessor José Nelson.
331 Lec 14.1Fall 2002 Review: Abstract Implementation View  Split memory (Harvard) model - single cycle operation  Simplified to contain only the instructions:
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
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.
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2003 TopicH: Building a Data Path and a Control Path for a Microprocessor José Nelson.
The Datapath Andreas Klappenecker CPSC321 Computer Architecture.
The Processor: Datapath & Control. Implementing Instructions Simplified instruction set memory-reference instructions: lw, sw arithmetic-logical instructions:
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
Processor: Datapath and Control
Lec 15Systems Architecture1 Systems Architecture Lecture 15: A Simple Implementation of MIPS Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some.
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]
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.
ECE-C355 Computer Structures Winter 2008 The MIPS Datapath Slides have been adapted from Prof. Mary Jane Irwin ( )
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.
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.
MIPS Processor.
May 22, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 14: A Simple Implementation of MIPS * Jeremy R. Johnson Mon. May 17, 2000.
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
MIPS Microarchitecture Single-Cycle Processor Control
Single Cycle CPU - Control
CS161 – Design and Architecture of Computer Systems
Single-Cycle Datapath and Control
Computer Architecture
/ Computer Architecture and Design
Multi-Cycle CPU.
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 CPU DataPath.
CS/COE0447 Computer Organization & Assembly Language
CSCI206 - Computer Organization & Programming
Systems Architecture II
Datapath & Control MIPS
Topic 5: Processor Architecture Implementation Methodology
Rocky K. C. Chang 6 November 2017
Composing the Elements
Composing the Elements
The Processor Lecture 3.2: Building a Datapath with Control
Topic 5: Processor Architecture
Systems Architecture I
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Lecture 14: Single Cycle MIPS Processor
Computer Architecture Processor: Datapath
MIPS processor continued
CS/COE0447 Computer Organization & Assembly Language
Control Unit (single cycle implementation)
The Processor: Datapath & Control.
COMS 361 Computer Organization
MIPS Processor.
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures1 Machine instructions execution steps (1) FETCH = Read the instruction from memory using PC as the ptr (2) DECODE = Decode the instruction (decide what to do next) and read the necessary registers (1 or 2) (3) EXECUTE = Calculate the result or a memory address by the ALU (4) MEMORY = Use the ALU result to access the memory if required (read data in load, write data in store) (5) WRITE BACK = If required, write the result into the appropriate register

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures2 We “read” during the entire CK cycle We write at the end of the CK cycle cycle time rising edge falling edge The control lines: Those are produced by the CK. Every rising edge of the CK causes the appropriate changes of the control lines.

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures3 A simplified MIPS CPU The connections shown above supports all phases of R-type and I-type instructions. Our design will support add, sub, or, xor, and, slt, lw, sw, beq, j instructions. We should be able to add more instructions, e.g., bne, addi, jal, jr.

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures4 The basic CPU parts needed for the Fetch phase: Instruction Address Instruction Memory Add Sum It is clear that we need a PC register, a memory to store the instructions and an adder to increment the PC.

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures5 The Fetch phase Add 4 PC Read address Instruction memory 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures6 A CPU capable of R-type instructions only 5 [25:21]=Rs 5 [20:16]=Rt 5 [15:11]=Rd Instruction Memory PC Adde r 4 ck 6 [31:26] 6 [5:0]= funct PC0x x Memory outputNew Memory output fetch 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures7 The general register file (GPR). This unit is required for the decode phase (and for the Write Back phase) Read register 1 Registers Read register 2 Write register Write Data Read data1 Read data2 The registers indices Data

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures8 Arithmetic Logic operation Read register1 Registers Read register2 Write register Write Data Read data1 Read data2 ALU Zero ALU operation ALU result Instruction ALU result ALU operation The basic operation we demonstrate is an R-type instruction

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures9 A CPU capable of R-type instructions only 5 [25:21]=Rs 5 [20:16]=Rt 5 [15:11]=Rd Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] 6 [5:0]= funct PC0x x Rs, RtALU inputsnew ALU inputs Memory outputNew Memory output fetch decode fetch decode 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures10 A CPU capable of R-type instructions only 5 [25:21]=Rs 5 [20:16]=Rt 5 [15:11]=Rd Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] 6 [5:0]= funct 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures11 The internal structure of the Register File 32 Read data 2 write data Read data Rd reg 2 (= Rt) Rd reg 1 (= Rs) RegWrite Wr reg (= Rd) 32 E We read 2 different registers from the 2 outputs simultaneously We write to one of the registers (in the next rising edge of the CK).

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures12 A CPU capable of R-type instructions only 5 [25:21]=Rs 5 [20:16]=Rt 5 [15:11]=Rd Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] RegWrite 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures13 A CPU capable of R-type instructions only 5 [25:21]=Rs 5 [20:16]=Rt 5 [15:11]=Rd Reg File Instruction Memory PCALU ck 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures14 A CPU capable of R-type instructions only 5 [25:21]=Rs 5 [20:16]=Rt 5 [15:11]=Rd Reg File Instruction Memory PC ALU ck 4 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures15 A CPU capable of R-type instructions only 5 [25:21]=Rs 5 [20:16]=Rt 5 [15:11]=Rd Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] RegWrite 6 [5:0]=funct ALU control 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures16 Building the Load and Store operations Read address Data memory Write address Write data Read data Write Read Here we need Data memory from which we read (and to which we write). We also need to perform sign extension to the 16 bit imm. 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures17 A CPU capable of lw instructions only 5 [25:21]=Rs 5 [20:16]=Rt Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] RegWrite=1 16 [15:0] 5 add Sext 16->32 Data Memory Address D. Out 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures18 A CPU capable of lw instructions only 5 [25:21]=Rs 5 [20:16]=Rt Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] RegWrite=1 16 [15:0] 5 add Sext 16->32 Data Memory Address D. Out 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures19 A CPU capable of lw instructions only 5 [25:21]=Rs 5 [20:16]=Rt Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] RegWrite=1 16 [15:0] 5 add Sext 16->32 Data Memory Address D. Out 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures20 A CPU capable of lw & sw instructions only 5 [25:21]=Rs 5 [20:16]=Rt Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] RegWrite=0 16 [15:0] 5 add Sext 16->32 Data Memory D.In Address MeWrite=1 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures21 A CPU capable of R-type & lw instructions (principle) 5 [25:21]=Rs 5 [20:16]=Rt Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] RegWrite 16 [15:0] 5 add Sext 16->32 Data Memory 5 [25:21]=Rs 6 [5:0]=funct ALU control 5 [15:11]=Rd Address 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures22 A CPU capable of R-type & lw instructions 5 [25:21]=Rs 5 [20:16]=Rt Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] RegWrite 16 [15:0] 5 add Sext 16->32 Data Memory 5 [25:21]=Rs 6 [5:0]=funct ALU control Rd Address D. Out 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures23 A CPU capable of R-type & lw/sw instructions 5 [25:21]=Rs 5 [20:16]=Rt Reg File Instruction Memory PCALU Adde r 4 ck 6 [31:26] RegWrite 16 [15:0] 5 add Sext 16->32 Data Memory 5 [25:21]=Rs 6 [5:0]=funct ALU control Rd Address D.In D. Out MemWrite 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures24 Elements needed for Branch instruction ALU Zero Read register1 Registers Read register2 Write register Write Data Read data1 Read data2 Instruction Adder Sum Shift left2 Sigh Extend Branch Target The zero signal is transferred to the control unit as the result of the comparison 1632 PC+4 after Fetch In addresses, we always shift left by two bits 32

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures25 Combining all of the instructions Read register1 Registers Read register2 Write register Write Data Read data1 Read data2 Zero ALU result Data Sign extend 32 Read address memory Write address Write data Read data Write Read 16 Add 4 PC M u x Read address Instruction memory ADD ALU result Shift left2 M u x M u x

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures26 Where is the CPU? CPU Instruction Memory Data Memory PC

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures27 Control lines PC Instruction memory Read address Instruction Add M u x Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 4 M u x ALU operation 3 RegWrite MemRead MemWrite PCSrc ALUSrc MemtoReg ALU result Zero ALU Data memory Address Write data Read data M u x Sign extend Add ALU result Shift left 2

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures28 Control PC Instruction memory Read address Instruction [31–0] Instruction [20–16] Instruction [25–21] Add Instruction [5–0] MemtoReg ALUOp MemWrite RegWrite MemRead Branch R register 2 Sign extend Shift left 2 M u x 1 ALU result Zero Data memory Write data Rea d dat a M u x 1 Instruction [15–11] ALU control ALU Address

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures29 Control

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures30 ALU control ALU control input 000 AND 001OR 010add 110subtract 111set-on-less-than (sign of rs-rt -> rd) 00 = lw, sw (add) 01 = beq (sub) 10 = arithmetic (see table) ALUop: Operation[2:0]

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures The Jump instruction 4 bits 26 bits 2 bits Jump address in words: Jump address in bytes: … … Final jump address in bytes: Adding the 4 MSBs: The instruction: J 101 … means that the next instruction is in address 101 … (actually in word 101 … )

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures32 Jump Shift left 2 PC Instruction memory Read address Instruction [31–0] Data memory Read data Write data Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Instruction [15–11] Instruction [20–16] Instruction [25–21] Add ALU result Zero Instruction [5–0] MemtoReg ALUOp MemWrite RegWrite MemRead Branch Jump RegDst ALUSrc I sult M u x 0 10 ALU Shift left Address

Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures33 End of single cycle implementation