(rom_data: Vec<u8>)
| 58 | // Keyboard input MMIO device. See `devices::keyboard`. |
| 59 | pub const KBD_BASE: u64 = 0x1007_0000; |
| 60 | pub const KBD_SIZE: u64 = crate::devices::keyboard::KBD_TOTAL_BYTES as u64; |
| 61 | pub const KBD_END: u64 = KBD_BASE + KBD_SIZE - 1; |
| 62 | // The framebuffer device span is large; guard against it overlapping the keyboard. |
| 63 | const _: () = assert!(KBD_BASE > FB_END); |
| 64 | pub const CLINT_BASE: u64 = 0x0200_0000; |
| 65 | pub const CLINT_SIZE: u64 = 0x10000; |
| 66 | pub const CLINT_END: u64 = CLINT_BASE + CLINT_SIZE - 1; |
| 67 | pub const PLIC_BASE: u64 = 0x0C00_0000; |
| 68 | pub const PLIC_SIZE: u64 = 0x0100_0000; |
| 69 | pub const PLIC_END: u64 = PLIC_BASE + PLIC_SIZE - 1; |
| 70 | pub const RAM_BASE: u64 = 0x8000_0000; |
| 71 | pub const RAM_SIZE_DEFAULT: usize = 128 * 1024 * 1024; // 128 MiB |
| 72 | pub const ELF_LOAD_BASE: u64 = 0x0001_0000; |
| 73 | pub const HEAP_PTR_ADDR: u64 = RAM_BASE + 32 * 1024 * 1024 - 8; // 0x81FF_FFF8 |
| 74 | |
| 75 | /// Blocking data-access latency in simulated cycles for each cache outcome. |
| 76 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| 77 | pub struct MemoryLatencyConfig { |
| 78 | pub enabled: bool, |
| 79 | pub l1_hit: u32, |
| 80 | pub l2_hit: u32, |
| 81 | pub l3_hit: u32, |
| 82 | pub dram: u32, |
| 83 | pub uncached: u32, |
| 84 | } |
| 85 | |
| 86 | impl MemoryLatencyConfig { |
| 87 | /// Preserve the historical model where every access completes in one cycle. |
| 88 | pub const fn disabled() -> Self { |
| 89 | Self { |
| 90 | enabled: false, |
| 91 | l1_hit: 1, |
| 92 | l2_hit: 1, |
| 93 | l3_hit: 1, |
| 94 | dram: 1, |
| 95 | uncached: 1, |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /// A teaching-oriented blocking hierarchy, not a specific physical CPU. |
| 100 | pub const fn realistic() -> Self { |
| 101 | Self { |
| 102 | enabled: true, |
| 103 | l1_hit: 4, |
| 104 | l2_hit: 12, |
| 105 | l3_hit: 40, |
| 106 | dram: 200, |
| 107 | uncached: 20, |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | impl Default for MemoryLatencyConfig { |
| 113 | fn default() -> Self { |
nothing calls this directly
no outgoing calls
no test coverage detected