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
phy
mig_7series_v1_9_ddr_prbs_gen.v
1
//*****************************************************************************
2
// (c) Copyright 2009 - 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: ddr_prbs_gen.v
55
// /___/ /\ Date Last Modified: $Date: 2011/06/02 08:35:10 $
56
// \ \ / \ Date Created: 05/12/10
57
// \___\/\___\
58
//
59
//Device: 7 Series
60
//Design Name: ddr_prbs_gen
61
// Overview:
62
// Implements a "pseudo-PRBS" generator. Basically this is a standard
63
// PRBS generator (using an linear feedback shift register) along with
64
// logic to force the repetition of the sequence after 2^PRBS_WIDTH
65
// samples (instead of 2^PRBS_WIDTH - 1). The LFSR is based on the design
66
// from Table 1 of XAPP 210. Note that only 8- and 10-tap long LFSR chains
67
// are supported in this code
68
// Parameter Requirements:
69
// 1. PRBS_WIDTH = 8 or 10
70
// 2. PRBS_WIDTH >= 2*nCK_PER_CLK
71
// Output notes:
72
// The output of this module consists of 2*nCK_PER_CLK bits, these contain
73
// the value of the LFSR output for the next 2*CK_PER_CLK bit times. Note
74
// that prbs_o[0] contains the bit value for the "earliest" bit time.
75
//
76
//Reference:
77
//Revision History:
78
//
79
//*****************************************************************************
80
81
/******************************************************************************
82
**$Id: ddr_prbs_gen.v,v 1.1 2011/06/02 08:35:10 mishra Exp $
83
**$Date: 2011/06/02 08:35:10 $
84
**$Author: mishra $
85
**$Revision: 1.1 $
86
**$Source: /devl/xcs/repo/env/Databases/ip/src2/O/mig_7series_v1_3/data/dlib/7series/ddr3_sdram/verilog/rtl/phy/ddr_prbs_gen.v,v $
87
*******************************************************************************/
88
89
90
`timescale
1ps/1ps
91
92
module
mig_7series_v1_9_ddr_prbs_gen
#
93
(
94
parameter
TCQ
=
100
,
// clk->out delay (sim only)
95
parameter
PRBS_WIDTH
=
64
// LFSR shift register length
96
)
97
(
98
input
clk_i
,
// input clock
99
input
clk_en_i
,
// clock enable
100
input
rst_i
,
// synchronous reset
101
input
[
PRBS_WIDTH
-
1
:
0
]
prbs_seed_i
,
// initial LFSR seed
102
input
phy_if_empty
,
// IN_FIFO empty flag
103
input
prbs_rdlvl_start
,
// PRBS read lveling start
104
output
[
PRBS_WIDTH
-
1
:
0
]
prbs_o
// generated pseudo random data
105
);
106
107
//***************************************************************************
108
109
function
integer
clogb2
(
input
integer
size
);
110
begin
111
size
=
size
-
1
;
112
for
(
clogb2
=
1
;
size
>
1
;
clogb2
=
clogb2
+
1
)
113
size
=
size
>>
1
;
114
end
115
endfunction
116
117
// Number of internal clock cycles before the PRBS sequence will repeat
118
localparam
PRBS_SEQ_LEN_CYCLES
=
128
;
119
localparam
PRBS_SEQ_LEN_CYCLES_BITS
=
clogb2
(
PRBS_SEQ_LEN_CYCLES
);
120
121
reg
phy_if_empty_r
;
122
reg
reseed_prbs_r
;
123
reg
[
PRBS_SEQ_LEN_CYCLES_BITS
-
1
:
0
]
sample_cnt_r
;
124
reg
[
PRBS_WIDTH
-
1
:
0
]
prbs
;
125
reg
[
PRBS_WIDTH
:
1
]
lfsr_q
;
126
127
//***************************************************************************
128
always
@(
posedge
clk_i
)
begin
129
phy_if_empty_r
<= #TCQ
phy_if_empty
;
130
end
131
132
//***************************************************************************
133
// Generate PRBS reset signal to ensure that PRBS sequence repeats after
134
// every 2**PRBS_WIDTH samples. Basically what happens is that we let the
135
// LFSR run for an extra cycle after "truly PRBS" 2**PRBS_WIDTH - 1
136
// samples have past. Once that extra cycle is finished, we reseed the LFSR
137
always
@(
posedge
clk_i
)
138
begin
139
if
(
rst_i
|| ~
clk_en_i
)
begin
140
sample_cnt_r
<= #TCQ
'b0
;
141
reseed_prbs_r
<= #TCQ
1'b0
;
142
end
else
if
(
clk_en_i
&& (~
phy_if_empty_r
|| ~
prbs_rdlvl_start
))
begin
143
// The rollver count should always be [(power of 2) - 1]
144
sample_cnt_r
<= #TCQ
sample_cnt_r
+
1
;
145
// Assert PRBS reset signal so that it is simultaneously with the
146
// last sample of the sequence
147
if
(
sample_cnt_r
==
PRBS_SEQ_LEN_CYCLES
-
2
)
148
reseed_prbs_r
<= #TCQ
1'b1
;
149
else
150
reseed_prbs_r
<= #TCQ
1'b0
;
151
end
152
end
153
154
always
@ (
posedge
clk_i
)
155
begin
156
//reset it to a known good state to prevent it locks up
157
if
((
reseed_prbs_r
&&
clk_en_i
) ||
rst_i
|| ~
clk_en_i
)
begin
158
lfsr_q
[
4
:
1
] <= #TCQ
prbs_seed_i
[
3
:
0
] |
4'h5
;
159
lfsr_q
[
PRBS_WIDTH
:
5
] <= #TCQ
prbs_seed_i
[
PRBS_WIDTH
-
1
:
4
];
160
end
161
else
if
(
clk_en_i
&& (~
phy_if_empty_r
|| ~
prbs_rdlvl_start
))
begin
162
lfsr_q
[
PRBS_WIDTH
:
31
] <= #TCQ
lfsr_q
[
PRBS_WIDTH
-
1
:
30
];
163
lfsr_q
[
30
] <= #TCQ
lfsr_q
[
16
] ^
lfsr_q
[
13
] ^
lfsr_q
[
5
] ^
lfsr_q
[
1
];
164
lfsr_q
[
29
:
9
] <= #TCQ
lfsr_q
[
28
:
8
];
165
lfsr_q
[
8
] <= #TCQ
lfsr_q
[
32
] ^
lfsr_q
[
7
];
166
lfsr_q
[
7
] <= #TCQ
lfsr_q
[
32
] ^
lfsr_q
[
6
];
167
lfsr_q
[
6
:
4
] <= #TCQ
lfsr_q
[
5
:
3
];
168
lfsr_q
[
3
] <= #TCQ
lfsr_q
[
32
] ^
lfsr_q
[
2
];
169
lfsr_q
[
2
] <= #TCQ
lfsr_q
[
1
] ;
170
lfsr_q
[
1
] <= #TCQ
lfsr_q
[
32
];
171
end
172
end
173
174
always
@ (
lfsr_q
[
PRBS_WIDTH
:
1
])
begin
175
prbs
=
lfsr_q
[
PRBS_WIDTH
:
1
];
176
end
177
178
assign
prbs_o
=
prbs
;
179
180
endmodule
181
182
Generated on Wed Apr 18 2018 10:55:28 for AMC13 by
1.8.1