Skip to content

Commit

Permalink
[fromverilog] Update DefineCircuit assertion for case with single module
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardt committed Oct 24, 2018
1 parent 0bceafb commit ee0575d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions magma/fromverilog.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ def FromVerilog(source, func, type_map, target_modules=None):

v = ModuleVisitor()
v.visit(ast)

if func == DefineCircuit:
# only allow a single verilog module unless we're only defining one
# circuit (only one module in target_modules), otherwise, they would
# all use the same source, so if they are compiled together, there will
# be multiple definitions of the same verilog module
assert len(v.nodes) == 1 or len(target_modules) == 1
modules = []
for node in v.nodes:
if target_modules is not None and node.name not in target_modules:
Expand Down

0 comments on commit ee0575d

Please sign in to comment.