1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use orzir_core::Context;

pub mod basic;
pub mod regs;
pub mod rv_f;
pub mod rv_m;

/// Register the riscv dialects according to the ISA extension name.
pub fn register_riscv_dialects(ctx: &mut Context, spec: &str) {
    let spec = spec.to_lowercase();
    let spec = spec.replace('g', "imafd_zicsr_zifencei");

    basic::register(ctx);

    if spec.contains('m') {
        rv_m::register(ctx);
    }

    if spec.contains('f') {
        rv_f::register(ctx);
        // TODO: RVF implies Zicsr extension.
    }
}