ab_riscv_primitives/lib.rs
1//! Composable RISC-V primitives (instructions, registers) and abstractions around them.
2//!
3//! The primitives are designed to be generic over the number of general purpose registers, and a
4//! macro system allows composing base ISA like RV32/RV64 with a desired set of standard or custom
5//! extensions/instructions. Trait abstractions are designed to allow expressing generic APIs
6//! without hardcoding specific types whenever possible.
7//!
8//! The immediate needs dictate the current set of available instructions and extensions. Consider
9//! contributing if you need something not yet available.
10//!
11//! `ab-riscv-interpreter` crate contains a complementary interpreter implementation, but these
12//! primitives are completely independent.
13//!
14//! `ab-riscv-act4-runner` crate in the repository contains a complementary RISC-V Architectural
15//! Certification Tests runner for <https://github.com/riscv-non-isa/riscv-arch-test> that ensures
16//! correct implementation.
17//!
18//! Does not require a standard library (`no_std`) or an allocator.
19//!
20//! ## Supported ISA variants and extensions
21//!
22//! ISA variants:
23//! * RV32I (version 2.1)
24//! * RV32E (version 2.0)
25//! * RV64I (version 2.1)
26//! * RV64E (version 2.0)
27//!
28//! Extensions:
29//! * M (version 2.0)
30//! * B (version 1.0.0)
31//! * Zba (version 1.0.0)
32//! * Zbb (version 1.0.0)
33//! * Zbc (version 1.0.0)
34//! * Zbkc (version 1.0.0)
35//! * Zbs (version 1.0.0)
36//! * Zknh (version 1.0.0)
37//! * Zicsr (version 2.0)
38//! * (experimental) Zve32x (version 1.0.0)
39//! * (experimental) Zve64x (version 1.0.0)
40//! * (experimental) Zvl*b (version 1.0.0), where `*` is anything allowed by the specification
41//!
42//! All extensions except experimental pass all relevant RISC-V Architectural Certification Tests
43//! (ACTs) using the ACT4 framework.
44//!
45//! Any permutation of compatible extensions is supported.
46//!
47//! Experimental extensions are known to have bugs and need more work. They are not tested against
48//! ACTs yet.
49
50#![no_std]
51#![feature(
52 const_cmp,
53 const_convert,
54 const_default,
55 const_destruct,
56 const_index,
57 const_ops,
58 const_option_ops,
59 const_trait_impl,
60 const_try,
61 const_try_residual,
62 generic_const_exprs,
63 stmt_expr_attributes,
64 try_blocks
65)]
66#![expect(incomplete_features, reason = "generic_const_exprs")]
67
68pub mod instructions;
69pub mod privilege;
70pub mod registers;