1 |
15 |
juko |
/*
|
2 |
|
|
* .--------------. .----------------. .------------.
|
3 |
|
|
* | .------------. | .--------------. | .----------. |
|
4 |
|
|
* | | ____ ____ | | | ____ ____ | | | ______ | |
|
5 |
|
|
* | ||_ || _|| | ||_ \ / _|| | | .' ___ || |
|
6 |
|
|
* ___ _ __ ___ _ __ | | | |__| | | | | | \/ | | | |/ .' \_|| |
|
7 |
|
|
* / _ \| '_ \ / _ \ '_ \ | | | __ | | | | | |\ /| | | | || | | |
|
8 |
|
|
* (_) | |_) | __/ | | || | _| | | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
|
9 |
|
|
* \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
|
10 |
|
|
* | | | | | | | | | | | |
|
11 |
|
|
* |_| | '------------' | '--------------' | '----------' |
|
12 |
|
|
* '--------------' '----------------' '------------'
|
13 |
|
|
*
|
14 |
|
|
* openHMC - An Open Source Hybrid Memory Cube Controller
|
15 |
|
|
* (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
|
16 |
|
|
* www.ziti.uni-heidelberg.de
|
17 |
|
|
* B6, 26
|
18 |
|
|
* 68159 Mannheim
|
19 |
|
|
* Germany
|
20 |
|
|
*
|
21 |
|
|
* Contact: openhmc@ziti.uni-heidelberg.de
|
22 |
|
|
* http://ra.ziti.uni-heidelberg.de/openhmc
|
23 |
|
|
*
|
24 |
|
|
* This source file is free software: you can redistribute it and/or modify
|
25 |
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
26 |
|
|
* the Free Software Foundation, either version 3 of the License, or
|
27 |
|
|
* (at your option) any later version.
|
28 |
|
|
*
|
29 |
|
|
* This source file is distributed in the hope that it will be useful,
|
30 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
31 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
32 |
|
|
* GNU Lesser General Public License for more details.
|
33 |
|
|
*
|
34 |
|
|
* You should have received a copy of the GNU Lesser General Public License
|
35 |
|
|
* along with this source file. If not, see <http://www.gnu.org/licenses/>.
|
36 |
|
|
*
|
37 |
|
|
*
|
38 |
|
|
* Module name: openhmc_counter48_wrapper_xilinx
|
39 |
|
|
*/
|
40 |
|
|
|
41 |
|
|
`default_nettype none
|
42 |
|
|
|
43 |
|
|
module openhmc_counter48_wrapper_xilinx #(
|
44 |
|
|
parameter DATASIZE = 48, // width of the counter, must be <=48 bits!
|
45 |
|
|
parameter INC_SIZE = 1, // must be <= 18bits
|
46 |
|
|
parameter PIPELINED = 1
|
47 |
|
|
) (
|
48 |
|
|
input wire clk,
|
49 |
|
|
input wire res_n,
|
50 |
|
|
input wire [INC_SIZE-1:0] inc_value,
|
51 |
|
|
output wire [DATASIZE-1:0] value
|
52 |
|
|
);
|
53 |
|
|
|
54 |
|
|
`ifdef SIMULATION
|
55 |
|
|
initial
|
56 |
|
|
begin
|
57 |
|
|
if (DATASIZE > 48)
|
58 |
|
|
begin
|
59 |
|
|
$display ("unsupported DATASIZE parameter in counter48.\nMax value is 48, actual value is %2d", DATASIZE);
|
60 |
|
|
$stop;
|
61 |
|
|
end
|
62 |
|
|
end
|
63 |
|
|
`endif
|
64 |
|
|
|
65 |
|
|
wire [47:0] value_w;
|
66 |
|
|
|
67 |
|
|
DSP48E1 #(
|
68 |
|
|
.ACASCREG(0), // Number of pipeline registers between A/ACIN input and ACOUT output,
|
69 |
|
|
// 0, 1, or 2
|
70 |
|
|
.ADREG(PIPELINED), // Number of pipeline registers on pre-adder output, 0 or 1
|
71 |
|
|
.ALUMODEREG(PIPELINED), // Number of pipeline registers on ALUMODE input, 0 or 1
|
72 |
|
|
.AREG(0), // Number of pipeline registers on the A input, 0, 1 or 2
|
73 |
|
|
.AUTORESET_PATDET("NO_RESET"), // NO_RESET, RESET_MATCH, RESET_NOT_MATCH
|
74 |
|
|
.A_INPUT("DIRECT"), // Selects A input used, "DIRECT" (A port) or "CASCADE" (ACIN port)
|
75 |
|
|
.BCASCREG(PIPELINED), // Number of pipeline registers between B/BCIN input and BCOUT output,
|
76 |
|
|
// 0, 1, or 2
|
77 |
|
|
.BREG(PIPELINED), // Number of pipeline registers on the B input, 0, 1 or 2
|
78 |
|
|
.B_INPUT("DIRECT"), // Selects B input used, "DIRECT" (B port) or "CASCADE" (BCIN port)
|
79 |
|
|
.CARRYINREG(1), // Number of pipeline registers for the CARRYIN input, 0 or 1
|
80 |
|
|
.CARRYINSELREG(1), // Number of pipeline registers for the CARRYINSEL input, 0 or 1
|
81 |
|
|
.CREG(0), // Number of pipeline registers on the C input, 0 or 1
|
82 |
|
|
.DREG(0), // Number of pipeline registers on the D input, 0 or 1
|
83 |
|
|
.INMODEREG(1), // Number of pipeline registers on INMODE input, 0 or 1
|
84 |
|
|
.MASK(48'h3fffffffffff), // 48-bit Mask value for pattern detect
|
85 |
|
|
.MREG(0), // Number of multiplier pipeline registers, 0 or 1
|
86 |
|
|
.OPMODEREG(1), // Number of pipeline registers on OPMODE input, 0 or 1
|
87 |
|
|
.PATTERN(48'h000000000000), // 48-bit Pattern match for pattern detect
|
88 |
|
|
.PREG(1), // Number of pipeline registers on the P output, 0 or 1
|
89 |
|
|
.SEL_MASK("MASK"), // "C", "MASK", "ROUNDING_MODE1", "ROUNDING_MODE2"
|
90 |
|
|
.SEL_PATTERN("PATTERN"), // Select pattern value between the "PATTERN" value or the value on the
|
91 |
|
|
// "C" port
|
92 |
|
|
.USE_DPORT("FALSE"), // Select D port usage, TRUE or FALSE
|
93 |
|
|
.USE_MULT("NONE"), // Select multiplier usage, "MULTIPLY", "DYNAMIC", or "NONE" (no multiplier)
|
94 |
|
|
.USE_PATTERN_DETECT("NO_PATDET"), // Enable pattern detect, "PATDET", "NO_PATDET"
|
95 |
|
|
.USE_SIMD("ONE48") // SIMD selection, "ONE48", "TWO24", "FOUR12"
|
96 |
|
|
) DSP48E1_inst (
|
97 |
|
|
// Cascade: 30-bit (each) Cascade
|
98 |
|
|
.ACOUT(), // 30-bit A port cascade output
|
99 |
|
|
.BCOUT(), // 18-bit B port cascade output
|
100 |
|
|
.CARRYCASCOUT(), // 1-bit cascade carry output
|
101 |
|
|
.MULTSIGNOUT(), // 1-bit multiplier sign cascade output
|
102 |
|
|
.PCOUT(), // 48-bit cascade output
|
103 |
|
|
// Control: 1-bit (each) Control
|
104 |
|
|
.OVERFLOW(), // 1-bit overflow in add/acc output
|
105 |
|
|
.PATTERNBDETECT(), // 1-bit active high pattern bar detect output
|
106 |
|
|
.PATTERNDETECT(), // 1-bit active high pattern detect output
|
107 |
|
|
.UNDERFLOW(), // 1-bit active high underflow in add/acc output
|
108 |
|
|
// Data: 4-bit (each) Data
|
109 |
|
|
.CARRYOUT(), // 4-bit carry output
|
110 |
|
|
.P(value_w), // 48-bit output
|
111 |
|
|
// Cascade: 30-bit (each) Cascade
|
112 |
|
|
.ACIN(30'b0), // 30-bit A cascade data input
|
113 |
|
|
.BCIN(18'b0), // 18-bit B cascade input
|
114 |
|
|
.CARRYCASCIN(1'b0), // 1-bit cascade carry input
|
115 |
|
|
.MULTSIGNIN(1'b0), // 1-bit multiplier sign input
|
116 |
|
|
.PCIN(48'b0), // 48-bit P cascade input
|
117 |
|
|
// Control: 4-bit (each) Control
|
118 |
|
|
.ALUMODE(4'b0000), // 4-bit ALU control input
|
119 |
|
|
.CARRYINSEL(3'b000), // 3-bit carry select input
|
120 |
|
|
.CEINMODE(1'b0), // 1-bit active high clock enable input for INMODE registers
|
121 |
|
|
.CLK(clk), // 1-bit Clock input
|
122 |
|
|
.INMODE(5'b00000), // 5-bit INMODE control input
|
123 |
|
|
.OPMODE({1'b0, 1'b1, 1'b0, 4'b0011}), // 7-bit operation mode input
|
124 |
|
|
.RSTINMODE(!res_n), // 1-bit reset input for INMODE pipeline registers
|
125 |
|
|
// Data: 30-bit (each) Data
|
126 |
|
|
.A(30'b0), // 30-bit A data input
|
127 |
|
|
.B({{18-INC_SIZE{1'b0}}, inc_value}), // 18-bit B data input
|
128 |
|
|
.C(48'h0), // 48-bit C data input
|
129 |
|
|
.CARRYIN(1'b0), // 1-bit carry input signal
|
130 |
|
|
.D(25'b0), // 25-bit D data input
|
131 |
|
|
// Reset/Clock Enable: 1-bit (each) Reset/Clock Enable
|
132 |
|
|
.CEA1(1'b0), // 1-bit active high clock enable input for 1st stage A registers
|
133 |
|
|
.CEA2(1'b0), // 1-bit active high clock enable input for 2nd stage A registers
|
134 |
|
|
.CEAD(1'b0), // 1-bit active high clock enable input for pre-adder output registers
|
135 |
|
|
.CEALUMODE(1'b1), // 1-bit active high clock enable input for ALUMODE registers
|
136 |
|
|
.CEB1(1'b0), // 1-bit active high clock enable input for 1st stage B registers
|
137 |
|
|
.CEB2(1'b1), // 1-bit active high clock enable input for 2nd stage B registers
|
138 |
|
|
.CEC(1'b0), // 1-bit active high clock enable input for C registers
|
139 |
|
|
.CECARRYIN(1'b0), // 1-bit active high clock enable input for CARRYIN register
|
140 |
|
|
.CECTRL(1'b1), // 1-bit active high clock enable input for OPMODE and carry registers
|
141 |
|
|
.CED(1'b0), // 1-bit active high clock enable input for D registers
|
142 |
|
|
.CEM(1'b0), // 1-bit active high clock enable input for multiplier registers
|
143 |
|
|
.CEP(1'b1), // 1-bit active high clock enable input for P registers
|
144 |
|
|
.RSTA(1'b0), // 1-bit reset input for A pipeline registers
|
145 |
|
|
.RSTALLCARRYIN(1'b0), // 1-bit reset input for carry pipeline registers
|
146 |
|
|
.RSTALUMODE(1'b0), // 1-bit reset input for ALUMODE pipeline registers
|
147 |
|
|
.RSTB(!res_n), // 1-bit reset input for B pipeline registers
|
148 |
|
|
.RSTC(1'b0), // 1-bit reset input for C pipeline registers
|
149 |
|
|
.RSTCTRL(!res_n), // 1-bit reset input for OPMODE pipeline registers
|
150 |
|
|
.RSTD(1'b0), // 1-bit reset input for D pipeline registers
|
151 |
|
|
.RSTM(1'b0), // 1-bit reset input for multiplier registers
|
152 |
|
|
.RSTP(!res_n) // 1-bit reset input for P pipeline registers
|
153 |
|
|
);
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
generate
|
158 |
|
|
if(PIPELINED==1) begin
|
159 |
|
|
reg [DATASIZE-1:0] value_temp;
|
160 |
|
|
always @(posedge clk) begin
|
161 |
|
|
value_temp <= value_w[DATASIZE-1:0];
|
162 |
|
|
end
|
163 |
|
|
assign value=value_temp;
|
164 |
|
|
end else begin
|
165 |
|
|
assign value = value_w[DATASIZE-1:0];
|
166 |
|
|
end
|
167 |
|
|
endgenerate
|
168 |
|
|
|
169 |
|
|
endmodule
|
170 |
|
|
|
171 |
|
|
`default_nettype wire
|