openvm_native_compiler/asm/
builder.rs
1use openvm_circuit::arch::instructions::program::Program;
2use openvm_stark_backend::p3_field::{ExtensionField, PrimeField32, TwoAdicField};
3
4use super::{config::AsmConfig, AsmCompiler};
5use crate::{
6 conversion::{convert_program, CompilerOptions},
7 prelude::Builder,
8};
9
10pub type AsmBuilder<F, EF> = Builder<AsmConfig<F, EF>>;
12
13impl<F: PrimeField32 + TwoAdicField, EF: ExtensionField<F> + TwoAdicField> AsmBuilder<F, EF> {
14 pub fn compile_isa(self) -> Program<F> {
15 self.compile_isa_with_options(CompilerOptions::default())
16 }
17
18 pub fn compile_isa_with_options(self, options: CompilerOptions) -> Program<F> {
19 let mut compiler = AsmCompiler::new(options.word_size);
20 compiler.build(self.operations);
21 let asm_code = compiler.code();
22 convert_program(asm_code, options)
23 }
24}