waiting for machine update

This commit is contained in:
Moysan Gabriel 2023-02-08 14:34:09 +01:00
parent 5d7b35b9e6
commit 027e91119b
3 changed files with 36 additions and 1 deletions

View File

@ -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<U: RegisterNum> {
register: [U; 32]
}

View File

@ -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");
}
}
}
}
}

View File

@ -1,7 +1,7 @@
pub mod machine;
pub mod decode;
pub mod print;
mod mem_cmp;
pub mod mem_cmp;
pub mod global {