예제 #1
0
 def test_short_transistor_with_auto_node_removal(self):
     netlist = Netlist()
     str_netlist = "M0001 OUT01 N0001 IN002 VDD PMOS\n"
     netlist.set_netlist(str_netlist)
     self.assertEqual(
         len(netlist.node_dicts_[netlist.get_set_name_for_node('N0001')]),
         1)
     old_gate_name = netlist.turn_on_transistor('M0001')
     self.assertEqual(old_gate_name, 'N0001')
     self.assertEqual(
         len(netlist.node_dicts_[netlist.get_set_name_for_node('N0001')]),
         0)
예제 #2
0
    def test_unshort_transistor(self):
        netlist = Netlist()
        str_netlist = "M0001 OUT01 N0001 IN002 VDD PMOS\n"
        netlist.set_netlist(str_netlist)
        self.assertEqual(
            len(netlist.node_dicts_[netlist.get_set_name_for_node('N0001')]),
            1)
        old_gate_name = netlist.turn_on_transistor('M0001')
        self.assertEqual(old_gate_name, 'N0001')
        self.assertEqual(
            len(netlist.node_dicts_[netlist.get_set_name_for_node('N0001')]),
            0)

        netlist.replace_transistor_gate('M0001', old_gate_name)
        self.assertEqual(
            len(netlist.node_dicts_[netlist.get_set_name_for_node('N0001')]),
            1)
        self.assertEqual(str_netlist, netlist.get_netlist_string())