Skip to content

Commit

Permalink
[PyCDE] Clarify BackedgeBuilder error message
Browse files Browse the repository at this point in the history
Presumably, this error message stems from when BackedgeBuilder was initially used solely for creating backedges to top-level port assignments when creating a new module instance. However, the `BackedgeBuilder` is also used for other operations (and useful as a general tool), wherein 'port' may be misleading. Changing this to `Backedge` makes it explicit that a backedge was created, and was expected to be assigned to.
  • Loading branch information
mortbopet committed Jul 18, 2022
1 parent d904317 commit 041a5dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions integration_test/Bindings/Python/dialects/rtl_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def instance_builder_body(module):
print(e)

# Note, the error here is actually caught and printed below.
# CHECK: Uninitialized ports remain in circuit!
# CHECK: Port: [[PORT_NAME:.+]]
# CHECK: Uninitialized backedges remain in circuit!
# CHECK: Backedge: [[PORT_NAME:.+]]
# CHECK: InstanceOf: hw.module @one_input(%[[PORT_NAME]]: i32)
# CHECK: Instance: hw.instance "inst1" @one_input({{.+}})
inst1 = one_input.instantiate("inst1")
Expand Down
8 changes: 4 additions & 4 deletions lib/Bindings/Python/circt/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ class Edge:
def __init__(self,
creator,
type: ir.Type,
port_name: str,
backedge_name: str,
op_view,
instance_of: ir.Operation,
loc: ir.Location = None):
self.creator: BackedgeBuilder = creator
self.dummy_op = ir.Operation.create("TemporaryBackedge", [type], loc=loc)
self.instance_of = instance_of
self.op_view = op_view
self.port_name = port_name
self.port_name = backedge_name
self.erased = False

@property
Expand Down Expand Up @@ -236,7 +236,7 @@ def __exit__(self, exc_type, exc_value, traceback):
errors = []
for edge in list(self.edges):
# TODO: Make this use `UnconnectedSignalError`.
msg = "Port: " + edge.port_name + "\n"
msg = "Backedge: " + edge.port_name + "\n"
if edge.instance_of is not None:
msg += "InstanceOf: " + str(edge.instance_of).split(" {")[0] + "\n"
if edge.op_view is not None:
Expand All @@ -245,7 +245,7 @@ def __exit__(self, exc_type, exc_value, traceback):
errors.append(msg)

if errors:
errors.insert(0, "Uninitialized ports remain in circuit!")
errors.insert(0, "Uninitialized backedges remain in circuit!")
raise RuntimeError("\n".join(errors))


Expand Down

0 comments on commit 041a5dc

Please sign in to comment.