Chrysoberyl is a Veryl port of Alexandrite, a small in-order
RV32IC CPU. It retains Alexandrite's instruction ROM and byte-enable RAM
interfaces (including its byte-addressed RAM address port), exposes all 32
integer registers for simulation, and raises
o_finish after a non-zero store to address 0x4.
The current implementation supports the Alexandrite RV32I subset plus the
RV32C compressed-instruction extension, including mixed 16/32-bit streams and
32-bit instructions that cross a ROM-word boundary. Integer arithmetic,
branches, jumps, loads, stores, LUI, and AUIPC are supported. CSR and
system instructions remain intentionally outside Alexandrite's scope.
The instruction address space defaults to 16 KiB. Set the elaboration-time
ROM_SIZE_BYTES module parameter to another power-of-two byte size when a
different ROM capacity is required; the PC and word-address output widths are
derived from that value.
Control flow uses a static fetch-stage predictor: backward conditional branches are predicted taken, forward conditional branches are predicted not taken, and direct jumps are predicted taken. Indirect jumps continue to resolve in the execute stage.
Set the USE_HISTORY_PREDICTION module parameter to true to replace BTFNT
conditional-branch decisions with a 64-entry local history table. Each valid
entry is a two-bit saturating counter indexed by halfword PC bits [6:1];
untrained entries fall back to BTFNT. The table is tagless, so aliased branch
PCs intentionally share history. Direct and indirect jump policies are
unchanged.
Install Veryl and run:
veryl check
veryl buildGenerated SystemVerilog is placed in target/.
Run the included smoke test plus directed RV32I and RV32C instruction tests with:
sh test/run_smoke.shThe latest riscv-tests repository is pinned as a Git submodule. Initialize it after cloning with:
git submodule update --initRun the 37 unprivileged rv32ui tests and the upstream rv32uc compressed
instruction test with:
sh test/run_riscv_tests.shThe runner builds the current Veryl source with Verilator, compiles each test
using Clang's RISC-V target, loads a flat ROM/RAM image, and observes the
standard tohost result. Set VERYL, RISCV_CC, or RISCV_LD to override the
corresponding tools. Chrysoberyl provides a 16 KiB instruction address space so
the complete upstream rv32uc image fits without modification.