EASTERN MEDITERRANEAN UNIVERSITY COMPUTER ENGINEERING DEPARTMENT

Similar documents
EASTERN MEDITERRANEAN UNIVERSITY COMPUTER ENGINEERING DEPARTMENT


Programmable Machines

Programmable Machines

University of Jordan Computer Engineering Department CPE439: Computer Design Lab

Chapter 4. The Processor

ECE410 Design Project Spring 2013 Design and Characterization of a CMOS 8-bit pipelined Microprocessor Data Path

bits 5..0 the sub-function of opcode 0, 32 for the add instruction

Design of Digital Circuits 2017 Srdjan Capkun Onur Mutlu (Guest starring: Frank K. Gürkaynak and Aanjhan Ranganathan)

CS3350B Computer Architecture Quiz 3 March 15, 2018

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Final Project: MIPS-like Microprocessor

LECTURE 5. Single-Cycle Datapath and Control

The MIPS Processor Datapath

Chapter 4. The Processor

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

Informatics 2C Computer Systems Practical 2 Deadline: 18th November 2009, 4:00 PM

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

CS31001 COMPUTER ORGANIZATION AND ARCHITECTURE. Debdeep Mukhopadhyay, CSE, IIT Kharagpur. Instructions and Addressing

EECS 151/251A Fall 2017 Digital Design and Integrated Circuits. Instructor: John Wawrzynek and Nicholas Weaver. Lecture 13 EE141

ECE 473 Computer Architecture and Organization Project: Design of a Five Stage Pipelined MIPS-like Processor Project Team TWO Objectives

The Processor (1) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CSEN 601: Computer System Architecture Summer 2014

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

Processor (I) - datapath & control. Hwansoo Han

MIPS%Assembly% E155%

Laboratory Exercise 6 Pipelined Processors 0.0

Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations

Computer Organization MIPS Architecture. Department of Computer Science Missouri University of Science & Technology

CENG 3420 Lecture 06: Datapath

Data paths for MIPS instructions

Chapter 4. The Processor Designing the datapath

ICS 233 COMPUTER ARCHITECTURE. MIPS Processor Design Multicycle Implementation

ECE 30 Introduction to Computer Engineering

MIPS Instruction Reference

ELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)

EECS150 - Digital Design Lecture 10- CPU Microarchitecture. Processor Microarchitecture Introduction

/ : Computer Architecture and Design Fall Midterm Exam October 16, Name: ID #:

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Computer Architecture

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

CS 2506 Computer Organization II

ECE/CS 552: Introduction to Computer Architecture ASSIGNMENT #1 Due Date: At the beginning of lecture, September 22 nd, 2010

Lecture 4: MIPS Instruction Set

CSc 256 Midterm 2 Fall 2011

Review: Abstract Implementation View

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009

Lecture 6 Decision + Shift + I/O

F. Appendix 6 MIPS Instruction Reference

Laboratory 5 Processor Datapath

The Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture

CS 351 Exam 2 Mon. 11/2/2015

Lab 4 Report. Single Cycle Design BAOTUNG C. TRAN EEL4713C

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

14:332:331. Computer Architecture and Assembly Language Fall Week 5

Midterm Questions Overview

Chapter 2. Instructions:

Reduced Instruction Set Computer (RISC)

Project Part A: Single Cycle Processor

Lecture Topics. Announcements. Today: Single-Cycle Processors (P&H ) Next: continued. Milestone #3 (due 2/9) Milestone #4 (due 2/23)

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

ECE Exam I February 19 th, :00 pm 4:25pm

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

Midterm Questions Overview

The MIPS Instruction Set Architecture

Design for a simplified DLX (SDLX) processor Rajat Moona

Chapter 3 MIPS Assembly Language. Ó1998 Morgan Kaufmann Publishers 1

Review of Last Lecture. CS 61C: Great Ideas in Computer Architecture. MIPS Instruction Representation II. Agenda. Dealing With Large Immediates

CSc 256 Midterm 2 Spring 2012

RISC Processor Design

EECS150 - Digital Design Lecture 9- CPU Microarchitecture. Watson: Jeopardy-playing Computer

CS 230 Practice Final Exam & Actual Take-home Question. Part I: Assembly and Machine Languages (22 pts)

Reduced Instruction Set Computer (RISC)

University of California, Berkeley College of Engineering Department of Electrical Engineering and Computer Science

Grading: 3 pts each part. If answer is correct but uses more instructions, 1 pt off. Wrong answer 3pts off.

CS 4200/5200 Computer Architecture I

MIPS PROJECT INSTRUCTION SET and FORMAT

CPU Organization (Design)

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H

CS3350B Computer Architecture MIPS Instruction Representation

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

Programming the processor

Single-Cycle CPU VITO KLAUDIO CSC343 FALL 2015 PROF. IZIDOR GERTNER

Concocting an Instruction Set

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

R-type Instructions. Experiment Introduction. 4.2 Instruction Set Architecture Types of Instructions

EN2910A: Advanced Computer Architecture Topic 02: Review of classical concepts

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

ECE260: Fundamentals of Computer Engineering

The University of Alabama in Huntsville Electrical & Computer Engineering Department CPE Test II November 14, 2000

EC 413 Computer Organization - Fall 2017 Problem Set 3 Problem Set 3 Solution

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support

ece4750-tinyrv-isa.txt

Assembly Programming

CS31001 COMPUTER ORGANIZATION AND ARCHITECTURE

Computer Architecture Experiment

CS Computer Architecture Spring Week 10: Chapter

Control Unit. Simulation. Result

Transcription:

1986 EASTERN MEDITERRANEAN UNIVERSITY COMPUTER ENGINEERING DEPARTMENT Fall 2ØØ4-Ø5 CMPE 325 - Computer Architecture II EXPERIMENT 6 Complete Single Clock DataPath for 16-bit Instructions in ALTERA MAX-PLUS-II VHDL Environment. Objective: To familiarize with the Single-Clock VHDL implementation for a set of 16-bit R-type instructions, and to measure the response time of several building components in a RISC datapath. 1. Introduction In this experiment you will work on a single clock cycle 16-bit datapath that can perform R-type, I-type, and L-type instructions. register file Data Memory Branch on zero gates ALU Control Control Unit Jump-Register Mux Branch Target Adder instr-field separator 16-bit instruction 16-bit ALU instruction memory program counter adder for PC+1 constant nr. (=1) Figure 1 Single Cycle DataPath for all Instructions. The complete set of the 16-bit instructions are summarized in the following tables. Table 1 General representation of R-type Instructions Opcode ReadReg1 ReadReg2 WriteReg FunctionCode 4-bits 3-bits 3-bits 3-bits 3-bits

CMPE325 Exp6- MB041208 2 Table 2 Karnough Map Representation of the Instruction OpCodes OpCode.. 00.. 01.. 11.. 10 00.. R-type Halt Goto Lw 01.. Call (or Jal) Lui (or LuL) X Beq 11.. Addi X X Bneq 10.. Andi Ori Xori Sw Table 3 Function Codes for the R-type Instructions FNCODE.00.01.11.10 0.. And Or Xor Add 1.. Jr ShrA Slt Sub The R-type instructions And, Or, and Xor operates bitwise. Add and Sub works on signed integers. ShrA is one bit shift, and shifts A-input of the ALU one bit right by keeping the sign-bit. Slt sets the destination register to one if the first source is less than the second source. Jr is the jump return instruction, it is detected by jump-return-gates in the ALU control, and connects the ALU-result to the PC-in, so that with the clock-edge PC-value changes to source1+source2. The I-type instructions Addi, Andi, Ori, Xori, Lw, Sw, Beq, and Bneq have a 6-bit immediate operand, which is sign extended in the fieldseparator block to a 16-bit immediate value. The L-type instruction Goto has 12-bit Long-immediate field for the address. Call and Lui are also L-type, and they use register-7 for destination (implied addressing). Halt instruction stops the execution of the program until an external signal "continue" goes high. Instruction Memory You can click-on the instruction memory block to access the contents of the instruction memory. The instruction is written in 4+6+6 character groups for the compatibility with the instruction fields. The four bits of the opcode of all R-type instructions are zero. It is possible to modify the contents of the location by modifying the bit pattern. The contents of the file is explained in Figure 2.

CMPE325 Exp6- MB041208 3 Instruction OpCodes Function Codes for R-type instructions -- OPCODE FNCODE -- xx00 xx01 xx11 xx10 x00 x01 x11 x10 -- -- 00xx RType halt jump lw 0xx and or xor add -- 01xx jal lui -- beq 1xx jr shr slt sub -- 11xx addi -- -- bne -- 10xx andi ori xori sw begin case addr is -- here is the istructions in instr memory to be fetched -- here is the istructins in instr memory to be fetched When "0000000000000000"=>instr<="1100"&"000001"&"111111"; -- 0 addi $1,$0,-1 When "0000000000000001"=>instr<="0000"&"011011"&"011011"; -- 1 xor $3,$3,$3 When "0000000000000010"=>instr<="1100"&"001010"&"000001"; -- 2 addi $2,$1,1 When "0000000000000011"=>instr<="0000"&"011001"&"011010"; -- 3 Back: add $3,$3,$1 When "0000000000000100"=>instr<="0100"&"000000"&"001001"; -- 4 jal Save When "0000000000000101"=>instr<="1100"&"001001"&"000001"; -- 5 addi $1,$1,1 When "0000000000000110"=>instr<="0110"&"001010"&"000001"; -- 6 beq $1,$2,Exit When "0000000000000111"=>instr<="0011"&"000000"&"000011"; -- 7 jump back When "0000000000001000"=>instr<="0001"&"000000"&"000000"; -- 8 Exit: halt When "0000000000001001"=>instr<="1010"&"001011"&"000000"; -- 9 Save: sw $3,0($1) When "0000000000001010"=>instr<="0000"&"111000"&"000100"; -- A jumpr $7 When "0000000000001011"=>instr<="0000"&"000000"&"000000"; -- B When "0000000000001100"=>instr<="0000"&"000000"&"000000"; -- C When "0000000000001101"=>instr<="0000"&"000000"&"000000"; -- D When "0000000000001110"=>instr<="0000"&"000000"&"000000"; -- E When "0000000000001111"=>instr<="0000"&"000000"&"000000"; -- F when others =>instr<="1111111111111111"; Instruction field separator Binary Instruction Address Contents (Binary Instruction) separated in fields Figure 2 The contents of the Instruction Memory. The Instr_Fields block in the lab.gdf Schematic editor is a field-separator block that renames the fields of the instruction (the bit-groups for OPC[3..0], RR1[2..0], RR2[2..0], RWT[2..0], FN[2..0]), and also the immediate and long fields with and without sign extension and 4-bit shift for immediate instruction). The VHDL description for these units are simply a signal connection without any interfacing circuit. Register File The register file block contains total 7 registers and a constant zero at address 0. It has two read-register-file (RR1, RR2), one write-registerfile (WReg) and a 16-bit write-data input. RR1, RR2 and WReg specify the address of the register to access. Writing a data occurs at the positive clock-edge, while reading a register is combinatory (does not require a clock-edge). ALU The ALU block in the lab.gdf graphic file is written in VHDL code. The 'case' statement in the VHDL code corresponds to a multiplexer, and the add-sub functions are optimized by the MAXPLUS2 compiler to the most compact form. The ALU-operation select codes "sel" are given in Table 4 Select codes of 16-bit ALU functions Sel. code 000 001 010 011 100 101 110 111 Function and or add xor add sra sub slt

CMPE325 Exp6- MB041208 4 With these ALU function ("sel") codes the ALU-control unit can transfer the FN[2..0] field of the instruction directly to the sel[2..0] inputs of ALU. The inputs and output of ALU is furnished with output ports ALUOP1[15..0], ALUOP2[15..0] and ALURESULT[15..0] for monitoring purpose in the Waveform Editor. Dependency analysis In the execution of the load-word instruction (the longest of all) the following time instances are observable: TPC TIM TRR TALU TIMM Figure 3 Important Time Intervals for time dependency analysis a- Clock-cycle ( TC: from clock-edge to clock-edge) c- ipc+1 npc, state change propagation time (TPC: from clock-edge to stabilized npc), d- Instruction memory access (TIM: from stabilized npc to stabilized instruction) d- Immediate field stabilization interval (TIMM: from stabilized npc to stabilized immediate field) f- Reg[rr1] and Reg[rr2] becomes stable, (TRR: from stable fields to stable register contents) g- ALU produce the result of the operation, (TALU: from stable ALUinputs to stable ALUresult) h- ALUresult is written to Reg[rwt], (T MWT : not observable, around 2ns) The following two constraints must be satisfied in the execution of the LW instructions for this datapath to work properly. 1- T C > T npc ; 2- T C > T PC + Max(T IMM, T IM +T RR ) + T ALU + T MWT ; You can derive the timing constraints of other instructions (beq, sw, call, etc.) similarly by analyzing their waveforms.

CMPE325 Exp6- MB041208 5 2. Experimental Practice Part-1 LW instruction In the first part, we will observe the time dependency of the load-word instruction on this single-cycle-16-bit-datapath. 1-We will use 2ns grid-step, and 40 multiplication factor for the pc_clock generation, so that the clock period will be 160ns. The program to be used in this observation will be 0 addi $1,$0,-1 1 xor $3,$3,$3 (Or addi $3,$0,0) 2 addi $2,$1,1 3 Back: add $3,$3,$1 4 jal Save 5 addi $1,$1,1 6 beq $1,$2,Exit 7 jump back 8 Exit: Halt 9 Save: sw $3,2($1) A lw $3,1($2) B jumpr $7 Check the instruction memory VHDL code, correct it if necessary, and compile the project. Run the simulator (grid size 2ns, pc_clock multiplied with 40) and open the SCF file to watch the Waveforms. 2- The opcode of the LW instruction is 2. Find opcode 2 in the overall diagram, and zoom in the execution of the instruction. Figure 4 Zoom into execution of the LW instruction 1 opcode of LW instruction 2 zoom into this range When you zoom to 870-980ns range (key sequence alt-v,t and enter the time values) you will see the waveforms given in Figure 3. Take all necessary measurements to calculate the minimum possible T C period for this particular case of lw instruction according to the constraints 1- T C > T npc ; 2- T C > T PC + Max(T IMM, T IM +T RR ) + T ALU + T MWT. Fill in your time interval readings, and calculated minimum TC to the reporting sheet. Part-2 Branch Instruction The branch instruction in the program is beq, and has opcode 6. Find the time interval with opcode 6, and zoom into that region (from 1350 to 1500 ns).

CMPE325 Exp6- MB041208 6 T PC T IM T IMM T ALU-ZERO Figure 5 Timing parameters in BEQ instruction. The time constraint in deciding on the PC-in value is T PC + T IM +T RR + T ALU-ZERO < T C A parallel constraint raises up in the target-address calculation path as T PC + T IMM +T Branch-Adder < T C. Note that we don't observe the branch target adder output, since we assume that this adder has almost the same delay with the ALU-adder. In your calculation, you can simply assume T Branch-Adder =T ALU. Read and fill in to the reporting sheet the intervals, and calculate the minimum clock time for this particular branch instruction. Part-3 Conclusion: If we complete the dependency analysis for all instructions, we can find a minimum clock time constraint for the worst case of each instruction. Since we don't know which instruction will be executed before the cycle starts, the overall clock time must be long enough for the execution of all instructions. Therefore, we must use the maximum of the minimum-clock-cycles for each instruction. For example, if LW instruction requires minimum 120ns, and BEQ requires minimum 105ns, max(120ns,105ns)= 120 ns will be sufficient both for the execution of the LW and BEQ instruction.

Name: Student Number: Submitted to (Asst.): Date:dd/mm/yy / / 1986 EASTERN MEDITERRANEAN UNIVERSITY COMPUTER ENGINEERING DEPARTMENT CMPE 325 - Computer Architecture II EXPERIMENT 6- Reporting Sheet Section 2. Part-1 LW instruction: start-time end-time interval T C T PC T IM +T RR : T IMM T ALU What is the minimum possible clock period Tcmin? Tcmin=... Fall 2ØØ4 What is the maximum possible clock rate Fcmax? Fcmax=... Section 2. Part-2 Branch Instruction start-time end-time interval T C T PC T IM +T RR : T IMM T ALU-ZERO T Branch-Adder What is the minimum possible clock period Tcmin? Tcmin=... Part-3 Conclusion: If we consider only the LW and BEQ instructions, and assuming that we measured the worst case intervals in part-1 and -2, what is the maximum clock frequency for this datapath. F C-Max =........ Grading: Quiz Performance: Lab Performance: Asst. Observations: