diff options
author | Prashanth Mundkur <prashanth.mundkur@gmail.com> | 2019-07-18 13:27:57 -0700 |
---|---|---|
committer | Prashanth Mundkur <prashanth.mundkur@gmail.com> | 2019-07-18 13:32:12 -0700 |
commit | 93eb67eebdb100b4f5d1e5ceab64ba194030d9f8 (patch) | |
tree | 00f6becef6a4a96cbd7590eb27a94d5d4adbaac5 /doc/ReadingGuide.md | |
parent | 8c8bef62070fa4ef22422f89d684fd6b1adaa38a (diff) | |
download | sail-riscv-93eb67eebdb100b4f5d1e5ceab64ba194030d9f8.zip sail-riscv-93eb67eebdb100b4f5d1e5ceab64ba194030d9f8.tar.gz sail-riscv-93eb67eebdb100b4f5d1e5ceab64ba194030d9f8.tar.bz2 |
Add info about the C emulator to the reading guide.
Diffstat (limited to 'doc/ReadingGuide.md')
-rw-r--r-- | doc/ReadingGuide.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/ReadingGuide.md b/doc/ReadingGuide.md index 46d9f65..152267f 100644 --- a/doc/ReadingGuide.md +++ b/doc/ReadingGuide.md @@ -118,3 +118,32 @@ such as the platform memory map. Note that the files above are listed in dependency order, i.e. files earlier in the order do not depend on later files. + +Structure of the C emulator +---------------------------- + +The diagram below illustrates how the C emulator is built from the +Sail model. The OCaml emulator follows the same approach. + +<img src="figs/riscvcsimdeps.svg"> + +The nodes that are not colored are the handwritten C files for the C +emulator. + +`riscv_sim` is the top level file for the C emulator: it processes +command line options, initializes the platform model with any ISA +implementation choices if specified, and loads the ELF program or OS +image into raw memory, including any ROM firmware such as the Berkeley +boot loader and DeviceTree binary blobs, and initializes the memory +map. + +The generated C model `riscv_model_$ARCH` is built from the Sail +sources by the Sail compiler. It contains calls to the platform +interface `riscv_platform` for platform-specific information; the +latter is typically defined as externally specified in the Sail file +`riscv_platform.sail`. + +The Sail system provides a C library for use with its C backend, which +provides the low-level details of the implementation of raw memory and +bitvectors (typically optimized to use the native machine word +representation). |