stzoffset.v
1.61 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
/**************************************************************************
* *
* 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. *
* *
*************************************************************************/
/* Project Reality
MDP
Created by Mike M. Cai 5/31/94
*/
module stzoffset( att_data_out,
att_data_in, dx, x_offset,
dy, y_offset);
output [18:0] att_data_out; // integer only
input [21:0] att_data_in; // 14 bits integer, 4 bits fraction
input [21:0] dx, dy; // 14 bits integer, 4 bits fraction
input[1:0] x_offset, y_offset; // 2 bits of fractions
wire [23:0] x_prod, y_prod; // 14 bits integer, 6 bits fraction
wire [21:0] sum; // 14 bits integer, 6 bits fraction
wire [18:0] att_data_out;
assign x_prod = {{2{dx[21]}},dx} * x_offset;
assign y_prod = {{2{dy[21]}},dy} * y_offset;
assign sum = att_data_in +
x_prod[23:2] +
y_prod[23:2];
assign att_data_out = sum[21:3];
endmodule // stzoffset