Computer Architecture, Semester 1, 2017 Assignment — RISC-V RV32I ISS — Stage 1 Your task for this assignment is to develop an instruction set simulator (ISS) for the RV32I subset of the RISC-V instruction set. An instruction set simulator is a program used by computer architects to simulate execution of a computer’s instructions. It contains representations of the computer’s memory and the internal registers of the CPU. It responds to commands that specify initialization and inspection of the memories and registers, and control execution of instructions. The RISC-V instruction set is described in The RISC-V Instruction Set Manual, Volume I: User-Level ISA, Version 2.1, available at riscv.org (also on the course web site). The RV32I subset is described in Chapter 2 of the Instruction Set Manual, and the instruction encoding is summarized in Chapter 9. For this assignment, you should implement just the RV32I base integer instruction set, with the following exceptions: • FENCE, FENCE.I: These instructions should be decoded as legal instructions, but perform no operation. • ECALL, EBREAK, CSRRW, CSRRS, CSRRC, CSRRWI, SRRSI, CSRRCI: These instructions should be decoded as legal instructions, but a message should be displayed indicating they are unimplemented. For any fetched instruction word that does not represent an RV32I instruction, a message should be displayed indicating the instruction is illegal. I have provided a skeleton program on the course web site for you to use as a starting point. The program is written in C++, and is located in the Assignment file folder (also linked in the Assignment module). You can download either rvsim.zip or rvsim.tgz; the content is the same in each. The skeleton program implements processing of commandline options and input commands. Your task is to implement classes to model the processor and memory. Header files are provided showing the member functions required. The cache class will be used in Stage 2. You can add additional classes if you need to. The only command-line option you need to implement at this stage is the -v option to enable verbose output. Further options will be implemented in Stage 2. If the -v option is specified on the command line, your program can display debugging information. If the option is omitted, your program should display only the output required for each command. Your program must format that output exactly as specified below, since the assessment process will compare you output with expected output. The rvsim program reads commands from the standard input stream, one command per line. The commands are: Command

Operation performed

xn

Show the content of register xn in hex (n is register number, from 0 to 31). The value is displayed as 8 hex digits with leading 0s.

xn = value

Set register xn to value (value in hex).

pc

Show content of PC register in hex. The value is displayed as 8 hex digits with leading 0s.

pc = address

Set PC register to address (address in hex).

m address

Show the content of memory word at address (address in hex, rvsim rounds it down to nearest word-aligned address). The value is displayed as 8 hex digits with leading 0s.

m address = value

Set memory word at address to value (address in hex, rvsim rounds it down to nearest word-aligned address; value in hex).

l "filename"

Load memory from Intel hex format file named filename. If the file includes a start address record, the PC is set to the start address.

.

Execute one instruction.

.n

Execute n instructions. 1

Command

Operation performed

b address

Set an execution breakpoint at address. If the simulator is executing multiple instructions (. n command), it stops when the PC reaches address without executing that instruction. There is only one execution breakpoint; using the b command with a different address removes any previously set breakpoint.

b

Clear the breakpoint.

Each command may be followed by a comment, starting with the ‘#’ character and extending to the end of the line. Blank lines are permitted, as are lines containing only a comment. The initial value of all processor general purpose registers should be 0, and the initial value of the PC should also be 0. The memory should appear to have all locations initialized to 0. Your program should count the number of instructions executed. This will be reported on completion of execution. You can test your ISS by using the “m” command to set memory locations to the encoded value of RISC-Vinstructions, using the “pc” command to set the PC to the start of the code, then using the “.” command to execute the code. Alternatively, you can use the RISC-V GNU Compiler Toolchain (C compiler, assembler, linker, binutils; available at riscv.org) to generate hex files to load into memory. We will use both of these processes when we assess your ISS. Performance of an ISS program is important. Computer architects typically use them to develop code for embedded system, so they must be able to execute 100s of thousands of instructions per second. You should design your ISS with performance in mind. The skeleton program provided uses the native integer data type uint32_t to represent instruction and data words, rather than using a dynamically allocated class-typed object or string. When you implement the memory, you should not attempt to represent it using a large array of words. Since addresses are 32 bits, that would imply an array of 4Gbytes. Instead, consider a representation that allocates blocks of memory on demand (that is, on the first read or write to an address within a block). Please keep an eye on the Questions and Answers forum on the course web site. There will no doubt be questions of clarification of requirements arising that I will answer there. I will also announce incremental releases of a test suite that you should use to test your program. You must develop your program and check it into a subdirectory named 2017/s1/ca/rvsim in your SVN repository. I will provide a web submission script that will check out this subdirectory, make your ISS, and run it with several test cases. Compliance with this development process will count toward the assessment of the assignment. The script will compare your output with our expected output using the “diff -iw” command (differences ignoring case and whitespace). Your work for Stage 1 will be assessed in the web submission system based on the following criteria, with points awarded out of 1500: • Program builds and runs using web submission script — 100 points • Correct execution of instruction, based on the number of test cases that pass — 1300 points • Program efficiency, based on run time not exceeding a limit — 100 points The points for this assignment will comprise 15% of your final assessment for the course. The deadline for submission is 11:59pm Sunday 9 April 2017.

Postgraduate requirements If you are enrolled in the postgraduate course (COMP SCI 7026), you should implement the following additional requirements: During simulated execution, you should count the number of simulated clock cycles, in addition to the number of instructions executed. You should use the following cycle counts for various instruction types: • Conditional branch instruction: 2 cycles if the branch is taken, or 1 cycle if the branch is not taken. • Unconditional branch instruction: 2 cycles.

2

• Load instruction: 3 cycles if the loaded data is contained within a word, or 5 cycles if the loaded data straddles two words. • Store instruction: 2 cycles if the stored data is contained within a word, or 4 cycles if the stored data straddles two words. • All other instruction: 1 cycle. On completion of a simulation, if the -c option is specified on the command line, your program will report the total number of simulated clock cycles taken.

3

Postgraduate requirements If you are enrolled in the postgraduate course (COMP SCI 7026), you should implement the following additional instructions: • RDCYCLE, RDCYCLEH, RDINSTRET, RDINSTRETH You should use the following cycle counts for various instruction types: • Load/store instructions: 1 cycle if the loaded value is entirely contained within one aligned word, or 3 cycles otherwise. • Conditional branch instructions: 2 cycles if the branch is taken, or 1 cycle if the branch is not taken. • Unconditional jump instructions: 2 cycles. • All other instructions: 1 cycle. On completion of a simulation, if the -c option is specified on the command line, you should report the total number of instructions executed and the number of simulated clock cycles taken.

4

RISC-V RV32I ISS — Stage 1 -

Apr 9, 2017 - decoded as legal instructions, but a message should be displayed ... If the option is omitted, your program should display only the output ...

94KB Sizes 0 Downloads 72 Views

Recommend Documents

RISC-V RV32I ISS — Stage 2 -
Jun 11, 2017 - to check whether the block containing the address is in each cache, and if so, display the block contents. RISCYV CPU. Main Memory. LevelY1.

Stage 1 - Desired Results
344. T.ELA8W3.21 : The student selects and uses a variety of technology tools to locate, analyze, synthesize, evaluate and/or apply information to accomplish a content specific task. T.ELA8W4.6 : The student uses brainstorming/webbing software in pla

DPD Area/Stage Stage 1 Stage 2 Stage 3 Stage 4 ICT Proficiency ...
skills by using different digital tools or services fluently ... you have used Moodle tools productively and ... participation information and big data to help evaluate ...

DPD Area/Stage Stage 1 Stage 2 Stage 3 Stage 4 ICT Proficiency ...
current technological knowledge. Compare the benefits/ ... design and review, and responsive teaching for ... interacted with online educational or professional ...

ISS Items.pdf
25 x FN P90 3000GD x 25 = 75000 GD. 25 x FN P90S 3000GD x 25 = 75000 GD. 25 x KT Decider 3000GD x 25 = 75000 GD. 25 x AA-12 3500GD x 25 = 87500 ...

vol 78 iss 1 2014.pdf
The VDR receptor is an intranuclear receptor. It is encoded by a. large gene, over 100 kb, on chromosome 12q12-14 [33]. It is made. up of two promoter regions, ...

Key stage 1 Autumn1.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Key stage 1 ...

LICK stage dive 1.pdf
Tu'jil Qyol Mam te Tu'jil Qyol Mam te. Tkab'in Yol Tkab'in Yol. Page 2 of 15. Page 3 of 15. Page 3 of 15. Main menu. Displaying LICK stage dive 1.pdf.

Key Stage 1 Results.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Key Stage 1 ...

LICK stage dive 1.pdf
Page 3 of 232. LICK stage dive 1.pdf. LICK stage dive 1.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying LICK stage dive 1.pdf. Page 1 of 232.

ISS template.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. ISS template.pdf.

Correção - ISS-Niterói.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying.

Page 1 strum" - - - - - - - 1. The Lions of the East. pao Yn hiki "" iss V (A ...
Which of the fallowing is not an operating system ? .... PBX. 54. A bag contains 5 red and n green balls. If probability of drawing a green ball is three times.

Download [Epub] American Oxford Bookworms: Stage 1: Wizard of Oz (Oxford Bookworms Library: Stage 1) Full Pages
American Oxford Bookworms: Stage 1: Wizard of Oz (Oxford Bookworms Library: Stage 1) Download at => https://pdfkulonline13e1.blogspot.com/0194237451 American Oxford Bookworms: Stage 1: Wizard of Oz (Oxford Bookworms Library: Stage 1) pdf download

Download [Epub] American Oxford Bookworms: Stage 1: Wizard of Oz (Oxford Bookworms Library: Stage 1) Read online
American Oxford Bookworms: Stage 1: Wizard of Oz (Oxford Bookworms Library: Stage 1) Download at => https://pdfkulonline13e1.blogspot.com/0194237451 American Oxford Bookworms: Stage 1: Wizard of Oz (Oxford Bookworms Library: Stage 1) pdf download

Read [PDF] American Oxford Bookworms: Stage 1: Wizard of Oz (Oxford Bookworms Library: Stage 1) Full Books
American Oxford Bookworms: Stage 1: Wizard of Oz (Oxford Bookworms Library: Stage 1) Download at => https://pdfkulonline13e1.blogspot.com/0194237451 American Oxford Bookworms: Stage 1: Wizard of Oz (Oxford Bookworms Library: Stage 1) pdf download

Vol-6-Iss-10.pdf
... of a dozen all-star dancers, DJ and. violinist. December 17, 7:00 pm, December 18, 3:00. pm, Whiting, Holiday Pops, Flint. Symphony Orchestra, and friends bring. festive favorites. Wondering About Legionella? Guidance from Dr. Donald R. Vereen, J

ISS Paper 148 jfs.indd - Africa Portal
Jul 2, 2007 - send an elected leader to liaise with the North while ...... details: (Tel) +27 12 346 9500, (Fax) +27 12 460 0998, Email: [email protected].

3531 ISS Paper 160.indd
Mar 3, 2008 - training, establish an ASF database to which the centres are to contribute data of trained beneficiaries to enhance the AU's list of ..... partners could provide support without duplication of efforts and resources (par 42 of the ...

ISS Paper 148 jfs.indd - Africa Portal
Jul 2, 2007 - because of concern over management of the Nile. Basin waters ...... Please note that credit card payments are also welcome. You can also ...

ISS Cyberissues Book small.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. ISS Cyberissues ...

Offre Stage AODocs - Product Manager Junior-1.pdf
Offre Stage AODocs - Product Manager Junior-1.pdf. Offre Stage AODocs - Product Manager Junior-1.pdf. Open. Extract. Open with. Sign In. Main menu.

Asymptotic Inference from Multi$Stage Samples !1
Mar 31, 2003 - Phone: 646$932$. 2335 ..... For later use, let us define $scsh . '#scsh ..... For several US surveys like the PSID and the HRS, the stratum and.