Exemple #1
0
    def _delay(self, root):
        if not isinstance(root, Node):
            raise TypeError('invalid type: Node expected')
        if not root:
            return 0, root.electro_property.c
        downstream_delays, downstream_caps = zip(*[self._delay(child) for child in root.neighbors()])

        delay_cal = DelayCalculator(root, downstream_delays, downstream_caps, self.unit_rc, self.wire_rc_adjustment)
        cap_cal = CapacitanceCalculator(root, downstream_caps, self.unit_rc, self.wire_rc_adjustment)
        return delay_cal.calculate(), cap_cal.calculate()
Exemple #2
0
    def _delay(self, root):
        if not isinstance(root, Node):
            raise TypeError('invalid type: Node expected')
        if not root:
            return 0, root.electro_property.c
        downstream_delays, downstream_caps = zip(
            *[self._delay(child) for child in root.neighbors()])

        delay_cal = DelayCalculator(root, downstream_delays, downstream_caps,
                                    self.unit_rc, self.wire_rc_adjustment)
        cap_cal = CapacitanceCalculator(root, downstream_caps, self.unit_rc,
                                        self.wire_rc_adjustment)
        return delay_cal.calculate(), cap_cal.calculate()
 def test_capacitor_node(self):
     calculator = CapacitanceCalculator(self._root_node, [2, 3], self._unit_rc, RCAdjustment())
     self.assertEqual(calculator.calculate(), 2 + 3 + 1 * 5 + 1 * 6)
 def test_capacitor_gate(self):
     calculator = CapacitanceCalculator(
         Gate(Coordinate([1, 1]), ElectroProperty([2, 2])), [2, 3], self._unit_rc, RCAdjustment()
     )
     self.assertEqual(calculator.calculate(), 2)