A collection of classes providing simple hardware specification, simulation, tracing, and testing suitable for teaching and research. Simplicity, usability, clarity, and extensibility are the overarching goals, rather than performance or optimization.
When the same wire is the source to a particular net multiple times (e.g. a c net), net_graph(), and by extension all the graphical output functions that use it like output_to_graphviz(), don't properly display the additional edges.
For example, given:
import pyrtl
c = pyrtl.Const(1, 1)
o = pyrtl.Output(3, 'o')
o <<= pyrtl.concat(c, c, c)
the logic of block is:
for net in pyrtl.working_block():
print(net)
tmp0/3W <-- c -- const_0_1/1C, const_0_1/1C, const_0_1/1C
o/3O <-- w -- tmp0/3W
however the result of net_graph() previously was:
for src, vals in pyrtl.net_graph().items():
for dst, edge in vals.items():
print(f"({src}) - {edge} -> ({dst})"
(o/3O <-- w -- tmp0/3W ) - o/3O -> (o/3O)
(tmp0/3W <-- c -- const_0_1/1C, const_0_1/1C, const_0_1/1C ) - tmp0/3W -> (o/3O <-- w -- tmp0/3W )
(const_0_1/1C) - const_0_1/1C -> (tmp0/3W <-- c -- const_0_1/1C, const_0_1/1C, const_0_1/1C )
This problem is evident in the visual output as well:
Solution
net_graph has been updated so that there are lists of edges between nodes.
for src, vals in pyrtl.net_graph().items():
for dst, edges in vals.items():
for edge in edges:
print(f"({src}) - {edge} -> ({dst})")
Problem
When the same wire is the source to a particular net multiple times (e.g. a
c
net),net_graph()
, and by extension all the graphical output functions that use it likeoutput_to_graphviz()
, don't properly display the additional edges.For example, given:
the logic of block is:
however the result of
net_graph()
previously was:This problem is evident in the visual output as well:
Solution
net_graph
has been updated so that there are lists of edges between nodes.producing
It now looks like: