Exemplo n.º 1
0
def RUQLG(L, A, B, C):
    A1, A2 = blocklogic.beamsplitter(A)
    A0 = blocklogic.blockpos(L, A1, A2)  # Block A
    # print('A0 = ', A0)
    B1, B2 = blocklogic.beamsplitter(B)
    B0 = blocklogic.blockpos(L, B1, B2)  # Block B
    # print('B0 = ',B0)
    sum = blocklogic.beamcombiner(A0, B0)
    # print ('sum = ', sum)
    v1, v2 = blocklogic.beamsplitter(sum)
    v0 = blocklogic.blockpos(L, v1, v2)  # Block V
    # print ('v0 =', v0)
    w1, w2 = blocklogic.beamsplitter(sum)
    w0 = blocklogic.blockpos(L, w1, w2)  # Block W
    # print('w0 = ',w0)
    C1, C2 = blocklogic.beamsplitter(C)
    C0 = blocklogic.blockpos(v0, C1, C2)  # Block C
    # print('C0 = ',C0)
    x1, x2 = blocklogic.beamsplitter(w0)
    x0 = blocklogic.blockneg(L, x1, x2)  # Block X
    # print('x0 = ',x0)
    y0 = blocklogic.blockpos(x0, C1, C2)  # Block Y
    # print('y0 = ',y0)
    z1, z2 = blocklogic.beamsplitter(C0)
    z0 = blocklogic.blockneg(v0, z1, z2)  # Block Z
    # print('z0 = ',z0)
    R = blocklogic.beamcombiner(y0, z0)
    return A0, B0, R
import blocklogic
print("This is simulating the OR gate using RUQLG\n")
print("Enter the following values : \n\n")

y = 'y'
while y == 'y':
    A1 = int(input("Enter A1 : "))
    A2 = int(input("Enter A2 : "))
    B1 = int(input("Enter B1 : "))
    B2 = int(input("Enter B2 : "))
    C1 = 0
    C2 = 0
    L = 3

    A0 = blocklogic.blockpos(L, A1, A2)  # Block A
    # print('A0 = ', A0)
    B0 = blocklogic.blockpos(L, B1, B2)  # Block B
    # print('B0 = ',B0)
    sum = blocklogic.beamcombiner(A0, B0)
    # print ('sum = ', sum)
    v1, v2 = blocklogic.beamsplitter(sum)
    v0 = blocklogic.blockpos(L, v1, v2)  # Block V
    # print ('v0 =', v0)
    w1, w2 = blocklogic.beamsplitter(sum)
    w0 = blocklogic.blockpos(L, w1, w2)  # Block W
    # print('w0 = ',w0)
    C0 = blocklogic.blockpos(v0, C1, C2)  # Block C
    # print('C0 = ',C0)
    x1, x2 = blocklogic.beamsplitter(w0)
    x0 = blocklogic.blockneg(L, x1, x2)  # Block X
    # print('x0 = ',x0)
Exemplo n.º 3
0
import blocklogic

print("This is simulating the QUAD valued OR gate\n")
print("Enter the following values : \n\n")

y = 'y'
while y == 'y':
    A1 = int(input("Enter A1 : "))
    A2 = int(input("Enter A2 : "))
    B1 = int(input("Enter B1 : "))
    B2 = int(input("Enter B2 : "))
    L = 3
    A0 = blocklogic.blockpos(L, A1, A2)
    B0 = blocklogic.blockpos(A0, B1, B2)

    print('\n\n\n')
    C1, C2 = blocklogic.beamsplitter(B0)
    print(A1, A2, ' AND ', B1, B2, ' = ', C1, C2)
    y = input('\n\nto continue press y   \n')
    A21 = int(input("Enter A2 : "))
    A12 = int(input("Enter B1 : "))
    A22 = int(input("Enter B2 : "))
    B11 = 0
    B21 = 0
    B12 = 0
    B22 = 0
    C11 = 1
    C21 = 1
    C12 = 1
    C22 = 1
    C13 = 1
    C23 = 1
    L = 3

    A01 = blocklogic.blockpos(L, A11, A21)  # Block A
    # print('A0 = ', A0)
    B01 = blocklogic.blockpos(L, B11, B21)  # Block B
    # print('B0 = ',B0)
    sum1 = blocklogic.beamcombiner(A01, B01)
    # print ('sum = ', sum)
    v011, v012 = blocklogic.beamsplitter(sum1)
    v01 = blocklogic.blockpos(L, v011, v012)  # Block V
    # print ('v0 =', v0)
    w011, w012 = blocklogic.beamsplitter(sum1)
    w01 = blocklogic.blockpos(L, w011, w012)  # Block W
    # print('w0 = ',w0)
    C01 = blocklogic.blockpos(v01, C11, C21)  # Block C
    # print('C0 = ',C0)
    x011, x012 = blocklogic.beamsplitter(w01)
    x01 = blocklogic.blockneg(L, x011, x012)  # Block X
Exemplo n.º 5
0
import blocklogic
print("This is simulating the QUAD valued OR gate\n")
print("Enter the following values : \n\n")

y = 'y'
while y == 'y':
    A1 = int(input("Enter A1 : "))
    A2 = int(input("Enter A2 : "))
    B1 = int(input("Enter B1 : "))
    B2 = int(input("Enter B2 : "))
    L = 3
    A0 = blocklogic.blockpos(L, A1, A2)
    B0 = blocklogic.subblocksneg(L, A0)

    print('\n\n\n')
    C1, C2 = blocklogic.beamsplitter(B0)
    print(A1, A2, ' NOT ', ' = ', C1, C2)
    y = input('\n\nto continue press y   \n')