Layout matrix correctly for additional rows

This commit is contained in:
2024-02-21 16:45:03 +01:00
parent cf83e27f50
commit f04ee8e603
6 changed files with 73 additions and 35 deletions

View File

@@ -16,7 +16,14 @@ mod ffi {
fn reset(&mut self);
fn apply_config(&mut self, config: &str);
fn bank_mode(&self) -> BankMode;
fn execute_read(&mut self, bank_index: u32, address: u32, bank_data: &[u8]);
fn execute_read(
&mut self,
bank_index: u32,
address: u32,
row: u32,
column: u32,
bank_data: &[u8],
);
fn execute_write(&mut self, bank_index: u32) -> [u8; 32];
fn init_logger();
@@ -27,8 +34,10 @@ fn init_logger() {
env_logger::init();
}
const GRF_A_BIT_OFFSET: usize = 10;
const GRF_B_BIT_OFFSET: usize = 13;
const GRF_A_BIT_OFFSET: usize = 2;
const GRF_B_BIT_OFFSET: usize = 5;
const COLUMN_BITS : usize = 7;
const BURST_LENGTH: usize = 32;
const GRF_NUM_REGISTERS: usize = 8;
@@ -120,7 +129,14 @@ fn new_pim_vm(num_banks: u32) -> Box<PimVM> {
struct BankData([f16; FP_UNITS]);
impl PimVM {
pub fn execute_read(&mut self, bank_index: u32, address: u32, bank_data: &[u8]) {
pub fn execute_read(
&mut self,
bank_index: u32,
address: u32,
row: u32,
column: u32,
bank_data: &[u8],
) {
assert_eq!(bank_data.len(), BURST_LENGTH);
let pim_unit_index = if cfg!(feature = "shared_pim_units") {
@@ -133,8 +149,9 @@ impl PimVM {
let inst = self.kernel.0[pim_unit.pc as usize];
let aam_grf_a_index = (address >> GRF_A_BIT_OFFSET) & 0b111;
let aam_grf_b_index = (address >> GRF_B_BIT_OFFSET) & 0b111;
let row_column_bits = (row << COLUMN_BITS) | column;
let aam_grf_a_index = (row_column_bits >> GRF_A_BIT_OFFSET) & 0b111;
let aam_grf_b_index = (row_column_bits >> GRF_B_BIT_OFFSET) & 0b111;
if pim_unit_index == 0 {
log::debug!(