cvxcnt.v
2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**************************************************************************
* *
* 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: cvxcnt.v,v 1.1 2002/03/28 00:26:13 berndt Exp $
/////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: cvxcnt
// description: counter to generate x values for each span
//
//
// designer: Mike M. Cai 8/24/94
//
/////////////////////////////////////////////////////////////////////////
module cvxcnt( // outputs
x_cur,
// inputs
ew_cv_start_x,
ncyc, // ncyc = cycle_type[0]
new_span, left,
reset_l, gclk);
output [11:0] x_cur;
input [11:0] ew_cv_start_x;
input ncyc, new_span, left;
input reset_l, gclk;
reg comp_new;
reg [11:0] add_value;
reg [11:0] x_cur;
always @(posedge gclk or negedge reset_l)
if ( reset_l == 1'h0)
begin
x_cur <= 12'h0;
comp_new <= 1'h0;
end
else
begin
comp_new <= new_span ? ~ncyc : (ncyc ? ~comp_new : comp_new);
if ( left )
add_value = {11'h0, comp_new};
else
add_value = 12'hfff & {12{comp_new}};
x_cur <= new_span ? ew_cv_start_x : (x_cur + add_value);
end
endmodule // cvxcnt