6.004 Recitation Problems L11 RISC-V Interpreter

Size: px
Start display at page:

Download "6.004 Recitation Problems L11 RISC-V Interpreter"

Transcription

1 6.004 Recitation Problems L11 RISC-V Interpreter Refer to the ISA Reference Tables (Website > Resources) for details about each instruction. New Bluespec Constructs: Maybe Types // Maybe#() is a type constructor that takes in a type and returns a new type with an extra bit to specify if the associated data is valid or not. // In the processor, Maybe#(Bit#(5)) is used to represent the destination register. Instructions that write to the register file have a Valid destination register. Instructions that do not write to the register file have an Invalid destination register. Maybe#(Bit#(5)) rd_a = Valid(3); // destination register for an instruction // that writes to x3 Maybe#(Bit#(5)) rd_b = Invalid; // destination register for an instruction // that does not write to a register // isvalid(x) returns True if x is a Valid value, and False if x is Invalid. isvalid(rd_a) // returns True isvalid(rd_b) // returns False // frommaybe(x, y) returns the data for y if y is a Valid value, and it returns x if y is Invalid frommaybe(0, rd_a) // returns 3 (valid value of rd_a) frommaybe(0, rd_b) // returns Worksheet - 1 of 10 - L11 RISC-V Interpreter

2 RISC-V Interpreter: Components Register File typedef Bit#(32) Word; typedef Bit#(5) RIndx; // Register File has 2 read ports and 1 write port interface RFile2R1W; method Word rd1(rindx rindx); method Word rd2(rindx rindx); method Action wr(rindx rindx, Word data); endinterface module mkrfile2r1w(rfile2r1w); Vector#(32, Reg#(Word)) rfile <- replicatem(mkreg(0)); method Word rd1(rindx rindx); return rfile[rindx]; endmethod method Word rd2(rindx rindx); return rfile[rindx]; endmethod method Action wr(rindx rindx, Word data); if (rindx!= 0) begin rfile[rindx] <= data; end endmethod endmodule Main Memory typedef enum { Ld, St } MemOp deriving (Bits, Eq, FShow); typedef struct { MemOp op; Word addr; Word data; } MemReq deriving (Bits, Eq); interface MagicMemory; method ActionValue#(Word) req(memreq memreq); endinterface Worksheet - 2 of 10 - L11 RISC-V Interpreter

3 ALU (within Execute) typedef enum {Add, Sub, And, Or, Xor, Nor, Slt, Sltu, Sll, Srl, Sra} AluFunc deriving (Bits, Eq, FShow); function Word alu(word a, Word b, AluFunc func); // Implemented in LAB2 typedef enum {Eq, Neq, Lt, Ltu, Ge, Geu} BrFunc deriving (Bits, Eq, FShow); function Bool alubr(word a, Word b, BrFunc brfunc); Bool res = case (brfunc) Eq: (a == b); Neq: (a!= b); Lt: signedlt(a, b); Ltu: (a < b); Ge: signedge(a, b); Geu: (a >= b); endcase; return res; Worksheet - 3 of 10 - L11 RISC-V Interpreter

4 Decode typedef enum {LUI, JAL, JALR, BRANCH, LOAD, STORE, OPIMM, OP, Unsupported} InstType deriving (Bits, Eq, FShow); typedef struct { InstType itype; AluFunc alufunc; BrFunc brfunc; Maybe#(RIndx) dst; RIndx src1; RIndx src2; Word imm; } DecodedInst deriving (Bits, Eq, FShow); // definition of AluFunc is with alu // definition of BrFunc is with bralu function DecodedInst decode(bit#(32) inst); // Implemented in Lab 5 return dinst; Worksheet - 4 of 10 - L11 RISC-V Interpreter

5 Execute typedef struct { InstType itype; Maybe#(RIndx) dst; Word data; Word addr; Word nextpc; } ExecInst deriving (Bits, Eq, FShow); function ExecInst execute(decodedinst dinst, Word rval1, Word rval2, Word pc); let imm = dinst.imm; let brfunc = dinst.brfunc; let alufunc = dinst.alufunc; Word data =?; Word nextpc =?; Word addr =?; case (dinst.itype) LUI: begin data = imm; nextpc = pc+4; end JAL: begin data = pc+4; nextpc = pc+imm; end JALR: begin data = pc+4; nextpc = (rval1+imm) & ~1; end BRANCH: begin nextpc = alubr(rval1, rval2, brfunc)? pc+imm : pc+4; end LOAD: begin addr = rval1+imm; nextpc = pc+4; end STORE: begin data = rval2; addr = rval1+imm; nextpc = pc+4; end OPIMM: begin data = alu(rval1, imm, alufunc); nextpc = pc+4; end OP: begin data = alu(rval1, rval2, alufunc); nextpc = pc+4; end endcase ExecInst einst =?; einst.itype = dinst.itype; einst.dst = dinst.dst; einst.data = data; einst.addr = addr; einst.nextpc = nextpc; return einst; Worksheet - 5 of 10 - L11 RISC-V Interpreter

6 Full Interpreter (put it all together) module mkinterpreter(empty); Reg#(Word) pc <- mkreg(0); RFile2R1W rf <- mkrfile2r1w; MagicMemory imem <- mkmagicmemory; // instruction memory MagicMemory dmem <- mkmagicmemory; // data memory rule dointerpreter; let inst <- imem.req(memreq{op: Ld, addr: pc, data:?}); let dinst = decode(inst); let rval1 = rf.rd1(dinst.src1); let rval2 = rf.rd2(dinst.src2); let einst = execute(dinst, rval1, rval2, pc); updatestate(einst, pc, rf, dmem); endrule endmodule function Action updatestate(execinst einst, Reg#(Word) pc, RFile2R1W rf, MagicMemory dmem); return (action // memory access let data = einst.data; if (einst.itype == LOAD) begin data <- dmem.req(memreq{op: Ld, addr: einst.addr, data:?}); end else if (einst.itype == STORE) begin let dummy <- dmem.req(memreq{op: St, addr: einst.addr, data: data}); end // register file write if (isvalid(einst.dst)) rf.wr(frommaybe(?, einst.dst), data); // pc update pc <= einst.nextpc; endaction); Worksheet - 6 of 10 - L11 RISC-V Interpreter

7 Problem 1. Decode the following 32-bit RISC-V instructions: Worksheet - 7 of 10 - L11 RISC-V Interpreter

8 Problem 2. Implement the signedlt(a, b) and signedge(a, b) functions that are used by the alu function definition. The function specifications are as follows: function Bool signedlt(word a, Word b); function Bool signedge(word a, Word b); Worksheet - 8 of 10 - L11 RISC-V Interpreter

9 Problem 3. Add a branch if greater-than (BGT) instruction to the provided RISC-V processor. The instruction encoding should match other branch instructions, but have funct3 = 3 b Worksheet - 9 of 10 - L11 RISC-V Interpreter

10 Problem 4. Assume that alubr has been replaced with the new branch ALU function, newalubr, shown below. This new branch ALU is controlled by two control signals: newbrfunc and invert. When the result of this function is true, the next PC is going to be computed as pc + imm. typedef enum {Eq, Lt, Ltu} NewBrFunc deriving (Bits, Eq, FShow); function Bool newalubr(word a, Word b, NewBrFunc newbrfunc, Bool negate); Bool res = case (brfunc) Eq: (a == b); Lt: signedlt(a, b); Ltu: (a < b); endcase; return negate?!res : res; A) Fill in the decoding table below to specify what the control signals should be for each funct3. Write an X in the table for entries that don t matter. (Use the ISA reference card from the course website.) funct3 newbrfunc invert 3 b000 3 b001 3 b010 3 b011 3 b100 3 b101 3 b110 3 b Worksheet - 10 of 10 - L11 RISC-V Interpreter

6.004 Recitation Problems L11 RISC-V Interpreter

6.004 Recitation Problems L11 RISC-V Interpreter 6.004 Recitation Problems L11 RISC-V Interpreter Refer to the 6.004 ISA Reference Tables (Website > Resources) for details about each instruction. New Bluespec Constructs: Maybe Types // Maybe#() is a

More information

6.004 Recitation Problems L13 RISC-V Interpreter

6.004 Recitation Problems L13 RISC-V Interpreter 6.004 Recitation Problems L13 RISC-V Interpreter Refer to the 6.004 ISA Reference Tables (Website > Resources) for details about each instruction. RISC-V Interpreter: Components Register File typedef Bit#(32)

More information

6.004 Recitation Problems L13 RISC-V Interpreter

6.004 Recitation Problems L13 RISC-V Interpreter 6.004 Recitation Problems L13 RISC-V Interpreter Refer to the 6.004 ISA Reference Tables (Website > Resources) for details about each instruction. RISC-V Interpreter: Components Register File typedef Bit#(32)

More information

Control Unit. Main Memory. control. status. address instructions. address data. Internal storage Datapath

Control Unit. Main Memory. control. status. address instructions. address data. Internal storage Datapath control Internal storage Datapath status Control Unit address data address instructions Main Memory March 20, 2018 http://csg.csail.mit.edu/6.s084 L11-1 Our interpreter is a Single-Cycle RISC-V Processor

More information

Implementing RISC-V Interpreter in Hardware

Implementing RISC-V Interpreter in Hardware Implementing RISC-V Interpreter in Hardware Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology October 16, 2018 MIT 6.004 Fall 2018 L11-1 Instruction interpreter

More information

Non-Pipelined Processors

Non-Pipelined Processors Constructive Computer Architecture: Non-Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L10-1 Single-Cycle RISC Processor As an illustrative

More information

1 /15 2 /20 3 /20 4 /25 5 /20

1 /15 2 /20 3 /20 4 /25 5 /20 M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.S084 Computation Structures Spring 2018 1 /15 2 /20 3 /20 4 /25 5 /20 Quiz

More information

Non-pipelined Multicycle processors

Non-pipelined Multicycle processors Non-pipelined Multicycle processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Code for the lecture is available on the course website under the code tab

More information

Non-Pipelined Processors

Non-Pipelined Processors Constructive Computer Architecture: Non-Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology September 29, 2014 http://csg.csail.mit.edu/6.175

More information

Multicycle processors. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology

Multicycle processors. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Multicycle processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L14-1 Single-Cycle RISC Processor As an illustrative example, we use a subset of RISC-V

More information

1 /20 2 /18 3 /20 4 /18 5 /24

1 /20 2 /18 3 /20 4 /18 5 /24 M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.S084 Computation Structures Spring 2018 1 /20 2 /18 3 /20 4 /18 5 /24 Practice

More information

1 /18 2 /16 3 /18 4 /26 5 /22

1 /18 2 /16 3 /18 4 /26 5 /22 M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.004 Computation Structures Fall 2018 Quiz #2 1 /18 2 /16 3 /18 4 /26 5 /22

More information

1 /18 2 /16 3 /18 4 /26 5 /22

1 /18 2 /16 3 /18 4 /26 5 /22 M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.004 Computation Structures Fall 2018 Quiz #2 1 /18 2 /16 3 /18 4 /26 5 /22

More information

Multicycle processors. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology

Multicycle processors. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Multicycle processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L12-1 Single-Cycle RISC Processor As an illustrative example, we use a subset of RISC-V

More information

1 /20 2 /18 3 /20 4 /18 5 /24

1 /20 2 /18 3 /20 4 /18 5 /24 M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.S084 Computation Structures Spring 2018 1 /20 2 /18 3 /20 4 /18 5 /24 Practice

More information

Virtual Memory and Interrupts

Virtual Memory and Interrupts Constructive Computer Architecture Virtual Memory and Interrupts Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November 13, 2015 http://csg.csail.mit.edu/6.175

More information

Non-Pipelined Processors - 2

Non-Pipelined Processors - 2 Constructive Computer Architecture: Non-Pipelined Processors - 2 Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology October 4, 2017 http://csg.csail.mit.edu/6.175

More information

Interrupts/Exceptions/Faults

Interrupts/Exceptions/Faults Constructive Computer Architecture Interrupts/Exceptions/Faults Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November 6, 2013 http://csg.csail.mit.edu/6.s195

More information

Data Hazards in Pipelined Processors

Data Hazards in Pipelined Processors Data Hazards in Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology March 13, 2013 http://csg.csail.mit.edu/6.375 L11-1 A different 2-Stage

More information

Contributors to the course material

Contributors to the course material Constructive Computer Architecture: Data Hazards in Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology October 11, 2013 http://csg.csail.mit.edu/6.s195

More information

Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology

Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Constructive Computer Architecture: Data Hazards in Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology January 2, 2014 http://csg.csail.mit.edu/6.s195/cdac

More information

6.175: Constructive Computer Architecture. Tutorial 4 Epochs and Scoreboards

6.175: Constructive Computer Architecture. Tutorial 4 Epochs and Scoreboards 6.175: Constructive Computer Architecture Tutorial 4 Epochs and Scoreboards Quan Nguyen (Hopes to help you avoid epoch fails) https://xkcd.com/376/ (not that kind of epoch) T04-1 Outline Epochs Scoreboards

More information

Bypassing and EHRs. Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L23-1

Bypassing and EHRs. Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L23-1 Bypassing and EHRs Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L23-1 Bypassing F D RF bypass E/WB Bypassing is a technique to reduce the number of stalls (that is, the number

More information

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Modeling Processors Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L07-1 Instruction set typedef enum {R0;R1;R2; ;R31} RName; typedef union tagged { struct

More information

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Modeling Processors Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L08-1 Instruction set typedef enum {R0;R1;R2; ;R31} RName; typedef union tagged { struct

More information

Memory System Implementation

Memory System Implementation Memory System Implementation Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L14-1 Best Wishes from Japan October 25, 2018 MIT 6.004 Fall 2018

More information

6.175: Constructive Computer Architecture. Tutorial 1 Bluespec SystemVerilog (BSV) Sep 30, 2016

6.175: Constructive Computer Architecture. Tutorial 1 Bluespec SystemVerilog (BSV) Sep 30, 2016 6.175: Constructive Computer Architecture Tutorial 1 Bluespec SystemVerilog (BSV) Quan Nguyen (Only crashed PowerPoint three times) T01-1 What s Bluespec? A synthesizable subset of SystemVerilog Rule-based

More information

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Modeling Processors Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L07-1 The Plan Non-pipelined processor Two-stage synchronous pipeline Two-stage asynchronous

More information

Constructive Computer Architecture. Combinational ALU. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology

Constructive Computer Architecture. Combinational ALU. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Constructive Computer Architecture Combinational ALU Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology September 11, 2017 ht://csg.csail.mit.edu/6.175 L03-1 Outline

More information

Operating Systems and Interrupts/Exceptions

Operating Systems and Interrupts/Exceptions Operating Systems and Interrupts/Exceptions Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Code for the lecture is available on the course website under the

More information

Constructive Computer Architecture Tutorial 7: SMIPS Epochs. Andy Wright TA. October 7,

Constructive Computer Architecture Tutorial 7: SMIPS Epochs. Andy Wright TA. October 7, Constructive Computer Architecture Tutorial 7: SMIPS Epochs Andy Wright 6.7 TA T0- drecirect erecirect N-Stage pipeline: Two predictors f fdepoch redirect depoch redirect d miss pred? miss pred? Fetch

More information

Sizhuo Zhang TA

Sizhuo Zhang TA Constructive Computer Architecture Tutorial 2 Advanced BSV Sizhuo Zhang 6.175 TA T02-1 EHR and Scheduling Design example Up/down counter interface Counter; Bit#(8) read; Action increment(bit#(8) x); Action

More information

Programmable Machines

Programmable Machines Programmable Machines Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab M.I.T. Quiz 1: next week Covers L1-L8 Oct 11, 7:30-9:30PM Walker memorial 50-340 L09-1 6.004 So Far Using Combinational

More information

Programmable Machines

Programmable Machines Programmable Machines Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab M.I.T. Quiz 1: next week Covers L1-L8 Oct 11, 7:30-9:30PM Walker memorial 50-340 L09-1 6.004 So Far Using Combinational

More information

Branch Prediction: Direction Predictors

Branch Prediction: Direction Predictors Constructive Computer Architecture: Branch Prediction: Direction Predictors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology October 27, 2014 http://csg.csail.mit.edu/6.175

More information

Computer Architecture

Computer Architecture CS3350B Computer Architecture Winter 2015 Lecture 4.2: MIPS ISA -- Instruction Representation Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted from lectures on Computer Organization and Design,

More information

Bluespec SystemVerilog TM Training. Lecture 05: Rules. Copyright Bluespec, Inc., Lecture 05: Rules

Bluespec SystemVerilog TM Training. Lecture 05: Rules. Copyright Bluespec, Inc., Lecture 05: Rules Bluespec SystemVerilog Training Copyright Bluespec, Inc., 2005-2008 Rules: conditions, actions Rule Untimed Semantics Non-determinism Functional correctness: atomicity, invariants Examples Performance

More information

MIPS%Assembly% E155%

MIPS%Assembly% E155% MIPS%Assembly% E155% Outline MIPS Architecture ISA Instruction types Machine codes Procedure call Stack 2 The MIPS Register Set Name Register Number Usage $0 0 the constant value 0 $at 1 assembler temporary

More information

EE108B Lecture 3. MIPS Assembly Language II

EE108B Lecture 3. MIPS Assembly Language II EE108B Lecture 3 MIPS Assembly Language II Christos Kozyrakis Stanford University http://eeclass.stanford.edu/ee108b 1 Announcements Urgent: sign up at EEclass and say if you are taking 3 or 4 units Homework

More information

Review: MIPS Organization

Review: MIPS Organization 1 MIPS Arithmetic Review: MIPS Organization Processor Memory src1 addr 5 src2 addr 5 dst addr 5 write data Register File registers ($zero - $ra) bits src1 data src2 data read/write addr 1 1100 2 30 words

More information

RISC-V Assembly and Binary Notation

RISC-V Assembly and Binary Notation RISC-V Assembly and Binary Notation L02-1 Course Mechanics Reminders Course website: http://6004.mit.edu All lectures, videos, tutorials, and exam material can be found under Information/Resources tab.

More information

Need for a scheduler. Concurrent rule execution. L17/L18 Review- Rule Scheduling

Need for a scheduler. Concurrent rule execution. L17/L18 Review- Rule Scheduling L17/L18 Review- Rule Scheduling Conflict Matri (CM) BSV compiler generates the pairwise conflict information Eample 1 rule ra;

More information

Bluespec-5: Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Bluespec-5: Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Bluespec-5: Modeling Processors Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Based on material prepared by Bluespec Inc, January 2005 L12-1 Some New Types

More information

Computer Architecture. The Language of the Machine

Computer Architecture. The Language of the Machine Computer Architecture The Language of the Machine Instruction Sets Basic ISA Classes, Addressing, Format Administrative Matters Operations, Branching, Calling conventions Break Organization All computers

More information

Complex Pipelines and Branch Prediction

Complex Pipelines and Branch Prediction Complex Pipelines and Branch Prediction Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. L22-1 Processor Performance Time Program Instructions Program Cycles Instruction CPI Time Cycle

More information

Modular Refinement. Successive refinement & Modular Structure

Modular Refinement. Successive refinement & Modular Structure Modular Refinement Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L09-1 Successive refinement & Modular Structure pc rf fetch decode execute memory writeback

More information

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

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization CISC 662 Graduate Computer Architecture Lecture 4 - ISA MIPS ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,

More information

Modular Refinement - 2. Successive refinement & Modular Structure

Modular Refinement - 2. Successive refinement & Modular Structure Modular Refinement - 2 Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L10-1 Successive refinement & Modular Structure pc rf fetch decode execute memory writeback

More information

6.175: Constructive Computer Architecture. Tutorial 3 RISC-V and Debugging. Oct 14, 2016

6.175: Constructive Computer Architecture. Tutorial 3 RISC-V and Debugging. Oct 14, 2016 6.175: Constructive Computer Architecture Tutorial 3 RISC-V and Debugging Quan Nguyen (Moonlights as an amateur instruction set evangelist) T02-1 Outline RISC-V processor (from lab 5 onwards) Debugging

More information

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA CISC 662 Graduate Computer Architecture Lecture 4 - ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,

More information

The RiSC-16 Instruction-Set Architecture

The RiSC-16 Instruction-Set Architecture The RiSC-16 Instruction-Set Architecture ENEE 646: Digital Computer Design, Fall 2002 Prof. Bruce Jacob This paper describes a sequential implementation of the 16-bit Ridiculously Simple Computer (RiSC-16),

More information

Bluespec-5: Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Bluespec-5: Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Bluespec-5: Modeling Processors (revised after the lecture) Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Based on material prepared by Bluespec Inc, January

More information

CS3350B Computer Architecture MIPS Instruction Representation

CS3350B Computer Architecture MIPS Instruction Representation CS3350B Computer Architecture MIPS Instruction Representation Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada

More information

Constructive Computer Architecture. Tutorial 1 BSV Types. Andy Wright TA. September12, 2014

Constructive Computer Architecture. Tutorial 1 BSV Types. Andy Wright TA. September12, 2014 Constructive Computer Architecture Tutorial 1 BSV Types Andy Wright 6.175 TA T01-1 Bit#(numeric type n) The most important type in BSV We ll go into the details later L03-2 Bit#(numeric type n) Literal

More information

RTL Model of a Two-Stage MIPS Processor

RTL Model of a Two-Stage MIPS Processor RTL Model of a Two-Stage MIPS Processor 6.884 Laboratory February 4, 5 - Version 45 Introduction For the first lab assignment, you are to write an RTL model of a two-stage pipelined MIPS processor using

More information

CS 61c: Great Ideas in Computer Architecture

CS 61c: Great Ideas in Computer Architecture MIPS Functions July 1, 2014 Review I RISC Design Principles Smaller is faster: 32 registers, fewer instructions Keep it simple: rigid syntax, fixed instruction length MIPS Registers: $s0-$s7,$t0-$t9, $0

More information

Concocting an Instruction Set

Concocting an Instruction Set Concocting an Instruction Set Nerd Chef at work. move flour,bowl add milk,bowl add egg,bowl move bowl,mixer rotate mixer... Read: Chapter 2.1-2.7 L03 Instruction Set 1 A General-Purpose Computer The von

More information

A General-Purpose Computer The von Neumann Model. Concocting an Instruction Set. Meaning of an Instruction. Anatomy of an Instruction

A General-Purpose Computer The von Neumann Model. Concocting an Instruction Set. Meaning of an Instruction. Anatomy of an Instruction page 1 Concocting an Instruction Set Nerd Chef at work. move flour,bowl add milk,bowl add egg,bowl move bowl,mixer rotate mixer... A General-Purpose Computer The von Neumann Model Many architectural approaches

More information

Flow of Control -- Conditional branch instructions

Flow of Control -- Conditional branch instructions Flow of Control -- Conditional branch instructions You can compare directly Equality or inequality of two registers One register with 0 (>,

More information

Introduction to Bluespec

Introduction to Bluespec Introduction to Bluespec Andy Wright acwright@mit.edu Updated: December 30, 2013 1 Combinational Logic 1.1 Primitive Types definition: Bool This is a basic type for expressing true-false values with a

More information

Successive refinement & Modular Structure. Bluespec-8: Modules and Interfaces. Designing a 2-Stage Processor with GAA. A 2-Stage Processor in RTL

Successive refinement & Modular Structure. Bluespec-8: Modules and Interfaces. Designing a 2-Stage Processor with GAA. A 2-Stage Processor in RTL Bluespec-8: Modules and Interfaces Successive refinement & Modular Structure rf fetch decode memory writeback Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

More information

Lecture Topics. Announcements. Today: The MIPS ISA (P&H ) Next: continued. Milestone #1 (due 1/26) Milestone #2 (due 2/2)

Lecture Topics. Announcements. Today: The MIPS ISA (P&H ) Next: continued. Milestone #1 (due 1/26) Milestone #2 (due 2/2) Lecture Topics Today: The MIPS ISA (P&H 2.1-2.14) Next: continued 1 Announcements Milestone #1 (due 1/26) Milestone #2 (due 2/2) Milestone #3 (due 2/9) 2 1 Evolution of Computing Machinery To understand

More information

Concocting an Instruction Set

Concocting an Instruction Set Concocting an Instruction Set Nerd Chef at work. move flour,bowl add milk,bowl add egg,bowl move bowl,mixer rotate mixer... Read: Chapter 2.1-2.6 L04 Instruction Set 1 A General-Purpose Computer The von

More information

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

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture Computer Science 324 Computer Architecture Mount Holyoke College Fall 2009 Topic Notes: MIPS Instruction Set Architecture vonneumann Architecture Modern computers use the vonneumann architecture. Idea:

More information

Anne Bracy CS 3410 Computer Science Cornell University. See P&H Chapter: , , Appendix B

Anne Bracy CS 3410 Computer Science Cornell University. See P&H Chapter: , , Appendix B Anne Bracy CS 3410 Computer Science Cornell University The slides are the product of many rounds of teaching CS 3410 by Professors Weatherspoon, Bala, Bracy, and Sirer. See P&H Chapter: 2.16-2.20, 4.1-4.4,

More information

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

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support Components of an ISA EE 357 Unit 11 MIPS ISA 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support SUBtract instruc. vs. NEGate + ADD instrucs. 3. Registers accessible

More information

Anne Bracy CS 3410 Computer Science Cornell University. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]

Anne Bracy CS 3410 Computer Science Cornell University. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon] Anne Bracy CS 3410 Computer Science Cornell University [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon] Understanding the basics of a processor We now have the technology to build a CPU! Putting it all

More information

Bluespec for a Pipelined SMIPSv2 Processor

Bluespec for a Pipelined SMIPSv2 Processor Bluespec for a Pipelined SMIPSv2 Processor 6.375 Laboratory 2 February 14, 2008 The second laboratory assignment is to implement a pipelined SMIPSv2 in Bluespec SystemVerilog. As with Lab One, your deliverables

More information

Examples of branch instructions

Examples of branch instructions Examples of branch instructions Beq rs,rt,target #go to target if rs = rt Beqz rs, target #go to target if rs = 0 Bne rs,rt,target #go to target if rs!= rt Bltz rs, target #go to target if rs < 0 etc.

More information

--------------------------------------------------------------------------------------------------------------------- 1. Objectives: Using the Logisim simulator Designing and testing a Pipelined 16-bit

More information

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the ISA. RISC Goals RISC: Simplify ISA Simplify CPU Design Better CPU Performance Motivated by simplifying

More information

Concocting an Instruction Set

Concocting an Instruction Set Concocting an Instruction Set Nerd Chef at work. move flour,bowl add milk,bowl add egg,bowl move bowl,mixer rotate mixer... Read: Chapter 2.1-2.7 L04 Instruction Set 1 A General-Purpose Computer The von

More information

ece4750-tinyrv-isa.txt

ece4750-tinyrv-isa.txt ========================================================================== Tiny RISC-V Instruction Set Architecture ========================================================================== # Author :

More information

Topic Notes: MIPS Instruction Set Architecture

Topic Notes: MIPS Instruction Set Architecture Computer Science 220 Assembly Language & Comp. Architecture Siena College Fall 2011 Topic Notes: MIPS Instruction Set Architecture vonneumann Architecture Modern computers use the vonneumann architecture.

More information

Laboratory Exercise 6 Pipelined Processors 0.0

Laboratory Exercise 6 Pipelined Processors 0.0 Laboratory Exercise 6 Pipelined Processors 0.0 Goals After this laboratory exercise, you should understand the basic principles of how pipelining works, including the problems of data and branch hazards

More information

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1 Instructions: MIPS ISA Chapter 2 Instructions: Language of the Computer 1 PH Chapter 2 Pt A Instructions: MIPS ISA Based on Text: Patterson Henessey Publisher: Morgan Kaufmann Edited by Y.K. Malaiya for

More information

Computer Organization and Components

Computer Organization and Components 2 Course Structure Computer Organization and Components Module 4: Memory Hierarchy Module 1: Logic Design IS1500, fall 2014 Lecture 4: and F1 DC Ö1 F2 DC Ö2 F7b Lab: dicom F8 Module 2: C and Associate

More information

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering MIPS Instruction Set James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy MIPS Registers MIPS

More information

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

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009 101 Assembly ENGR 3410 Computer Architecture Mark L. Chang Fall 2009 What is assembly? 79 Why are we learning assembly now? 80 Assembly Language Readings: Chapter 2 (2.1-2.6, 2.8, 2.9, 2.13, 2.15), Appendix

More information

Lecture 3: Single Cycle Microarchitecture. James C. Hoe Department of ECE Carnegie Mellon University

Lecture 3: Single Cycle Microarchitecture. James C. Hoe Department of ECE Carnegie Mellon University 8 447 Lecture 3: Single Cycle Microarchitecture James C. Hoe Department of ECE Carnegie Mellon University 8 447 S8 L03 S, James C. Hoe, CMU/ECE/CALCM, 208 Your goal today Housekeeping first try at implementing

More information

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the machine. Reduced number of cycles needed per instruction.

More information

EE 109 Unit 8 MIPS Instruction Set

EE 109 Unit 8 MIPS Instruction Set 1 EE 109 Unit 8 MIPS Instruction Set 2 Architecting a vocabulary for the HW INSTRUCTION SET OVERVIEW 3 Instruction Set Architecture (ISA) Defines the software interface of the processor and memory system

More information

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

EECS 151/251A Fall 2017 Digital Design and Integrated Circuits. Instructor: John Wawrzynek and Nicholas Weaver. Lecture 13 EE141 EECS 151/251A Fall 2017 Digital Design and Integrated Circuits Instructor: John Wawrzynek and Nicholas Weaver Lecture 13 Project Introduction You will design and optimize a RISC-V processor Phase 1: Design

More information

Concocting an Instruction Set

Concocting an Instruction Set Concocting an Instruction Set Nerd Chef at work. move flour,bowl add milk,bowl add egg,bowl move bowl,mixer rotate mixer... Lab is posted. Do your prelab! Stay tuned for the first problem set. L04 Instruction

More information

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4 Processor Han Wang CS3410, Spring 2012 Computer Science Cornell University See P&H Chapter 2.16 20, 4.1 4 Announcements Project 1 Available Design Document due in one week. Final Design due in three weeks.

More information

Computer Architecture Experiment

Computer Architecture Experiment Computer Architecture Experiment Jiang Xiaohong College of Computer Science & Engineering Zhejiang University Architecture Lab_jxh 1 Topics 0 Basic Knowledge 1 Warm up 2 simple 5-stage of pipeline CPU

More information

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering MIPS Instruction Set James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy MIPS Registers MIPS

More information

The MIPS Instruction Set Architecture

The MIPS Instruction Set Architecture The MIPS Set Architecture CPS 14 Lecture 5 Today s Lecture Admin HW #1 is due HW #2 assigned Outline Review A specific ISA, we ll use it throughout semester, very similar to the NiosII ISA (we will use

More information

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26)

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26) Lecture Topics Today: Integer Arithmetic (P&H 3.1-3.4) Next: The MIPS ISA (P&H 2.1-2.14) 1 Announcements Consulting hours Milestone #1 (due 1/26) Milestone #2 (due 2/2) 2 1 Review: Integer Operations Internal

More information

Programming the processor

Programming the processor CSC258 Week 9 Logistics This week: Lab 7 is the last Logisim DE2 lab. Next week: Lab 8 will be assembly. For assembly labs you can work individually or in pairs. No matter how you do it, the important

More information

CS250 Section 4. 9/21/10 Yunsup Lee. Image Courtesy: Tilera

CS250 Section 4. 9/21/10 Yunsup Lee. Image Courtesy: Tilera CS250 Section 4 9/21/10 Yunsup Lee Image Courtesy: Tilera Any questions on lab 2 & lab 3? Doing okay with gate-level simulations? Announcements I m still working to get physical libraries for lab 3 work

More information

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei Instruction Set Architecture part 1 (Introduction) Mehran Rezaei Overview Last Lecture s Review Execution Cycle Levels of Computer Languages Stored Program Computer/Instruction Execution Cycle SPIM, a

More information

RiSC-16 Sequential Implementation

RiSC-16 Sequential Implementation RiSC-16 Sequential Implementation ENEE 446: Digital Computer Design, Fall 2000 Prof. Bruce Jacob This paper describes a sequential implementation of the 16-bit Ridiculously Simple Computer (RiSC-16), a

More information

Unsigned Binary Integers

Unsigned Binary Integers Unsigned Binary Integers Given an n-bit number x x n 1 n 2 1 0 n 12 xn 22 x12 x02 Range: 0 to +2 n 1 Example 2.4 Signed and Unsigned Numbers 0000 0000 0000 0000 0000 0000 0000 1011 2 = 0 + + 1 2 3 + 0

More information

Unsigned Binary Integers

Unsigned Binary Integers Unsigned Binary Integers Given an n-bit number x x n 1 n 2 1 0 n 12 xn 22 x12 x02 Range: 0 to +2 n 1 Example 2.4 Signed and Unsigned Numbers 0000 0000 0000 0000 0000 0000 0000 1011 2 = 0 + + 1 2 3 + 0

More information

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

ISA and RISCV. CASS 2018 Lavanya Ramapantulu ISA and RISCV CASS 2018 Lavanya Ramapantulu Program Program =?? Algorithm + Data Structures Niklaus Wirth Program (Abstraction) of processor/hardware that executes 3-Jul-18 CASS18 - ISA and RISCV 2 Program

More information

Chapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week.

Chapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week. Chapter 2 Instructions: Language of the Computer HW#1: 1.3 all, 1.4 all, 1.6.1, 1.14.4, 1.14.5, 1.14.6, 1.15.1, and 1.15.4 Due date: one week. Practice: 1.5 all, 1.6 all, 1.10 all, 1.11 all, 1.14 all,

More information

EECS 151/251A: SPRING 17 MIDTERM 2 SOLUTIONS

EECS 151/251A: SPRING 17 MIDTERM 2 SOLUTIONS University of California College of Engineering Department of Electrical Engineering and Computer Sciences J. Rabaey G. Alexandrov, N. Narevsky, V. Iyer MoWe 4-5:30pm Mo, Oct. 2, 6:00-7:30pm EECS 151/251A:

More information

Chapter 2A Instructions: Language of the Computer

Chapter 2A Instructions: Language of the Computer Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction

More information

Mark Redekopp, All rights reserved. EE 352 Unit 3 MIPS ISA

Mark Redekopp, All rights reserved. EE 352 Unit 3 MIPS ISA EE 352 Unit 3 MIPS ISA Instruction Set Architecture (ISA) Defines the software interface of the processor and memory system Instruction set is the vocabulary the HW can understand and the SW is composed

More information