Skip to content

Commit 8efc82e

Browse files
Samuel OrtizSamuel Ortiz
authored andcommitted
do-core1: Initial arbitrary registers initialization
This is temporary. Eventually, there will be a Cpu constructor, and potentially register initialization through memory loads. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
1 parent 06d8e5e commit 8efc82e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ fn main() -> Result<(), Error> {
9191
let opts: DoCoreOpts = DoCoreOpts::parse();
9292
let insn = u32::from_str_radix(opts.insn.trim_start_matches("0x"), 16).unwrap();
9393
let mut registers = [0u32; MAX_REGISTER_INDEX as usize + 1];
94+
// Arbitrary initial registers value.
95+
// Registers will eventually be initialized through memory loads.
96+
for (index, register) in registers.iter_mut().enumerate() {
97+
*register = index as u32 * 0x10;
98+
}
9499

95100
dump_cpu_state("Initial CPU state", &registers);
96101

0 commit comments

Comments
 (0)