1 |
5 |
eyalhoc |
<##//////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Author: Eyal Hochberg ////
|
4 |
|
|
//// eyal@provartec.com ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// Downloaded from: http://www.opencores.org ////
|
7 |
|
|
/////////////////////////////////////////////////////////////////////
|
8 |
|
|
//// ////
|
9 |
|
|
//// Copyright (C) 2010 Provartec LTD ////
|
10 |
|
|
//// www.provartec.com ////
|
11 |
|
|
//// info@provartec.com ////
|
12 |
|
|
//// ////
|
13 |
|
|
//// This source file may be used and distributed without ////
|
14 |
|
|
//// restriction provided that this copyright statement is not ////
|
15 |
|
|
//// removed from the file and that any derivative work contains ////
|
16 |
|
|
//// the original copyright notice and the associated disclaimer.////
|
17 |
|
|
//// ////
|
18 |
|
|
//// This source file is free software; you can redistribute it ////
|
19 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
20 |
|
|
//// Public License as published by the Free Software Foundation.////
|
21 |
|
|
//// ////
|
22 |
|
|
//// This source is distributed in the hope that it will be ////
|
23 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
24 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
25 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more////
|
26 |
|
|
//// details. http://www.gnu.org/licenses/lgpl.html ////
|
27 |
|
|
//// ////
|
28 |
|
|
//////////////////////////////////////////////////////////////////##>
|
29 |
2 |
eyalhoc |
|
30 |
13 |
eyalhoc |
|
31 |
|
|
SWAP.GLOBAL MODEL_NAME FIR
|
32 |
|
|
|
33 |
2 |
eyalhoc |
##check all input parameters have been given
|
34 |
|
|
CHECK CONST(ORDER)
|
35 |
|
|
CHECK CONST(COEFF_BITS)
|
36 |
|
|
CHECK CONST(DIN_BITS)
|
37 |
|
|
|
38 |
13 |
eyalhoc |
SWAP NAME MAC_NUM_TOPO ##name of top module and file
|
39 |
2 |
eyalhoc |
SWAP INPUT_BITS DIN_BITS_COEFF_BITS ##input sizes
|
40 |
|
|
SWAP TOPO ORDER_INPUT_BITS ##topology
|
41 |
|
|
|
42 |
|
|
SWAP COEFF_NUM EXPR(ORDER+1) ##number of coefficients
|
43 |
|
|
SWAP ADD_STAGES LOG2(COEFF_NUM) ##number of binary tree adder stages
|
44 |
|
|
SWAP MULT_BITS EXPR(COEFF_BITS+DIN_BITS) ##bits of mult product
|
45 |
|
|
SWAP DOUT_BITS EXPR(MULT_BITS+ADD_STAGES) ##bits of output data (lossless)
|
46 |
11 |
eyalhoc |
|
47 |
|
|
##macros
|
48 |
|
|
SWAP MAC_EQ(X) TRUE(MAC_NUM==X)
|