Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite the RISCV machine as template + renders #1619

Closed
leonardoalt opened this issue Jul 26, 2024 · 0 comments · Fixed by #2137
Closed

Rewrite the RISCV machine as template + renders #1619

leonardoalt opened this issue Jul 26, 2024 · 0 comments · Fixed by #2137

Comments

@leonardoalt
Copy link
Member

Currently the way we build the RISCV machine powdr-asm code is quite ugly imo, with a bunch of String concatenations that look quite messy. Ideally we should have a template file in powdr-asm that simply gets filled by the Rust code that collects the info needed about registers, instructions, continuations etc and renders the final machine.

Example:

use std::machines::memory::{{memory_machine}};
{{ binary_import }}
{{ shift_import }}
{{ split_import }}
{{ poseidon_import }}
{{ arith_import }}

// could actually always import all, don't think it hurts compilation

machine Main {
    reg val1;
    reg val2;
    
    {{ extra_registers }}

    col witness va1_col;
    col witness va2_col;
    col witness va3_col;
    col witness va3_col;

   // ... all base instructions
   
   {{ binary_instructions }}
   {{ shift_instructions }}
   {{ poseidon_instructions }}
   {{ arith_instructions }}
   
   function main {
     {{ code }}
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant