Skip to content

Commit

Permalink
Add test for multi directional tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardt committed Aug 30, 2018
1 parent 111443d commit 954cba9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_coreir/gold/test_multi_direction_tuple.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{"top":"global.Foo",
"namespaces":{
"global":{
"modules":{
"Foo":{
"type":["Record",[
["ifc",["Record",[["I","BitIn"],["O","Bit"]]]]
]],
"connections":[
["self.ifc.O","self.ifc.I"]
]
}
}
}
}
}
21 changes: 21 additions & 0 deletions tests/test_coreir/test_coreir_tuple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import magma as m
from magma.testing import check_files_equal


def test_multi_direction_tuple():
foo = m.DefineCircuit("Foo", "ifc", m.Tuple(I=m.In(m.Bit), O=m.Out(m.Bit)))
m.wire(foo.ifc.I, foo.ifc.O)
m.EndCircuit()

m.compile("build/test_multi_direction_tuple", foo, output="coreir")
assert check_files_equal(__file__, f"build/test_multi_direction_tuple.json",
f"gold/test_multi_direction_tuple.json")

assert [T.isinput() for T in foo.interface.ports["ifc"].Ts] == \
[False, True]

assert [T.isinput() for T in foo.IO.ports["ifc"].Ts] == \
[True, False]

if __name__ == "__main__":
test_multi_direction_tuple()

0 comments on commit 954cba9

Please sign in to comment.