Datapath and Control Exceptions

Slides:



Advertisements
Similar presentations
CS/COE1541: Introduction to Computer Architecture Datapath and Control Review Sangyeun Cho Computer Science Department University of Pittsburgh.
Advertisements

Adding the Jump Instruction
Advanced Pipelining Optimally Scheduling Code Optimally Programming Code Scheduling for Superscalars (6.9) Exceptions (5.6, 6.8)
The Processor: Datapath & Control
Savio Chau Single Cycle Controller Design Last Time: Discussed the Designing of a Single Cycle Datapath Control Datapath Memory Processor (CPU) Input Output.
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.
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.
1 The Processor: Datapath and Control We will design a microprocessor that includes a subset of the MIPS instruction set: –Memory access: load/store word.
The Processor: Datapath & Control. Implementing Instructions Simplified instruction set memory-reference instructions: lw, sw arithmetic-logical instructions:
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Processor: Datapath and Control
Exam 2 Review Two’s Complement Arithmetic Ripple carry ALU logic and performance Look-ahead techniques Basic multiplication and division ( non- restoring)
Computer Architecture and Design – ECEN 350 Part 6 [Some slides adapted from A. Sprintson, M. Irwin, D. Paterson and others]
Datapath and Control Unit Design
Computer Organization Rabie A. Ramadan Lecture 3.
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.
Single Cycle Controller Design
MIPS Processor.
CDA 3101 Spring 2016 Introduction to Computer Organization Microprogramming and Exceptions 08 March 2016.
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
CS Computer Architecture Week 10: Single Cycle Implementation

CS 230: Computer Organization and Assembly Language
Single-Cycle Datapath and Control
Computer Architecture
Introduction CPU performance factors
ELEN 468 Advanced Logic Design
Extensions to the Multicycle CPU
ECS 154B Computer Architecture II Spring 2009
Basic MIPS Architecture
MIPS Processor.
Processor (I).
CS/COE0447 Computer Organization & Assembly Language
Designing MIPS Processor (Single-Cycle) Presentation G
Pipelining: Advanced ILP
CSCI206 - Computer Organization & Programming
CS/COE0447 Computer Organization & Assembly Language
CSCE 212 Chapter 5 The Processor: Datapath and Control
Computer Architecture
Single-Cycle CPU DataPath.
CS/COE0447 Computer Organization & Assembly Language
CSCI206 - Computer Organization & Programming
MIPS Processor.
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.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
COMS 361 Computer Organization
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Processor: Multi-Cycle Datapath & Control
COMP541 Datapaths I Montek Singh Mar 18, 2010.
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:

Datapath and Control Exceptions 5.1-5.3 5.6

Goal Build an architecture to support the following instructions Arithmetic: add, sub, addi,slt Memory references: lw, sw Branches: jump, beq

Process Design basic framework that is needed by all instructions Build a computer for each individually Add MUXes to choose between different operations Add control signals to control the MUXes

MIPS trends Get an ____________ from memory using the ______________ (___) Read ____ or _____ registers each instruction _____ register: _____ registers:

MIPS trends All instructions use ______ after reading regs Some instructions also access _______ Write result to ________

Framework Use ALU Get instruction from memory Read from register file Access memory Write register file

What *exactly* is memory? Interface: reads: input output writes: Variation Multi-ported May read or write multiple items at the same time Must add inputs / outputs

Instruction Fetch Where are instructions stored? ________ How do we know where to fetch and instruction? ___________ What happens to the PC each instruction? ____________ By how much does the PC change? _____ What determines this amount? _________ Is the PC one of the 32 regs? Why or why not?

Get Instruction

“Add” instruction Where does the instruction tell what registers to read? Where does the instruction tell what register to write?

“Add” Instruction Operation rs rt rd shamt funct # meaning add 3 5 2 32 # $2 <- $3 + $5 Read Addr Out Data Instruction Memory PC 4 op/fun rs rt rd imm src1 src1data src2 src2data Register File destreg destdata Instruction

“Addi” Instruction Operation rs rt imm # meaning addi $5,$3,6 3 5 6 # $5 <- $3 + 6 Read Addr Out Data Instruction Memory PC 4 op/fun rs rt rd imm src1 src1data src2 src2data Register File destreg destdata Instruction

Sign Extension How do we go from 16-bit number to 32-bit number? How about 4-bit to 8-bit. 0111 = 7 = ________ 1110 = -2 = ________ So, how do we do it?

Reading/Write Registers When does register get written? What would happen if we allowed write to occur at any time?

Putting them together Instruction Memory op/fun rs rt rd imm Read Addr Out Data Instruction Memory PC 4 op/fun rs rt rd imm src1 src1data src2 src2data Register File destreg destdata Instruction

Putting them together Control Unit 4 Register File PC op/fun rs rt rd ALUOp ALUSrc 4 RegDest src1 src1data src2 src2data Register File destreg destdata PC op/fun rs rt rd imm Read Addr Out Data Instruction Memory Inst M U X M U X 16 Sign Ext 32

Machine Speed What determines the clock rate of a machine? _____________________ Making something bigger makes it:

Load Word (lw) Operation rs rt imm # meaning lw $5,8($3) 3 5 8 Read Addr Out Data Instruction Memory PC 4 op/fun rs rt rd imm src1 src1data src2 src2data Register File destreg destdata Instruction

Addr Out Data Data Memory In Data

Store Word (sw) Operation rs rt imm # meaning sw $5,8($3) 3 5 8 Read Addr Out Data Instruction Memory PC 4 op/fun rs rt rd imm src1 src1data src2 src2data Register File destreg destdata Instruction 16 Sign Ext 32

Address calculation identical to load word Out Data Data Memory In Data

Putting them together Instruction Memory op/fun rs rt rd imm Read Addr Out Data Instruction Memory PC 4 op/fun rs rt rd imm src1 src1data src2 src2data Register File destreg destdata Instruction 16 Sign Ext 32

Addr Out Data Data Memory In Data

Putting them together Data Memory Control Unit 4 Register File PC MemWr MemRd ALUOp 4 RegWrite Addr Out Data Data Memory In Data src1 src1data src2 src2data Register File destreg destdata PC op/fun rs rt rd imm Read Addr Out Data Instruction Memory Inst 16 Sign Ext 32

Ld/St Questions Are the data and instruction memory the same thing? How do they differ?

Ld/St Questions What is the advantage to split memory? What is the advantage to unified memory?

Beq What ALU operation are we going to perform? We add a ______ bit as an output to the ALU. To perform a jump, we need to change the ________

beq Operation rs rt imm # meaning Beq $3,$5,lp 3 5 6 # if ($3 == $5) goto lp Read Addr Out Data Instruction Memory PC 4 op/fun rs rt rd imm src1 src1data src2 src2data Register File destreg destdata Instruction

Beq The immediate field is the number of _____________ to advance. The address is expressed in ___________. Each instruction is _____ bytes We need to multiply the # instructions by ______ or shift left by _____

Jump Instruction The absolute address is stored in the target – do not add to current address Absolute address is only ______ bits PC is ______ 32 We get the top bits by Sign extending target? Concatenating target?

j (jump) Operation Target address # meaning J loop 0x0174837 # goto loop Read Addr Out Data Instruction Memory PC 4 op/fun rs rt rd imm src1 src1data src2 src2data Register File destreg destdata Instruction

The Whole Shebang Data Memory << 2 << 2 4 Register File PC Addr Out Data Data Memory In Data src1 src1data src2 src2data Register File destreg destdata PC op/fun rs rt rd imm Read Addr Out Data Instruction Memory Inst 16 Sign Ext 32

Exceptions 5.6

Unexpected Events Internal External

Definitions Anything unexpected happens PowerPC External event occurs Internal event occurs Change in control flow Exception Interrupt PowerPC Intel MIPS

Exception-Handling Stop Transfer control to OS Tell OS what happened Begin executing where we left off

1. Detect Exception Add control lines to detect errors

Step 2: Store PC into EPC Data Memory << 2 << 2 4 Addr Out Data Data Memory In Data src1 src1data src2 src2data Register File destreg destdata PC op/fun rs rt rd imm Read Addr Out Data Instruction Memory Inst 16 Sign Ext 32

Step 3: Tell OS the problem Store error code in the _________ Use vectored interrupts Use error code to determine _________

Cause Register Set a flag in the cause register How does the OS find out if an overflow occurred if the bit corresponding to an overflow is bit 5?

Vectored Interrupts The address of trap handler is determined by cause Exception type Exception vector address (in hex) Undefined Instruction C0 00 00 00hex Arithmetic Overflow C0 00 00 20hex

Cause Register – Go to OS Handler PC << 2 -4 Cause << 2 4 EPC Addr Out Data Data Memory In Data src1 src1data src2 src2data Register File destreg destdata PC op/fun rs rt rd imm Read Addr Out Data Instruction Memory Inst 16 Sign Ext 32

Vectored Interrupt – Go to OS Cause Vector Table << 2 << 2 -4 4 EPC Addr Out Data Data Memory In Data src1 src1data src2 src2data Register File destreg destdata PC op/fun rs rt rd imm Read Addr Out Data Instruction Memory Inst 16 Sign Ext 32