| -- | -- | --- | --- | ----- | -------- |--| ------ |
| NN | RT | RA | RB | RC | mode 001 |Rc| ternary |
| NN | RT | RA | RB | im0-4 | im5-7 00 |Rc| ternaryi |
-| NN | RS | RA | RB | deg | 00 011 |Rc| gfmul |
+| NN | RS | RA | RB | RC | 00 011 |Rc| gfmul |
| NN | RS | RA | RB | deg | 01 011 |Rc| gfadd |
| NN | RT | RA | RB | deg | 10 011 |Rc| gfinv |
-| NN | RS | RA | RB | deg | 11 011 |Rc| gfmod |
+| NN | RS | RA | RB | deg | 11 011 |Rc| gfmuli |
| 0.5|6.10|11.15| 16.23 |24.27 | 28.30 |31| name |
| -- | -- | --- | ----- | ---- | ----- |--| ------ |
| NN | RA | RB | | | 1 | 0100 110 |Rc| rsvd |
| NN | RA | RB | sh | itype | SH | 1000 110 |Rc| bmopsi |
| NN | RA | RB | | | | 1100 110 |Rc| rsvd |
+| NN | RA | RB | | | | 1100 110 |Rc| rsvd |
+| NN | RA | RB | | | | 1100 110 |Rc| rsvd |
+| NN | RA | RB | | | | 1100 110 |Rc| rsvd |
| NN | RA | RB | | | 0 | 0001 110 |Rc| rsvd |
| NN | RA | RB | | | 0 | 0101 110 |Rc| rsvd |
| NN | RA | RB | RC | 00 | 0 | 0010 110 |Rc| gorc |
| -- | -- | --- | --- | --- | ------- |--| ----- |
| NN | RT | RA | RB | RC | mode 010 |Rc| bm* |
| NN | RT | RA | RB | RC | 0 1 111 |Rc| bmrev |
-| NN | | | | | 1 1 111 |Rc| rsvd |
+
```
uint_xlen_t bmset(RA, RB, sh)
}
```
-bitmask extract with reverse
+bitmask extract with reverse. can be done by bitinverting all of RA and getting bits of RA from the opposite end.
```
msb = rb[5:0];
rev[0:msb] = ra[msb:0];
rt = ZE(rev[msb:0]);
+
+uint_xlen_t bmextrev(RA, RB, sh)
+{
+ int shamt = (RB & (XLEN - 1));
+ shamt = (XLEN-1)-shamt; # shift other end
+ bra = bitreverse(RA) # swap LSB-MSB
+ mask = (2<<sh)-1;
+ return mask & (bra >> shamt);
+}
```
| 0.5|6.10|11.15|16.20|21.26| 27..30 |31| name |
```
# Galois Field
+see <https://courses.csail.mit.edu/6.857/2016/files/ffield.py>
+
## Multiply
this requires 3 parameters and a "degree"
realistically with the degree also needing to be an immediate it should be brought down to an overwrite version:
RS = GFMUL(RS, RA, gfdegree, modulo=RB)
+ RS = GFMUL(RS, RA, gfdegree=RC, modulo=RB)
| 0.5|6.10|11.15|16.20|21.25| 26..30 |31|
| -- | -- | --- | --- | --- | ------- |--|
| NN | RS | RA | RB | deg | 00 011 |Rc|
+| NN | RS | RA | RB | RC | 11 011 |Rc|
where the SimpleV variant may override RS-as-src differently from RS-as-dest
## GF add
RS = GFADD(RS, RA|0, gfdegree, modulo=RB)
+ RS = GFADDI(RS, RA|0, gfdegree=RC, modulo=RB)
-| 0.5|6.10|11.15|16.20|21.25| 26..30 |31|
-| -- | -- | --- | --- | --- | ------- |--|
-| NN | RS | RA | RB | deg | 01 011 |Rc|
+| 0.5|6.10|11.15|16.20|21.25| 26..30 |31| name |
+| -- | -- | --- | --- | --- | ------- |--| ----- |
+| NN | RS | RA | RB | RC | 0 1 011 |Rc| gfadd |
+| NN | RS | RA | RB | RC | 1 1 111 |Rc| gfaddi |
+
+GFMOD is a pseudo-op where RA=0
## gf invert
return g1
```
-## GF mod
-
-modulo arithmetic to ensure a polynomial is in range seems sensible to have.
-
# bitmatrix
```