def test_mux(self):
     "Defines a truth table for mux"
     self.assertFalse(mux(zero, zero, zero))
     self.assertFalse(mux(zero, zero, one))
     self.assertFalse(mux(zero, one, zero))
     self.assertTrue(mux(zero, one, one))
     self.assertTrue(mux(one, zero, zero))
     self.assertFalse(mux(one, zero, one))
     self.assertTrue(mux(one, one, zero))
     self.assertTrue(mux(one, one, one))
示例#2
0
 def __call__(self, bit, load, clock):
     initial_mux = mux(self.value, bit, load)
     self.value = self.dff(initial_mux, clock)
     return self.value
示例#3
0
def multimux(mult1, mult2, sel):
    "Takes two Multi instances and a 1-Bit sel and returns m1 if sel = 0 and m2 if sel = 1"
    a, b = pad_multi(mult1, mult2)
    return Multi(mux(pair[0], pair[1], sel) for pair in zip(a.value, b.value))
示例#4
0
def multimux(mult1, mult2, sel):
    "Takes two Multi instances and a 1-Bit sel and returns m1 if sel = 0 and m2 if sel = 1"
    a, b = pad_multi(mult1, mult2)
    return Multi(mux(pair[0], pair[1], sel) for pair in zip(a.value, b.value))
示例#5
0
 def __call__(self, bit, load, clock):
     initial_mux = mux(self.value, bit, load)
     self.value = self.dff(initial_mux, clock)
     return self.value