From 027e91119bb53d3261bca402654d0e510f84c563 Mon Sep 17 00:00:00 2001 From: Moysan Gabriel Date: Wed, 8 Feb 2023 14:34:09 +0100 Subject: [PATCH] waiting for machine update --- src/simulator/machine.rs | 3 +++ src/simulator/mem_cmp.rs | 32 ++++++++++++++++++++++++++++++++ src/simulator/mod.rs | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/simulator/machine.rs b/src/simulator/machine.rs index 44888f4..1624713 100644 --- a/src/simulator/machine.rs +++ b/src/simulator/machine.rs @@ -2,6 +2,7 @@ use std::ops::{Add, Sub}; use super::{decode::{Instruction, decode}}; use super::global::*; + /// doit disparaitre const MEM_SIZE : usize = 4096; @@ -11,6 +12,8 @@ impl RegisterNum for i64 {} impl RegisterNum for f32 {} + + pub struct Register { register: [U; 32] } diff --git a/src/simulator/mem_cmp.rs b/src/simulator/mem_cmp.rs index 00a60eb..9f2e160 100644 --- a/src/simulator/mem_cmp.rs +++ b/src/simulator/mem_cmp.rs @@ -2,6 +2,8 @@ use std::fs; use std::io; use std::io::BufRead; +const MEM_SIZE : usize = 4096; + /* TRUCS MANQUANT @@ -153,6 +155,36 @@ impl Mem_Checker{ } } + + fn Mem_Checker_check(m_c: &Mem_Checker, memory: [u8 ; MEM_SIZE]){ + /* + * Check pc, sp + */ + + + /* + * Check sections + */ + + for(i, s) in m_c.sections.iter().enumerate() { + let addr = s.addr; + let len = s.len; + let segment = &s.content; + + /* + regarder dans mem[addr] + a cette adresse verifier len octets + */ + + for j in 0..(len-1){ + if segment[j] != memory[addr + j] { + println!("missmatch"); + } + } + + } + + } } diff --git a/src/simulator/mod.rs b/src/simulator/mod.rs index 76c2931..54d271e 100644 --- a/src/simulator/mod.rs +++ b/src/simulator/mod.rs @@ -1,7 +1,7 @@ pub mod machine; pub mod decode; pub mod print; -mod mem_cmp; +pub mod mem_cmp; pub mod global {