csadder5b.v 3.81 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.  *
 *                                                                        *
 *************************************************************************/
// $Id: csadder5b.v,v 1.1.1.1 2002/05/17 06:07:45 blythe Exp $
   /////////////////////////////////////////////////////////////////////////
   //
   // Project Reality
   //
   // module:      csadder5b
   // description: a 5-bit adder
   //   
   //
   // designer:    Mike M. Cai   10/5/94
   //
   /////////////////////////////////////////////////////////////////////////

module csadder5b(sum, a, base_adrs, shf_state);
output [4:0]   sum;
input [4:0]    a, base_adrs;
input [4:0]    shf_state;

wire [4:0]  sum0, sum1;
wire [4:0]  sum0_co, sum1_co;
wire  	    state_zero;
wire [4:0]  sum_m;
wire [4:0]  base_adrsbuf;

nr05d2 state0(.zn(state_zero), .a1(shf_state[0]), .a2(shf_state[1]), 
      	    .a3(shf_state[2]), .a4(shf_state[3]), .a5(shf_state[4]));
/*
ad01d1 sum0b2(.s(sum0[2]), .co(sum0_co[3]), 
                .a(a[2]), .b(base_adrs[2]), .ci(1'h0));
ad01d1 sum1b2(.s(sum1[2]), .co(sum1_co[3]), 
                .a(a[2]), .b(base_adrs[2]), .ci(1'h1));
ad01d1 sum0b3(.s(sum0[3]), .co(sum0_co[4]), 
                .a(a[3]), .b(base_adrs[3]), .ci(sum0_co[3]));
ad01d1 sum1b3(.s(sum1[3]), .co(sum1_co[4]), 
                .a(a[3]), .b(base_adrs[3]), .ci(sum1_co[3]));
ad01d1 sum0b4(.s(sum0[4]), // .co(sum0_co[5]), 
                .a(a[4]), .b(base_adrs[4]), .ci(sum0_co[4]));
ad01d1 sum1b4(.s(sum1[4]), // .co(sum1_co[5]), 
                .a(a[4]), .b(base_adrs[4]), .ci(sum1_co[4]));

mx21d1 sum2(.z(sum_m[2]), .i0(sum0[2]), .i1(sum1[2]), .s(sum0_co[2]));
mx21d1 sum3(.z(sum_m[3]), .i0(sum0[3]), .i1(sum1[3]), .s(sum0_co[2]));
mx21d1 sum4(.z(sum_m[4]), .i0(sum0[4]), .i1(sum1[4]), .s(sum0_co[2]));
ad01d1h sumb0(.s(sum_m[0]), .co(sum0_co[1]), 
                .a(a[0]), .b(base_adrs[0]), .ci(1'h0));
*/

ni01d2 base0(.z(base_adrsbuf[0]), .i(base_adrs[0]));
ni01d2 base1(.z(base_adrsbuf[1]), .i(base_adrs[1]));
ni01d2 base2(.z(base_adrsbuf[2]), .i(base_adrs[2]));
ni01d2 base3(.z(base_adrsbuf[3]), .i(base_adrs[3]));
ni01d2 base4(.z(base_adrsbuf[4]), .i(base_adrs[4]));

an02d1h sumb0_co(.z(sum0_co[1]), .a1(a[0]), .a2(base_adrsbuf[0]));
xo02d1  sumb0_sum(.z(sum_m[0]), .a1(a[0]), .a2(base_adrsbuf[0]));
ad01d1h sumb1(.s(sum_m[1]), .co(sum0_co[2]), 
                .a(a[1]), .b(base_adrsbuf[1]), .ci(sum0_co[1]));
ad01d1h sumb2(.s(sum_m[2]), .co(sum0_co[3]), 
                .a(a[2]), .b(base_adrsbuf[2]), .ci(sum0_co[2]));
ad01d1h sumb3(.s(sum_m[3]), .co(sum0_co[4]), 
                .a(a[3]), .b(base_adrsbuf[3]), .ci(sum0_co[3]));
ad01d1h sumb4(.s(sum_m[4]), // .co(sum0_co[1]), 
                .a(a[4]), .b(base_adrsbuf[4]), .ci(sum0_co[4]));

mx21d1h muxbout0(.z(sum[0]), .i0(sum_m[0]), .i1(base_adrsbuf[0]), .s(state_zero));
mx21d1h muxbout1(.z(sum[1]), .i0(sum_m[1]), .i1(base_adrsbuf[1]), .s(state_zero));
mx21d1h muxbout2(.z(sum[2]), .i0(sum_m[2]), .i1(base_adrsbuf[2]), .s(state_zero));
mx21d1h muxbout3(.z(sum[3]), .i0(sum_m[3]), .i1(base_adrsbuf[3]), .s(state_zero));
mx21d1h muxbout4(.z(sum[4]), .i0(sum_m[4]), .i1(base_adrsbuf[4]), .s(state_zero));

//initial
//   $monitor($time, "sum = %b %h", sum, sum);

endmodule  //  csadder5b