X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=isa%2Fmacros%2Fsimplev%2Fsv_test_macros.h;h=be324f3bd09d63ea274be28cac8be6f88e48f21e;hb=30dcd148bd02a5f38fe7c59ba65d2957c212b64b;hp=6c671df0e17cf5851238ee442480cba5ba435ba1;hpb=90da209c49050e8301d487b08609b43aff47ab84;p=riscv-tests.git diff --git a/isa/macros/simplev/sv_test_macros.h b/isa/macros/simplev/sv_test_macros.h index 6c671df..be324f3 100644 --- a/isa/macros/simplev/sv_test_macros.h +++ b/isa/macros/simplev/sv_test_macros.h @@ -1,8 +1,32 @@ +#define SV_REMAP_CSR(reg0, shape0, reg1, shape1, reg2, shape2) \ + (reg0 | (reg1<<8) | (reg2<<8) | \ + (shape0<<24) | (shape0<<26) | (shape0<<28)) + +#define SV_SHAPE_PERM_XYZ 0 +#define SV_SHAPE_PERM_XZY 1 +#define SV_SHAPE_PERM_YXZ 2 +#define SV_SHAPE_PERM_YZX 3 +#define SV_SHAPE_PERM_ZXY 4 +#define SV_SHAPE_PERM_ZYX 5 + +#define SV_SHAPE_CSR(xd, yd, zd, offs, perm) \ + ((xd-1) | ((yd-1)<<8) | ((zd-1)<<16) | (perm<<24) | \ + ((offs&0x1)<<7) | ((offs&0x2)<<14) | ((offs&0x4)<<21) ) + + #define SV_REG_CSR(type, regkey, elwidth, regidx, isvec) \ (regkey | (elwidth<<5) | (type<<7) | (regidx<<8) | (isvec<<15)) #define SV_PRED_CSR(type, regkey, zero, inv, regidx, packed) \ (regkey | (zero<<5) | (inv<<6) | (type<<7) | (regidx<<8) | (packed<<15)) +#define SET_SV_REMAP_CSR(reg0, shape0, reg1, shape1, reg2, shape2) \ + li x1, SV_REMAP_CSR( reg0, shape0, reg1, shape1, reg2, shape2); \ + csrrw x0, 0x4f7, x1 + +#define SET_SV_SHAPE0_CSR(xd, yd, zd, offs, permute) \ + li x1, SV_SHAPE_CSR( xd, yd, zd, offs, permute); \ + csrrw x0, 0x4f8, x1 + #define SET_SV_CSR( type, regkey, elwidth, regidx, isvec) \ li x1, SV_REG_CSR( type, regkey, elwidth, regidx, isvec); \ csrrw x0, 0x4c0, x1