2015-11-30 13:45:49 -05:00
|
|
|
//CSA4:2 Compressor
|
|
|
|
module oh_csa42 (/*AUTOARG*/
|
|
|
|
// Outputs
|
2015-12-03 18:01:47 -05:00
|
|
|
s, c, cout,
|
2015-11-30 13:45:49 -05:00
|
|
|
// Inputs
|
2015-12-03 18:01:47 -05:00
|
|
|
in0, in1, in2, in3, cin
|
2015-11-30 13:45:49 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
input in0;
|
|
|
|
input in1;
|
|
|
|
input in2;
|
|
|
|
input in3;
|
2015-12-03 18:01:47 -05:00
|
|
|
input cin;
|
2015-11-30 13:45:49 -05:00
|
|
|
|
|
|
|
output s;
|
|
|
|
output c;
|
2015-12-03 18:01:47 -05:00
|
|
|
output cout;
|
2015-11-30 13:45:49 -05:00
|
|
|
|
|
|
|
wire s_int;
|
|
|
|
|
2015-12-03 18:01:47 -05:00
|
|
|
assign s = in0 ^ in1 ^in2 ^in3 ^ cin;
|
2015-11-30 13:45:49 -05:00
|
|
|
assign s_int = in1 ^ in2 ^ in3;
|
2015-12-03 18:01:47 -05:00
|
|
|
assign c = (in0 & s_int) | (in0 & cin) | (s_int & cin);
|
|
|
|
assign cout = (in1 & in2) | (in1 & in3) | (in2 & in3);
|
2015-11-30 13:45:49 -05:00
|
|
|
|
|
|
|
endmodule // oh_csa42
|
|
|
|
|
|
|
|
|