
* #10 CGP Circuits as inputs (#11) * CGP Circuits as inputs * #10 support of signed output in general circuit * input as output works * output connected to input (c) * automated verilog testing * output rename * Implemented CSA and Wallace tree multiplier composing of CSAs. Also did some code cleanup. * Typos fix and code cleanup. * Added new (approximate) multiplier architectures and did some minor changes regarding sign extension for c output formats. * Updated automated testing scripts. * Small bugfix in python code generation (I initially thought this line is useless). * Updated generated circuits folder. Co-authored-by: Vojta Mrazek <mrazek@fit.vutbr.cz>
259 lines
16 KiB
C
259 lines
16 KiB
C
#include <stdio.h>
|
|
#include <stdint.h>
|
|
|
|
uint8_t xor_gate(uint8_t a, uint8_t b){
|
|
return ((a >> 0) & 0x01) ^ ((b >> 0) & 0x01);
|
|
}
|
|
|
|
uint8_t and_gate(uint8_t a, uint8_t b){
|
|
return ((a >> 0) & 0x01) & ((b >> 0) & 0x01);
|
|
}
|
|
|
|
uint8_t or_gate(uint8_t a, uint8_t b){
|
|
return ((a >> 0) & 0x01) | ((b >> 0) & 0x01);
|
|
}
|
|
|
|
uint8_t pg_fa(uint8_t a, uint8_t b, uint8_t cin){
|
|
uint8_t pg_fa_out = 0;
|
|
uint8_t pg_fa_xor0 = 0;
|
|
uint8_t pg_fa_and0 = 0;
|
|
uint8_t pg_fa_xor1 = 0;
|
|
|
|
pg_fa_xor0 = xor_gate(((a >> 0) & 0x01), ((b >> 0) & 0x01));
|
|
pg_fa_and0 = and_gate(((a >> 0) & 0x01), ((b >> 0) & 0x01));
|
|
pg_fa_xor1 = xor_gate(((pg_fa_xor0 >> 0) & 0x01), ((cin >> 0) & 0x01));
|
|
|
|
pg_fa_out |= ((pg_fa_xor0 >> 0) & 0x01ull) << 0;
|
|
pg_fa_out |= ((pg_fa_and0 >> 0) & 0x01ull) << 1;
|
|
pg_fa_out |= ((pg_fa_xor1 >> 0) & 0x01ull) << 2;
|
|
return pg_fa_out;
|
|
}
|
|
|
|
int64_t s_pg_rca16(int64_t a, int64_t b){
|
|
int64_t s_pg_rca16_out = 0;
|
|
uint8_t s_pg_rca16_pg_fa0_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa0_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa1_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa1_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa1_xor1 = 0;
|
|
uint8_t s_pg_rca16_and1 = 0;
|
|
uint8_t s_pg_rca16_or1 = 0;
|
|
uint8_t s_pg_rca16_pg_fa2_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa2_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa2_xor1 = 0;
|
|
uint8_t s_pg_rca16_and2 = 0;
|
|
uint8_t s_pg_rca16_or2 = 0;
|
|
uint8_t s_pg_rca16_pg_fa3_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa3_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa3_xor1 = 0;
|
|
uint8_t s_pg_rca16_and3 = 0;
|
|
uint8_t s_pg_rca16_or3 = 0;
|
|
uint8_t s_pg_rca16_pg_fa4_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa4_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa4_xor1 = 0;
|
|
uint8_t s_pg_rca16_and4 = 0;
|
|
uint8_t s_pg_rca16_or4 = 0;
|
|
uint8_t s_pg_rca16_pg_fa5_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa5_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa5_xor1 = 0;
|
|
uint8_t s_pg_rca16_and5 = 0;
|
|
uint8_t s_pg_rca16_or5 = 0;
|
|
uint8_t s_pg_rca16_pg_fa6_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa6_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa6_xor1 = 0;
|
|
uint8_t s_pg_rca16_and6 = 0;
|
|
uint8_t s_pg_rca16_or6 = 0;
|
|
uint8_t s_pg_rca16_pg_fa7_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa7_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa7_xor1 = 0;
|
|
uint8_t s_pg_rca16_and7 = 0;
|
|
uint8_t s_pg_rca16_or7 = 0;
|
|
uint8_t s_pg_rca16_pg_fa8_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa8_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa8_xor1 = 0;
|
|
uint8_t s_pg_rca16_and8 = 0;
|
|
uint8_t s_pg_rca16_or8 = 0;
|
|
uint8_t s_pg_rca16_pg_fa9_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa9_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa9_xor1 = 0;
|
|
uint8_t s_pg_rca16_and9 = 0;
|
|
uint8_t s_pg_rca16_or9 = 0;
|
|
uint8_t s_pg_rca16_pg_fa10_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa10_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa10_xor1 = 0;
|
|
uint8_t s_pg_rca16_and10 = 0;
|
|
uint8_t s_pg_rca16_or10 = 0;
|
|
uint8_t s_pg_rca16_pg_fa11_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa11_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa11_xor1 = 0;
|
|
uint8_t s_pg_rca16_and11 = 0;
|
|
uint8_t s_pg_rca16_or11 = 0;
|
|
uint8_t s_pg_rca16_pg_fa12_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa12_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa12_xor1 = 0;
|
|
uint8_t s_pg_rca16_and12 = 0;
|
|
uint8_t s_pg_rca16_or12 = 0;
|
|
uint8_t s_pg_rca16_pg_fa13_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa13_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa13_xor1 = 0;
|
|
uint8_t s_pg_rca16_and13 = 0;
|
|
uint8_t s_pg_rca16_or13 = 0;
|
|
uint8_t s_pg_rca16_pg_fa14_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa14_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa14_xor1 = 0;
|
|
uint8_t s_pg_rca16_and14 = 0;
|
|
uint8_t s_pg_rca16_or14 = 0;
|
|
uint8_t s_pg_rca16_pg_fa15_xor0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa15_and0 = 0;
|
|
uint8_t s_pg_rca16_pg_fa15_xor1 = 0;
|
|
uint8_t s_pg_rca16_and15 = 0;
|
|
uint8_t s_pg_rca16_or15 = 0;
|
|
uint8_t s_pg_rca16_xor0 = 0;
|
|
uint8_t s_pg_rca16_xor1 = 0;
|
|
|
|
s_pg_rca16_pg_fa0_xor0 = (pg_fa(((a >> 0) & 0x01), ((b >> 0) & 0x01), (0x00)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa0_and0 = (pg_fa(((a >> 0) & 0x01), ((b >> 0) & 0x01), (0x00)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa1_xor0 = (pg_fa(((a >> 1) & 0x01), ((b >> 1) & 0x01), ((s_pg_rca16_pg_fa0_and0 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa1_and0 = (pg_fa(((a >> 1) & 0x01), ((b >> 1) & 0x01), ((s_pg_rca16_pg_fa0_and0 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa1_xor1 = (pg_fa(((a >> 1) & 0x01), ((b >> 1) & 0x01), ((s_pg_rca16_pg_fa0_and0 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and1 = and_gate(((s_pg_rca16_pg_fa0_and0 >> 0) & 0x01), ((s_pg_rca16_pg_fa1_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or1 = or_gate(((s_pg_rca16_and1 >> 0) & 0x01), ((s_pg_rca16_pg_fa1_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa2_xor0 = (pg_fa(((a >> 2) & 0x01), ((b >> 2) & 0x01), ((s_pg_rca16_or1 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa2_and0 = (pg_fa(((a >> 2) & 0x01), ((b >> 2) & 0x01), ((s_pg_rca16_or1 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa2_xor1 = (pg_fa(((a >> 2) & 0x01), ((b >> 2) & 0x01), ((s_pg_rca16_or1 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and2 = and_gate(((s_pg_rca16_or1 >> 0) & 0x01), ((s_pg_rca16_pg_fa2_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or2 = or_gate(((s_pg_rca16_and2 >> 0) & 0x01), ((s_pg_rca16_pg_fa2_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa3_xor0 = (pg_fa(((a >> 3) & 0x01), ((b >> 3) & 0x01), ((s_pg_rca16_or2 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa3_and0 = (pg_fa(((a >> 3) & 0x01), ((b >> 3) & 0x01), ((s_pg_rca16_or2 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa3_xor1 = (pg_fa(((a >> 3) & 0x01), ((b >> 3) & 0x01), ((s_pg_rca16_or2 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and3 = and_gate(((s_pg_rca16_or2 >> 0) & 0x01), ((s_pg_rca16_pg_fa3_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or3 = or_gate(((s_pg_rca16_and3 >> 0) & 0x01), ((s_pg_rca16_pg_fa3_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa4_xor0 = (pg_fa(((a >> 4) & 0x01), ((b >> 4) & 0x01), ((s_pg_rca16_or3 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa4_and0 = (pg_fa(((a >> 4) & 0x01), ((b >> 4) & 0x01), ((s_pg_rca16_or3 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa4_xor1 = (pg_fa(((a >> 4) & 0x01), ((b >> 4) & 0x01), ((s_pg_rca16_or3 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and4 = and_gate(((s_pg_rca16_or3 >> 0) & 0x01), ((s_pg_rca16_pg_fa4_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or4 = or_gate(((s_pg_rca16_and4 >> 0) & 0x01), ((s_pg_rca16_pg_fa4_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa5_xor0 = (pg_fa(((a >> 5) & 0x01), ((b >> 5) & 0x01), ((s_pg_rca16_or4 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa5_and0 = (pg_fa(((a >> 5) & 0x01), ((b >> 5) & 0x01), ((s_pg_rca16_or4 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa5_xor1 = (pg_fa(((a >> 5) & 0x01), ((b >> 5) & 0x01), ((s_pg_rca16_or4 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and5 = and_gate(((s_pg_rca16_or4 >> 0) & 0x01), ((s_pg_rca16_pg_fa5_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or5 = or_gate(((s_pg_rca16_and5 >> 0) & 0x01), ((s_pg_rca16_pg_fa5_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa6_xor0 = (pg_fa(((a >> 6) & 0x01), ((b >> 6) & 0x01), ((s_pg_rca16_or5 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa6_and0 = (pg_fa(((a >> 6) & 0x01), ((b >> 6) & 0x01), ((s_pg_rca16_or5 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa6_xor1 = (pg_fa(((a >> 6) & 0x01), ((b >> 6) & 0x01), ((s_pg_rca16_or5 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and6 = and_gate(((s_pg_rca16_or5 >> 0) & 0x01), ((s_pg_rca16_pg_fa6_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or6 = or_gate(((s_pg_rca16_and6 >> 0) & 0x01), ((s_pg_rca16_pg_fa6_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa7_xor0 = (pg_fa(((a >> 7) & 0x01), ((b >> 7) & 0x01), ((s_pg_rca16_or6 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa7_and0 = (pg_fa(((a >> 7) & 0x01), ((b >> 7) & 0x01), ((s_pg_rca16_or6 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa7_xor1 = (pg_fa(((a >> 7) & 0x01), ((b >> 7) & 0x01), ((s_pg_rca16_or6 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and7 = and_gate(((s_pg_rca16_or6 >> 0) & 0x01), ((s_pg_rca16_pg_fa7_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or7 = or_gate(((s_pg_rca16_and7 >> 0) & 0x01), ((s_pg_rca16_pg_fa7_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa8_xor0 = (pg_fa(((a >> 8) & 0x01), ((b >> 8) & 0x01), ((s_pg_rca16_or7 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa8_and0 = (pg_fa(((a >> 8) & 0x01), ((b >> 8) & 0x01), ((s_pg_rca16_or7 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa8_xor1 = (pg_fa(((a >> 8) & 0x01), ((b >> 8) & 0x01), ((s_pg_rca16_or7 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and8 = and_gate(((s_pg_rca16_or7 >> 0) & 0x01), ((s_pg_rca16_pg_fa8_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or8 = or_gate(((s_pg_rca16_and8 >> 0) & 0x01), ((s_pg_rca16_pg_fa8_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa9_xor0 = (pg_fa(((a >> 9) & 0x01), ((b >> 9) & 0x01), ((s_pg_rca16_or8 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa9_and0 = (pg_fa(((a >> 9) & 0x01), ((b >> 9) & 0x01), ((s_pg_rca16_or8 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa9_xor1 = (pg_fa(((a >> 9) & 0x01), ((b >> 9) & 0x01), ((s_pg_rca16_or8 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and9 = and_gate(((s_pg_rca16_or8 >> 0) & 0x01), ((s_pg_rca16_pg_fa9_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or9 = or_gate(((s_pg_rca16_and9 >> 0) & 0x01), ((s_pg_rca16_pg_fa9_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa10_xor0 = (pg_fa(((a >> 10) & 0x01), ((b >> 10) & 0x01), ((s_pg_rca16_or9 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa10_and0 = (pg_fa(((a >> 10) & 0x01), ((b >> 10) & 0x01), ((s_pg_rca16_or9 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa10_xor1 = (pg_fa(((a >> 10) & 0x01), ((b >> 10) & 0x01), ((s_pg_rca16_or9 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and10 = and_gate(((s_pg_rca16_or9 >> 0) & 0x01), ((s_pg_rca16_pg_fa10_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or10 = or_gate(((s_pg_rca16_and10 >> 0) & 0x01), ((s_pg_rca16_pg_fa10_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa11_xor0 = (pg_fa(((a >> 11) & 0x01), ((b >> 11) & 0x01), ((s_pg_rca16_or10 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa11_and0 = (pg_fa(((a >> 11) & 0x01), ((b >> 11) & 0x01), ((s_pg_rca16_or10 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa11_xor1 = (pg_fa(((a >> 11) & 0x01), ((b >> 11) & 0x01), ((s_pg_rca16_or10 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and11 = and_gate(((s_pg_rca16_or10 >> 0) & 0x01), ((s_pg_rca16_pg_fa11_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or11 = or_gate(((s_pg_rca16_and11 >> 0) & 0x01), ((s_pg_rca16_pg_fa11_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa12_xor0 = (pg_fa(((a >> 12) & 0x01), ((b >> 12) & 0x01), ((s_pg_rca16_or11 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa12_and0 = (pg_fa(((a >> 12) & 0x01), ((b >> 12) & 0x01), ((s_pg_rca16_or11 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa12_xor1 = (pg_fa(((a >> 12) & 0x01), ((b >> 12) & 0x01), ((s_pg_rca16_or11 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and12 = and_gate(((s_pg_rca16_or11 >> 0) & 0x01), ((s_pg_rca16_pg_fa12_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or12 = or_gate(((s_pg_rca16_and12 >> 0) & 0x01), ((s_pg_rca16_pg_fa12_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa13_xor0 = (pg_fa(((a >> 13) & 0x01), ((b >> 13) & 0x01), ((s_pg_rca16_or12 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa13_and0 = (pg_fa(((a >> 13) & 0x01), ((b >> 13) & 0x01), ((s_pg_rca16_or12 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa13_xor1 = (pg_fa(((a >> 13) & 0x01), ((b >> 13) & 0x01), ((s_pg_rca16_or12 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and13 = and_gate(((s_pg_rca16_or12 >> 0) & 0x01), ((s_pg_rca16_pg_fa13_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or13 = or_gate(((s_pg_rca16_and13 >> 0) & 0x01), ((s_pg_rca16_pg_fa13_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa14_xor0 = (pg_fa(((a >> 14) & 0x01), ((b >> 14) & 0x01), ((s_pg_rca16_or13 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa14_and0 = (pg_fa(((a >> 14) & 0x01), ((b >> 14) & 0x01), ((s_pg_rca16_or13 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa14_xor1 = (pg_fa(((a >> 14) & 0x01), ((b >> 14) & 0x01), ((s_pg_rca16_or13 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and14 = and_gate(((s_pg_rca16_or13 >> 0) & 0x01), ((s_pg_rca16_pg_fa14_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or14 = or_gate(((s_pg_rca16_and14 >> 0) & 0x01), ((s_pg_rca16_pg_fa14_and0 >> 0) & 0x01));
|
|
s_pg_rca16_pg_fa15_xor0 = (pg_fa(((a >> 15) & 0x01), ((b >> 15) & 0x01), ((s_pg_rca16_or14 >> 0) & 0x01)) >> 0) & 0x01;
|
|
s_pg_rca16_pg_fa15_and0 = (pg_fa(((a >> 15) & 0x01), ((b >> 15) & 0x01), ((s_pg_rca16_or14 >> 0) & 0x01)) >> 1) & 0x01;
|
|
s_pg_rca16_pg_fa15_xor1 = (pg_fa(((a >> 15) & 0x01), ((b >> 15) & 0x01), ((s_pg_rca16_or14 >> 0) & 0x01)) >> 2) & 0x01;
|
|
s_pg_rca16_and15 = and_gate(((s_pg_rca16_or14 >> 0) & 0x01), ((s_pg_rca16_pg_fa15_xor0 >> 0) & 0x01));
|
|
s_pg_rca16_or15 = or_gate(((s_pg_rca16_and15 >> 0) & 0x01), ((s_pg_rca16_pg_fa15_and0 >> 0) & 0x01));
|
|
s_pg_rca16_xor0 = xor_gate(((a >> 15) & 0x01), ((b >> 15) & 0x01));
|
|
s_pg_rca16_xor1 = xor_gate(((s_pg_rca16_xor0 >> 0) & 0x01), ((s_pg_rca16_or15 >> 0) & 0x01));
|
|
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa0_xor0 >> 0) & 0x01ull) << 0;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa1_xor1 >> 0) & 0x01ull) << 1;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa2_xor1 >> 0) & 0x01ull) << 2;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa3_xor1 >> 0) & 0x01ull) << 3;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa4_xor1 >> 0) & 0x01ull) << 4;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa5_xor1 >> 0) & 0x01ull) << 5;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa6_xor1 >> 0) & 0x01ull) << 6;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa7_xor1 >> 0) & 0x01ull) << 7;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa8_xor1 >> 0) & 0x01ull) << 8;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa9_xor1 >> 0) & 0x01ull) << 9;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa10_xor1 >> 0) & 0x01ull) << 10;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa11_xor1 >> 0) & 0x01ull) << 11;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa12_xor1 >> 0) & 0x01ull) << 12;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa13_xor1 >> 0) & 0x01ull) << 13;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa14_xor1 >> 0) & 0x01ull) << 14;
|
|
s_pg_rca16_out |= ((s_pg_rca16_pg_fa15_xor1 >> 0) & 0x01ull) << 15;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 16;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 17;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 18;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 19;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 20;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 21;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 22;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 23;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 24;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 25;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 26;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 27;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 28;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 29;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 30;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 31;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 32;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 33;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 34;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 35;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 36;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 37;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 38;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 39;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 40;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 41;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 42;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 43;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 44;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 45;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 46;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 47;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 48;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 49;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 50;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 51;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 52;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 53;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 54;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 55;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 56;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 57;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 58;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 59;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 60;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 61;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 62;
|
|
s_pg_rca16_out |= ((s_pg_rca16_xor1 >> 0) & 0x01ull) << 63;
|
|
return s_pg_rca16_out;
|
|
} |