1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00
oh/common/hdl/oh_csa42.v
Andreas Olofsson 19fa611bb9 Massive reorganization to impove reuse
- adding more chip code
- pushing memory stuff into common
- making common "oh_" naming class
-
2015-11-30 13:45:49 -05:00

29 lines
497 B
Verilog

//CSA4:2 Compressor
module oh_csa42 (/*AUTOARG*/
// Outputs
s, c, c_out,
// Inputs
in0, in1, in2, in3, c_in
);
input in0;
input in1;
input in2;
input in3;
input c_in;
output s;
output c;
output c_out;
wire s_int;
assign s = in0 ^ in1 ^in2 ^in3 ^ c_in;
assign s_int = in1 ^ in2 ^ in3;
assign c = (in0 & s_int) | (in0 & c_in) | (s_int & c_in);
assign c_out = (in1 & in2) | (in1 & in3) | (in2 & in3);
endmodule // oh_csa42