Microsoft PowerPoint - CA_03 Chapter5 Part-II_multi _V1.ppt

Similar documents
Microsoft PowerPoint - CA_02 Chapter5 Part-I_Single _V2.ppt

Microsoft PowerPoint - CA_04 Chapter6 v ppt

1 CPU

Microsoft PowerPoint - notes3-Simple-filled12

Edge-Triggered Rising Edge-Triggered ( Falling Edge-Triggered ( Unit 11 Latches and Flip-Flops 3 Timing for D Flip-Flop (Falling-Edge Trigger) Unit 11

2/80 2

Microsoft PowerPoint - STU_EC_Ch08.ppt

Computer Architecture

Microsoft PowerPoint - STU_EC_Ch02.ppt


Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

ch_code_infoaccess

1.ai

穨control.PDF

PowerPoint Presentation

Microsoft Word - template.doc

Microsoft PowerPoint - CH 04 Techniques of Circuit Analysis

Microsoft PowerPoint - TTCN-Introduction-v5.ppt

投影片 1

IP TCP/IP PC OS µclinux MPEG4 Blackfin DSP MPEG4 IP UDP Winsock I/O DirectShow Filter DirectShow MPEG4 µclinux TCP/IP IP COM, DirectShow I

Process Data flow Data store External entity 6-10 Context diagram Level 0 diagram Level 1 diagram Level 2 diagram

Windows XP

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO

untitled

PROFIBUS3.doc

untitled

入學考試網上報名指南

BC04 Module_antenna__ doc

* RRB *

Microsoft PowerPoint - Lecture7II.ppt

邏輯分析儀的概念與原理-展示版

untitled

Progress Report of BESIII Slow Control Software Development

Chapter 24 DC Battery Sizing

K301Q-D VRT中英文说明书141009

PowerPoint Presentation

Microsoft PowerPoint - ch6 [相容模式]

Microsoft PowerPoint - ATF2015.ppt [相容模式]

國 立 政 治 大 學 教 育 學 系 2016 新 生 入 學 手 冊 目 錄 表 11 國 立 政 治 大 學 教 育 學 系 博 士 班 資 格 考 試 抵 免 申 請 表 論 文 題 目 申 報 暨 指 導 教 授 表 12 國 立 政 治 大 學 碩 博 士 班 論

OA-253_H1~H4_OL.ai

CH01.indd

9 什 么 是 竞 争 与 冒 险 现 象? 怎 样 判 断? 如 何 消 除?( 汉 王 笔 试 ) 在 组 合 逻 辑 中, 由 于 门 的 输 入 信 号 通 路 中 经 过 了 不 同 的 延 时, 导 致 到 达 该 门 的 时 间 不 一 致 叫 竞 争 产 生 毛 刺 叫 冒 险 如

第五章 重叠、流水和现代处理器技术

2005 5,,,,,,,,,,,,,,,,, , , 2174, 7014 %, % 4, 1961, ,30, 30,, 4,1976,627,,,,, 3 (1993,12 ),, 2

2015年4月11日雅思阅读预测机经(新东方版)

PowerPoint Presentation

Microsoft Word - ChineseSATII .doc

Microsoft Word - TIP006SCH Uni-edit Writing Tip - Presentperfecttenseandpasttenseinyourintroduction readytopublish

...1 What?...2 Why?...3 How? ( ) IEEE / 23

热设计网

LH_Series_Rev2014.pdf

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor

Microsoft PowerPoint - ryz_030708_pwo.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_11

Microsoft PowerPoint - 異常事件管理 [相容模式]

Bus Hound 5

Microsoft PowerPoint - Ch5 The Bipolar Junction Transistor

Chn 116 Neh.d.01.nis

C/C++ - 字符输入输出和字符确认

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM

東莞工商總會劉百樂中學

<4D F736F F F696E74202D20B5DAD2BBD5C228B4F2D3A1B0E6292E BBCE6C8DDC4A3CABD5D>

研究論文 Assessment of Effectiveness of Passenger Seatbelt Reminder on Using Belt Rate - Toward Introducing Its Assessment in the New Car Assessm

Microsoft Word - Final Exam Review Packet.docx

國立中山大學學位論文典藏.PDF

Go构建日请求千亿微服务最佳实践的副本

高中英文科教師甄試心得

4. 每 组 学 生 将 写 有 习 语 和 含 义 的 两 组 卡 片 分 别 洗 牌, 将 顺 序 打 乱, 然 后 将 两 组 卡 片 反 面 朝 上 置 于 课 桌 上 5. 学 生 依 次 从 两 组 卡 片 中 各 抽 取 一 张, 展 示 给 小 组 成 员, 并 大 声 朗 读 卡

國家圖書館典藏電子全文

lan03_yen


(baking powder) 1 ( ) ( ) 1 10g g (two level design, D-optimal) 32 1/2 fraction Two Level Fractional Factorial Design D-Optimal D

Improved Preimage Attacks on AES-like Hash Functions: Applications to Whirlpool and Grøstl

中国人民大学商学院本科学年论文

1 目 錄 1. 簡 介 一 般 甄 試 程 序 第 一 階 段 的 準 備 第 二 階 段 的 準 備 每 間 學 校 的 面 試 方 式 各 程 序 我 的 做 法 心 得 及 筆 記 結 論..

PCPDbooklet_high-res.pdf

Olav Lundström MicroSCADA Pro Marketing & Sales 2005 ABB - 1-1MRS755673

Ch03_嵌入式作業系統建置_01

GH1220 Hall Switch

59 1 CSpace 2 CSpace CSpace URL CSpace 1 CSpace URL 2 Lucene 3 ID 4 ID Web 1. 2 CSpace LireSolr 3 LireSolr 3 Web LireSolr ID

第16卷 第2期 邯郸学院学报 年6月

Microsoft Word - 論文封面 修.doc

林教授2.PDF


: ( ),,

2 2 3 DLight CPU I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AM

K7VT2_QIG_v3

Microsoft Word doc

PTS7_Manual.PDF

HC50246_2009


T stg -40 to 125 C V cc 3.8V V dc RH 0 to 100 %RH T a -40 to +125 C -0.3 to 3.6V V -0.3 to VDD+0.3 V -10 to +10 ma = 25 = 3V) VDD

Microsoft Word - (web)_F.1_Notes_&_Application_Form(Chi)(non-SPCCPS)_16-17.doc

168 健 等 木醋对几种小浆果扦插繁殖的影响 第1期 the view of the comprehensive rooting quality, spraying wood vinegar can change rooting situation, and the optimal concent

Preface This guide is intended to standardize the use of the WeChat brand and ensure the brand's integrity and consistency. The guide applies to all d

MICROCHIP EVM Board : APP APP001 PICmicro Microchip APP001 40pin PDIP PICmicro Design Tips Character LCM Temperature Sensor Application I/O Pi

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

<4D F736F F F696E74202D20C8EDBCFEBCDCB9B9CAA6D1D0D0DEBDB2D7F92E707074>

Value Chain ~ (E-Business RD / Pre-Sales / Consultant) APS, Advanc

Outline Speech Signals Processing Dual-Tone Multifrequency Signal Detection 云南大学滇池学院课程 : 数字信号处理 Applications of Digital Signal Processing 2

Transcription:

Chapter5-2 The Processor: Datapath and Control (Multi-cycle implementation) 臺大電機系 吳安宇教授 V1. 03/27/2007 For 2007 DSD Course 臺大電機吳安宇教授 - 計算機結構 1

Outline 5.1 Introduction 5.2 Logic Design Conventions 5.3 Building a Datapath 5.4 A Simple Implementation Scheme 5.5 A multi-cycle Implementation 臺大電機吳安宇教授 - 計算機結構 2

Review of Single-cycle Implementation 臺大電機吳安宇教授 - 計算機結構 3

Single-cycle implementation Why a single-cycle implementation isn t used today? Long cycle time for each instruction (load takes longest time) All instructions take as much time as the slowest one 臺大電機吳安宇教授 - 計算機結構 4

A multi-cycle Implementation Each step in the execution will take one clock cycle. Allow a function unit (e.q. ALU) to be used more than once per instruction, as long as it is used on different clock cycles. Advantage: Allow instructions to take different numbers of clock cycles. Share function units within the execution of a single instruction. The difference between single-cycle & multi-cycle implementation: A single memory unit is used for both instructions and data. A register is used to save the instruction after it is read from memory. It is called Instruction Register (IR). A single ALU is used, rather than an ALU + two adders. 臺大電機吳安宇教授 - 計算機結構 5

Added Temporary Registers The Instruction Register (IR) and the Memory Data Register (MDR) are added to save the output of memory for an instruction read and a data read, respectively. Two separate registers are used, since both values are needed during the same clock cycle (the IR needs to hold the instruction until the end of execution of that instruction, and thus will require a write control signal) The A and Bregisters are used to hold the register operand values read from the register file. The ALUOut register holds the output of the ALU. 臺大電機吳安宇教授 - 計算機結構 6

A multi-cycle Implementation Two sources for a memory address: a MUX to select The PC (for instruction access) ALUOut (for data access, lw, sw) A single ALU must accommodate all the inputs Two required changes to the datapath: An additional multiplexor: choose between the A register and the PC. A four-way multiplexor: the B register the constant 4 the sign-extended field the sign-extended and shifted offset field (2bits) 臺大電機吳安宇教授 - 計算機結構 7

Multi-cycle Datapath 臺大電機吳安宇教授-計算機結構 8

Adding Control Signals to Datapath 臺大電機吳安宇教授 - 計算機結構 9

Program Counter Control With the jump and branch instruction, there are 3 possible values to be written into the PC: Normal: The output of the ALU: PC+4, which should be stored directly into the PC The register ALUOut: the address of the branch target address When the instruction is a jump: The lower 26 bits of the IR shifted left by 2 and concatenated with the upper 4 bits of the incremented PC. PCWrite: causes an unconditional write of the PC PCWriteCond: causes a write of the PC if the branch condition is also true 臺大電機吳安宇教授 - 計算機結構 10

Complete Datapath 臺大電機吳安宇教授 - 計算機結構 11

Actions of the control signals Priority: PCWrite > PCWriteCond 臺大電機吳安宇教授 - 計算機結構 12

Actions of the 2-bit control signals 臺大電機吳安宇教授 - 計算機結構 13

Breaking the Instruction Execution into Clock Cycles The limitation of one ALU operation, one memory access, and one register file access determines what can fit in one step Breaking the Instruction Execution into Clock Cycles 1. Instruction fetch step (IF) 2. Instruction decode (ID) and register fetch step 3. Execute (EX), memory address computation, or branch completion 4. Memory access or R-type instruction completion step 5. Memory read completion step Each MIPS instruction needs 3 ~ 5 of these steps. 臺大電機吳安宇教授 - 計算機結構 14

Complete Datapath 臺大電機吳安宇教授 - 計算機結構 15

Instruction Fetch and Decode 1. Instruction fetch step IR Memory [PC]; PC PC + 4; (using ALU) 2. Instruction decode and register fetch step A Reg [IR [25:21]]; # get rs B Reg [IR [20:16]]; # get rt ALUOut PC + (sign-extend (IR[15:0]) << 2) # precompute branch target address 臺大電機吳安宇教授 - 計算機結構 16

Execution cycle 3. Execute, memory address computation, or branch completion Memory reference: ALUOut A + sign-extend (IR[15:0]); R-type: ALUOut A op B; Branch: if (A==B) PC ALUOut; Jump: PC {PC[31:28], (IR[25:0], 2 b00)}; # {x, y} is the Verilog notation for concatenation of bit fields x and y 臺大電機吳安宇教授 - 計算機結構 17

Instruction Completion Steps 4. Memory access or R-type instruction completion step Memory reference: MDR Memory [ALUOut]; or Memory [ALUOut] B; R-type: Reg [ IR [ 15:11 ] ] ALUOut; # for lw # for sw # completion of R-type 5. Memory read completion step (# for lw) Load: Reg[IR[20:16]] MDR; 臺大電機吳安宇教授 - 計算機結構 18

Micro Instructions in multi-cycle Implementation 臺大電機吳安宇教授 - 計算機結構 19

CPI in a Multi-cycle CPU: CPI in the multi-cycle CPU: 25% loads (1% load byte + 24% load word) 10% stores (1% store byte + 9% store word) 11% branches (6% beq, 5% bne) 2% jumps (1% jal + 1% jr) 52% ALU (all the rest) Loads: 5 (clock cycles) Stores: 4 ALU instructions: 4 Branches: 3 Jumps: 3 CPI = 0.25*5 + 0.10*4 + 0.52*4 + 0.11*3 + 0.02*3 = 4.12 This CPI is better than the worst-case CPI of 5.0 when all the instructions take the same number of clock cycles. 臺大電機吳安宇教授 - 計算機結構 20

Techniques to Specify the Control Two different techniques to specify the control: 1. Finite state machine (state diagram) 2. Microprogramming (see Appendix) Microprogram: A symbolic representation of control in the form of instructions, called microinstructions, that are executed on a simple micromachine. 臺大電機吳安宇教授 - 計算機結構 21

Finite-state Machine Control The high-level view of the finite state machine control 臺大電機吳安宇教授 - 計算機結構 22

Instruction Fetch and Decode 臺大電機吳安宇教授 - 計算機結構 23

Memory-reference instructions 臺大電機吳安宇教授 - 計算機結構 24

R-type 臺大電機吳安宇教授 - 計算機結構 25

Branch 臺大電機吳安宇教授 - 計算機結構 26

Jump 臺大電機吳安宇教授 - 計算機結構 27

Complete State Diagram of the Control Unit 臺大電機吳安宇教授 - 計算機結構 28

Implementation of State Diagram A. Conventional way to implement the Control Unit B. Use Verilog/VHDL to implement the State Diagram 臺大電機吳安宇教授 - 計算機結構 29

Interrupt and Exception Interrupts were initially created to handle unexpected events like arithmetic overflow and to signal requests for service from I/O devices. Some events generated internally or externally: Type of event I/O device request Invoke the operating system from user program Arithmetic overflow Using an undefined instruction Hardware malfunctions From where? External Internal Internal Internal Either MIPS terminology Interrupt Exception Exception Exception Exception or interrupt 臺大電機吳安宇教授 - 計算機結構 30

Interrupt and Exception Exception: any unexpected change in control flow without distinguishing whether the cause is internal or external Interrupt: only when the event is externally caused We will only discuss how to handle an undefined instruction or an arithmetic overflow in this chapter. How exceptions are handled: Save the address of the offending instruction in the Exception Program Counter (EPC) and transfer control to the operating system at some specified address. Take some predefined action in response to an overflow, or stop the execution of the program and report an error (Execute Interrupt Service Routine, ISR) Terminate the program or may continue its execution, using the EPC to determine where to restart the execution of the program. 臺大電機吳安宇教授 - 計算機結構 31

Interrupt Registers Two main methods used to communicate the reason for an exception: 1. Cause register: A status register which holds a field that indicates the reason for the exception (used in MIPS architecture) 2. Vectored interrupt: An interrupt for which the address to which control is transferred is determined by the cause of the exception. Exception type Undefined instruction Arithmetic overflow Exception vector address (in hex) C000 0000 hex C000 0020 hex The operating system knows the reason for the exception by the address at which it is initiated. The address are separated by 32 bytes or 8 instructions, and the operating system must record the reason for the exception and may perform some limited processing in this sequence. 臺大電機吳安宇教授 - 計算機結構 32

Handle Exception in MIPS For MIPS exception system Two additional registers to the datapath: 1. EPC (exception program counter): A 32-bit register used to hold the address of the affected instruction. 2. Cause: A register used to record the cause of the exception. In the MIPS architecture, this register is 32 bits. 3 Additional control signals: EPCWrite (update the problem instruction address) CauseWrite (update the Cause number) IntCause Change the 3-way mutiplexor (controlled by PCSouse) to a 4-way multiplexor, with additional input wired to the constant value 8000 0180 hex The Operating system entry point for exception handling subroutines 臺大電機吳安宇教授 - 計算機結構 33

Handle Interrupt in MIPS Two new states (10 and 11) are shown in Fig 5.40 1. Undefined instruction (10): This is detected when no next state is defined from state 1 for the op value. 2. Arithmetic overflow (11): The Overflow signal is used in the modified finite state machine to specify an additional possible next state(11) for state 7. 臺大電機吳安宇教授 - 計算機結構 34

Complete Datapath of MIPS CPU Added Hardware 臺大電機吳安宇教授 - 計算機結構 35

Complete State Diagram of the MIPS Controller 臺大電機吳安宇教授 - 計算機結構 36