

:define NOT[w=1]
:input	A[w]
:output	Q[w]
:expression
	Q = NotGate(A)

:define NAND[w=1]
:input	A[w],B[w]
:output	Q[w]
:expression
	Q = NandGate(A,B)

:define WIRE_AND[w=1]
:input	A[w],B[w]
:output	Q[w]
:expression
	Q = WireAndGate(A,B)

:define XOR[w=1]
:input	A[w],B[w]
:output	Q[w]
:expression
	Q = OR( AND(A,!B), AND(!A,B) )

:define AND[w=1]
:input	A[w],B[w]
:output	Q[w]
:expression
	Q = NOT(NAND(A,B))

:define OR[w=1]
:input	A[w],B[w]
:output	Q[w]
:expression
	Q = NAND(!A,!B)

:define NOR[w=1]
:input	A[w],B[w]
:output	Q[w]
:expression
	Q = NOT(NAND(!A,!B))

:define NAND_FF[w=1]
:input	nSET[w],nRES[w]
:output	Q[w],nQ[w]
:signals
	q,r
:expression
	q = nSET & r
	r = nSET & q
	Q = q
	nQ = r







