dp_incdec16.v 6.84 KB
/*
*************************************************************************
*									*
*               Copyright (C) 1994, Silicon Graphics, Inc.		*
*									*
*  These coded instructions, statements, and computer programs  contain	*
*  unpublished  proprietary  information of Silicon Graphics, Inc., and	*
*  are protected by Federal copyright  law.  They  may not be disclosed	*
*  to  third  parties  or copied or duplicated in any form, in whole or	*
*  in part, without the prior written consent of Silicon Graphics, Inc.	*
*									*
*************************************************************************
*/

/*
*************************************************************************
*									*
*  Project Reality							*
*									*
*  module:	dp_incdec16.v						*
*  description:	16 bit incrementer/decrementer which is optimised	*
*		for minimum area therefore is implemented as a 		*
*		ripple carry.						*
*									*
*									*
*  designer:	Brian Ferguson						*
*  date:	3/21/95							*
*									*
*************************************************************************
*/

// $Id: dp_incdec16.v,v 1.1 2002/03/28 00:26:14 berndt Exp $


module dp_incdec16 (
				input_data,
				decrement,
				carryin,
				output_data,
				carryout
		       ) ;

input	[15:0]	input_data ;
input	decrement ;
input	carryin ; 

output	[15:0]	output_data ;
output	carryout ; 


wire	decrement_buf ;		// zero input to register when high

wire	[15:0]	comp_input_data ;  // conditionally complemented input data for decrement function
wire	[15:0]	carry_bits ; 	   // carry out bits for whole incrementer/decrementer

	ni01d5	incdec_buf ( .i (decrement), .z (decrement_buf) ) ;


xo02d1 exor_comp_b0 (
			.a1		(input_data[0]),
			.a2		(decrement_buf),
			.z		(comp_input_data[0])
		    ) ;

xo02d1 exor_b0 (
			.a1		(input_data[0]),
			.a2		(carryin),
			.z		(output_data[0])
	       ) ;

an02d1h and_b0 (
			.a1		(comp_input_data[0]),
			.a2		(carryin),
			.z		(carry_bits[0])
	       ) ;


xo02d1 exor_comp_b1 (
			.a1		(input_data[1]),
			.a2		(decrement_buf),
			.z		(comp_input_data[1])
		    ) ;

xo02d1 exor_b1 (
			.a1		(input_data[1]),
			.a2		(carry_bits[0]),
			.z		(output_data[1])
	       ) ;

an02d1h and_b1 (
			.a1		(comp_input_data[1]),
			.a2		(carry_bits[0]),
			.z		(carry_bits[1])
	       ) ;


xo02d1 exor_comp_b2 (
			.a1		(input_data[2]),
			.a2		(decrement_buf),
			.z		(comp_input_data[2])
		    ) ;

xo02d1 exor_b2 (
			.a1		(input_data[2]),
			.a2		(carry_bits[1]),
			.z		(output_data[2])
	       ) ;

an02d1h and_b2 (
			.a1		(comp_input_data[2]),
			.a2		(carry_bits[1]),
			.z		(carry_bits[2])
	       ) ;


xo02d1 exor_comp_b3 (
			.a1		(input_data[3]),
			.a2		(decrement_buf),
			.z		(comp_input_data[3])
		    ) ;

xo02d1 exor_b3 (
			.a1		(input_data[3]),
			.a2		(carry_bits[2]),
			.z		(output_data[3])
	       ) ;

an02d1h and_b3 (
			.a1		(comp_input_data[3]),
			.a2		(carry_bits[2]),
			.z		(carry_bits[3])
	       ) ;


xo02d1 exor_comp_b4 (
			.a1		(input_data[4]),
			.a2		(decrement_buf),
			.z		(comp_input_data[4])
		    ) ;

xo02d1 exor_b4 (
			.a1		(input_data[4]),
			.a2		(carry_bits[3]),
			.z		(output_data[4])
	       ) ;

an02d1h and_b4 (
			.a1		(comp_input_data[4]),
			.a2		(carry_bits[3]),
			.z		(carry_bits[4])
	       ) ;


xo02d1 exor_comp_b5 (
			.a1		(input_data[5]),
			.a2		(decrement_buf),
			.z		(comp_input_data[5])
		    ) ;

xo02d1 exor_b5 (
			.a1		(input_data[5]),
			.a2		(carry_bits[4]),
			.z		(output_data[5])
	       ) ;

an02d1h and_b5 (
			.a1		(comp_input_data[5]),
			.a2		(carry_bits[4]),
			.z		(carry_bits[5])
	       ) ;


xo02d1 exor_comp_b6 (
			.a1		(input_data[6]),
			.a2		(decrement_buf),
			.z		(comp_input_data[6])
		    ) ;

xo02d1 exor_b6 (
			.a1		(input_data[6]),
			.a2		(carry_bits[5]),
			.z		(output_data[6])
	       ) ;

an02d1h and_b6 (
			.a1		(comp_input_data[6]),
			.a2		(carry_bits[5]),
			.z		(carry_bits[6])
	       ) ;


xo02d1 exor_comp_b7 (
			.a1		(input_data[7]),
			.a2		(decrement_buf),
			.z		(comp_input_data[7])
		    ) ;

xo02d1 exor_b7 (
			.a1		(input_data[7]),
			.a2		(carry_bits[6]),
			.z		(output_data[7])
	       ) ;

an02d1h and_b7 (
			.a1		(comp_input_data[7]),
			.a2		(carry_bits[6]),
			.z		(carry_bits[7])
	       ) ;


xo02d1 exor_comp_b8 (
			.a1		(input_data[8]),
			.a2		(decrement_buf),
			.z		(comp_input_data[8])
		    ) ;

xo02d1 exor_b8 (
			.a1		(input_data[8]),
			.a2		(carry_bits[7]),
			.z		(output_data[8])
	       ) ;

an02d1h and_b8 (
			.a1		(comp_input_data[8]),
			.a2		(carry_bits[7]),
			.z		(carry_bits[8])
	       ) ;


xo02d1 exor_comp_b9 (
			.a1		(input_data[9]),
			.a2		(decrement_buf),
			.z		(comp_input_data[9])
		    ) ;

xo02d1 exor_b9 (
			.a1		(input_data[9]),
			.a2		(carry_bits[8]),
			.z		(output_data[9])
	       ) ;

an02d1h and_b9 (
			.a1		(comp_input_data[9]),
			.a2		(carry_bits[8]),
			.z		(carry_bits[9])
	       ) ;


xo02d1 exor_comp_b10 (
			.a1		(input_data[10]),
			.a2		(decrement_buf),
			.z		(comp_input_data[10])
		     ) ;

xo02d1 exor_b10 (
			.a1		(input_data[10]),
			.a2		(carry_bits[9]),
			.z		(output_data[10])
	        ) ;

an02d1h and_b10 (
			.a1		(comp_input_data[10]),
			.a2		(carry_bits[9]),
			.z		(carry_bits[10])
	        ) ;

xo02d1 exor_comp_b11 (
			.a1		(input_data[11]),
			.a2		(decrement_buf),
			.z		(comp_input_data[11])
		     ) ;

xo02d1 exor_b11 (
			.a1		(input_data[11]),
			.a2		(carry_bits[10]),
			.z		(output_data[11])
	       ) ;

an02d1h and_b11 (
			.a1		(comp_input_data[11]),
			.a2		(carry_bits[10]),
			.z		(carry_bits[11])
	        ) ;

xo02d1 exor_comp_b12 (
			.a1		(input_data[12]),
			.a2		(decrement_buf),
			.z		(comp_input_data[12])
		     ) ;

xo02d1 exor_b12 (
			.a1		(input_data[12]),
			.a2		(carry_bits[11]),
			.z		(output_data[12])
	        ) ;

an02d1h and_b12 (
			.a1		(comp_input_data[12]),
			.a2		(carry_bits[11]),
			.z		(carry_bits[12])
	        ) ;

xo02d1 exor_comp_b13 (
			.a1		(input_data[13]),
			.a2		(decrement_buf),
			.z		(comp_input_data[13])
		     ) ;

xo02d1 exor_b13 (
			.a1		(input_data[13]),
			.a2		(carry_bits[12]),
			.z		(output_data[13])
	        ) ;

an02d1h and_b13 (
			.a1		(comp_input_data[13]),
			.a2		(carry_bits[12]),
			.z		(carry_bits[13])
	        ) ;


xo02d1 exor_comp_b14 (
			.a1		(input_data[14]),
			.a2		(decrement_buf),
			.z		(comp_input_data[14])
		     ) ;

xo02d1 exor_b14 (
			.a1		(input_data[14]),
			.a2		(carry_bits[13]),
			.z		(output_data[14])
	        ) ;

an02d1h and_b14 (
			.a1		(comp_input_data[14]),
			.a2		(carry_bits[13]),
			.z		(carry_bits[14])
	        ) ;


xo02d1 exor_comp_b15 (
			.a1		(input_data[15]),
			.a2		(decrement_buf),
			.z		(comp_input_data[15])
		     ) ;

xo02d1 exor_b15 (
			.a1		(input_data[15]),
			.a2		(carry_bits[14]),
			.z		(output_data[15])
	        ) ;

an02d1h and_b15 (
			.a1		(comp_input_data[15]),
			.a2		(carry_bits[14]),
			.z		(carry_bits[15])
	        ) ;

	assign carryout =	carry_bits[15] ;

endmodule  //  dp_incdec16