Skip to content

Commit

Permalink
Fix Mux16 endian
Browse files Browse the repository at this point in the history
  • Loading branch information
mlouielu committed Jul 3, 2017
1 parent 83ad254 commit 806e40f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nand2vm/gate/mux.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def Mux16(a: List[bool], b: List[bool], select: bool) -> List[bool]:
gate.Mux(a[13], b[13], select),
gate.Mux(a[14], b[14], select),
gate.Mux(a[15], b[15], select)
])
], endian=False)


def Mux4Way16(a: List[bool], b: List[bool], c: List[bool], d: List[bool],
Expand Down
5 changes: 5 additions & 0 deletions test/test_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def test_mux_16_gate(self):
self.assertEqual(gate.Mux16(a, b, False), a)
self.assertEqual(gate.Mux16(a, b, True), b)

a = BitArray('1100110000101101')
b = BitArray('0010101011001100')
self.assertEqual(gate.Mux16(a, b, False), a)
self.assertEqual(gate.Mux16(a, b, True), b)

def test_mux4way16_gate(self):
a = BitArray([True, True, False, False] * 4)
b = BitArray([True, False, True, False] * 4)
Expand Down

0 comments on commit 806e40f

Please sign in to comment.