mirror of
https://github.com/ehw-fit/ariths-gen.git
synced 2025-04-20 13:51:23 +01:00

* #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>
47 lines
1.6 KiB
Verilog
47 lines
1.6 KiB
Verilog
module s_rca4(input [3:0] a, input [3:0] b, output [4:0] s_rca4_out);
|
|
wire s_rca4_ha_xor0;
|
|
wire s_rca4_ha_and0;
|
|
wire s_rca4_fa1_xor0;
|
|
wire s_rca4_fa1_and0;
|
|
wire s_rca4_fa1_xor1;
|
|
wire s_rca4_fa1_and1;
|
|
wire s_rca4_fa1_or0;
|
|
wire s_rca4_fa2_xor0;
|
|
wire s_rca4_fa2_and0;
|
|
wire s_rca4_fa2_xor1;
|
|
wire s_rca4_fa2_and1;
|
|
wire s_rca4_fa2_or0;
|
|
wire s_rca4_fa3_xor0;
|
|
wire s_rca4_fa3_and0;
|
|
wire s_rca4_fa3_xor1;
|
|
wire s_rca4_fa3_and1;
|
|
wire s_rca4_fa3_or0;
|
|
wire s_rca4_xor0;
|
|
wire s_rca4_xor1;
|
|
|
|
assign s_rca4_ha_xor0 = a[0] ^ b[0];
|
|
assign s_rca4_ha_and0 = a[0] & b[0];
|
|
assign s_rca4_fa1_xor0 = a[1] ^ b[1];
|
|
assign s_rca4_fa1_and0 = a[1] & b[1];
|
|
assign s_rca4_fa1_xor1 = s_rca4_fa1_xor0 ^ s_rca4_ha_and0;
|
|
assign s_rca4_fa1_and1 = s_rca4_fa1_xor0 & s_rca4_ha_and0;
|
|
assign s_rca4_fa1_or0 = s_rca4_fa1_and0 | s_rca4_fa1_and1;
|
|
assign s_rca4_fa2_xor0 = a[2] ^ b[2];
|
|
assign s_rca4_fa2_and0 = a[2] & b[2];
|
|
assign s_rca4_fa2_xor1 = s_rca4_fa2_xor0 ^ s_rca4_fa1_or0;
|
|
assign s_rca4_fa2_and1 = s_rca4_fa2_xor0 & s_rca4_fa1_or0;
|
|
assign s_rca4_fa2_or0 = s_rca4_fa2_and0 | s_rca4_fa2_and1;
|
|
assign s_rca4_fa3_xor0 = a[3] ^ b[3];
|
|
assign s_rca4_fa3_and0 = a[3] & b[3];
|
|
assign s_rca4_fa3_xor1 = s_rca4_fa3_xor0 ^ s_rca4_fa2_or0;
|
|
assign s_rca4_fa3_and1 = s_rca4_fa3_xor0 & s_rca4_fa2_or0;
|
|
assign s_rca4_fa3_or0 = s_rca4_fa3_and0 | s_rca4_fa3_and1;
|
|
assign s_rca4_xor0 = a[3] ^ b[3];
|
|
assign s_rca4_xor1 = s_rca4_xor0 ^ s_rca4_fa3_or0;
|
|
|
|
assign s_rca4_out[0] = s_rca4_ha_xor0;
|
|
assign s_rca4_out[1] = s_rca4_fa1_xor1;
|
|
assign s_rca4_out[2] = s_rca4_fa2_xor1;
|
|
assign s_rca4_out[3] = s_rca4_fa3_xor1;
|
|
assign s_rca4_out[4] = s_rca4_xor1;
|
|
endmodule |