Ejemplo n.º 1
0
 def test_uniquify_simple_with_names(self):
     '''simple test with 2 definitions.'''
     nl = Netlist()
     lib = nl.create_library()
     d1 = lib.create_definition()
     d1.name = "definition1"
     d2 = lib.create_definition()
     d2.name = "definition2"
     d3 = lib.create_definition()
     d3.name = "leaf definition"
     i1 = d1.create_child()
     i1.name = "instance1"
     i2 = d1.create_child()
     i2.name = "instance2"
     i1.reference = d2
     i2.reference = d2
     i3 = d2.create_child()
     i3.name = "leaf cell"
     i3.reference = d3
     top = Instance()
     top.name = "top instance"
     top.reference = d1
     nl.top_instance = top
     assert not self.is_unique(nl), "initial netlist should not be unique in this test"
     uniquify(nl)
     assert self.is_unique(nl), "netlist should have been uniquified."
Ejemplo n.º 2
0
    def test_flatten_cables(self):
        nl = self.create_netlist_with_wires()
        self.simple_cable_connection_visualizer(nl)

        uniquify(nl)
        flatten(nl)
        self.simple_cable_connection_visualizer(nl)

        assert self.is_flat(
            nl)  #might be nice to add some tests for the connections here.
Ejemplo n.º 3
0
 def test_already_unique(self):
     nl = Netlist()
     lib = nl.create_library()
     d1 = lib.create_definition()
     d2 = lib.create_definition()
     d3 = lib.create_definition()
     i1 = d1.create_child()
     i2 = d1.create_child()
     i1.reference = d2
     i2.reference = d3
     top = Instance()
     top.reference = d1
     nl.top_instance = top
     assert self.is_unique(nl), "netlist should be unique upon creation in this test"
     uniquify(nl)
     assert self.is_unique(nl), "netlist should remain unique in this test. somehow uniquify made the netlist un-unique"
Ejemplo n.º 4
0
 def test_is_unique(self):
     example_name = 'unique_challenge'
     netlist = sdn.load_example_netlist_by_name(example_name)
     self.assertFalse(netlist.is_unique())
     uniquify(netlist)
     self.assertTrue(netlist.is_unique())
Ejemplo n.º 5
0
 def test_uniquify(self):
     nl = self.create_netlist()
     assert not self.is_unique(nl), "our test netlist should not be unique"
     uniquify(nl)
     assert self.is_unique(nl), "our netlist should have been uniquified"
Ejemplo n.º 6
0
 def test_flatten_instances(self):
     nl = self.create_netlist()
     uniquify(nl)
     flatten(nl)
     assert self.is_flat(nl)