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

Fix Calyx backend issue with emitting signed binops #430

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

Mark1626
Copy link
Collaborator

@Mark1626 Mark1626 commented Apr 9, 2024

This fixes point number 2 in #427

Background

Dahlia was emitting Calyx primitives incorrectly for signed ops.

eg)

decl a: bit<10>[128];
decl b: bit<10>[128];
decl c: bit<10>[128];

for (let i:bit<8>=0..128) {
    c[i] := a[i] & b[i];
}

The Calyx IR contains a std_sand primitive

Changes Summary

  1. Modify the function signed in Helpers.scala to use the op to decide if a given op is signed or not
    1. Match for op type NumOp and use the previous behaviour
    2. Any other op type binary operator primitives are not signed eg) bitwise, comparison
  2. Add an test with signed bit and binops for regression

@rachitnigam
Copy link
Member

LGTM!

@rachitnigam rachitnigam merged commit 164c2dd into master Apr 9, 2024
1 check passed
@rachitnigam rachitnigam deleted the fix-calyx-signed-op-emit branch April 9, 2024 14:37
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.

None yet

2 participants