-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix rebase bug in aggregate wireables, add tests (#1152)
I chose the wrong changes for these functions when rebasing the tuple2 code. With the aggregate_wireable_method decorator, they only need to implement the logic for when children are elaborated (the decorator calls the aggregate method if the has_elaborated_children check fails). This didn't trigger a CI bug because when unwire fails, it just raises a warning (e.g. driving an already driven value) that occurs silently in the passing tests. Adds a test to cover this case.
- Loading branch information
Showing
3 changed files
with
28 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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,18 @@ | ||
import pytest | ||
import magma as m | ||
|
||
|
||
@pytest.mark.parametrize('T', [m.Bits[8], m.Tuple[m.Bit, m.Bits[8]]]) | ||
def test_aggregate_wireable_unwire(T): | ||
class Foo(m.Circuit): | ||
io = m.IO(I=m.In(T), O=m.Out(T)) | ||
io.O @= io.I | ||
assert io.O.value() is io.I | ||
io.O.unwire(io.I) | ||
assert io.O.value() is None | ||
|
||
io.O @= io.I | ||
io.O[0] # Trigger elaboration | ||
assert io.O.value() is io.I | ||
io.O.unwire(io.I) | ||
assert io.O.value() is None |