Skip to content

Commit f4f604c

Browse files
committed
Update Zbkb
1 parent 5fda047 commit f4f604c

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

arch/inst/Zbkb/brev8.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
$schema: inst_schema.json#
44
kind: instruction
55
name: brev8
6-
long_name: No synopsis available.
6+
long_name: Reverse the bits in each byte of a source register.
77
description: |
8-
No description available.
8+
This instruction reverses the order of the bits in every byte of a register.
99
definedBy:
1010
anyOf: [B, Zbkb, Zk, Zkn, Zks]
1111
assembly: xd, xs1
@@ -23,3 +23,12 @@ access:
2323
vu: always
2424
data_independent_timing: false
2525
operation(): |
26+
if (implemented?(ExtensionName::B) && (CSR[misa].Zbkb == 1'b0)) {
27+
raise (ExceptionCode::IllegalInstruction, mode(), $encoding);
28+
}
29+
30+
result : xlenbits = EXTZ(0b0);
31+
foreach (i from 0 to sizeof(xlen) by 8) {
32+
result[i+7..i] = reverse_bits_in_byte(X(rs1)[i+7..i]);
33+
};
34+
X(rd) = result;

arch/inst/Zbkb/unzip.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
$schema: inst_schema.json#
44
kind: instruction
55
name: unzip
6-
long_name: No synopsis available.
6+
long_name: Inverse of Zip.
77
description: |
8-
No description available.
8+
This instruction gathers bits from the high and low halves of the source word into odd/even bit
9+
positions in the destination word. It is the inverse of the zip instruction. This instruction is
10+
available only on RV32.
911
definedBy:
1012
anyOf: [B, Zbkb, Zk, Zkn, Zks]
1113
assembly: xd, xs1
@@ -24,3 +26,11 @@ access:
2426
data_independent_timing: false
2527
base: 32
2628
operation(): |
29+
if (implemented?(ExtensionName::B) && (CSR[misa].Zbkb == 1'b0)) {
30+
raise (ExceptionCode::IllegalInstruction, mode(), $encoding);
31+
}
32+
33+
foreach (i from 0 to xlen/2-1) {
34+
X(rd)[i] = X(rs1)[2*i]
35+
X(rd)[i+xlen/2] = X(rs1)[2*i+1]
36+
}

arch/inst/Zbkb/zip.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
$schema: inst_schema.json#
44
kind: instruction
55
name: zip
6-
long_name: No synopsis available.
6+
long_name: Gather odd and even bits of the source word into upper/lower halves of the destination.
77
description: |
8-
No description available.
8+
This instruction scatters all of the odd and even bits of a source word into the high and low halves
9+
of a destination word. It is the inverse of the unzip instruction. This instruction is available only on
10+
RV32.
911
definedBy:
1012
anyOf: [B, Zbkb, Zk, Zkn, Zks]
1113
assembly: xd, xs1
@@ -24,3 +26,11 @@ access:
2426
data_independent_timing: false
2527
base: 32
2628
operation(): |
29+
if (implemented?(ExtensionName::B) && (CSR[misa].Zbkb == 1'b0)) {
30+
raise (ExceptionCode::IllegalInstruction, mode(), $encoding);
31+
}
32+
33+
foreach (i from 0 to xlen/2-1) {
34+
X(rd)[2*i] = X(rs1)[i]
35+
X(rd)[2*i+1] = X(rs1)[i+xlen/2]
36+
}

0 commit comments

Comments
 (0)