Computer Architecture ELECENG3088

Your task for this assignment is to develop an instruction set simulator (ISS) for the RV64I 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 commandsthatspecify initialization and inspection ofthe memories and registers, and control execution of instructions.
iuww520iuww520iuww520iuww520iuww520iuww520iuww520iuww520
The RISC-V instruction setis described in “ The RISC-V Instruction SetManual, Volume I:Unprivileged ISA”, available on the course web site. The RV64I subset is described in Chapter 5 of the Instruction Set Manual, building on the RV32I subset described in Chapter 2. The instruction encoding is summarized in Chapter 24. For this assignment, you should implement just the RV64I base integer instruction set, with the following exceptions:
FENCE: This instruction should be decoded as a legal instruction but perform no operation.
ECALL, EBREAK: These instructions should be decoded as legal instructions, but a message should be displayed indicating they are unimplemented.
For load and store instructions, you can assume that the effective address is properly aligned. Do not implement misaligned loads or stores. For any fetched instruction word that does not represent an RV64I instruction, a message should be displayed indicating the instruction is illegal. In Stage 2, you will implement exception handling, which will be used for illegal instructions.
We have provided a skeleton programon 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 rv64sim.zip or rv64sim.tgz; the content is the same in each. The skeleton program implements processing of command-line options and input commands. Yourtask isto implement classestomodelthe processor andmemory.Head- er files are provided showing the member functions required. 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. 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 rv64sim program reads commands from the standard input stream, one command per line. The commands are listed in Table 1.
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. Thememory should appearto have all locationsinitialized to 0. Your programshould countthe 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-V instructions, 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
https://github.com/riscv/riscv-gnu-toolchain) 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 types uint32_t and uint64_t to
represent instructions and data, 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 64 bits,
that would imply an array of 2 64 bytes. 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)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值