Skip to content

Commit

Permalink
do-core1: Initial arbitrary registers initialization
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Samuel Ortiz authored and Samuel Ortiz committed Feb 6, 2022
1 parent 06d8e5e commit 8efc82e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ fn main() -> Result<(), Error> {
let opts: DoCoreOpts = DoCoreOpts::parse();
let insn = u32::from_str_radix(opts.insn.trim_start_matches("0x"), 16).unwrap();
let mut registers = [0u32; MAX_REGISTER_INDEX as usize + 1];
// Arbitrary initial registers value.
// Registers will eventually be initialized through memory loads.
for (index, register) in registers.iter_mut().enumerate() {
*register = index as u32 * 0x10;
}

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

Expand Down

0 comments on commit 8efc82e

Please # to comment.