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
Variables
src
common
DDR
ddr3_1_9_a
ecc
mig_7series_v1_9_ecc_merge_enc.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_merge_enc.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_merge_enc
69
#(
70
parameter
TCQ
=
100
,
71
parameter
PAYLOAD_WIDTH
=
64
,
72
parameter
CODE_WIDTH
=
72
,
73
parameter
DATA_BUF_ADDR_WIDTH
=
4
,
74
parameter
DATA_BUF_OFFSET_WIDTH
=
1
,
75
parameter
DATA_WIDTH
=
64
,
76
parameter
DQ_WIDTH
=
72
,
77
parameter
ECC_WIDTH
=
8
,
78
parameter
nCK_PER_CLK
=
4
79
)
80
(
81
/*AUTOARG**/
82
// Outputs
83
mc_wrdata
,
mc_wrdata_mask
,
84
// Inputs
85
clk
,
rst
,
wr_data
,
wr_data_mask
,
rd_merge_data
,
h_rows
,
raw_not_ecc
86
);
87
88
input
clk
;
89
input
rst
;
90
91
input
[
2
*
nCK_PER_CLK
*
PAYLOAD_WIDTH
-
1
:
0
]
wr_data
;
92
input
[
2
*
nCK_PER_CLK
*
DATA_WIDTH
/
8
-
1
:
0
]
wr_data_mask
;
93
input
[
2
*
nCK_PER_CLK
*
DATA_WIDTH
-
1
:
0
]
rd_merge_data
;
94
95
reg
[
2
*
nCK_PER_CLK
*
PAYLOAD_WIDTH
-
1
:
0
]
wr_data_r
;
96
reg
[
2
*
nCK_PER_CLK
*
DATA_WIDTH
/
8
-
1
:
0
]
wr_data_mask_r
;
97
reg
[
2
*
nCK_PER_CLK
*
DATA_WIDTH
-
1
:
0
]
rd_merge_data_r
;
98
99
always
@(
posedge
clk
)
wr_data_r
<= #TCQ
wr_data
;
100
always
@(
posedge
clk
)
wr_data_mask_r
<= #TCQ
wr_data_mask
;
101
always
@(
posedge
clk
)
rd_merge_data_r
<= #TCQ
rd_merge_data
;
102
103
// Merge new data with memory read data.
104
wire
[
2
*
nCK_PER_CLK
*
PAYLOAD_WIDTH
-
1
:
0
]
merged_data
;
105
genvar
h
;
106
genvar
i
;
107
generate
108
for
(
h
=
0
;
h
<
2
*
nCK_PER_CLK
;
h
=
h
+
1
)
begin
:
merge_data_outer
109
for
(
i
=
0
;
i
<
DATA_WIDTH
/
8
;
i
=
i
+
1
)
begin
:
merge_data_inner
110
assign
merged_data
[
h
*
PAYLOAD_WIDTH
+
i
*
8
+:
8
] =
111
wr_data_mask
[
h
*
DATA_WIDTH
/
8
+
i
]
112
?
rd_merge_data
[
h
*
DATA_WIDTH
+
i
*
8
+:
8
]
113
:
wr_data
[
h
*
PAYLOAD_WIDTH
+
i
*
8
+:
8
];
114
end
115
if
(
PAYLOAD_WIDTH
>
DATA_WIDTH
)
116
assign
merged_data
[(
h
+
1
)*
PAYLOAD_WIDTH
-
1
-:
PAYLOAD_WIDTH
-
DATA_WIDTH
]=
117
wr_data
[(
h
+
1
)*
PAYLOAD_WIDTH
-
1
-:
PAYLOAD_WIDTH
-
DATA_WIDTH
];
118
119
end
120
endgenerate
121
122
// Generate ECC and overlay onto mc_wrdata.
123
input
[
CODE_WIDTH
*
ECC_WIDTH
-
1
:
0
]
h_rows
;
124
input
[
2
*
nCK_PER_CLK
-
1
:
0
]
raw_not_ecc
;
125
reg
[
2
*
nCK_PER_CLK
-
1
:
0
]
raw_not_ecc_r
;
126
always
@(
posedge
clk
)
raw_not_ecc_r
<= #TCQ
raw_not_ecc
;
127
output
reg
[
2
*
nCK_PER_CLK
*
DQ_WIDTH
-
1
:
0
]
mc_wrdata
;
128
reg
[
2
*
nCK_PER_CLK
*
DQ_WIDTH
-
1
:
0
]
mc_wrdata_c
;
129
genvar
j
;
130
integer
k
;
131
generate
132
for
(
j
=
0
;
j
<
2
*
nCK_PER_CLK
;
j
=
j
+
1
)
begin
:
ecc_word
133
always
@(
/*AS**/
h_rows
or
merged_data
or
raw_not_ecc_r
)
begin
134
mc_wrdata_c
[
j
*
DQ_WIDTH
+:
DQ_WIDTH
] =
135
{{
DQ_WIDTH
-
PAYLOAD_WIDTH
{
1'b0
}},
136
merged_data
[
j
*
PAYLOAD_WIDTH
+:
PAYLOAD_WIDTH
]};
137
for
(
k
=
0
;
k
<
ECC_WIDTH
;
k
=
k
+
1
)
138
if
(~
raw_not_ecc_r
[
j
])
139
mc_wrdata_c
[
j
*
DQ_WIDTH
+
CODE_WIDTH
-
k
-
1
] =
140
^(
merged_data
[
j
*
PAYLOAD_WIDTH
+:
DATA_WIDTH
] &
141
h_rows
[
k
*
CODE_WIDTH
+:
DATA_WIDTH
]);
142
end
143
end
144
endgenerate
145
always
@(
posedge
clk
)
mc_wrdata
<=
mc_wrdata_c
;
146
147
// Set all DRAM masks to zero.
148
output
wire
[
2
*
nCK_PER_CLK
*
DQ_WIDTH
/
8
-
1
:
0
]
mc_wrdata_mask
;
149
assign
mc_wrdata_mask
= {
2
*
nCK_PER_CLK
*
DQ_WIDTH
/
8
{
1'b0
}};
150
151
endmodule
Generated on Wed Apr 18 2018 10:55:27 for AMC13 by
1.8.1