File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,20 @@ operation(): |
3131 raise (ExceptionCode::IllegalInstruction, mode(), $encoding);
3232 }
3333
34+ XReg input1 = X[rs1];
35+ XReg input2 = X[rs2];
36+ XReg output = 0;
37+
38+ for(U32 i=0; i<(xlen()-4); i = i+4) {
39+ XReg index = input2[i+3:i];
40+ if(4*index < xlen()) {
41+ output[i+3:i] = input1[4*index+3:4*index];
42+ }
43+ }
44+
45+ X[rd] = output;
46+
47+ sail() : |
3448 val xperm4_lookup : (bits(4), xlenbits) -> bits(4)
3549 function xperm4_lookup (idx, lut) = {
3650 (lut >> (idx @ 0b00))[3..0]
Original file line number Diff line number Diff line change @@ -31,14 +31,29 @@ operation(): |
3131 raise (ExceptionCode::IllegalInstruction, mode(), $encoding);
3232 }
3333
34+ XReg input1 = X[rs1];
35+ XReg input2 = X[rs2];
36+ XReg output = 0;
37+
38+ for(U32 i=0; i<(xlen()-8); i = i+8) {
39+ XReg index = input2[i+7:i];
40+ if(8*index < xlen()) {
41+ output[i+7:i] = input1[8*index+7:8*index];
42+ }
43+ }
44+
45+ X[rd] = output;
46+
47+ sail() : |
48+
3449 val xperm8_lookup : (bits(8), xlenbits) -> bits(8)
3550 function xperm8_lookup (idx, lut) = {
3651 (lut >> (idx @ 0b00))[7..0]
3752 }
3853 function clause execute ( XPERM_8 (rs2,rs1,rd)) = {
3954 result : xlenbits = EXTZ(0b0);
4055 foreach(i from 0 to xlen by 8) {
41- result[i+7..i] = xperm4_lookup (X(rs2)[i+7..i], X(rs1));
56+ result[i+7..i] = xperm8_lookup (X(rs2)[i+7..i], X(rs1));
4257 };
4358 X(rd) = result;
4459 RETIRE_SUCCESS
You can’t perform that action at this time.
0 commit comments