From 93eb67eebdb100b4f5d1e5ceab64ba194030d9f8 Mon Sep 17 00:00:00 2001 From: Prashanth Mundkur Date: Thu, 18 Jul 2019 13:27:57 -0700 Subject: Add info about the C emulator to the reading guide. --- doc/ReadingGuide.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'doc/ReadingGuide.md') 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. + + + +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). -- cgit v1.1