narrowed down comparator XOR to 6 unique operations
http://pbin.in/haxTheHax
here's the output now:
add is shorthand for A+B
sub is shorthand for A-B
subiB is shorthand for A-!B
Also everything works under the assumption that A>=B atm. Maybe I'll rework it later so that the order doesn't matter.
http://pbin.in/haxTheHax
here's the output now:
Code:
Testing 0000 ^ 0000...
add
sub
subiB-1
Testing 0001 ^ 0000...
add
sub
Testing 0010 ^ 0000...
add
sub
Testing 0011 ^ 0000...
add
sub
Testing 0100 ^ 0000...
add
sub
Testing 0101 ^ 0000...
add
sub
Testing 0110 ^ 0000...
add
sub
Testing 0111 ^ 0000...
add
sub
!(add+1)
Testing 1000 ^ 0000...
add
sub
!(sub-1)
Testing 1001 ^ 0000...
add
sub
Testing 1010 ^ 0000...
add
sub
Testing 1011 ^ 0000...
add
sub
Testing 1100 ^ 0000...
add
sub
Testing 1101 ^ 0000...
add
sub
Testing 1110 ^ 0000...
add
sub
Testing 1111 ^ 0000...
add
sub
!subiB
Testing 0001 ^ 0001...
sub
subiB-1
Testing 0010 ^ 0001...
add
Testing 0011 ^ 0001...
sub
Testing 0100 ^ 0001...
add
Testing 0101 ^ 0001...
sub
Testing 0110 ^ 0001...
add
!(add+1)
Testing 0111 ^ 0001...
sub
!(add+1)
Testing 1000 ^ 0001...
add
!(sub-1)
Testing 1001 ^ 0001...
sub
!(sub-1)
Testing 1010 ^ 0001...
add
Testing 1011 ^ 0001...
sub
Testing 1100 ^ 0001...
add
Testing 1101 ^ 0001...
sub
Testing 1110 ^ 0001...
add
!subiB
Testing 1111 ^ 0001...
sub
!subiB
Testing 0010 ^ 0010...
sub
subiB-1
Testing 0011 ^ 0010...
sub
Testing 0100 ^ 0010...
add
Testing 0101 ^ 0010...
add
!(add+1)
Testing 0110 ^ 0010...
sub
Testing 0111 ^ 0010...
sub
!(add+1)
Testing 1000 ^ 0010...
add
!(sub-1)
Testing 1001 ^ 0010...
add
Testing 1010 ^ 0010...
sub
!(sub-1)
Testing 1011 ^ 0010...
sub
Testing 1100 ^ 0010...
add
Testing 1101 ^ 0010...
add
!subiB
Testing 1110 ^ 0010...
sub
Testing 1111 ^ 0010...
sub
!subiB
Testing 0011 ^ 0011...
sub
subiB-1
Testing 0100 ^ 0011...
add
!(add+1)
Testing 0101 ^ 0011...
!(add+1)
Testing 0110 ^ 0011...
!(add+1)
Testing 0111 ^ 0011...
sub
!(add+1)
Testing 1000 ^ 0011...
add
!(sub-1)
Testing 1001 ^ 0011...
!(sub-1)
Testing 1010 ^ 0011...
!(sub-1)
Testing 1011 ^ 0011...
sub
!(sub-1)
Testing 1100 ^ 0011...
add
!subiB
Testing 1101 ^ 0011...
!subiB
Testing 1110 ^ 0011...
!subiB
Testing 1111 ^ 0011...
sub
!subiB
Testing 0100 ^ 0100...
sub
subiB-1
Testing 0101 ^ 0100...
sub
Testing 0110 ^ 0100...
sub
Testing 0111 ^ 0100...
sub
!(add+1)
Testing 1000 ^ 0100...
add
!(sub-1)
Testing 1001 ^ 0100...
add
Testing 1010 ^ 0100...
add
Testing 1011 ^ 0100...
add
!subiB
Testing 1100 ^ 0100...
sub
!(sub-1)
Testing 1101 ^ 0100...
sub
Testing 1110 ^ 0100...
sub
Testing 1111 ^ 0100...
sub
!subiB
Testing 0101 ^ 0101...
sub
subiB-1
Testing 0110 ^ 0101...
!(add+1)
Testing 0111 ^ 0101...
sub
!(add+1)
Testing 1000 ^ 0101...
add
!(sub-1)
Testing 1001 ^ 0101...
!(sub-1)
Testing 1010 ^ 0101...
add
!subiB
Testing 1011 ^ 0101...
!subiB
Testing 1100 ^ 0101...
!(sub-1)
Testing 1101 ^ 0101...
sub
!(sub-1)
Testing 1110 ^ 0101...
!subiB
Testing 1111 ^ 0101...
sub
!subiB
Testing 0110 ^ 0110...
sub
subiB-1
Testing 0111 ^ 0110...
sub
!(add+1)
Testing 1000 ^ 0110...
add
!(sub-1)
Testing 1001 ^ 0110...
add
!subiB
Testing 1010 ^ 0110...
!(sub-1)
Testing 1011 ^ 0110...
!subiB
Testing 1100 ^ 0110...
!(sub-1)
Testing 1101 ^ 0110...
!subiB
Testing 1110 ^ 0110...
sub
!(sub-1)
Testing 1111 ^ 0110...
sub
!subiB
Testing 0111 ^ 0111...
sub
!(add+1)
subiB-1
Testing 1000 ^ 0111...
add
!subiB
!(sub-1)
Testing 1001 ^ 0111...
!subiB
!(sub-1)
Testing 1010 ^ 0111...
!subiB
!(sub-1)
Testing 1011 ^ 0111...
!subiB
!(sub-1)
Testing 1100 ^ 0111...
!subiB
!(sub-1)
Testing 1101 ^ 0111...
!subiB
!(sub-1)
Testing 1110 ^ 0111...
!subiB
!(sub-1)
Testing 1111 ^ 0111...
sub
!subiB
!(sub-1)
Testing 1000 ^ 1000...
sub
!(add+1)
subiB-1
Testing 1001 ^ 1000...
sub
subiB-1
Testing 1010 ^ 1000...
sub
subiB-1
Testing 1011 ^ 1000...
sub
subiB-1
Testing 1100 ^ 1000...
sub
subiB-1
Testing 1101 ^ 1000...
sub
subiB-1
Testing 1110 ^ 1000...
sub
subiB-1
Testing 1111 ^ 1000...
sub
!subiB
subiB-1
Testing 1001 ^ 1001...
sub
!(add+1)
Testing 1010 ^ 1001...
subiB-1
Testing 1011 ^ 1001...
sub
Testing 1100 ^ 1001...
subiB-1
Testing 1101 ^ 1001...
sub
Testing 1110 ^ 1001...
!subiB
subiB-1
Testing 1111 ^ 1001...
sub
!subiB
Testing 1010 ^ 1010...
sub
!(add+1)
Testing 1011 ^ 1010...
sub
Testing 1100 ^ 1010...
subiB-1
Testing 1101 ^ 1010...
!subiB
subiB-1
Testing 1110 ^ 1010...
sub
Testing 1111 ^ 1010...
sub
!subiB
Testing 1011 ^ 1011...
sub
!(add+1)
Testing 1100 ^ 1011...
!subiB
subiB-1
Testing 1101 ^ 1011...
!subiB
Testing 1110 ^ 1011...
!subiB
Testing 1111 ^ 1011...
sub
!subiB
Testing 1100 ^ 1100...
sub
!(add+1)
Testing 1101 ^ 1100...
sub
Testing 1110 ^ 1100...
sub
Testing 1111 ^ 1100...
sub
!subiB
Testing 1101 ^ 1101...
sub
!(add+1)
Testing 1110 ^ 1101...
!subiB
Testing 1111 ^ 1101...
sub
!subiB
Testing 1110 ^ 1110...
sub
!(add+1)
Testing 1111 ^ 1110...
sub
!subiB
Testing 1111 ^ 1111...
sub
!subiB
!(add+1)
Necessary operations:
add
sub
!subiB
!(add+1)
!(sub-1)
subiB-1
add is shorthand for A+B
sub is shorthand for A-B
subiB is shorthand for A-!B
Also everything works under the assumption that A>=B atm. Maybe I'll rework it later so that the order doesn't matter.