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 --------------------------------------------------------------------------
21 --------------------------------------------------------------------------
23 --------------------------------------------------------------------------
25 The riscv-isa-run program is not usually invoked directly; rather, fesvr, the
26 Front-End Server, invokes riscv-isa-run. fesvr and riscv-pk must be installed
27 to simulate a RISC-V user program using riscv-isa-run.
29 --------------------------------------------------------------------------
30 Compiling and Running a Simple C Program
31 --------------------------------------------------------------------------
33 Install riscv-isa-run (see Build Steps), then install the following additional
34 packages: riscv-fesvr, riscv-gcc, riscv-pk.
36 Write a short C program and name it hello.c. Then, compile it into a RISC-V
37 ELF binary named hello:
39 % riscv-gcc -o hello hello.c
41 Now you can simulate the program:
45 --------------------------------------------------------------------------
46 Simulating a New Instruction
47 --------------------------------------------------------------------------
49 Adding an instruction to the simulator requires two steps:
51 1. Describe the instruction's functional behavior in the file
52 riscv/insns/<new_instruction_name>.h. Examine other instructions
53 in that directory as a starting point.
55 2. Add the instruction to the riscv-opcodes package:
58 % vi opcodes // add a line for the new instruction
61 3. Rebuild the simulator.