def test_longer_wires(self):
     a = pyrtl.Input(3, 'a')
     b = pyrtl.Input(2, 'b')
     out = pyrtl.Output(name='out')
     out <<= a + b
     pyrtl.synthesize()
     self.assertTrue(simulators.circuit_equivalence(lambda i, j: i + j, in_wires=(a, b)))
    def test_equivalence_fail(self):
        a, b = pyrtl.Input(1, 'a'), pyrtl.Input(1, 'b')
        out = pyrtl.Output(1, 'out')
        out <<= a & b

        def soft_or(a, b):
            return a | b

        self.assertFalse(simulators.circuit_equivalence(soft_or))
Beispiel #3
0
 def test_longer_wires(self):
     a = pyrtl.Input(3, 'a')
     b = pyrtl.Input(2, 'b')
     out = pyrtl.Output(name='out')
     out <<= a + b
     pyrtl.synthesize()
     self.assertTrue(
         simulators.circuit_equivalence(lambda i, j: i + j,
                                        in_wires=(a, b)))
Beispiel #4
0
    def test_equivalence_fail(self):
        a, b = pyrtl.Input(1, 'a'), pyrtl.Input(1, 'b')
        out = pyrtl.Output(1, 'out')
        out <<= a & b

        def soft_or(a, b):
            return a | b

        self.assertFalse(simulators.circuit_equivalence(soft_or))
 def test_equivalence_asymetrical(self):
     a, b = pyrtl.Input(1, 'a'), pyrtl.Input(1, 'b')
     out = pyrtl.Output(1, 'out')
     out <<= a & ~b
     self.assertFalse(simulators.circuit_equivalence(lambda i, j: i ^ ~j))
 def test_equivalence_pass(self):
     a, b = pyrtl.Input(1, 'a'), pyrtl.Input(1, 'b')
     out = pyrtl.Output(1, 'out')
     out <<= a & b
     self.assertTrue(simulators.circuit_equivalence(lambda i, j: i & j))
Beispiel #7
0
 def test_equivalence_asymetrical(self):
     a, b = pyrtl.Input(1, 'a'), pyrtl.Input(1, 'b')
     out = pyrtl.Output(1, 'out')
     out <<= a & ~b
     self.assertFalse(simulators.circuit_equivalence(lambda i, j: i ^ ~j))
Beispiel #8
0
 def test_equivalence_pass(self):
     a, b = pyrtl.Input(1, 'a'), pyrtl.Input(1, 'b')
     out = pyrtl.Output(1, 'out')
     out <<= a & b
     self.assertTrue(simulators.circuit_equivalence(lambda i, j: i & j))