Exemplo n.º 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()
Exemplo n.º 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_delay_node(self):
     calculator = DelayCalculator(self._root_node, [0, 0], [2, 3], self._unit_rc, RCAdjustment())
     self.assertAlmostEqual(calculator.calculate(), 36)
 def test_delay_gate(self):
     calculator = DelayCalculator(self._root_gate, [0, 0], [2, 3], self._unit_rc, RCAdjustment())
     self.assertEqual(calculator.calculate(), 4 * (4 + 5 + 2 + 3) + 5 * (5 / 2.0 + 3))