9ca1a0ed9f
Validate Operations / validate-operations (push) Has been cancelled
fix offset selection implementation to match the pim isa automatic code format for pim-simulator
118 lines
3.2 KiB
Rust
118 lines
3.2 KiB
Rust
mod common;
|
|
|
|
use pimcore::{
|
|
Executable,
|
|
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 = common::empty_cpu(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).build(),
|
|
);
|
|
let core_instruction = vec![inst_builder.build().into()];
|
|
let mut executable = Executable::new(cpu, core_instruction);
|
|
executable.execute();
|
|
}
|
|
|
|
#[test]
|
|
#[should_panic(expected = "Function not found for the requested size input:8 output:8")]
|
|
fn unsupported_8_bit_vectors_do_not_alias_f32() {
|
|
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(8, 8).build());
|
|
inst_builder.make_inst(
|
|
vvadd,
|
|
idata_build.set_rdr1r2(3, 1, 2).set_imm_len(8).build(),
|
|
);
|
|
}
|
|
|
|
fn place_holder(inst: InstructionType) {
|
|
let mut cpu = common::empty_cpu(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);
|
|
}
|