cvpipe.v 2.91 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: cvpipe.v,v 1.2 2002/11/22 00:34:20 rws Exp $

   /////////////////////////////////////////////////////////////////////////
   //
   // Project Reality
   //
   // module:      cvpipe
   // description: pipeline between ew and cv
   //   
   //
   // designer:    Mike M. Cai   8/24/94
   //
   /////////////////////////////////////////////////////////////////////////

module cvpipe( // outputs
      	       xval,
	       xmax0_, xmax1_, xmax2_, xmax3_,
	       xmin0_, xmin1_, xmin2_, xmin3_,
	       // inputs
	       x_sc, left, new_span,
	       clk, start_gclk);
output [3:0]   xval;
output [12:0]  xmax0_, xmax1_, xmax2_, xmax3_,
	       xmin0_, xmin1_, xmin2_, xmin3_;
input [12:0]   x_sc;
input 	       left, new_span, clk, start_gclk;

reg   [12:0]   xval_m,
      	       xm3_m, xh3_m, xm2_m,xh2_m,  
      	       xm1_m, xh1_m, xm0_m, xh0_m;
reg [12:0]     xmin3_m, xmax3_m, xmin2_m, xmax2_m,
      	       xmin1_m, xmax1_m, xmin0_m, xmax0_m;
reg [12:0]     xmin3_, xmax3_, xmin2_, xmax2_,
      	       xmin1_, xmax1_, xmin0_, xmax0_;
reg [3:0]      xval;


always @(posedge clk)
   if (start_gclk) begin
//      xval_m   = x_sc;
//      xm3_m    <= xval_m;
      xm3_m    <= x_sc;
      xh3_m    <= xm3_m;
      xm2_m    <= xh3_m;
      xh2_m    <= xm2_m;
      xm1_m    <= xh2_m;
      xh1_m    <= xm1_m;
      xm0_m    <= xh1_m;
      xh0_m    <= xm0_m;
      xmin3_m  = left ? xh3_m : xm3_m;
      xmax3_m  = left ? xm3_m : xh3_m;
      xmin2_m  = left ? xh2_m : xm2_m;
      xmax2_m  = left ? xm2_m : xh2_m;
      xmin1_m  = left ? xh1_m : xm1_m;
      xmax1_m  = left ? xm1_m : xh1_m;
      xmin0_m  = left ? xh0_m : xm0_m;
      xmax0_m  = left ? xm0_m : xh0_m;
      xval     <= new_span ? x_sc[3:0] : xval;
      xmin3_   <= new_span ? xmin3_m : xmin3_;
      xmax3_   <= new_span ? xmax3_m : xmax3_;
      xmin2_   <= new_span ? xmin2_m : xmin2_;
      xmax2_    <= new_span ? xmax2_m : xmax2_;
      xmin1_    <= new_span ? xmin1_m : xmin1_;
      xmax1_    <= new_span ? xmax1_m : xmax1_;
      xmin0_    <= new_span ? xmin0_m : xmin0_;
      xmax0_    <= new_span ? xmax0_m : xmax0_;
   end

endmodule  //  cvpipe