cvoffset.v
2.6 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: cvoffset.v,v 1.1 2002/03/28 00:26:13 berndt Exp $
//////////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: cvoffset
// description: None
//
// designer: Mike M. Cai 6/3/94
//
//////////////////////////////////////////////////////////////////////////////
module cvoffset(x_offset, y_offset, mask_in);
output [1:0] x_offset, y_offset;
input [15:0] mask_in;
wire [3:0] y_mask;
reg [3:0] x_mask;
/*
assign x_mask[0] = mask_in[15] | mask_in[11] | mask_in[7] | mask_in[3],
x_mask[1] = mask_in[14] | mask_in[10] | mask_in[6] | mask_in[2],
x_mask[2] = mask_in[13] | mask_in[9] | mask_in[5] | mask_in[1],
x_mask[3] = mask_in[12] | mask_in[8] | mask_in[4] | mask_in[0];
*/
assign y_mask[0] = mask_in[15] | mask_in[14] | mask_in[13] | mask_in[12],
y_mask[1] = mask_in[11] | mask_in[10] | mask_in[9] | mask_in[8],
y_mask[2] = mask_in[7] | mask_in[6] | mask_in[5] | mask_in[4],
y_mask[3] = mask_in[3] | mask_in[2] | mask_in[1] | mask_in[0];
assign y_offset[0] = (y_mask[1] & ~y_mask[0]) |
(y_mask[3] & ~y_mask[2] & ~y_mask[0]),
y_offset[1] = (y_mask[2] | y_mask[3]) & ~y_mask[1] & ~y_mask[0];
always @(y_offset or mask_in )
case (y_offset)
2'b00: x_mask = {mask_in[12],mask_in[13],mask_in[14],mask_in[15]};
2'b01: x_mask = {mask_in[8],mask_in[9],mask_in[10],mask_in[11]};
2'b10: x_mask = {mask_in[4],mask_in[5],mask_in[6],mask_in[7]};
2'b11: x_mask = {mask_in[0],mask_in[1],mask_in[2],mask_in[3]};
endcase
assign x_offset[0] = (x_mask[1] & ~x_mask[0]) |
(x_mask[3] & ~x_mask[2] & ~x_mask[0]),
x_offset[1] = (x_mask[2] | x_mask[3]) & ~x_mask[1] & ~x_mask[0];
endmodule // cvoffset