111 lines
2.8 KiB
Rust
111 lines
2.8 KiB
Rust
|
|
use pimcore::{Executable, cpu::CPU, instruction_set::{InstructionType, InstructionsBuilder, instruction_data::InstructionDataBuilder, isa::*}};
|
|
|
|
|
|
#[test]
|
|
#[should_panic(expected = "Function not found for the requested size") ]
|
|
fn wrong_size_place_holder() {
|
|
let cpu = CPU::new(0);
|
|
let mut inst_builder = InstructionsBuilder::new();
|
|
let mut idata_build = InstructionDataBuilder::new();
|
|
idata_build.set_core_indx(0).fix_core_indx();
|
|
inst_builder.make_inst(
|
|
setbw,
|
|
idata_build
|
|
.set_ibiw_obiw(55, 55)
|
|
.build(),
|
|
);
|
|
inst_builder.make_inst(
|
|
vvadd,
|
|
idata_build
|
|
.set_rdr1r2(3, 1, 2)
|
|
.set_imm_len(8 * size_of::<f32>() as i32)
|
|
.build(),
|
|
);
|
|
let core_instruction = vec![inst_builder.build().into()];
|
|
let mut executable = Executable::new(cpu, core_instruction);
|
|
executable.execute();
|
|
}
|
|
|
|
|
|
|
|
fn place_holder(inst : InstructionType) {
|
|
let mut cpu = CPU::new(0);
|
|
let mut idata_build = InstructionDataBuilder::new();
|
|
idata_build.set_core_indx(0).fix_core_indx();
|
|
inst(&mut cpu, idata_build.build()).unwrap();
|
|
}
|
|
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn vvadd_placeholder() {
|
|
place_holder(vvadd);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn vvsub_placeholder() {
|
|
place_holder(vvsub);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn vvmul_placeholder() {
|
|
place_holder(vvmul);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn vvdmul_placeholder() {
|
|
place_holder(vvdmul);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn vvmax_placeholder() {
|
|
place_holder(vvmax);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn vavg_placeholder() {
|
|
place_holder(vavg);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn vrelu_placeholder() {
|
|
place_holder(vrelu);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn vtanh_placeholder() {
|
|
place_holder(vtanh);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn vsigm_placeholder() {
|
|
place_holder(vsigm);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "You are calling a placeholder, the real call is the generic version") ]
|
|
fn mvmul_placeholder() {
|
|
place_holder(mvmul);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic ]
|
|
fn vvsll_why_inst() {
|
|
place_holder(vvsll);
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic ]
|
|
fn vvsra_why_inst() {
|
|
place_holder(vvsra);
|
|
}
|