Created
May 27, 2014 05:31
-
-
Save akfish/91b73348e2bc70d71fd7 to your computer and use it in GitHub Desktop.
Quantum Full Adder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a semi-quantum fulladder. It adds to b_in | |
// a c-number. Carry-in bit is c_in and carry_out is | |
// c_out. xlt-l and L are enablebits. See documentation | |
// for further information | |
proc muxfa a, b_in, c_in, c_out, xlt_l, L, total //a, | |
if a == 0//00 | |
Toffoli b_in, c_in, c_out | |
CNot b_in, c_in | |
endif | |
if a == 3//11 | |
Toffoli L, c_in, c_out | |
CNot L, c_in | |
Toffoli b_in, c_in, c_out | |
CNot b_in, c_in | |
endif | |
if a == 1//01 | |
Toffoli L, xlt_l, b_in | |
Toffoli b_in, c_in, c_out | |
Toffoli L, xlt_l, b_in | |
Toffoli b_in, c_in, c_out | |
Toffoli L, xlt_l, c_in | |
Toffoli b_in, c_in, c_out | |
CNot b_in, c_in | |
endif | |
if a == 2//10 | |
SigmaX xlt_l | |
Toffoli L, xlt_l, b_in | |
Toffoli b_in, c_in, c_out | |
Toffoli L, xlt_l, b_in | |
Toffoli b_in, c_in, c_out | |
Toffoli L, xlt_l, c_in | |
Toffoli b_in, c_in, c_out | |
CNot b_in, c_in | |
SigmaX xlt_l | |
endif | |
endproc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment