Constructive Computer Architecture Tutorial 3 RISC-V Processor

Slides:



Advertisements
Similar presentations
Constructive Computer Architecture: Data Hazards in Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute.
Advertisements

Final Presentation Part-A
EHRs: Designing modules with concurrent methods Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology February 27,
Computer Architecture: A Constructive Approach EHRs: Designing modules with concurrent methods Teacher: Yoav Etsion Taken (with permission) from Arvind.
Constructive Computer Architecture Tutorial 4: SMIPS on FPGA Andy Wright 6.S195 TA October 7, 2013http://csg.csail.mit.edu/6.s195T04-1.
Asynchronous Pipelines: Concurrency Issues Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology October 13, 2009http://csg.csail.mit.edu/koreaL12-1.
Modeling Processors Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology February 22, 2011L07-1
Computer Architecture: A Constructive Approach Branch Direction Prediction – Six Stage Pipeline Joel Emer Computer Science & Artificial Intelligence Lab.
Constructive Computer Architecture Tutorial 5: Programming SMIPS: Single-Core Assembly Andy Wright TA October 10, 2014http://csg.csail.mit.edu/6.175T04-1.
Constructive Computer Architecture Tutorial 3: Debugging SMIPS Andy Wright 6.S195 TA October 4, 2013http://csg.csail.mit.edu/6.s195T03-1.
Constructive Computer Architecture Tutorial 3 Debugging BSV Andy Wright TA September12, 2014http://csg.csail.mit.edu/6.175T01-1.
Infrastructure design & implementation of MIPS processors for students lab based on Bluespec HDL Students: Danny Hofshi, Shai Shachrur Supervisor: Mony.
Oct 2, 2014T01-1http://csg.csail.mit.edu/6.175 Constructive Computer Architecture Tutorial 1 BSV Sizhuo Zhang TA.
Constructive Computer Architecture Tutorial 2 Advanced BSV Sizhuo Zhang TA Oct 9, 2015T02-1http://csg.csail.mit.edu/6.175.
Constructive Computer Architecture Tutorial 8 Final Project Part 2: Coherence Sizhuo Zhang TA Nov 25, 2015T08-1http://csg.csail.mit.edu/6.175.
Constructive Computer Architecture Tutorial 4 Debugging Sizhuo Zhang TA Oct 23, 2015T04-1http://csg.csail.mit.edu/6.175.
Constructive Computer Architecture Tutorial 2 Advanced BSV Andy Wright TA September 26, 2014http://csg.csail.mit.edu/6.175T02-1.
Elastic Pipelines: Concurrency Issues Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology February 28, 2011L08-1http://csg.csail.mit.edu/6.375.
Computer Architecture: A Constructive Approach Branch Prediction - 2 Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of.
Computer Architecture: A Constructive Approach Next Address Prediction – Six Stage Pipeline Joel Emer Computer Science & Artificial Intelligence Lab. Massachusetts.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Constructive Computer Architecture Tutorial 4: Running and Debugging SMIPS Andy Wright TA October 10, 2014http://csg.csail.mit.edu/6.175T04-1.
1 Tutorial: Lab 4 Again Nirav Dave Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology.
Modular Refinement Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology March 8,
October 22, 2009http://csg.csail.mit.edu/korea Modular Refinement Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology.
Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright 6.S195 TA October 7, 2013http://csg.csail.mit.edu/6.s195T05-1.
6.375 Tutorial 4 RISC-V and Final Projects Ming Liu March 4, 2016http://csg.csail.mit.edu/6.375T04-1.
6.375 Tutorial 3 Scheduling, Sce-Mi & FPGA Tools Ming Liu
Computer Architecture: A Constructive Approach Data Hazards and Multistage Pipelines Teacher: Yoav Etsion Taken (with permission) from Arvind et al.*,
October 20, 2009L14-1http://csg.csail.mit.edu/korea Concurrency and Modularity Issues in Processor pipelines Arvind Computer Science & Artificial Intelligence.
Modeling Processors Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology March 1, 2010
EHRs: Designing modules with concurrent methods
EHRs: Designing modules with concurrent methods
Constructive Computer Architecture Tutorial 6 Cache & Exception
Control Hazards Constructive Computer Architecture: Arvind
Bluespec-6: Modeling Processors
Bluespec-6: Modules and Interfaces
Constructive Computer Architecture Tutorial 6: Discussion for lab6
Project Part 2: Coherence
in Pipelined Processors
Constructive Computer Architecture: Lab Comments & RISCV
Non-Pipelined Processors - 2
Non-Pipelined Processors
Non-Pipelined Processors
Constructive Computer Architecture Tutorial 7 Final Project Overview
Modular Refinement Arvind
Modular Refinement Arvind
6.375 Tutorial 2 Guards and Scheduling Ming Liu
Lab 4 Overview: 6-stage SMIPS Pipeline
Blusepc-5: Dead cycles, bubbles and Forwarding in Pipelines Arvind
Non-Pipelined and Pipelined Processors
in Pipelined Processors
6.375 Tutorial 5 RISC-V 6-Stage with Caches Ming Liu
Bypassing Computer Architecture: A Constructive Approach Joel Emer
Multistage Pipelined Processors and modular refinement
Stmt FSM Arvind (with the help of Nirav Dave)
Modular Refinement - 2 Arvind
in Pipelined Processors
Bluespec-5: Modeling Processors
Tutorial 4: RISCV modules Constructive Computer Architecture
Modeling Processors Arvind
Modeling Processors Arvind
Modular Refinement Arvind
Modular Refinement Arvind
Tutorial 7: SMIPS Labs and Epochs Constructive Computer Architecture
Non-Pipelined Processors
Branch Predictor Interface
Bluespec-8: Modules and Interfaces
Constructive Computer Architecture Tutorial 1 Andy Wright 6.S195 TA
Presentation transcript:

Constructive Computer Architecture Tutorial 3 RISC-V Processor Sizhuo Zhang 6.175 TA Oct 16, 2015 http://csg.csail.mit.edu/6.175

Course Content Oct 16, 2015 http://csg.csail.mit.edu/6.175

Normal Register File module mkRFile(RFile); Vector#(32,Reg#(Data)) rfile <- replicateM(mkReg(0)); method Action wr(RIndx rindx, Data data); if(rindx!=0) rfile[rindx] <= data; endmethod method Data rd1(RIndx rindx) = rfile[rindx]; method Data rd2(RIndx rindx) = rfile[rindx]; endmodule {rd1, rd2} < wr October 14, 2015 http://csg.csail.mit.edu/6.175 3

Bypass Register File using EHR module mkBypassRFile(RFile); Vector#(32,Ehr#(2, Data)) rfile <- replicateM(mkEhr(0)); method Action wr(RIndx rindx, Data data); if(rindex!=0) (rfile[rindex])[0] <= data; endmethod method Data rd1(RIndx rindx) = (rfile[rindx])[1]; method Data rd2(RIndx rindx) = (rfile[rindx])[1]; endmodule wr < { October 14, 2015 http://csg.csail.mit.edu/6.175 4

Bypass Register File with external bypassing move rd module mkBypassRFile(BypassRFile); RFile rf <- mkRFile; Fifo#(1, Tuple2#(RIndx, Data)) bypass <- mkBypassSFifo; rule move; begin rf.wr(bypass.first); bypass.deq end; endrule method Action wr(RIndx rindx, Data data); if(rindex!=0) bypass.enq(tuple2(rindx, data)); endmethod method Data rd1(RIndx rindx) = return (!bypass.search1(rindx)) ? rf.rd1(rindx) : bypass.read1(rindx); method Data rd2(RIndx rindx) = return (!bypass.search2(rindx)) ? rf.rd2(rindx) : bypass.read2(rindx); endmodule wr < {rd1, rd2} October 14, 2015 http://csg.csail.mit.edu/6.175 5

Scoreboard implementation using searchable Fifos function Bool isFound (Maybe#(RIndx) dst, Maybe#(RIndx) src); return isValid(dst) && isValid(src) && (fromMaybe(?,dst)==fromMaybe(?,src)); endfunction module mkCFScoreboard(Scoreboard#(size)); SFifo#(size, Maybe#(RIndx), Maybe#(RIndx)) f <- mkCFSFifo(isFound); method insert = f.enq; method remove = f.deq; method search1 = f.search1; method search2 = f.search2; endmodule October 14, 2015 http://csg.csail.mit.edu/6.175

Searchable FIFO Code Will see in Lab 6 Oct 16, 2015 http://csg.csail.mit.edu/6.175

SCE-MI Infrastructure RISC-V Processor SCE-MI Infrastructure Oct 16, 2015 http://csg.csail.mit.edu/6.175

RISC-V Interface interface Proc; method Action hostToCpu(Addr startpc); method ActionValue#(CpuToHostData) cpuToHost; interface MemInit iMemInit; interface MemInit dMemInit; endinterface typedef struct { CpuToHostType c2hType; Bit#(16) data; } CpuToHostData deriving(Bits, Eq); typedef enum { ExitCode, PrintChar, PrintIntLow, PrintIntHigh } CpuToHostType deriving(Bits, Eq); Oct 16, 2015 http://csg.csail.mit.edu/6.175

RISC-V Interface mkProc – BSV Host (Testbench) cpuToHost CSR hostToCpu PC Core iMemInit iMem dMemInit dMem Oct 16, 2015 http://csg.csail.mit.edu/6.175

RISC-V Interface: cpuToHost Write mtohost CSR: csrw mtohost, rs1 rs1[15:0]: data 32-bit Integer needs two writes rs1[17:16]: c2hType 0: Exit code 1: Print character 2: Print int low 16 bits 3: Print int high 16 bits typedef struct { CpuToHostType c2hType; Bit#(16) data; } CpuToHostData deriving(Bits, Eq); Oct 16, 2015 http://csg.csail.mit.edu/6.175

RISC-V Interface: Others hostToCpu Tells the processor to start running from the given address iMemInit/dMemInit Used to initialize iMem and dMem Can also be used to check when initialization is done Defined in MemInit.bsv Oct 16, 2015 http://csg.csail.mit.edu/6.175

Connecting RISC-V Interface Previous labs have used testbenches written in BSV to connect with modules we wanted to test. Now we want a more advanced program testing the processor Want to be able to load multiple files from the user and display printed output How do we do this? Use a SceMi interface to connect a testbench written in C++ with a module written in BSV Oct 16, 2015 http://csg.csail.mit.edu/6.175

SceMi Interface tb – C++ mkProc – BSV CSR Core iMem dMem PC Oct 16, 2015 http://csg.csail.mit.edu/6.175

Load Program Bypass this step in simulation tb – C++ mkProc – BSV CSR PC Core add.riscv.vmh iMem dMem Oct 16, 2015 http://csg.csail.mit.edu/6.175

Load Program Simulation: load with mem.vmh (fixed file name) tb – C++ mkProc – BSV Simulation: load with mem.vmh (fixed file name) Copy <test>.riscv.vmh to mem.vmh CSR PC Core iMem dMem mem.vmh Oct 16, 2015 http://csg.csail.mit.edu/6.175

Start Processor tb – C++ mkProc – BSV CSR Starting PC 0x200 Core iMem dMem Oct 16, 2015 http://csg.csail.mit.edu/6.175

Print & Exit tb – C++ mkProc – BSV CSR Core iMem dMem Get reg c2hType: Data == 0 PASSED Data != 0 FAILED CSR PC Core iMem dMem Oct 16, 2015 http://csg.csail.mit.edu/6.175

SceMi Interface: Simulation tb – C++ mkProc – BSV Compiled Program: tb Compiled BSim Executable: bsim_dut COP PC Core iMem dMem TCP Oct 16, 2015 http://csg.csail.mit.edu/6.175

Build and Run Processor Oct 16, 2015 http://csg.csail.mit.edu/6.175

SceMi Interface: FPGA The same SceMi Testbench can be used to test hardware FPGA designs too! tb – C++ mkProc – BSV Compiled Program: tb Compiled FPGA Design running on an FPGA dev board COP PC Core iMem dMem PCIe Oct 16, 2015 http://csg.csail.mit.edu/6.175

SceMi Code Oct 16, 2015 http://csg.csail.mit.edu/6.175

RISC-V Assembly Oct 16, 2015 http://csg.csail.mit.edu/6.175