1 ==========================================================================
3 ==========================================================================
4 # Author : Andrew Waterman
6 # Version : (under version control)
8 The RISC-V ISA Simulator implements a functional model of one or more
11 --------------------------------------------------------------------------
13 --------------------------------------------------------------------------
15 We assume that the RISCV environment variable is set to the RISC-V tools
16 install path, and that the riscv-fesvr package is installed there.
20 % ../configure --prefix=$RISCV --with-fesvr=$RISCV
24 --------------------------------------------------------------------------
25 Compiling and Running a Simple C Program
26 --------------------------------------------------------------------------
28 Install riscv-isa-run (see Build Steps), riscv-gcc, and riscv-pk.
30 Write a short C program and name it hello.c. Then, compile it into a RISC-V
31 ELF binary named hello:
33 % riscv-gcc -o hello hello.c
35 Now you can simulate the program atop the proxy kernel:
37 % riscv-isa-run pk hello
39 --------------------------------------------------------------------------
40 Simulating a New Instruction
41 --------------------------------------------------------------------------
43 Adding an instruction to the simulator requires two steps:
45 1. Describe the instruction's functional behavior in the file
46 riscv/insns/<new_instruction_name>.h. Examine other instructions
47 in that directory as a starting point.
49 2. Add the opcode and opcode mask to riscv/opcodes.h. Alternatively,
50 add it to the riscv-opcodes package, and it will do so for you:
53 % vi opcodes // add a line for the new instruction
56 3. Rebuild the simulator.