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

Feat: implement buses #371

Open
wants to merge 42 commits into
base: next
Choose a base branch
from

Conversation

Leo-Besancon
Copy link

@Leo-Besancon Leo-Besancon commented Mar 7, 2025

PR implementing #183, targetting upstream next (instead of massalabs#8 on massalabs's fork).

The goal of this PR is to make an initial implementation of buses, that can be declared:

buses {
    unit p,
    mult q,
}

Currently, only empty bus boundary constraints are handled (that are reduced to a 0 or 1 value depending on the bus type)

boundary_constraints {
    enf p.first = null;
    enf p.last = null;
}

Boundary constraints with public inputs depend on #143 and will be handled in a future PR.

integrity_constraints {
    p.add(a) when s1;
    p.rem(a, b) when 1 - s2;
}

What was done in this PR:

  • Parse bus related expressions (AST)
  • Handle semantic analysis and constant propagation for buses (AST)
  • In a new MIR > MIR pass, before lowering to the AIR, expand bus integrity constraints and handle empty bus boundary constraints
  • Add tests (in parser, Mir, Air, and Codegen) for new bus expressions
  • Add documentation on buses

In future PR, we will introduce, in order of priority:

Leo-Besancon and others added 30 commits March 7, 2025 17:14
Still needs additional checks (e.g. ensure Null only on buses boundaries, and ensure buses boundaries only on Null)
- fixed stack overflow on hash and eq with Singleton
- mir comparision utils
- buses test
@Leo-Besancon Leo-Besancon marked this pull request as ready for review March 17, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants