From: lkcl Date: Sat, 30 Apr 2022 14:50:20 +0000 (+0100) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~2538 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=446d4cbae13f22fea2a80f915c63b77ea3144205;p=libreriscv.git --- diff --git a/openpower/sv/svp64/appendix.mdwn b/openpower/sv/svp64/appendix.mdwn index 2871bd9bc..849ae216d 100644 --- a/openpower/sv/svp64/appendix.mdwn +++ b/openpower/sv/svp64/appendix.mdwn @@ -935,6 +935,75 @@ insert MV operations if necessary or desired, to give the level of efficiency or performance required.* +# Element-width overrides + + typedef union { + uint8_t b; + uint16_t s; + uint32_t i; + uint64_t l; + } el_reg_t; + + bw(elwidth): + if elwidth == 0: return xlen + if elwidth == 1: return 8 + if elwidth == 2: return 16 + // elwidth == 3: + return 32 + + get_max_elwidth(rs1, rs2): + return max(bw(int_csr[rs1].elwidth), # default (XLEN) if not set + bw(int_csr[rs2].elwidth)) # again XLEN if no entry + + get_polymorphed_reg(reg, bitwidth, offset): + el_reg_t res; + res.l = 0; // TODO: going to need sign-extending / zero-extending + if bitwidth == 8: + reg.b = int_regfile[reg].b[offset] + elif bitwidth == 16: + reg.s = int_regfile[reg].s[offset] + elif bitwidth == 32: + reg.i = int_regfile[reg].i[offset] + elif bitwidth == 64: + reg.l = int_regfile[reg].l[offset] + return res + + set_polymorphed_reg(reg, bitwidth, offset, val): + if (!int_csr[reg].isvec): + # sign/zero-extend depending on opcode requirements, from + # the reg's bitwidth out to the full bitwidth of the regfile + val = sign_or_zero_extend(val, bitwidth, xlen) + int_regfile[reg].l[0] = val + elif bitwidth == 8: + int_regfile[reg].b[offset] = val + elif bitwidth == 16: + int_regfile[reg].s[offset] = val + elif bitwidth == 32: + int_regfile[reg].i[offset] = val + elif bitwidth == 64: + int_regfile[reg].l[offset] = val + + maxsrcwid = get_max_elwidth(rs1, rs2) # source element width(s) + destwid = int_csr[rs1].elwidth # destination element width +  for (i = 0; i < VL; i++) + if (predval & 1<