Skip to content

Commit 186a7fd

Browse files
committed
Support Zbb.
1 parent 4880c78 commit 186a7fd

File tree

7 files changed

+625
-5
lines changed

7 files changed

+625
-5
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ test:
2424
for bitness in '--32' '--64'; do \
2525
for compress in 'false' 'true' 'Zcb'; do \
2626
for zba in '' '--zba'; do \
27-
for f in tc/*.S; do cargo run --bin riscv -- $$bitness "--compress=$$compress" $$zba "$$f" >/dev/null || exit 1; done; \
27+
for zbb in '' '--zbb'; do \
28+
for f in tc/*.S; do cargo run --bin riscv -- $$bitness "--compress=$$compress" $$zba $$zbb "$$f" >/dev/null || exit 1; done; \
29+
done; \
2830
done; \
2931
done; \
3032
done

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ The assembler only supports what the emulator implements. Per the [unprivileged
2626

2727
- Zba 1.0.0 (address generation instructions)
2828

29+
- Zbb 1.0.0 (basic bit-manipulation instructions)
30+
2931
- Zbs 1.0.0 (single-bit instructions)
3032

3133
Further extensions are not supported, notably instructions for hardware multiplication and division (M) and hardware floats (F, D).
@@ -56,7 +58,7 @@ The assembler does not consider whether the target architecture is 32-bit or 64-
5658

5759
Therefore the assembler also has a `--64` flag to explicitly set the target architecture to RV64I. When combined with the `--compress` flag it will instruct the assembler to not compress `jal`.
5860

59-
The `*.c` files contain equivalent C solutions that can be put in [Compiler Explorer](https://gcc.godbolt.org/) with compiler set to `RISC-V (32-bits) gcc` or `RISC-V rv32gc clang` or corresponding 64-bit version, and flags set to `--std=c23 -Os -march=rv32id_zba_zbs_zicond` or `--std=c23 -Os -march=rv64id_zba_zbs_zicond`. Note that the assembler programs are hand-written and will not exactly match the compiler's output.
61+
The `*.c` files contain equivalent C solutions that can be put in [Compiler Explorer](https://gcc.godbolt.org/) with compiler set to `RISC-V (32-bits) gcc` or `RISC-V rv32gc clang` or corresponding 64-bit version, and flags set to `--std=c23 -Os -march=rv32id_zba_zbb_zbs_zicond` or `--std=c23 -Os -march=rv64id_zba_zbb_zbs_zicond`. Note that the assembler programs are hand-written and will not exactly match the compiler's output.
6062

6163
The emulator has the Level Input and Level Output wired up to memory address `2^32 - 1`, which is why the assembler programs refer to `-1(zero)` and the C programs refer to `IO = (volatile uint8_t*)(intptr_t)-1;`.
6264

freestanding/riscv64-arnavion-none-elf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"data-layout": "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128",
88
"eh-frame-header": false,
99
"emit-debug-gdb-scripts": false,
10-
"features": "+forced-atomics,+zba,+zbs,+zca,+zcb,+zicond,+zicsr,+zicntr,+auipc-addi-fusion,+ld-add-fusion,+lui-addi-fusion",
10+
"features": "+forced-atomics,+zba,+zbb,+zbs,+zca,+zcb,+zicond,+zicsr,+zicntr,+auipc-addi-fusion,+ld-add-fusion,+lui-addi-fusion",
1111
"linker": "rust-lld",
1212
"linker-flavor": "gnu-lld",
1313
"llvm-target": "riscv64",

0 commit comments

Comments
 (0)