-
Notifications
You must be signed in to change notification settings - Fork 19
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
Write Memory chiplet bus constraints in AirScript #263
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Overcastan! I think this looks correct. I just left a few minor nits inline
constraints/miden-vm/memory.air
Outdated
ev is_zero(main: [values[4]]): | ||
ev is_zero([values[4]]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer this to be an evaluator that acts on a single column like the way we've done is_binary
. The comprehension would then be at level where the evaluator is called. I think this would be clearer and more consistent with our approach in other places. (That way, if we move all of these into a utils module in the future we could use the same is_zero
, is_unchanged
, is_binary
, etc. in all modules)
constraints/miden-vm/memory.air
Outdated
ev is_unchanged(main: [values[4]]): | ||
ev is_unchanged([values[4]]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to my previous comment - I would prefer this to be an evaluator that acts on a single column like the way we've done is_binary
. The comprehension would then be at level where the evaluator is called. I think this would be clearer and more consistent with our approach in other places. (That way, if we move all of these into a utils module in the future we could use the same is_zero
, is_unchanged
, is_binary
, etc. in all modules)
constraints/miden-vm/memory.air
Outdated
@@ -107,10 +103,22 @@ ev enforce_values(main: [s[2], v[4]]): | |||
enf is_unchanged([v]) when s[1] | |||
|
|||
|
|||
ev bus_constraints([s[2], ctx, addr, clk, v[4]], [b_chip]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's just call this chiplet_bus
constraints/miden-vm/memory.air
Outdated
# Calculate operation label for each operation | ||
let op_label = s[0] * 2^3 + 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's rename this to "op_mem" like the docs and change the comment to "Calculate the operation label for the memory access operation"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
Partially addressing: #203
This PR adds memory chiplet bus constraints and removes keywords from evaluator function declaration.