vi_gamma_sqrt.v 14.7 KB
// Module instances modified by /home/rws/workarea/rf/sw/bbplayer/tools/necprimfix 
//
//    31 instances of ad01d1h changed to j_ad01.
//    4 instances of an02d2 changed to j_an02.
//    4 instances of an03d2 changed to j_an03.
//    3 instances of an04d2 changed to j_an04.
//    2 instances of an05d2 changed to j_an05.
//    1 instance of an06d2 changed to j_an06.
//    1 instance of an07d2 changed to j_an07.
//    6 instances of in01d4 changed to j_in01.
//    29 instances of mx21d1h changed to j_mx21.
//    12 instances of nr02d2 changed to j_nr02.
//    5 instances of or02d2 changed to j_or02.
//    4 instances of or03d2 changed to j_or03.
//    3 instances of or04d2 changed to j_or04.
//    2 instances of or05d2 changed to j_or05.
//    1 instance of or06d2 changed to j_or06.
//    1 instance of or07d2 changed to j_or07.
//    20 instances of xn02d2 changed to j_xn02.
//    19 instances of xo02d2 changed to j_xo02.
//

/**************************************************************************
 *                                                                        *
 *               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: vi_gamma_sqrt.v,v 1.2 2002/11/13 02:11:42 rws Exp $

////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:	vi_gamma_sqrt
// description:	Square root for gamma correction for video interface.
//
// designer:	Phil Gossett
// date:	10/6/94
//
////////////////////////////////////////////////////////////////////////

module vi_gamma_sqrt (a, q);

input [13:0] a;	// 8 bits linear signal + 6 bits dither

output [6:0] q;	// 7 bits gamma corrected (pre-compensated)

wire   [6:1] qn;
wire [12:11] ca;
wire [13:11] c0b;
wire [13:11] c1b;
wire [10: 9] cb;
wire [13: 9] c0c;
wire [13: 9] c1c;
wire [ 8: 7] cc;
wire [13: 7] c0d;
wire [13: 7] c1d;
wire [ 6: 5] cd;
wire [13: 5] c0e;
wire [13: 5] c1e;
wire [ 4: 3] ce;
wire [13: 3] c0f;
wire [13: 3] c1f;
wire [ 2: 1] cf;
wire         rx;
wire [13:11] ra;
wire [13:11] r0b;
wire [13:11] r1b;
wire [13: 9] rb;
wire [13: 9] r0c;
wire [13: 9] r1c;
wire [13: 7] rc;
wire [13: 7] r0d;
wire [13: 7] r1d;
wire [13: 5] rd;
wire [13: 5] r0e;
wire [13: 5] r1e;
wire [13: 3] re;

// 6
j_xn02  rx13  ( .a1( a[13]), .a2(  a[12]),               .zn( rx));
j_or02  cx13  (	.a1( a[13]), .a2(  a[12]),                .z(  q[ 6]));
j_in01  inx   (  .i( q[ 6]),                             .zn( qn[ 6]));

// 5
j_xn02  ra11  (	.a1( a[11]), .a2(  a[10]),               .zn( ra[11]));
j_nr02  ca11  (	.a1( a[11]), .a2(  a[10]),               .zn( ca[11]));
j_xo02  ra12  ( .a1( a[12]), .a2( ca[11]),                .z( ra[12]));
j_nr02  ca12  (	.a1( a[12]), .a2( ca[11]),               .zn( ca[12]));
j_ad01 ra13  (	 .a( q[ 6]),  .b( rx    ), .ci( ca[12]),  .s( ra[13]),
						         .co(  q[ 5]));
j_in01  ina   (  .i( q[ 5]),                             .zn( qn[ 5]));

// 4
j_xn02  rb9   (	.a1( a[ 9]), .a2(  a[ 8]),               .zn( rb[ 9]));
j_nr02  cb9   (	.a1( a[ 9]), .a2(  a[ 8]),               .zn( cb[ 9]));
j_xo02  rb10  ( .a1( a[10]),               .a2( cb[ 9]),  .z( rb[10]));
j_nr02  cb10  (	.a1( a[10]),               .a2( cb[ 9]), .zn( cb[10]));
j_ad01 r0b11 (	 .a( q[ 6]),  .b( ra[11]), .ci( cb[10]),  .s(r0b[11]),
						         .co(c0b[11]));
j_xo02  r0b12 (              .a1( ra[12]), .a2(c0b[11]),  .z(r0b[12]));
j_xo02  r0b13 (              .a1( ra[13]), .a2(c0b[12]),  .z(r0b[13]));
j_an02  c0b12 (              .a1( ra[12]), .a2(c0b[11]),  .z(c0b[12]));
j_an03  c0b13 (	.a1(ra[13]), .a2( ra[12]), .a3(c0b[11]),  .z(c0b[13]));
j_ad01 r1b11 (	 .a(qn[ 6]),  .b( ra[11]), .ci( cb[10]),  .s(r1b[11]),
						         .co(c1b[11]));
j_xn02  r1b12 (              .a1( ra[12]), .a2(c1b[11]), .zn(r1b[12]));
j_xn02  r1b13 (              .a1( ra[13]), .a2(c1b[12]), .zn(r1b[13]));
j_or02  c1b12 (              .a1( ra[12]), .a2(c1b[11]),  .z(c1b[12]));
j_or03  c1b13 ( .a1(ra[13]), .a2( ra[12]), .a3(c1b[11]),  .z(c1b[13]));
j_mx21 mxb11 (  .s(qn[ 5]), .i0(r1b[11]), .i1(r0b[11]),  .z( rb[11]));
j_mx21 mxb12 (  .s(qn[ 5]), .i0(r1b[12]), .i1(r0b[12]),  .z( rb[12]));
j_mx21 mxb13 (  .s(qn[ 5]), .i0(r1b[13]), .i1(r0b[13]),  .z( rb[13]));
j_mx21 mxb   (  .s(qn[ 5]), .i0(c1b[13]), .i1(c0b[13]),  .z(  q[ 4]));
j_in01  inb   (	 .i( q[ 4]),                             .zn( qn[ 4]));

// 3
j_xn02  rc7   (	.a1( a[ 7]), .a2(  a[ 6]),               .zn( rc[ 7]));
j_nr02  cc7   (	.a1( a[ 7]), .a2(  a[ 6]),               .zn( cc[ 7]));
j_xo02  rc8   ( .a1( a[ 8]),               .a2( cc[ 7]),  .z( rc[ 8]));
j_nr02  cc8   (	.a1( a[ 8]),               .a2( cc[ 7]), .zn( cc[ 8]));
j_ad01 r0c9  (	 .a( q[ 5]),  .b( rb[ 9]), .ci( cc[ 8]),  .s(r0c[ 9]),
						         .co(c0c[ 9]));
j_ad01 r0c10 (	 .a( q[ 6]),  .b( rb[10]), .ci(c0c[ 9]),  .s(r0c[10]),
						         .co(c0c[10]));
j_xo02  r0c11 (              .a1( rb[11]), .a2(c0c[10]),  .z(r0c[11]));
j_xo02  r0c12 (              .a1( rb[12]), .a2(c0c[11]),  .z(r0c[12]));
j_xo02  r0c13 (              .a1( rb[13]), .a2(c0c[12]),  .z(r0c[13]));
j_an02  c0c11 (                            .a1( rb[11]),
					   .a2(c0c[10]),  .z(c0c[11]));
j_an03  c0c12 (              .a1( rb[12]), .a2( rb[11]),
					   .a3(c0c[10]),  .z(c0c[12]));
j_an04  c0c13 ( .a1(rb[13]), .a2( rb[12]), .a3( rb[11]),
					   .a4(c0c[10]),  .z(c0c[13]));
j_ad01 r1c9  (	 .a(qn[ 5]),  .b( rb[ 9]), .ci( cc[ 8]),  .s(r1c[ 9]),
						         .co(c1c[ 9]));
j_ad01 r1c10 (	 .a(qn[ 6]),  .b( rb[10]), .ci(c1c[ 9]),  .s(r1c[10]),
						         .co(c1c[10]));
j_xn02  r1c11 (              .a1( rb[11]), .a2(c1c[10]), .zn(r1c[11]));
j_xn02  r1c12 (              .a1( rb[12]), .a2(c1c[11]), .zn(r1c[12]));
j_xn02  r1c13 (              .a1( rb[13]), .a2(c1c[12]), .zn(r1c[13]));
j_or02  c1c11 (                            .a1( rb[11]), 
					   .a2(c1c[10]),  .z(c1c[11]));
j_or03  c1c12 (              .a1( rb[12]), .a2( rb[11]),
					   .a3(c1c[10]),  .z(c1c[12]));
j_or04  c1c13 ( .a1(rb[13]), .a2( rb[12]), .a3( rb[11]),
					   .a4(c1c[10]),  .z(c1c[13]));
j_mx21 mxc9  (  .s(qn[ 4]), .i0(r1c[ 9]), .i1(r0c[ 9]),  .z( rc[ 9]));
j_mx21 mxc10 (  .s(qn[ 4]), .i0(r1c[10]), .i1(r0c[10]),  .z( rc[10]));
j_mx21 mxc11 (  .s(qn[ 4]), .i0(r1c[11]), .i1(r0c[11]),  .z( rc[11]));
j_mx21 mxc12 (  .s(qn[ 4]), .i0(r1c[12]), .i1(r0c[12]),  .z( rc[12]));
j_mx21 mxc13 (  .s(qn[ 4]), .i0(r1c[13]), .i1(r0c[13]),  .z( rc[13]));
j_mx21 mxc   (  .s(qn[ 4]), .i0(c1c[13]), .i1(c0c[13]),  .z(  q[ 3]));
j_in01  inc   (	 .i( q[ 3]),                             .zn( qn[ 3]));

// 2
j_xn02  rd5   (	.a1( a[ 5]), .a2(  a[ 4]),               .zn( rd[ 5]));
j_nr02  cd5   (	.a1( a[ 5]), .a2(  a[ 4]),               .zn( cd[ 5]));
j_xo02  rd6   ( .a1( a[ 6]),               .a2( cd[ 5]),  .z( rd[ 6]));
j_nr02  cd6   (	.a1( a[ 6]),               .a2( cd[ 5]), .zn( cd[ 6]));
j_ad01 r0d7  (	 .a( q[ 4]),  .b( rc[ 7]), .ci( cd[ 6]),  .s(r0d[ 7]),
						         .co(c0d[ 7]));
j_ad01 r0d8  (	 .a( q[ 5]),  .b( rc[ 8]), .ci(c0d[ 7]),  .s(r0d[ 8]),
						         .co(c0d[ 8]));
j_ad01 r0d9  (	 .a( q[ 6]),  .b( rc[ 9]), .ci(c0d[ 8]),  .s(r0d[ 9]),
						         .co(c0d[ 9]));
j_xo02  r0d10 (              .a1( rc[10]), .a2(c0d[ 9]),  .z(r0d[10]));
j_xo02  r0d11 (              .a1( rc[11]), .a2(c0d[10]),  .z(r0d[11]));
j_xo02  r0d12 (              .a1( rc[12]), .a2(c0d[11]),  .z(r0d[12]));
j_xo02  r0d13 (              .a1( rc[13]), .a2(c0d[12]),  .z(r0d[13]));
j_an02  c0d10 (                                          .a1( rc[10]),
					   .a2(c0d[ 9]),  .z(c0d[10]));
j_an03  c0d11 (                            .a1( rc[11]), .a2( rc[10]),
					   .a3(c0d[ 9]),  .z(c0d[11]));
j_an04  c0d12 (              .a1( rc[12]), .a2( rc[11]), .a3( rc[10]),
					   .a4(c0d[ 9]),  .z(c0d[12]));
j_an05  c0d13 ( .a1(rc[13]), .a2( rc[12]), .a3( rc[11]), .a4( rc[10]),
					   .a5(c0d[ 9]),  .z(c0d[13]));
j_ad01 r1d7  (	 .a(qn[ 4]),  .b( rc[ 7]), .ci( cd[ 6]),  .s(r1d[ 7]),
						         .co(c1d[ 7]));
j_ad01 r1d8  (	 .a(qn[ 5]),  .b( rc[ 8]), .ci(c1d[ 7]),  .s(r1d[ 8]),
						         .co(c1d[ 8]));
j_ad01 r1d9  (	 .a(qn[ 6]),  .b( rc[ 9]), .ci(c1d[ 8]),  .s(r1d[ 9]),
						         .co(c1d[ 9]));
j_xn02  r1d10 (              .a1( rc[10]), .a2(c1d[ 9]), .zn(r1d[10]));
j_xn02  r1d11 (              .a1( rc[11]), .a2(c1d[10]), .zn(r1d[11]));
j_xn02  r1d12 (              .a1( rc[12]), .a2(c1d[11]), .zn(r1d[12]));
j_xn02  r1d13 (              .a1( rc[13]), .a2(c1d[12]), .zn(r1d[13]));
j_or02  c1d10 (                                          .a1( rc[10]),
					   .a2(c1d[ 9]),  .z(c1d[10]));
j_or03  c1d11 (                            .a1( rc[11]), .a2( rc[10]),
					   .a3(c1d[ 9]),  .z(c1d[11]));
j_or04  c1d12 (              .a1( rc[12]), .a2( rc[11]), .a3( rc[10]),
					   .a4(c1d[ 9]),  .z(c1d[12]));
j_or05  c1d13 ( .a1(rc[13]), .a2( rc[12]), .a3( rc[11]), .a4( rc[10]),
					   .a5(c1d[ 9]),  .z(c1d[13]));
j_mx21 mxd7  (	 .s(qn[ 3]), .i0(r1d[ 7]), .i1(r0d[ 7]),  .z( rd[ 7]));
j_mx21 mxd8  (	 .s(qn[ 3]), .i0(r1d[ 8]), .i1(r0d[ 8]),  .z( rd[ 8]));
j_mx21 mxd9  (	 .s(qn[ 3]), .i0(r1d[ 9]), .i1(r0d[ 9]),  .z( rd[ 9]));
j_mx21 mxd10 (	 .s(qn[ 3]), .i0(r1d[10]), .i1(r0d[10]),  .z( rd[10]));
j_mx21 mxd11 (	 .s(qn[ 3]), .i0(r1d[11]), .i1(r0d[11]),  .z( rd[11]));
j_mx21 mxd12 (	 .s(qn[ 3]), .i0(r1d[12]), .i1(r0d[12]),  .z( rd[12]));
j_mx21 mxd13 (	 .s(qn[ 3]), .i0(r1d[13]), .i1(r0d[13]),  .z( rd[13]));
j_mx21 mxd   (	 .s(qn[ 3]), .i0(c1d[13]), .i1(c0d[13]),  .z(  q[ 2]));
j_in01  ind   (	 .i( q[ 2]),                             .zn( qn[ 2]));

// 1
j_xn02  re3   (	.a1( a[ 3]), .a2(  a[ 2]),               .zn( re[ 3]));
j_nr02  ce3   (	.a1( a[ 3]), .a2(  a[ 2]),               .zn( ce[ 3]));
j_xo02  re4   ( .a1( a[ 4]),               .a2( ce[ 3]),  .z( re[ 4]));
j_nr02  ce4   (	.a1( a[ 4]),               .a2( ce[ 3]), .zn( ce[ 4]));
j_ad01 r0e5  (	 .a( q[ 3]),  .b( rd[ 5]), .ci( ce[ 4]),  .s(r0e[ 5]),
						         .co(c0e[ 5]));
j_ad01 r0e6  (	 .a( q[ 4]),  .b( rd[ 6]), .ci(c0e[ 5]),  .s(r0e[ 6]),
						         .co(c0e[ 6]));
j_ad01 r0e7  (	 .a( q[ 5]),  .b( rd[ 7]), .ci(c0e[ 6]),  .s(r0e[ 7]),
						         .co(c0e[ 7]));
j_ad01 r0e8  (	 .a( q[ 6]),  .b( rd[ 8]), .ci(c0e[ 7]),  .s(r0e[ 8]),
						         .co(c0e[ 8]));
j_xo02  r0e9  (              .a1( rd[ 9]), .a2(c0e[ 8]),  .z(r0e[ 9]));
j_xo02  r0e10 (              .a1( rd[10]), .a2(c0e[ 9]),  .z(r0e[10]));
j_xo02  r0e11 (              .a1( rd[11]), .a2(c0e[10]),  .z(r0e[11]));
j_xo02  r0e12 (              .a1( rd[12]), .a2(c0e[11]),  .z(r0e[12]));
j_xo02  r0e13 (              .a1( rd[13]), .a2(c0e[12]),  .z(r0e[13]));
j_an02  c0e9  ( .a1(rd[ 9]),		   .a2(c0e[ 8]),  .z(c0e[ 9]));
j_an03  c0e10 (                                          .a1( rd[10]),
		.a2(rd[ 9]),		   .a3(c0e[ 8]),  .z(c0e[10]));
j_an04  c0e11 (                            .a1( rd[11]), .a2( rd[10]),
		.a3(rd[ 9]),		   .a4(c0e[ 8]),  .z(c0e[11]));
j_an05  c0e12 (              .a1( rd[12]), .a2( rd[11]), .a3( rd[10]),
		.a4(rd[ 9]),		   .a5(c0e[ 8]),  .z(c0e[12]));
j_an06  c0e13 ( .a1(rd[13]), .a2( rd[12]), .a3( rd[11]), .a4( rd[10]),
		.a5(rd[ 9]),		   .a6(c0e[ 8]),  .z(c0e[13]));
j_ad01 r1e5  (	 .a(qn[ 3]),  .b( rd[ 5]), .ci( ce[ 4]),  .s(r1e[ 5]),
						         .co(c1e[ 5]));
j_ad01 r1e6  (	 .a(qn[ 4]),  .b( rd[ 6]), .ci(c1e[ 5]),  .s(r1e[ 6]),
						         .co(c1e[ 6]));
j_ad01 r1e7  (	 .a(qn[ 5]),  .b( rd[ 7]), .ci(c1e[ 6]),  .s(r1e[ 7]),
						         .co(c1e[ 7]));
j_ad01 r1e8  (	 .a(qn[ 6]),  .b( rd[ 8]), .ci(c1e[ 7]),  .s(r1e[ 8]),
						         .co(c1e[ 8]));
j_xn02  r1e9  (              .a1( rd[ 9]), .a2(c1e[ 8]), .zn(r1e[ 9]));
j_xn02  r1e10 (              .a1( rd[10]), .a2(c1e[ 9]), .zn(r1e[10]));
j_xn02  r1e11 (              .a1( rd[11]), .a2(c1e[10]), .zn(r1e[11]));
j_xn02  r1e12 (              .a1( rd[12]), .a2(c1e[11]), .zn(r1e[12]));
j_xn02  r1e13 (              .a1( rd[13]), .a2(c1e[12]), .zn(r1e[13]));
j_or02  c1e9  ( .a1(rd[ 9]), 		   .a2(c1e[ 8]),  .z(c1e[ 9]));
j_or03  c1e10 (                                          .a1( rd[10]), 
		.a2(rd[ 9]), 		   .a3(c1e[ 8]),  .z(c1e[10]));
j_or04  c1e11 (                            .a1( rd[11]), .a2( rd[10]), 
		.a3(rd[ 9]), 		   .a4(c1e[ 8]),  .z(c1e[11]));
j_or05  c1e12 (              .a1( rd[12]), .a2( rd[11]), .a3( rd[10]), 
		.a4(rd[ 9]), 		   .a5(c1e[ 8]),  .z(c1e[12]));
j_or06  c1e13 ( .a1(rd[13]), .a2( rd[12]), .a3( rd[11]), .a4( rd[10]), 
		.a5(rd[ 9]), 		   .a6(c1e[ 8]),  .z(c1e[13]));
j_mx21 mxe5  (	 .s(qn[ 2]), .i0(r1e[ 5]), .i1(r0e[ 5]),  .z( re[ 5]));
j_mx21 mxe6  (	 .s(qn[ 2]), .i0(r1e[ 6]), .i1(r0e[ 6]),  .z( re[ 6]));
j_mx21 mxe7  (	 .s(qn[ 2]), .i0(r1e[ 7]), .i1(r0e[ 7]),  .z( re[ 7]));
j_mx21 mxe8  (	 .s(qn[ 2]), .i0(r1e[ 8]), .i1(r0e[ 8]),  .z( re[ 8]));
j_mx21 mxe9  (	 .s(qn[ 2]), .i0(r1e[ 9]), .i1(r0e[ 9]),  .z( re[ 9]));
j_mx21 mxe10 (	 .s(qn[ 2]), .i0(r1e[10]), .i1(r0e[10]),  .z( re[10]));
j_mx21 mxe11 (	 .s(qn[ 2]), .i0(r1e[11]), .i1(r0e[11]),  .z( re[11]));
j_mx21 mxe12 (	 .s(qn[ 2]), .i0(r1e[12]), .i1(r0e[12]),  .z( re[12]));
j_mx21 mxe13 (	 .s(qn[ 2]), .i0(r1e[13]), .i1(r0e[13]),  .z( re[13]));
j_mx21 mxe   (	 .s(qn[ 2]), .i0(c1e[13]), .i1(c0e[13]),  .z(  q[ 1]));
j_in01  ine   (	 .i( q[ 1]),                             .zn( qn[ 1]));

// 0
j_nr02  cf1   (	.a1( a[ 1]), .a2(  a[ 0]),               .zn( cf[ 1]));
j_nr02  cf2   (	.a1( a[ 2]),               .a2( cf[ 1]), .zn( cf[ 2]));
j_ad01 c0f3  (	 .a( q[ 2]),  .b( re[ 3]), .ci( cf[ 2]), .co(c0f[ 3]));
j_ad01 c0f4  (	 .a( q[ 3]),  .b( re[ 4]), .ci(c0f[ 3]), .co(c0f[ 4]));
j_ad01 c0f5  (	 .a( q[ 4]),  .b( re[ 5]), .ci(c0f[ 4]), .co(c0f[ 5]));
j_ad01 c0f6  (	 .a( q[ 5]),  .b( re[ 6]), .ci(c0f[ 5]), .co(c0f[ 6]));
j_ad01 c0f7  (	 .a( q[ 6]),  .b( re[ 7]), .ci(c0f[ 6]), .co(c0f[ 7]));
j_an07  c0f13 ( .a1(re[13]), .a2( re[12]), .a3( re[11]), .a4( re[10]),
		.a5(re[ 9]), .a6( re[ 8]), .a7(c0f[ 7]),  .z(c0f[13]));
j_ad01 c1f3  (	 .a(qn[ 2]),  .b( re[ 3]), .ci( cf[ 2]), .co(c1f[ 3]));
j_ad01 c1f4  (	 .a(qn[ 3]),  .b( re[ 4]), .ci(c1f[ 3]), .co(c1f[ 4]));
j_ad01 c1f5  (	 .a(qn[ 4]),  .b( re[ 5]), .ci(c1f[ 4]), .co(c1f[ 5]));
j_ad01 c1f6  (	 .a(qn[ 5]),  .b( re[ 6]), .ci(c1f[ 5]), .co(c1f[ 6]));
j_ad01 c1f7  (	 .a(qn[ 6]),  .b( re[ 7]), .ci(c1f[ 6]), .co(c1f[ 7]));
j_or07  c1f13 ( .a1(re[13]), .a2( re[12]), .a3( re[11]), .a4( re[10]),
		.a5(re[ 9]), .a6( re[ 8]), .a7(c1f[ 7]),  .z(c1f[13]));
j_mx21 mxf   (	 .s(qn[ 1]), .i0(c1f[13]), .i1(c0f[13]),  .z(  q[ 0]));
assign c0f[12:8] = 0;
assign c1f[12:8] = 0;

endmodule // vi_gamma_sqrt