AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
Main Page
Design Unit List
Files
File List
All
Classes
Files
Variables
src
common
DDR
ddr3_1_9_a
ecc
mig_7series_v1_9_ecc_buf.v
1
//*****************************************************************************
2
// (c) Copyright 2008 - 2013 Xilinx, Inc. All rights reserved.
3
//
4
// This file contains confidential and proprietary information
5
// of Xilinx, Inc. and is protected under U.S. and
6
// international copyright and other intellectual property
7
// laws.
8
//
9
// DISCLAIMER
10
// This disclaimer is not a license and does not grant any
11
// rights to the materials distributed herewith. Except as
12
// otherwise provided in a valid license issued to you by
13
// Xilinx, and to the maximum extent permitted by applicable
14
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
15
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
16
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
17
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
18
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
19
// (2) Xilinx shall not be liable (whether in contract or tort,
20
// including negligence, or under any other theory of
21
// liability) for any loss or damage of any kind or nature
22
// related to, arising under or in connection with these
23
// materials, including for any direct, or any indirect,
24
// special, incidental, or consequential loss or damage
25
// (including loss of data, profits, goodwill, or any type of
26
// loss or damage suffered as a result of any action brought
27
// by a third party) even if such damage or loss was
28
// reasonably foreseeable or Xilinx had been advised of the
29
// possibility of the same.
30
//
31
// CRITICAL APPLICATIONS
32
// Xilinx products are not designed or intended to be fail-
33
// safe, or for use in any application requiring fail-safe
34
// performance, such as life-support or safety devices or
35
// systems, Class III medical devices, nuclear facilities,
36
// applications related to the deployment of airbags, or any
37
// other applications that could lead to death, personal
38
// injury, or severe property or environmental damage
39
// (individually and collectively, "Critical
40
// Applications"). Customer assumes the sole risk and
41
// liability of any use of Xilinx products in Critical
42
// Applications, subject only to applicable laws and
43
// regulations governing limitations on product liability.
44
//
45
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
46
// PART OF THIS FILE AT ALL TIMES.
47
//
48
//*****************************************************************************
49
// ____ ____
50
// / /\/ /
51
// /___/ \ / Vendor : Xilinx
52
// \ \ \/ Version : %version
53
// \ \ Application : MIG
54
// / / Filename : ecc_buf.v
55
// /___/ /\ Date Last Modified : $date$
56
// \ \ / \ Date Created : Tue Jun 30 2009
57
// \___\/\___\
58
//
59
//Device : 7-Series
60
//Design Name : DDR3 SDRAM
61
//Purpose :
62
//Reference :
63
//Revision History :
64
//*****************************************************************************
65
66
`timescale
1ps/1ps
67
68
module
mig_7series_v1_9_ecc_buf
69
#(
70
parameter
TCQ
=
100
,
71
parameter
PAYLOAD_WIDTH
=
64
,
72
parameter
DATA_BUF_ADDR_WIDTH
=
4
,
73
parameter
DATA_BUF_OFFSET_WIDTH
=
1
,
74
parameter
DATA_WIDTH
=
64
,
75
parameter
nCK_PER_CLK
=
4
76
)
77
(
78
/*AUTOARG**/
79
// Outputs
80
rd_merge_data
,
81
// Inputs
82
clk
,
rst
,
rd_data_addr
,
rd_data_offset
,
wr_data_addr
,
83
wr_data_offset
,
rd_data
,
wr_ecc_buf
84
);
85
86
input
clk
;
87
input
rst
;
88
89
// RMW architecture supports only 16 data buffer entries.
90
// Allow DATA_BUF_ADDR_WIDTH to be greater than 4, but
91
// assume the upper bits are used for tagging.
92
93
input
[
DATA_BUF_ADDR_WIDTH
-
1
:
0
]
rd_data_addr
;
94
input
[
DATA_BUF_OFFSET_WIDTH
-
1
:
0
]
rd_data_offset
;
95
wire
[
4
:
0
]
buf_wr_addr
;
96
97
input
[
DATA_BUF_ADDR_WIDTH
-
1
:
0
]
wr_data_addr
;
98
input
[
DATA_BUF_OFFSET_WIDTH
-
1
:
0
]
wr_data_offset
;
99
reg
[
4
:
0
]
buf_rd_addr_r
;
100
101
generate
102
if
(
DATA_BUF_ADDR_WIDTH
>=
4
)
begin
:
ge_4_addr_bits
103
always
@(
posedge
clk
)
104
buf_rd_addr_r
<= #TCQ{
wr_data_addr
[
3
:
0
],
wr_data_offset
};
105
assign
buf_wr_addr
= {
rd_data_addr
[
3
:
0
],
rd_data_offset
};
106
end
107
else
begin
:
lt_4_addr_bits
108
always
@(
posedge
clk
)
109
buf_rd_addr_r
<= #TCQ{{
4
-
DATA_BUF_ADDR_WIDTH
{
1'b0
}},
110
wr_data_addr
[
DATA_BUF_ADDR_WIDTH
-
1
:
0
],
111
wr_data_offset
};
112
assign
buf_wr_addr
= {{
4
-
DATA_BUF_ADDR_WIDTH
{
1'b0
}},
113
rd_data_addr
[
DATA_BUF_ADDR_WIDTH
-
1
:
0
],
114
rd_data_offset
};
115
end
116
endgenerate
117
118
input
[
2
*
nCK_PER_CLK
*
PAYLOAD_WIDTH
-
1
:
0
]
rd_data
;
119
reg
[
2
*
nCK_PER_CLK
*
DATA_WIDTH
-
1
:
0
]
payload
;
120
integer
h
;
121
always
@(
/*AS**/
rd_data
)
122
for
(
h
=
0
;
h
<
2
*
nCK_PER_CLK
;
h
=
h
+
1
)
123
payload
[
h
*
DATA_WIDTH
+:
DATA_WIDTH
] =
124
rd_data
[
h
*
PAYLOAD_WIDTH
+:
DATA_WIDTH
];
125
126
input
wr_ecc_buf
;
127
localparam
BUF_WIDTH
=
2
*
nCK_PER_CLK
*
DATA_WIDTH
;
128
localparam
FULL_RAM_CNT
= (
BUF_WIDTH
/
6
);
129
localparam
REMAINDER
=
BUF_WIDTH
%
6
;
130
localparam
RAM_CNT
=
FULL_RAM_CNT
+ ((
REMAINDER
==
0
) ?
0
:
1
);
131
localparam
RAM_WIDTH
= (
RAM_CNT
*
6
);
132
wire
[
RAM_WIDTH
-
1
:
0
]
buf_out_data
;
133
generate
134
begin
:
ram_buf
135
wire
[
RAM_WIDTH
-
1
:
0
]
buf_in_data
;
136
if
(
REMAINDER
==
0
)
137
assign
buf_in_data
=
payload
;
138
else
139
assign
buf_in_data
= {{
6
-
REMAINDER
{
1'b0
}},
payload
};
140
141
genvar
i
;
142
for
(
i
=
0
;
i
<
RAM_CNT
;
i
=
i
+
1
)
begin
:
rd_buffer_ram
143
RAM32M
144
#(.
INIT_A
(
64'h0000000000000000
),
145
.
INIT_B
(
64'h0000000000000000
),
146
.
INIT_C
(
64'h0000000000000000
),
147
.
INIT_D
(
64'h0000000000000000
)
148
)
RAM32M0
(
149
.
DOA
(
buf_out_data
[((
i
*
6
)+
4
)+:
2
]),
150
.
DOB
(
buf_out_data
[((
i
*
6
)+
2
)+:
2
]),
151
.
DOC
(
buf_out_data
[((
i
*
6
)+
0
)+:
2
]),
152
.
DOD
(),
153
.
DIA
(
buf_in_data
[((
i
*
6
)+
4
)+:
2
]),
154
.
DIB
(
buf_in_data
[((
i
*
6
)+
2
)+:
2
]),
155
.
DIC
(
buf_in_data
[((
i
*
6
)+
0
)+:
2
]),
156
.
DID
(
2'b0
),
157
.
ADDRA
(
buf_rd_addr_r
),
158
.
ADDRB
(
buf_rd_addr_r
),
159
.
ADDRC
(
buf_rd_addr_r
),
160
.
ADDRD
(
buf_wr_addr
),
161
.
WE
(
wr_ecc_buf
),
162
.
WCLK
(
clk
)
163
);
164
end
// block: rd_buffer_ram
165
end
166
endgenerate
167
168
output
wire
[
2
*
nCK_PER_CLK
*
DATA_WIDTH
-
1
:
0
]
rd_merge_data
;
169
assign
rd_merge_data
=
buf_out_data
[
2
*
nCK_PER_CLK
*
DATA_WIDTH
-
1
:
0
];
170
171
172
endmodule
Generated on Sun Mar 6 2016 12:24:19 for AMC13 by
1.8.1