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

/*      Project Reality
        MDP
        Created by Mike M. Cai  6/1/94
*/

module cvg( cv_value, mask15, x_offset, y_offset,
      	    x_cur, xmin0_, xmin1_, xmin2_, xmin3_, 
	    xmax0_, xmax1_, xmax2_, xmax3_,
	    x_val, 
	    clk, start_gclk);
output [3:0]   cv_value;
output	       mask15;
output [1:0]   x_offset, y_offset;
input [11:0]    x_cur;
input [12:0]   xmin0_, xmin1_, xmin2_, xmin3_, 
      	       xmax0_, xmax1_, xmax2_, xmax3_;
input [3:0]    x_val;
input 	       clk, start_gclk;
// comparisons
wire [3:0]     xmin_eq, xmin_less,
      	       eq_xmax, less_xmax;
// cvmask
wire [15:0]    mask;
reg   	       mask15;
// cvvalue
wire [3:0]     cv_value_m;
reg  [3:0]     cv_value;
// cvoffset    
wire [1:0]     x_offset_m, y_offset_m;
reg [1:0]      x_offset, y_offset;

      	       
cvcompl comp0_l (.xmin_eq(xmin_eq[0]), .xmin_less(xmin_less[0]), 
      	       	  .xmin(xmin0_[12:3]), .x_cur(x_cur));
cvcompl comp1_l (.xmin_eq(xmin_eq[1]), .xmin_less(xmin_less[1]), 
      	       	  .xmin(xmin1_[12:3]), .x_cur(x_cur));
cvcompl comp2_l (.xmin_eq(xmin_eq[2]), .xmin_less(xmin_less[2]), 
      	       	  .xmin(xmin2_[12:3]), .x_cur(x_cur));
cvcompl comp3_l (.xmin_eq(xmin_eq[3]), .xmin_less(xmin_less[3]), 
      	       	  .xmin(xmin3_[12:3]), .x_cur(x_cur));

cvcompr comp0_r (.eq_xmax(eq_xmax[0]), .less_xmax(less_xmax[0]), 
      	       	  .x_cur(x_cur), .xmax(xmax0_[12:3]));
cvcompr comp1_r (.eq_xmax(eq_xmax[1]), .less_xmax(less_xmax[1]), 
      	       	  .x_cur(x_cur), .xmax(xmax1_[12:3]));
cvcompr comp2_r (.eq_xmax(eq_xmax[2]), .less_xmax(less_xmax[2]), 
      	       	  .x_cur(x_cur), .xmax(xmax2_[12:3]));
cvcompr comp3_r (.eq_xmax(eq_xmax[3]), .less_xmax(less_xmax[3]), 
      	       	  .x_cur(x_cur), .xmax(xmax3_[12:3]));

cvmask maskone (  .mask_out(mask), 
      	       	  .eq_xmax(eq_xmax), .less_xmax(less_xmax),
      	       	  .xmin_eq(xmin_eq), .xmin_less(xmin_less), .x_val(x_val),
	       	  .xmax0_fr(xmax0_[2:0]), .xmax1_fr(xmax1_[2:0]),
	       	  .xmax2_fr(xmax2_[2:0]), .xmax3_fr(xmax3_[2:0]),
	       	  .xmin0_fr(xmin0_[2:0]), .xmin1_fr(xmin1_[2:0]),
	       	  .xmin2_fr(xmin2_[2:0]), .xmin3_fr(xmin3_[2:0]) );

cvvalue cvv ( .cv_value(cv_value_m), .mask_in(mask));

cvoffset cvo ( .x_offset(x_offset_m), .y_offset(y_offset_m), .mask_in(mask));

always @(posedge clk)
   if (start_gclk) begin
      cv_value <= cv_value_m;
      mask15 <= mask[15];
      x_offset <= x_offset_m;
      y_offset <= y_offset_m;
   end

endmodule  //  cvg