def test_output_to_tgf_does_not_throw_error(self): with io.StringIO() as vfile: pyrtl.input_from_blif(full_adder_blif) pyrtl.output_to_trivialgraph(vfile)
# the constructor dummy_wv = pyrtl.WireVector(1, name="blah") # Also, because of the flexible nature of Python, you can also add custom # properties to the WireVector. dummy_wv.my_custom_property_name = "John Clow is great" dummy_wv.custom_value_028493 = 13 # removing the WireVector from the block to prevent problems with the rest of # this example pyrtl.working_block().remove_wirevector(dummy_wv) # ---- Trivial Graph Format ---- # Finally, there is a handy way to view your hardware creations as a graph. # The function output_to_trivialgraph will render your hardware a formal that # you can then open with the free software "yEd" # (http://en.wikipedia.org/wiki/YEd). There are options under the # "hierarchical" rendering to draw something that looks quite like a circuit. pyrtl.working_block().sanity_check() pyrtl.passes._remove_unused_wires( pyrtl.working_block()) # so that trivial_graph() will work print("--- Trivial Graph Format ---") with io.StringIO() as tgf: pyrtl.output_to_trivialgraph(tgf) print(tgf.getvalue())
# So far, each input and output wirevector have been given their own names, but # normal wirevectors can also be given names by supplying the name argument to # the constructor dummy_wv = pyrtl.WireVector(1, name="blah") # Also, because of the flexible nature of Python, you can also add custom # properties to the wirevector. dummy_wv.my_custom_property_name = "John Clow is great" dummy_wv.custom_value_028493 = 13 # removing the wirevector from the block to prevent problems with the rest of # this example pyrtl.working_block().remove_wirevector(dummy_wv) # ---- Trivial Graph Format # Finally, there is a handy way to view your hardware creations as a graph. The function # output_to_trivialgraph will render your hardware a formal that you can then open with the # free software "yEd" (http://en.wikipedia.org/wiki/YEd). There are options under the # "heirachical" rendering to draw something looks quite like a circuit. import io print("--- Trivial Graph Format ---") with io.StringIO() as tgf: pyrtl.output_to_trivialgraph(tgf) print(tgf.getvalue())