/***************************** logic.lib *****************************/ component { in opd0[ n ], opd1[ n ] } orBits( n ) { out result[ n ] } begin for i from 0 upto n do { in opd1[ i ] opd0[ i ] } or( 2 ) { out result[ i ] }; end end component { in opd0[ n ], opd1[ n ] } andBits( n ) { out result[ n ] } begin for i from 0 upto n do { in opd1[ i ] opd0[ i ] } and( 2 ) { out result[ i ] }; end end component { in opd0[ n ], opd1[ n ] } xorBits( n ) { out result[ n ] } begin for i from 0 upto n do { in opd1[ i ] opd0[ i ] } xor( 2 ) { out result[ i ] }; end end component { in opd0[ n ], opd1[ n ] } norBits( n ) { out result[ n ] } begin for i from 0 upto n do { in opd1[ i ] opd0[ i ] } or( 2 ).not( 1 ) { out result[ i ] }; end end component { in opd0[ n ], opd1[ n ] } nandBits( n ) { out result[ n ] } begin for i from 0 upto n do { in opd1[ i ] opd0[ i ] } and( 2 ).not( 1 ) { out result[ i ] }; end end component { in opd0[ n ], opd1[ n ] } nxorBits( n ) { out result[ n ] } begin for i from 0 upto n do { in opd1[ i ] opd0[ i ] } xor( 2 ).not( 1 ) { out result[ i ] }; end end