dp_adder32.v 2.23 KB
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:	dp_adder32
// description:	32 bit carry-propagating adder for use in replacing 
//		datapath adder with standard cells.  Requires carry 
//		in and carry out.
//		Ripple adder with high performance ad01d1 cells for 
//		lower 16 bits and thenm carry select on two 16 bit
//		ripple adders for upper 16 bits.
//
// designer:	Brian Ferguson
// date:	3/13/95
//
////////////////////////////////////////////////////////////////////////

module dp_adder32 (
			input1,
			input2,
			carryin,
			sumout,
			carryout14,
			carryout15,
			carryout30,
			carryout31
		  ) ;

input [31:0] input1;
input [31:0] input2;
input carryin;

output [31:0] sumout;
output carryout14;	// carry out for bit 14 used to generate overflow
output carryout15;	// carry out for bit 15
output carryout30;	// carry out for bit 30 used to generate overflow
output carryout31;	// carry out for bit 31


wire [15:0] sumupr0;	// sum upper assuming carry in 0
wire [15:0] sumupr1;	// sum upper assuming carry in 1
wire carry0b30;		// carry out assuming carry in 0
wire carry0b31;		// carry out assuming carry in 0
wire carry1b30;		// carry out assuming carry in 1
wire carry1b31;		// carry out assuming carry in 1


dp_adder16  dpadduprcin0 (
				.input1		(input1[31:16]),
				.input2		(input2[31:16]),
				.carryin	(1'b0),
				.sumout		(sumupr0[15:0]),
				.carryout14	(carry0b30),
				.carryout	(carry0b31)
			   ) ;

dp_adder16  dpadduprcin1 (
				.input1		(input1[31:16]),
				.input2		(input2[31:16]),
				.carryin	(1'b1),
				.sumout		(sumupr1[15:0]),
				.carryout14	(carry1b30),
				.carryout	(carry1b31)
			   ) ;

dp_adder16  dpaddlwr (
				.input1		(input1[15:0]),
				.input2		(input2[15:0]),
				.carryin	(carryin),
				.sumout		(sumout[15:0]),
				.carryout14	(carryout14),
				.carryout	(carryout15)
			  ) ;

dp_2to1mx16  dpcarryselmx (
				.input0		(sumupr0),
				.input1		(sumupr1),
				.select		(carryout15),
				.output_data	(sumout[31:16])
			  ) ;

mx21d1h	coutb30	(	.z		(carryout30),
			.i0		(carry0b30),
			.i1		(carry1b30),
			.s		(carryout15)
		) ;


mx21d1h	coutb31	(	.z		(carryout31),
			.i0		(carry0b31),
			.i1		(carry1b31),
			.s		(carryout15)
		) ;



endmodule // dp_adder32