MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / new

Method new

crates/virtual-machine/src/bus.rs:60–110  ·  view source on GitHub ↗
(rom_data: Vec<u8>)

Source from the content-addressed store, hash-verified

58// Keyboard input MMIO device. See `devices::keyboard`.
59pub const KBD_BASE: u64 = 0x1007_0000;
60pub const KBD_SIZE: u64 = crate::devices::keyboard::KBD_TOTAL_BYTES as u64;
61pub const KBD_END: u64 = KBD_BASE + KBD_SIZE - 1;
62// The framebuffer device span is large; guard against it overlapping the keyboard.
63const _: () = assert!(KBD_BASE > FB_END);
64pub const CLINT_BASE: u64 = 0x0200_0000;
65pub const CLINT_SIZE: u64 = 0x10000;
66pub const CLINT_END: u64 = CLINT_BASE + CLINT_SIZE - 1;
67pub const PLIC_BASE: u64 = 0x0C00_0000;
68pub const PLIC_SIZE: u64 = 0x0100_0000;
69pub const PLIC_END: u64 = PLIC_BASE + PLIC_SIZE - 1;
70pub const RAM_BASE: u64 = 0x8000_0000;
71pub const RAM_SIZE_DEFAULT: usize = 128 * 1024 * 1024; // 128 MiB
72pub const ELF_LOAD_BASE: u64 = 0x0001_0000;
73pub 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)]
77pub 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
86impl 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
112impl Default for MemoryLatencyConfig {
113 fn default() -> Self {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected