[libre-riscv-dev] SV Prefix questions

Jacob Lifshay programmerjake at gmail.com
Wed Jun 26 09:15:48 BST 2019


I tried to write a reduction calculation that uses the balancing the
last two iterations part of setvl and I discovered that it works just
fine without that. Therefore, I think we should switch the algorithm
to the following:
let mut regs = [0u64; 128];
let mut vl = 0;

// instruction fields:
let rd = get_rd_field();
let rs1 = get_rs1_field();
let vlmax = get_immed_field();

// handle illegal instruction decoding
if vlmax > XLEN {
    trap()
}

// calculate VL
if rs1 == 0 { // rs1 is x0
    vl = vlmax
} else {
    vl = min(regs[rs1], vlmax)
}

// write rd
if rd != 0 {
    // rd is not x0
    regs[rd] = vl
}



More information about the libre-riscv-dev mailing list