www.pudn.com > SHA1.zip > csa32.v, change:2001-02-09,size:842b


`include "add8_part.v" 
 
module csa32(a,     // 1 st input 
             b,     // 2 nd input 
 
             sum);  // MOD 2**32 
 
input  [31:0] a, 
              b; 
 
output [31:0] sum; 
 
wire          c_in, 
	      c7, c7_0, c7_1, 
	      c15, c15_0, c15_1, 
	      c23, c23_0, c23_1, 
	      c31_0, c31_1; 
 
assign c_in = 0; 
 
add8_part add8_1(a[7:0], b[7:0], c_in, c7_0, c7_1, sum[7:0]);    
add8_part add8_2(a[15:8], b[15:8], c7, c15_0, c15_1, sum[15:8]);    
add8_part add8_3(a[23:16], b[23:16], c15, c23_0, c23_1, sum[23:16]);    
add8_part add8_4(a[31:24], b[31:24], c23, c31_0, c31_1, sum[31:24]);    
 
assign c7  = (c_in & c7_1) | c7_0 ; 
assign c15 = (c7_0 & c15_1) | (c_in & c7_1 & c15_1) | c15_0 ; 
assign c23 = (c15_0 & c23_1) | (c7_0 & c15_1 & c23_1) 
	   | (c_in & c7_1 & c15_1 & c23_1) | c23_0; 
 
endmodule