debuging mem_checker::from
This commit is contained in:
parent
b5690a7f57
commit
4425ac747e
@ -94,7 +94,10 @@ impl Mem_Checker{
|
|||||||
fn from(path: &String) -> Mem_Checker {
|
fn from(path: &String) -> Mem_Checker {
|
||||||
|
|
||||||
let file = fs::File::open("test_file_section.txt").expect("Wrong filename");
|
let file = fs::File::open("test_file_section.txt").expect("Wrong filename");
|
||||||
let reader = io::BufReader::new(file);
|
let reader = io::BufReader::new(&file);
|
||||||
|
let reader2 = io::BufReader::new(&file);
|
||||||
|
let lines = reader.lines();
|
||||||
|
let length = reader2.lines().count();
|
||||||
|
|
||||||
let mut pc: usize = 0;
|
let mut pc: usize = 0;
|
||||||
let mut sp: usize = 0;
|
let mut sp: usize = 0;
|
||||||
@ -103,15 +106,15 @@ impl Mem_Checker{
|
|||||||
let mut tmp_addr_str: String = String::new();
|
let mut tmp_addr_str: String = String::new();
|
||||||
let mut tmp_len_str: String = String::new();
|
let mut tmp_len_str: String = String::new();
|
||||||
|
|
||||||
for (i,line) in reader.lines().enumerate() {
|
for (i,line) in lines.enumerate() {
|
||||||
|
|
||||||
let current_line = line.unwrap();
|
let current_line = line.unwrap();
|
||||||
|
|
||||||
if i == current_line.len()-2 {
|
if i == length-2 {
|
||||||
//Lecture de PC
|
//Lecture de PC
|
||||||
pc = string_hex_to_usize(¤t_line);
|
pc = string_hex_to_usize(¤t_line);
|
||||||
}
|
}
|
||||||
else if i == current_line.len()-1 {
|
else if i == length-1 {
|
||||||
//Lecture SP
|
//Lecture SP
|
||||||
sp = string_hex_to_usize(¤t_line);
|
sp = string_hex_to_usize(¤t_line);
|
||||||
}
|
}
|
||||||
@ -277,7 +280,6 @@ mod tests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_enum_start_at_zero(){
|
fn test_enum_start_at_zero(){
|
||||||
let v = vec![1,2,3];
|
let v = vec![1,2,3];
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
0
|
addi sp,sp,-32
|
||||||
0
|
sd s0,24(sp)
|
||||||
FF FF
|
addi s0,sp,32
|
||||||
F4A12200
|
sw zero,-20(s0)
|
||||||
A0 0A
|
li a5,1
|
||||||
01022B
|
sw a5,-24(s0)
|
||||||
0B 0F
|
lw a5,-20(s0)
|
||||||
FFACBC5CEF
|
mv a4,a5
|
||||||
|
lw a5,-24(s0)
|
||||||
|
addw a5,a4,a5
|
||||||
|
sw a5,-20(s0)
|
||||||
|
nop
|
||||||
|
ld s0,24(sp)
|
||||||
|
addi sp,sp,32
|
||||||
|
ret
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user