Trivial matrix multiplication kernel

This commit is contained in:
2024-01-01 23:08:46 +01:00
parent 05f184d51f
commit 6380385bd0
3 changed files with 60 additions and 167 deletions

View File

@@ -48,6 +48,12 @@ struct PimUnit {
jump_counter: Option<u16>,
}
impl PimUnit {
fn reset(&mut self) {
*self = Self::default();
}
}
impl Default for PimUnit {
fn default() -> Self {
Self {
@@ -71,8 +77,7 @@ struct PimVM {
impl PimVM {
fn reset(&mut self) {
for unit in self.pim_units.iter_mut() {
unit.pc = 0;
unit.jump_counter = None;
unit.reset();
}
}
@@ -166,10 +171,7 @@ impl PimVM {
match inst {
Instruction::NOP => (),
Instruction::EXIT => {
pim_unit.jump_counter = None;
pim_unit.pc = 0;
}
Instruction::EXIT => pim_unit.reset(),
Instruction::JUMP { .. } => unreachable!(),
Instruction::MOV { src, dst } | Instruction::FILL { src, dst } => {
let data = PimVM::load(src, pim_unit, &bank_data);