==========================================================================
-Modular C++ Build System Template
+RISC-V ISA Simulator
==========================================================================
-# Author : Christopher Batten
-# Date : September 24, 2008
+# Author : Andrew Waterman, Yunsup Lee
+# Date : June 19, 2011
# Version : (under version control)
-This is a template for the Modular C++ Build System. Please refer to the
-following documentation for more information on the build system:
+The RISC-V ISA Simulator implements a functional model of one or more
+RISC-V processors.
- - 'mcppbs-uguide.txt' : Modular C++ Build System User Guide
- - 'utst/utst-uguide.txt' : Unit Testing Framework User Guide
- - 'style-guide.txt' : C++ Coding Style Guide
+--------------------------------------------------------------------------
+Build Steps
+--------------------------------------------------------------------------
-Developers should eventually replace this 'README' file with information
-on their new project. It is recommended that the new 'README' file keep
-pointers to the above documentation so that end-users can learn about
-the build system. You may also want to keep the version information
-around so that you know what version of the build system you are using.
+We assume that the RISCV environment variable is set to the RISC-V tools
+install path, and that the riscv-fesvr package is installed there.
+
+ % mkdir build
+ % cd build
+ % ../configure --prefix=$RISCV --with-fesvr=$RISCV
+ % make
+ % [sudo] make install
--------------------------------------------------------------------------
-Template Instantiation
+Compiling and Running a Simple C Program
--------------------------------------------------------------------------
- - Update project metadata (name, maintainer, etc) in 'configure.ac'
- - Run 'autoconf && autoheader' in project's root directory
- - Add subprojects and update the list in 'configure.ac'
+Install spike (see Build Steps), riscv-gcc, and riscv-pk.
+
+Write a short C program and name it hello.c. Then, compile it into a RISC-V
+ELF binary named hello:
+
+ % riscv-gcc -o hello hello.c
+
+Now you can simulate the program atop the proxy kernel:
+
+ % spike pk hello
--------------------------------------------------------------------------
-Build Steps
+Simulating a New Instruction
--------------------------------------------------------------------------
- % mkdir build
- % cd build
- % ../configure
- % make
+Adding an instruction to the simulator requires two steps:
+
+ 1. Describe the instruction's functional behavior in the file
+ riscv/insns/<new_instruction_name>.h. Examine other instructions
+ in that directory as a starting point.
+
+ 2. Add the opcode and opcode mask to riscv/opcodes.h. Alternatively,
+ add it to the riscv-opcodes package, and it will do so for you:
+
+ % cd ../riscv-opcodes
+ % vi opcodes // add a line for the new instruction
+ % make install
+ 3. Rebuild the simulator.