📝 Documentation updates

This commit is contained in:
François Autin 2023-03-24 18:11:37 +01:00
parent 228d58655a
commit 928628c305
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C
2 changed files with 12 additions and 2 deletions

View File

@ -10,6 +10,7 @@ pub struct MachineError {
impl MachineError {
/// MachineError constructor
pub fn new(message: &str) -> MachineError {
MachineError {
message: message.to_string()

View File

@ -33,9 +33,10 @@ pub enum ExceptionType {
NumExceptionTypes
}
pub const STACK_REG: usize = 2;
/// Number of available Integer registers
pub const NUM_INT_REGS: usize = 32;
/// Number of available Floating Point registers
pub const NUM_FP_REGS: usize = 32;
/// max number of physical pages
pub const NUM_PHY_PAGE : u64 = 400;
@ -44,15 +45,23 @@ pub const PAGE_SIZE : u64 = 128;
/// Must be a multiple of PAGE_SIZE
pub const MEM_SIZE : usize = (PAGE_SIZE*NUM_PHY_PAGE*100) as usize;
#[derive(PartialEq)]
/// RISC-V Simulator
pub struct Machine {
/// Program counter
pub pc : u64,
/// Stack pointer
pub sp: usize,
/// Integer register
pub int_reg : Register<i64>,
/// Floating point register
pub fp_reg : Register<f32>,
/// Heap memory
pub main_memory : Vec<u8>,
/// Shiftmask
pub shiftmask : [u64 ; 64],
/// Debug data
pub registers_trace : String, // for tests
/// todo: document Interrupts
pub interrupt: Interrupt
// futur taille à calculer int memSize = g_cfg->NumPhysPages * g_cfg->PageSize;
//creer une struct cfg(configuration) qui s'initialise avec valeur dans un fichier cfg