-
Notifications
You must be signed in to change notification settings - Fork 60
add assert primitive and basic test #2463
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
067c268
add assert primitive and basic test
elamdf 838ccc2
formatting and organization
elamdf a4570ad
rename to std_assert
elamdf 03dc0d6
initial assert in cider
elamdf e2acddc
clean up test
elamdf c7d99d5
Merge branch 'main' of https://github.com/calyxir/calyx into add-asse…
elamdf 074d094
dummy data so runt doesn't complain
elamdf 3d8482f
expect ninja to crash
elamdf 3f6ed29
lift karmic debt via TODO
elamdf ef3ae3d
add assert primitive and basic test
elamdf b90f8bf
formatting and organization
elamdf 13e7314
rename to std_assert
elamdf 86ee0d3
initial assert in cider
elamdf df7f872
clean up test
elamdf 38a0dfc
dummy data so runt doesn't complain
elamdf ca4a9fa
expect ninja to crash
elamdf 257a266
lift karmic debt via TODO
elamdf 7cb4c1a
Merge branch 'main' into add-assert-primitive
elamdf 5b5f65a
update comments
elamdf 2ecd6c1
add todo and import
elamdf 1def930
assertion errror message
elamdf 58a488b
Merge branch 'add-assert-primitive' of github.com:elamdf/calyx into a…
elamdf b87a3fc
Merge branch 'main' into add-assert-primitive
elamdf f6aad81
Merge branch 'main' into add-assert-primitive
EclecticGriffin 749a416
fix the cider primitive impl
EclecticGriffin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import "primitives/core.futil"; | ||
| import "primitives/binary_operators.futil"; | ||
| import "primitives/assert.futil"; | ||
|
|
||
| component main() -> () { | ||
| cells { | ||
| a = std_const(32, 42); | ||
| b = std_const(32, 41); | ||
| eq = std_eq(32); | ||
| tmp_reg = std_reg(1); | ||
| my_assert = assert_prim(); | ||
| } | ||
|
|
||
| wires { | ||
| eq.left = a.out; | ||
| eq.right = b.out; | ||
|
|
||
|
|
||
| my_assert.in = eq.out; | ||
| group check_assert { | ||
| tmp_reg.in = 1'b1; | ||
| tmp_reg.write_en = 1'b1; | ||
| my_assert.en = 1'b1; | ||
| check_assert[done] = my_assert.out; | ||
|
|
||
| } | ||
|
|
||
| group check_assert2 { | ||
| tmp_reg.in = eq.out; | ||
| tmp_reg.write_en = 1'b1; | ||
| check_assert2[done] = tmp_reg.done; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| control { | ||
| check_assert; | ||
| check_assert2; | ||
|
|
||
|
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
|
|
||
| extern "assert.sv" { | ||
| primitive assert_prim(@data in: 1, en: 1, @clk clk:1, @reset reset: 1) -> (out: 1); | ||
elamdf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // WARNING: `done` must be referenced, or this will be optimized out | ||
| // TODO (elam) how do we `dont_touch` this? | ||
|
|
||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| module assert_prim #() ( | ||
| input wire logic clk, | ||
| input wire logic reset, | ||
| input logic in, | ||
| input logic en, | ||
| output logic out | ||
elamdf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ); | ||
| always_ff @(posedge clk) begin | ||
| out <= in; | ||
| if (in == '0 & en) begin | ||
| $fatal(1, "Assertion failed in assert primitive: input was 0"); | ||
| end | ||
| end | ||
| endmodule | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.