tracing lmv
This commit is contained in:
@@ -1108,41 +1108,58 @@ impl Trace {
|
|||||||
// Ok(InstructionStatus::Completed)
|
// Ok(InstructionStatus::Completed)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pre_lmv(&mut self, cores: &mut CPU, data: InstructionData) {
|
fn lmv_impl (&mut self, cores: &mut CPU, data: InstructionData, prefix: &'static str) {
|
||||||
|
use crate::tracing::pretty_print;
|
||||||
|
|
||||||
let (core, rd, r1, _, imm_len, offset_select, offset_value) =
|
let (core, rd, r1, _, imm_len, offset_select, offset_value) =
|
||||||
data.get_core_rd_r1_r2_immlen_offset();
|
data.get_core_rd_r1_r2_immlen_offset();
|
||||||
let file: &mut File = self
|
let file: &mut File = self
|
||||||
.out_files
|
.out_files
|
||||||
.get_mut(core as usize)
|
.get_mut(core as usize)
|
||||||
.expect("File at index not found");
|
.expect("File at index not found");
|
||||||
// let core = cores.core(core);
|
let (host, core) = cores.host_and_cores(core);
|
||||||
// let r1_val = core.register(r1);
|
let r1_val = core.register(r1);
|
||||||
// let rd_val = core.register(rd);
|
let rd_val = core.register(rd);
|
||||||
// let r1_val = add_offset_r1(r1_val, offset_select, offset_value);
|
if prefix == "Pre" {
|
||||||
// let rd_val = add_offset_rd(rd_val, offset_select, offset_value);
|
writeln!(
|
||||||
// let local_memory = core.load::<u8>(r1_val, imm_len)?;
|
file,
|
||||||
// let tmp = local_memory[0].to_vec();
|
"Inst: lvm {} {} {} {{ {} {} }}",
|
||||||
// core.execute_store(rd_val, tmp.as_slice());
|
rd, r1, imm_len, offset_select, offset_value
|
||||||
// Ok(InstructionStatus::Completed)
|
);
|
||||||
writeln!(file, "\t\tLMV\t\t");
|
} else {
|
||||||
|
writeln!(file);
|
||||||
|
}
|
||||||
|
writeln!(file, "{} Register:", prefix);
|
||||||
|
writeln!(file, "\trd({}): {}", rd, rd_val);
|
||||||
|
writeln!(file, "\trs1({}): {}", r1, r1_val);
|
||||||
|
writeln!(file, "{} Immediate:", prefix);
|
||||||
|
writeln!(file, "\timm_size: {}", imm_len);
|
||||||
|
writeln!(
|
||||||
|
file,
|
||||||
|
"\toffset_select {} offset_value {}",
|
||||||
|
offset_select, offset_value
|
||||||
|
);
|
||||||
|
let r1_val = add_offset_r1(r1_val, offset_select, offset_value);
|
||||||
|
let rd_val = add_offset_rd(rd_val, offset_select, offset_value);
|
||||||
|
let core_memory = core.load::<u8>(r1_val, imm_len).unwrap();
|
||||||
|
let global_memory = host.load::<u8>(rd_val, imm_len).unwrap();
|
||||||
|
writeln!(file, "{} Memory:", prefix);
|
||||||
|
writeln!(file, "\tLocal[{}:{}]: ", r1_val, r1_val + imm_len as usize,);
|
||||||
|
pretty_print::print_slice::<_,f32>(file, core_memory[0], 30);
|
||||||
|
writeln!(file, "\tLocal[{}:{}]: ", rd_val, rd_val + imm_len as usize,);
|
||||||
|
pretty_print::print_slice::<_,f32>(file, global_memory[0], 30);
|
||||||
|
|
||||||
|
if prefix == "Post" {
|
||||||
|
writeln!(file, "\n###############################################\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pre_lmv(&mut self, cores: &mut CPU, data: InstructionData) {
|
||||||
|
self.lmv_impl(cores, data, "Pre");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn post_lmv(&mut self, cores: &mut CPU, data: InstructionData) {
|
pub fn post_lmv(&mut self, cores: &mut CPU, data: InstructionData) {
|
||||||
let (core, rd, r1, _, imm_len, offset_select, offset_value) =
|
self.lmv_impl(cores, data, "Post");
|
||||||
data.get_core_rd_r1_r2_immlen_offset();
|
|
||||||
let file: &mut File = self
|
|
||||||
.out_files
|
|
||||||
.get_mut(core as usize)
|
|
||||||
.expect("File at index not found");
|
|
||||||
// let core = cores.core(core);
|
|
||||||
// let r1_val = core.register(r1);
|
|
||||||
// let rd_val = core.register(rd);
|
|
||||||
// let r1_val = add_offset_r1(r1_val, offset_select, offset_value);
|
|
||||||
// let rd_val = add_offset_rd(rd_val, offset_select, offset_value);
|
|
||||||
// let local_memory = core.load::<u8>(r1_val, imm_len)?;
|
|
||||||
// let tmp = local_memory[0].to_vec();
|
|
||||||
// core.execute_store(rd_val, tmp.as_slice());
|
|
||||||
// Ok(InstructionStatus::Completed)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pre_send(&mut self, cores: &mut CPU, data: InstructionData) {
|
pub fn pre_send(&mut self, cores: &mut CPU, data: InstructionData) {
|
||||||
|
|||||||
Reference in New Issue
Block a user