risc0_circuit_rv32im/zirgen/
mod.rs1use risc0_zkp::{
16 adapter::{CircuitCoreDef, TapsProvider},
17 field::baby_bear::BabyBear,
18 taps::TapSet,
19};
20
21pub(crate) mod info;
22pub(crate) mod poly_ext;
23pub(crate) mod taps;
24
25pub struct CircuitImpl;
26
27#[allow(unused)]
28#[allow(non_camel_case_types)]
29#[allow(non_snake_case)]
30pub(crate) mod circuit {
31 use risc0_zkp::layout::Reg;
32
33 macro_rules! set_field {
34 ($field:ident) => {
35 paste::paste! {
36 pub type CircuitField = risc0_core::field::[<$field:snake>]::$field;
37 pub type Val = <CircuitField as risc0_core::field::Field>::Elem;
38 pub type ExtVal = <CircuitField as risc0_core::field::Field>::ExtElem;
39 pub type MixState = risc0_zkp::adapter::MixState<ExtVal>;
40 pub type PolyMix = ExtVal;
41 }
42 };
43 }
44
45 macro_rules! define_buffer_list {
46 (
47 all: [ $( $name:ident ,)* ],
48 rows: [ $( $rows_name:ident ,)* ],
49 taps: [ $( $taps_name:ident ,)* ],
50 globals: [ $( $globals_name:ident ,)* ],
51 ) => {};
52 }
53
54 macro_rules! define_tap_buffer {
55 ($name:ident, $size:literal, $reg_group_id:literal) => {
56 paste::paste! {
57 pub const [< REGCOUNT_ $name:upper >] : usize = $size;
58 pub const [< REGISTER_GROUP_ $name:upper >] : usize = $reg_group_id;
59 }
60 };
61 }
62
63 macro_rules! define_global_buffer {
64 ($name:ident, $size:literal) => {
65 paste::paste! {
66 pub const [< REGCOUNT_ $name:upper >] : usize = $size;
67 }
68 };
69 }
70
71 macro_rules! define_buffer {
72 ($name:ident, $size:literal) => {
73 paste::paste! {
74 pub const [< REGCOUNT_ $name:upper >] : usize = $size;
75 }
76 };
77 }
78
79 include! {"types.rs.inc"}
80 include! {"defs.rs.inc"}
81 include! {"layout.rs.inc"}
82}
83
84impl CircuitCoreDef<BabyBear> for CircuitImpl {}
85
86impl TapsProvider for CircuitImpl {
87 fn get_taps(&self) -> &'static TapSet<'static> {
88 self::taps::TAPSET
89 }
90}