References:
in directory model/
./model/ (files in dependency order)
riscv_xlen32.sail
: define xlen
for RV32riscv_xlen64.sail
: define xlen
for RV64prelude.sail
: constains Sail library functionsprelude_mapping.sail
:prelude_mem.sail
: defines lowest level memory access primitives. These primitives will be implemented by the various Sail backends. This depends on the value of xlen
prelude_mem_metadata.sail
:riscv_types.sail
: This contains basic definitions used throughout the specification
riscv_reg_type.sail
: register types. In a separate file so that it can be redefined in the extensions.riscv_regs.sail
: contains base register file. Types is defined in riscv_reg_type.sail
.riscv_pc_access.sail
: functions to access and modify the program counter.riscv_sys_regs.sail
: This describes the privileged architectural state:
riscv_sys_control.sail
: This describes interrupt and exception delegation and dispatch, and the handling of privilege transitions.riscv_sys_exceptions.sail
: This defines the handling of the addresses involved in exception handling.riscv_sync_exception.sail
: This describes the structure used to capture the architectural information for an exception.riscv_platform.sail
: contains platform-specific functionality for the model.
riscv_mem.sail
: converts physical address access into 1) physical memory access, or 2) MMIO access to the devices, or 3) access fault.riscv_vmem_*.sail
: describes the S-mode address translation.
riscv_vmem_types.sail
and riscv_vmem_common.sail
contain the definitions and processing of the page-table entries and their various permission and status bits.riscv_addr_checks_common.sail
and riscv_addr_checks.sail
: hooks for address transformation.
…
riscv_insts_*.sail
: instruction definitions and their assembly language formats.
riscv_insts_base.sail
: base integer instruction set.riscv_insts_hints.sail
: Hint instructions that are not implicitly handled elsewhere are explicitly handled here.ast
typeexecute
functionmapping
clauses specify the encoding and decoding of each instruction to and from their binary representations and assembly language formats.riscv_fetch.sail
: contains the instruction fetch function.
riscv_step.sail
: top-level fetch and execute loop.
step
function: instruction fetch, fetch error handling, decoding, dispatching, checking interrupts.loop
function: the execution loop. Use the same HTIF(host-target interface) mechanism to detect the termination as Spike.…
riscv_analysis.sail
: This is used in the formal operational RVWMO memory model.
…
main.sail
: ?
Example:
SRET instruction def in Sail:
union clause ast = SRET : unit
mapping clause encdec = SRET() <-> 0b0001000 @ 0b00010 @ 0b00000 @ 0b000 @ 0b00000 @ 0b1110011
function clause execute SRET() = {
match cur_privilege {
User => handle_illegal(),
Supervisor => if mstatus.TSR() == true
then handle_illegal()
else nextPC = handle_exception(cur_privilege, CTL_SRET(), PC),
Machine => nextPC = handle_exception(cur_privilege, CTL_SRET(), PC)
};
false
}
mapping clause assembly = SRET() <-> "sret"
If you could revise
the fundmental principles of
computer system design
to improve security...
... what would you change?