SAIFIINDUSTRIES commited on
Commit
12bef33
·
verified ·
1 Parent(s): f749d8c

Add batch 5 (vicharak-in_shrike, hunterlew_convolution_network_on_FPGA, jhshi_openofdm, dpretet_async_fifo, AngeloJacobo_UberDDR3)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +14 -0
  2. AngeloJacobo_UberDDR3/.gitignore +27 -0
  3. AngeloJacobo_UberDDR3/LICENSE +674 -0
  4. AngeloJacobo_UberDDR3/README.md +234 -0
  5. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/Makefile +113 -0
  6. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ax7103_ddr3.v +245 -0
  7. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ax7103_ddr3.xdc +442 -0
  8. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/caas.conf +11 -0
  9. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/clk_wiz.v +66 -0
  10. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ddr3_controller.v +0 -0
  11. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ddr3_phy.v +1462 -0
  12. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ddr3_top.v +475 -0
  13. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/uart_rx.v +207 -0
  14. AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/uart_tx.v +187 -0
  15. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/Makefile +115 -0
  16. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ax7325b_ddr3.v +236 -0
  17. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ax7325b_ddr3.xdc +759 -0
  18. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ax7325b_spd_reader.xdc +37 -0
  19. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/caas.conf +11 -0
  20. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/clk_wiz.v +66 -0
  21. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ddr3_controller.v +0 -0
  22. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ddr3_phy.v +1462 -0
  23. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ddr3_top.v +475 -0
  24. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/uart_rx.v +207 -0
  25. AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/uart_tx.v +187 -0
  26. AngeloJacobo_UberDDR3/example_demo/arty_s7/Makefile +116 -0
  27. AngeloJacobo_UberDDR3/example_demo/arty_s7/arty_ddr3.v +247 -0
  28. AngeloJacobo_UberDDR3/example_demo/arty_s7/arty_ddr3.xdc +265 -0
  29. AngeloJacobo_UberDDR3/example_demo/arty_s7/arty_ddr3_vivado.xdc +265 -0
  30. AngeloJacobo_UberDDR3/example_demo/arty_s7/caas.conf +11 -0
  31. AngeloJacobo_UberDDR3/example_demo/arty_s7/clk_wiz.v +66 -0
  32. AngeloJacobo_UberDDR3/example_demo/arty_s7/ddr3_controller.v +0 -0
  33. AngeloJacobo_UberDDR3/example_demo/arty_s7/ddr3_phy.v +1462 -0
  34. AngeloJacobo_UberDDR3/example_demo/arty_s7/ddr3_top.v +475 -0
  35. AngeloJacobo_UberDDR3/example_demo/arty_s7/uart_rx.v +207 -0
  36. AngeloJacobo_UberDDR3/example_demo/arty_s7/uart_tx.v +187 -0
  37. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/Makefile +114 -0
  38. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/caas.conf +11 -0
  39. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/clk_wiz.v +74 -0
  40. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_controller.v +0 -0
  41. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_phy.v +1462 -0
  42. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test.c +114 -0
  43. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test.v +379 -0
  44. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/bd/bd.tcl +86 -0
  45. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/component.xml +900 -0
  46. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/data/ddr3_test_monitor_axi.mdd +10 -0
  47. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/data/ddr3_test_monitor_axi.tcl +5 -0
  48. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/src/Makefile +26 -0
  49. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/src/ddr3_test_monitor_axi.c +6 -0
  50. AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/src/ddr3_test_monitor_axi.h +107 -0
.gitattributes CHANGED
@@ -569,3 +569,17 @@ danfoisy_vdatp/mech/LED[[:space:]]mount1.stl filter=lfs diff=lfs merge=lfs -text
569
  danfoisy_vdatp/mech/bracket.stl filter=lfs diff=lfs merge=lfs -text
570
  danfoisy_vdatp/media/colorballsm.JPG filter=lfs diff=lfs merge=lfs -text
571
  zephray_VerilogBoy/sim/vb_sim filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
  danfoisy_vdatp/mech/bracket.stl filter=lfs diff=lfs merge=lfs -text
570
  danfoisy_vdatp/media/colorballsm.JPG filter=lfs diff=lfs merge=lfs -text
571
  zephray_VerilogBoy/sim/vb_sim filter=lfs diff=lfs merge=lfs -text
572
+ AngeloJacobo_UberDDR3/example_demo/orangecrab_ecp5/orangecrab_ecp5_ddr3.dfu filter=lfs diff=lfs merge=lfs -text
573
+ hunterlew_convolution_network_on_FPGA/validation_with_matlab/net-epoch-73.mat filter=lfs diff=lfs merge=lfs -text
574
+ jhshi_openofdm/testing_inputs/conducted/dot11a_12mbps_qos_data_e4_90_7e_15_2a_16_e8_de_27_90_6e_42.dat filter=lfs diff=lfs merge=lfs -text
575
+ jhshi_openofdm/testing_inputs/conducted/dot11a_6mbps_qos_data_e4_90_7e_15_2a_16_e8_de_27_90_6e_42.dat filter=lfs diff=lfs merge=lfs -text
576
+ jhshi_openofdm/testing_inputs/conducted/dot11a_9mbps_qos_data_e4_90_7e_15_2a_16_e8_de_27_90_6e_42.dat filter=lfs diff=lfs merge=lfs -text
577
+ jhshi_openofdm/testing_inputs/conducted/dot11n_13mbps_98_5f_d3_c7_06_27_e8_de_27_90_6e_42.dat filter=lfs diff=lfs merge=lfs -text
578
+ jhshi_openofdm/testing_inputs/conducted/dot11n_19.5mbps_98_5f_d3_c7_06_27_e8_de_27_90_6e_42.dat filter=lfs diff=lfs merge=lfs -text
579
+ jhshi_openofdm/testing_inputs/conducted/dot11n_6.5mbps_98_5f_d3_c7_06_27_e8_de_27_90_6e_42.dat filter=lfs diff=lfs merge=lfs -text
580
+ jhshi_openofdm/testing_inputs/conducted/dot11n_7.2mbps_98_5f_d3_c7_06_27_e8_de_27_90_6e_42.dat filter=lfs diff=lfs merge=lfs -text
581
+ jhshi_openofdm/testing_inputs/radiated/dot11n_26mbps.dat filter=lfs diff=lfs merge=lfs -text
582
+ jhshi_openofdm/testing_inputs/radiated/dot11n_6.5mbps.dat filter=lfs diff=lfs merge=lfs -text
583
+ vicharak-in_shrike/archive/firmware/shrike-lite_v_0.uf2 filter=lfs diff=lfs merge=lfs -text
584
+ vicharak-in_shrike/archive/shrike_1.0_r0.2_v1.uf2 filter=lfs diff=lfs merge=lfs -text
585
+ vicharak-in_shrike/examples/shrike_picorv32_xip/firmware/rp2040/shrike_xip.uf2 filter=lfs diff=lfs merge=lfs -text
AngeloJacobo_UberDDR3/.gitignore ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ formal/ddr3_multiconfig*prf*
2
+ formal/ddr3_multiconfig_default/
3
+ formal/ddr3_multiconfig_ecc/
4
+ formal/ecc/
5
+ formal/ddr3_singleconfig/
6
+ example_demo/nexys_video/build/
7
+ testbench/xsim/xsim*
8
+ testbench/xsim/*backup*
9
+ testbench/xsim/*.log
10
+ testbench/xsim/*.pb
11
+ testbench/xsim/*.wdb
12
+ example_demo/*/build/*
13
+ example_demo/build_logs*
14
+ *.fasm
15
+ *.frames
16
+ *.bin
17
+ *.json
18
+ *.bba
19
+ *toolchain-nix*
20
+ testbench/ddr3_dimm_micron_sim_behav.wcfg
21
+ testbench/icarus_sim/*.log
22
+ testbench/icarus_sim/uberddr3_sim
23
+ *jobid
24
+ .caas*
25
+
26
+ # But do not ignore testbench/xsim/test_*.log
27
+ !testbench/xsim/test_*.log
AngeloJacobo_UberDDR3/LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
AngeloJacobo_UberDDR3/README.md ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Table of Contents
3
+ - [Brief Description](https://github.com/AngeloJacobo/DDR3_Controller#brief-description)
4
+ - [Open IP Hub Blog Posts](https://github.com/AngeloJacobo/UberDDR3/edit/main/README.md#open-ip-hub-blog-posts)
5
+ - [Getting Started](https://github.com/AngeloJacobo/DDR3_Controller#getting-started)
6
+ - [Instantiate Design](https://github.com/AngeloJacobo/DDR3_Controller#heavy_check_mark-instantiate-design)
7
+ - [Create Constraint File](https://github.com/AngeloJacobo/DDR3_Controller#heavy_check_mark-create-constraint-file)
8
+ - [Edit Localparams](https://github.com/AngeloJacobo/DDR3_Controller#heavy_check_mark-edit-localparams)
9
+ - [Lint and Formal Verification](https://github.com/AngeloJacobo/DDR3_Controller#lint-and-formal-verification)
10
+ - [Simulation](https://github.com/AngeloJacobo/DDR3_Controller#simulation)
11
+ - [Demo Projects](https://github.com/AngeloJacobo/UberDDR3/tree/main?tab=readme-ov-file#demo-projects)
12
+
13
+
14
+ # Brief Description
15
+ This DDR3 controller was originally designed to be used on the [10-Gigabit Ethernet Project](https://github.com/ZipCPU/eth10g) for an 8-lane x8 DDR3 module running at 800 MHz DDR, but this is now being designed to be a more general-purpose DDR3 memory controller with multiple supported FPGA boards. This is a 4:1 memory controller with configurable timing parameters and mode registers so it can be configured to any DDR3 memory device. The user-interface is the basic Wishbone. Optional features include:
16
+ - AXI4 User Interface ([blog post here](https://www.openiphub.com/post/uberddr3-new-feature-axi4-interface))
17
+ - SECDEC for error correction ([blog post here](https://www.openiphub.com/post/uberddr3-feature-update-error-correction-part-1-post-5))
18
+ - Self-Refresh ([blog post here](https://www.openiphub.com/post/uberddr3-self-refresh-reducing-power-consumption-in-idle-periods-post-9))
19
+ - Dual-rank Support ([blog post here](https://www.openiphub.com/post/unlocking-more-memory-dual-rank-dimm-support-in-uberddr3-post-10))
20
+ - Integratable with MicroBlaze ([blog post here](https://www.openiphub.com/post/uberddr3-microblaze-part-1-post-7))
21
+ - Built-in self test
22
+
23
+ This memory controller is optimized to maintain a high data throughput and continuous sequential burst operations. The controller handles the reset sequence, refresh sequence, mode register configuration, bank status tracking, timing delay tracking, command issuing, and the PHY's calibration. The PHY's calibration handles the bitslip training, read-DQ/DQS alignment via MPR (read calibration), write-DQ/DQS alignment via write leveling (write calibration), and also an optional comprehensive read/write test.
24
+
25
+ The optional built-in self read/write tests made it easier to test the memory controller without needing an external CPU. These tests include a burst access, random access, and alternating read-write access tests. Only if no error is found on these tests will the calibration end and user can start accessing the wishbone interface.
26
+
27
+ This design is [formally verified](https://github.com/AngeloJacobo/DDR3_Controller#lint-and-formal-verification) and [simulated using the Micron DDR3 model](https://github.com/AngeloJacobo/DDR3_Controller#simulation).
28
+
29
+ # Open IP Hub Blog Posts
30
+ Check out these blog posts for detailed explanations on new features of UberDDR3, how to use them, and project demos:
31
+ - [UberDDR3: An Opensource DDR3 Controller - Post #1](https://www.openiphub.com/post/uberddr3-an-opensource-ddr3-controller-post-1)
32
+ - [Getting Started with UberDDR3 (Part 1) - Post #2](https://www.openiphub.com/post/getting-started-with-uberddr3-part-1-post-2)
33
+ - [Getting Started with UberDDR3 (Part 2) - Post #3](https://www.openiphub.com/post/getting-started-with-uberddr3-part-2-post-3)
34
+ - [UberDDR3 Update: AXI4 Interface - Post #4](https://www.openiphub.com/post/uberddr3-new-feature-axi4-interface)
35
+ - [UberDDR3 Update: Error Correction (Part 1) - Post #5](https://www.openiphub.com/post/uberddr3-feature-update-error-correction-part-1-post-5)
36
+ - [UberDDR3 Feature Update: Error Correction (Part 2) - Post #6](https://www.openiphub.com/post/uberddr3-feature-update-error-correction-part-2-post-6)
37
+ - [UberDDR3 + MicroBlaze (Part 1) - Post #7](https://www.openiphub.com/post/uberddr3-microblaze-part-1-post-7)
38
+ - [UberDDR3 + MicroBlaze (Part 2) - Post #8](https://www.openiphub.com/post/uberddr3-microblaze-part-2-post-8)
39
+ - [UberDDR3 Self-Refresh: Reducing Power Consumption in Idle Periods - Post #9](https://www.openiphub.com/post/uberddr3-self-refresh-reducing-power-consumption-in-idle-periods-post-9)
40
+ - [Unlocking More Memory: Dual-Rank DIMM Support in UberDDR3 - Post #10](https://www.openiphub.com/post/unlocking-more-memory-dual-rank-dimm-support-in-uberddr3-post-10)
41
+
42
+ # Getting Started
43
+ The recommended way to instantiate this IP is to use the top module [`rtl/ddr3_top.v`](https://github.com/AngeloJacobo/DDR3_Controller/blob/main/rtl/ddr3_top.v), a template for instantiation is also included in that file. Steps to include this DDR3 memory controller IP is to instantiate design, create the constraint file, then edit the localparams.
44
+
45
+ ## :heavy_check_mark: Instantiate Design
46
+ The first thing to edit are the **top-level parameters**:
47
+
48
+ | Parameter | Function |
49
+ | :---: | :--- |
50
+ | CONTROLLER_CLK_PERIOD | clock period of the controller interface in picoseconds. Tested values range from `12_000` ps (83.33 MHz) to `10_000` ps (100 MHz). |
51
+ | DDR3_CLK_PERIOD | clock period of the DDR3 RAM device in picoseconds which must be 1/4 of the `CONTROLLER_CLK_PERIOD`. Tested values range from `3_000` ps (333.33 MHz) to `2_500` ps (400 MHz). |
52
+ | ROW_BITS | width of row address. Use chapter _2.11 DDR3 SDRAM Addressing_ from [JEDEC DDR3 doc (page 15)](https://www.jedec.org/sites/default/files/docs/JESD79-3F.pdf) as a guide. Possible values range from `12` to `16`. |
53
+ | COL_BITS | width of column address. Use chapter _2.11 DDR3 SDRAM Addressing_ from [JEDEC DDR3 doc (page 15)](https://www.jedec.org/sites/default/files/docs/JESD79-3F.pdf) as a guide. Possible values range from `10` to `12`. |
54
+ | BA_BITS | width of bank address. Use chapter _2.11 DDR3 SDRAM Addressing_ from [JEDEC DDR3 doc (page 15)](https://www.jedec.org/sites/default/files/docs/JESD79-3F.pdf) as a guide. Usual value is `3`.
55
+ | BYTE_LANES | number of bytes based on width of DQ. <sup>[[1]](https://github.com/AngeloJacobo/DDR3_Controller#note) </sup> |
56
+ | AUX_WIDTH | width of auxiliary line. Value must be >= 4. <sup>[[2]](https://github.com/AngeloJacobo/DDR3_Controller#note) </sup> |
57
+ | WB2_ADDR_BITS | width of 2nd wishbone address bus for debugging (only relevant if SECOND_WISHBONE = 1). |
58
+ | WB2_DATA_BITS | width of 2nd wishbone data bus for debugging (only relevant if SECOND_WISHBONE = 1). |
59
+ | MICRON_SIM | set to 1 if used in Micron DDR3 model to shorten power-on sequence, otherwise 0. |
60
+ | ODELAY_SUPPORTED | set to 1 if ODELAYE2 primitive is supported by the FPGA, otherwise 0. <sup>[[3]](https://github.com/AngeloJacobo/DDR3_Controller#note) </sup> |
61
+ | SECOND_WISHBONE | set to 1 if 2nd wishbone for debugging is needed , otherwise 0.|
62
+ | WB_ERROR | set to 1 to support Wishbone error (asserts at ECC double bit error assuming ECCE_ENABLE != 0) |
63
+ | SKIP_INTERNAL_TEST | set to 1 to skip built-in self test which usually takes > 2 seconds|
64
+ | ECC_ENABLE | set to 0 to disable ECC OR: 1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC (more about [ECC on this blog post](https://www.openiphub.com/post/uberddr3-feature-update-error-correction-part-1-post-5))|
65
+ | DIC | Output Driver Impedance Control (2'b00 = RZQ/6, 2'b01 = RZQ/7, RZQ = 240ohms) (only change this when you know what you are doing) |
66
+ | RTT_NOM | RTT Nominal (3'b000 = disabled, 3'b001 = RZQ/4, 3'b010 = RZQ/2 , 3'b011 = RZQ/6, RZQ = 240ohms) (only change when you know what you are doing) |
67
+ | SELF_REFRESH | 0 = use i_user_self_refresh input, 1 = Self-refresh mode is enabled after 64 controller clock cycles of no requests, 2 = 128 cycles, 3 = 256 cycles (more on [self-refresh on this blog post](https://www.openiphub.com/post/uberddr3-self-refresh-reducing-power-consumption-in-idle-periods-post-9))|
68
+ ***
69
+
70
+ After the parameters, connect the ports of the top module to your design. Below are the **ports for clocks and reset**:
71
+ | Ports | Function |
72
+ | :---: | :--- |
73
+ | i_controller_clk | clock of the controller interface with period of `CONTROLLER_CLK_PERIOD` |
74
+ | i_ddr3_clk | clock of the DDR3 interface with period of `DDR3_CLK_PERIOD` |
75
+ | i_ref_clk | reference clock for IDELAYCTRL primitive with frequency of 200 MHz |
76
+ | i_ddr3_clk_90 | clock required only if ODELAY_SUPPORTED = 0, otherwise can be left unconnected. Has a period of `DDR3_CLK_PERIOD` with 90° phase shift. |
77
+ | i_rst_n | Active-low synchronous reset for the entire DDR3 controller and PHY |
78
+
79
+ It is recommended to generate all these clocks from a single PLL or clock-generator.
80
+
81
+ ***
82
+
83
+ Next are the **main wishbone ports**:
84
+
85
+ | Ports | Function |
86
+ | :---: | :--- |
87
+ | i_wb_cyc | Indicates if a bus cycle is active. A high value (1) signifies normal operation, while a low value (0) signals the cancellation of all ongoing transactions. |
88
+ | i_wb_stb | Strobe or transfer request signal. It's asserted (set to 1) to request a data transfer. |
89
+ | i_wb_we | Write-enable signal. A high value (1) indicates a write operation, and a low value (0) indicates a read operation. |
90
+ | i_wb_addr | Address bus. Used to specify the address for the current read or write operation. Formatted as {row, bank, column}. |
91
+ | i_wb_data | Data bus for write operations. In a 4:1 controller, the data width is 8 times the DDR3 pins `8`x`DQ_BITS`x`LANES`. |
92
+ | i_wb_sel | Byte select for write operations. Indicates which bytes of the data bus are to be overwritten for the write operation. |
93
+ | o_wb_stall | Indicates if the controller is busy (1)and cannot accept any new requests. |
94
+ | o_wb_ack | Acknowledgement signal. Indicates that a read or write request has been completed. |
95
+ | o_wb_data | Data bus for read operations. Similar to `i_wb_data`, the data width for a 4:1 controller is 8 times the DDR3 pins `8`x`DQ_BITS`x`LANES`. |
96
+
97
+ ***
98
+
99
+ Below are the **auxiliary ports** associated with the main wishbone. This is not required for normal operation, but is intended for AXI-interface compatibility *which is not yet available*:
100
+ | Ports | Function |
101
+ | :---: | :--- |
102
+ | i_aux | Request ID line with width of `AUX_WIDTH`. The Request ID is retrieved simultaneously with the strobe request. |
103
+ | o_aux | Request ID line with width of `AUX_WIDTH`. The Request ID is sent back concurrently with the acknowledgement signal. |
104
+
105
+
106
+ ***
107
+
108
+ After main wishbone port are the **second-wishbone ports**. This interface is only for debugging-purposes and would normally not be needed thus can be left unconnected by setting `SECOND_WISHBONE` = 0. The ports for the second-wishbone is very much the same as the main wishbone.
109
+
110
+ Next are the **DDR3 I/O ports**, these will be connected directly to the top-level pins of your design thus port-names must match what is indicated on your constraint file. You do not need to understand what each DDR3 I/O ports does but if you're curious, details on each DDR3 I/O pins are described on _2.10 Pinout Description_ from [JEDEC DDR3 doc (page 13)](https://www.jedec.org/sites/default/files/docs/JESD79-3F.pdf).
111
+
112
+ Finally are the **debug ports**, these are connected to relevant registers containing information on current state of the controller. Trace each `o_debug_*` inside `ddr3_controller.v` to edit the registers to be monitored.
113
+
114
+ ## :heavy_check_mark: Create Constraint File
115
+ * One example of constraint file is from the [Kintex-7 Ethernet Switch Project](https://github.com/AngeloJacobo/DDR3_Controller/blob/main/example_demo/klusterlab/kluster.xdc#L227-L389) <sup>[[4]](https://github.com/AngeloJacobo/DDR3_Controller#note) </sup>, highlighted are all the DDR3 pins. This constraint file assumes a dual-rank DDR3 RAM (thus 2 pairs of `o_ddr3_clk`, `o_ddr3_cke`, `o_ddr3_s_n`, and `o_ddr3_odt`) with 8 lanes of x8 DDR3 (thus 8 `o_ddr3_dm`, 8 `io_ddr3_dqs`, and 64 `io_ddr3_dq`). The constraint file also has [set_property](https://github.com/AngeloJacobo/DDR3_Controller/blob/main/example_demo/klusterlab/kluster.xdc#L453-L457) required for proper operation. The property `INTERNAL_VREF` must be set to half of the bank voltage (1.5V thus set to `0.75`). The property `BITSTREAM.STARTUP.MATCH_CYCLE` ([page 240 of UG628: Command Line Guide](https://docs.xilinx.com/v/u/en-US/devref)) is verified to work properly when value is set to `6`. Kintex-7 has HP bank where the DDR3 is connected thus allow the use of DCI (Digitally-Controlled Impedance) for impedance matching by using `SSTL15_T_DCI` type of `IOSTANDARD`.
116
+
117
+ * Another example of constraint file is for the [Arty-S7 project]( https://github.com/AngeloJacobo/UberDDR3/blob/main/example_demo/arty_s7/Arty-S7-50-Master.xdc#L24-L244), highlighted are the DDR3 pins. The Arty-S7 has x16 DDR3 and it works like two x8 (thus 2 `ddr3_dm`, 2 `ddr3_dqs`, and 16 `io_ddr3_dq`) <sup>[[1]](https://github.com/AngeloJacobo/DDR3_Controller#note) </sup>. Arty-S7 only has HR bank where the DDR3 is connected, this restricts the design to use on-chip split-termination [(UG471 7-Series Select Guide page 33)](https://docs.xilinx.com/v/u/en-US/ug471_7Series_SelectIO) for impedance matching instead of DCI used in HP banks. `IN_TERM UNTUNED_SPLIT_50` signifies that the input termination is set to an untuned split termination of 50 ohms. The constraint file was easily created by retrieving the pin constraints generated by the Vivado Memory Interface Generator (MIG) together with the [`.prj` file](https://github.com/Digilent/vivado-boards/blob/master/new/board_files/arty-s7-50/B.0/mig.prj#L47-L96) provided by Digilent for Arty-S7. The generated `.xdc` file by the MIG can be located at `[vivado_proj].gen/sources_1/ip/mig_7series_0/mig_7series_0/user_design/constraints/mig_7series_0.xdc`
118
+
119
+ ## :heavy_check_mark: Edit Localparams
120
+ The verilog file [`rtl/ddr3_controller`](https://github.com/AngeloJacobo/DDR3_Controller/blob/main/rtl/ddr3_controller.v) contains the timing parameters that needs to be configured by the user to align with the DDR3 device. User should base the timing values on _Chapter 13 Electrical Characteristics and AC Timing_ from [JEDEC DDR3 doc (page 169)](https://www.jedec.org/sites/default/files/docs/JESD79-3F.pdf). _The default values on the verilog file should generally work for DDR3-800_.
121
+
122
+ ### Note:
123
+ [1]: For x16 DDR3 like in Arty S7, use `BYTE_LANES` of 2. If the memory configuration is a SO-DIMM with 8 DDR3 RAM modules, each being x8 to form a total of 64 bits of data, then BYTE_LANES would be 8.
124
+ [2]: The auxiliary line is intended for AXI-interface compatibility but is also utilized in the reset sequence, which is the origin of the minimum required width of 4.
125
+ [3]: ODELAYE2 is supported if DDR3 device is connected to an HP (High-Powered) bank of FPGA. HR (High-Rank) bank does not support ODELAYE2 as based on [UG471 7-Series Select Guide (page 134)](https://docs.xilinx.com/v/u/en-US/ug471_7Series_SelectIO).
126
+ [4]: This is the open-sourced [10Gb Ethernet Project](https://github.com/ZipCPU/eth10g).
127
+
128
+
129
+ ***
130
+
131
+ # Lint and Formal Verification
132
+ The easiest way to compile, lint, and formally verify the design is to run [`./run_compile.sh`](https://github.com/AngeloJacobo/DDR3_Controller/blob/main/run_compile.sh) on the top-level directory. This will first run [Verilator](https://verilator.org/guide/latest/install.html) lint.
133
+
134
+ Next is compilation with [Yosys](https://github.com/YosysHQ/yosys), this will show warnings:
135
+ > Warning: Replacing memory ... with list of registers.
136
+
137
+ Disregards this kind of warning as it just converts small memory elements in the design into a series of register elements.
138
+
139
+ After Yosys compilation is [Icarus Verilog](https://github.com/steveicarus/iverilog) compilation, this should not show any warning or errors but will display the `Test Functions` to verify that the verilog-functions return the correct values, and `Controller Parameters` to verify the top-level parameters are set properly. Delay values for some timing parameters are also shown.
140
+
141
+ Last is the [Symbiyosys Formal Verification](https://symbiyosys.readthedocs.io/en/latest/install.html), this will run the [single and multiple configuration sby](https://github.com/AngeloJacobo/UberDDR3/tree/main/formal) for formal verification. A summary is shown at the end where all tasks passed:
142
+
143
+ ![image](https://github.com/AngeloJacobo/DDR3_Controller/assets/87559347/de554a92-880c-4513-83ba-a096da682f3b)
144
+
145
+
146
+ # Simulation
147
+
148
+ For simulation, the DDR3 SDRAM Verilog [Model from Micron](https://www.micron.com/search-results?searchRequest=DDR3+SDRAM+Verilog+Model&SelectedValues=%2Fsim-model--%2Fsim-model%2Fbdsl--%2Fsim-model%2Fbfm--%2Fsim-model%2Fcadence-dml--%2Fsim-model%2Fhspice--%2Fsim-model%2Fhyperlynx--%2Fsim-model%2Fibis--%2Fsim-model%2Fibis-ami--%2Fsim-model%2Fmentor-icx--%2Fsim-model%2Fs-parameter--%2Fsim-model%2Fspice--%2Fsim-model%2Fsisoft--%2Fsim-model%2Fsystem-c--%2Fsim-model%2Fsystem-verilog--%2Fsim-model%2Fthermal--%2Fsim-model%2Fverilog#accordion-db73c0b4db-item-4671aec5a3) is used. Import all simulation files under [./testbench](https://github.com/AngeloJacobo/DDR3_Controller/tree/main/testbench) to Vivado. [`ddr3_dimm_micron_sim.sv`](https://github.com/AngeloJacobo/DDR3_Controller/blob/main/testbench/ddr3_dimm_micron_sim.sv) is the top-level module which instantiates both the DDR3 memory controller and the Micron DDR3 model. This module issues read and write requests to the controller via the wishbone bus, then the returned data from read requests are verified if it matches the data written. Both sequential and random accesses are tested.
149
+
150
+ Currently, there are 2 general options for running the simulation and is defined by a `define` directive on the `ddr3_dimm_micron_sim.sv` file: `TWO_LANES_x8` and `EIGHT_LANES_x8`. `TWO_LANES_x8` simulates an Arty-S7 FPGA board which has an x16 DDR3, meanwhile `EIGHT_LANES_x8` simulates 8-lanes of x8 DDR3 module. **Make sure to change the organization via a `define` directive under [ddr3.sv](https://github.com/AngeloJacobo/DDR3_Controller/blob/main/testbench/ddr3.sv)** (`TWO_LANES_x8` must use `define x8` while `EIGHT_LANES_x8` must use `define x16`).
151
+
152
+
153
+ After configuring, run simulation. The `ddr3_dimm_micron_sim_behav.wcfg` contains the waveform. Shown below are the clocks:
154
+ ![image](https://github.com/AngeloJacobo/DDR3_Controller/assets/87559347/f11afd00-ea17-4669-bebb-9f22e8ae6f6d)
155
+
156
+
157
+ As shown below, `command_used` shows the command issued at a specific time. During reads the `dqs` should toggle and `dq` should have a valid value, else they must be in high-impedance `Z`. Precharge and activate also happens between reads when row addresses are different.
158
+ ![image](https://github.com/AngeloJacobo/DDR3_Controller/assets/87559347/a289066f-2a5c-4d08-9660-a76cf537383a)
159
+
160
+
161
+ A part of internal test is to do alternate write then read consecutively as shown below. The data written must match the data read. `dqs` should also toggle along with the data written and read.
162
+ ![image](https://github.com/AngeloJacobo/DDR3_Controller/assets/87559347/817124fa-43d0-4e9f-94c4-2889614d7c87)
163
+
164
+
165
+ There are counters for the number of correct and wrong read data during the internal read/write test: `correct_read_data` and `wrong_read_data`. As shown below, the `wrong_read_data` must remain zero while `correct_read_data` must increment until it reaches the maximum (3499 on this example).
166
+ ![image](https://github.com/AngeloJacobo/DDR3_Controller/assets/87559347/06d7b4c0-cd40-4fd1-9bc3-6329237e46e3)
167
+
168
+ The simulation also reports the status of the simulation. For example, the report below:
169
+ > [10000 ps] RD @ (0, 840) -> [10000 ps] RD @ (0, 848) -> [10000 ps] RD @ (0, 856) -> [10000 ps] RD @ (0, 864) -> [10000 ps] RD @ (0, 872) ->
170
+
171
+ The format is [`time_delay`] `command` @ (`bank`, `address`), so `[10000 ps] RD @ (0, 840)` means 10000 ps delay before a read command with bank 0 and address 840. Notice how each read command has a delay of 10000 ps or 10 ns from each other, since this has a controller clock of 100 MHz (10 ns clock period) this shows that there are no interruptions between sequential read commands resulting in a very high throughput.
172
+
173
+ A short report is also shown in each test section:
174
+ > DONE TEST 1: LAST ROW
175
+ Number of Operations: 2304
176
+ Time Started: 363390 ns
177
+ Time Done: 387980 ns
178
+ Average Rate: 10 ns/request
179
+
180
+
181
+ This report is after a burst write then burst read. This report means there were 2304 write and read operation, and the average time per request is 10 ns (1 controller clock period of 100 MHz). The average rate is optimal since this is a burst write and read. But for random writes and reads:
182
+ > DONE TEST 2: RANDOM
183
+ Number of Operations: 2304
184
+ Time Started: 387980 ns
185
+ Time Done: 497660 ns
186
+ Average Rate: 47 ns/request
187
+
188
+
189
+ Notice how the average rate increased to 47 ns/request. Random access requires occasional precharge and activate which takes time and thus prolong the time for every read or write access. At the very end of the report shows a summary:
190
+
191
+ > TEST CALIBRATION
192
+ [-]: write_test_address_counter = 5000
193
+ [-]: read_test_address_counter = 2000
194
+ [-]: correct_read_data = 3499
195
+ [-]: wrong_read_data = 0
196
+
197
+ > ------- SUMMARY -------
198
+ Number of Writes = 4608
199
+ Number of Reads = 4608
200
+ Number of Success = 4604
201
+ Number of Fails = 4
202
+ Number of Injected Errors = 4
203
+
204
+ The summary under `TEST CALIBRATION` are the results from the **internal** read/write test as part of the internal calibration. These are the same counters on the waveform shown before where the `wrong_read_data` should be zero. Under `SUMMARY` is the report from the **external** read/write test where the top-level simulation file `ddr3_dimm_micron_sim.sv` sends read/write request to the DDR3 controller via the wishbone bus. Notice that the number of fails (4) matches the number of injected errors (4) which is only proper.
205
+
206
+ # Demo Projects
207
+ - The [Arty-S7 demo project](./example_demo/arty_s7) is a basic project for testing the DDR3 controller. The gist is that the 4 LEDS should light-up which means reset sequence is done and all internal read/write test passed during calibration. This project also uses a UART line, sending small letters via UART will write those corresponding small letters to memory, meanwhile sending capital letters will read those small letters back from memory.
208
+ - To run this project on your Arty-S7 board, import all verilog files and xdc file under `example_demo/arty_s7/` and `rtl/`. Run synthesis-to-bitstream generation then upload the bitfile. After around 2 seconds, the 4 LEDS should light up then you can start interacting with the UART line. BTN0 button is for reset.
209
+ - Or just upload the [bitfile already given in the repo](./example_demo/arty_s7).
210
+
211
+ - The [Nexys Video demo project](./example_demo/nexys_video) utilizes the DDR3 chip on the Digilent Nexys Video board with xc7a200t. Only one lane is used for simplicity. Supports OpenXC7 toolchain. Makefiles have been included for quick start, just run the following command in the root directory of repo:
212
+
213
+ - Vivado compilation: `source /opt/Xilinx/Vivado/2019.1/settings64.sh` then `make -C example_demo/nexys_video -f Makefile.vivado`
214
+ - OpenXC7 compilation (using toolchain in Docker): `docker run --rm -v .:/mnt -v /chipdb:/chipdb regymm/openxc7 make -C /mnt/nexys_video -f Makefile.openxc7`
215
+
216
+ The bitstream will be compiled as `nexys_video/build/top.bit`.
217
+
218
+ - Board test: after programming bitstream, the 8 LEDs will show some pattern, then become all lit up after calibration. When pressing BTND(D22), LD7/LD6 will show a blinky, and LD5-LD0 will show 101110 after successful calibration. BTNC(B22) resets the controller, and calibration will be redone. 9600 baud UART will be the same as the Arty-S7 case: type small `abcd` to write to memory, and type capital `ABCD` to read back. For example, type `abcd` then `ABCDEFGH` will show `abcd����` (because EFGH memory locations are not written yet).
219
+ - The [QMTech Wukong demo project](./example_demo/qmtech_wukong) is just the same as the arty-s7 demo mentioned above.
220
+ - To run this project on your [QMTech Wukong board](https://github.com/ChinaQMTECH/QM_XC7A100T_WUKONG_BOARD/tree/master/V3), import all verilog files and xdc file under `example_demo/qmtech_wukong/` and `rtl/`. Run synthesis-to-bitstream generation then upload the bitfile. After around 2 seconds, the 2 LEDS should light up then you can start interacting with the UART line. SW2 button is for reset.
221
+ - Or just upload the [bitfile already given in the repo](./example_demo/qmtech_wukong).
222
+ - The [10Gb Ethernet Switch](https://github.com/ZipCPU/eth10g) project utilizes this DDR3 controller for accessing a single-rank DDR3 module (8 lanes of x8 DDR3) at DDR3-800 (100 MHz controller and 400 MHz PHY).
223
+
224
+ # Other Open-Sourced DDR3 Controllers
225
+ (soon...)
226
+
227
+ # Developer Documentation
228
+ There is no developer documentation yet. But may I include here the [notes I compiled](https://github.com/AngeloJacobo/DDR3-Notes) when I did an intensive study on DDR3 before I started this project.
229
+
230
+ # Acknowledgement
231
+ This project is funded through [NGI0 Entrust](https://nlnet.nl/entrust), a fund established by [NLnet](https://nlnet.nl) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu) program. Learn more at the [NLnet project page](https://nlnet.nl/project/UberDDR3).
232
+
233
+ [<img src="https://nlnet.nl/logo/banner.png" alt="NLnet foundation logo" width="20%" />](https://nlnet.nl)
234
+ [<img src="https://nlnet.nl/image/logos/NGI0_tag.svg" alt="NGI Zero Logo" width="20%" />](https://nlnet.nl/entrust)
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/Makefile ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PROJECT = ax7103_ddr3
2
+ FAMILY = artix7
3
+ PART = xc7a100tfgg484-2
4
+ CHIPDB = ${ARTIX7_CHIPDB}
5
+ ADDITIONAL_SOURCES = ../../rtl/ddr3_controller.v ../../rtl/ddr3_phy.v ../../rtl/ddr3_top.v uart_rx.v uart_tx.v clk_wiz.v
6
+
7
+ #############################################################################################
8
+ NEXTPNR_XILINX_DIR ?= /snap/openxc7/current/opt/nextpnr-xilinx
9
+ NEXTPNR_XILINX_PYTHON_DIR ?= ${NEXTPNR_XILINX_DIR}/python
10
+ PRJXRAY_DB_DIR ?= ${NEXTPNR_XILINX_DIR}/external/prjxray-db
11
+
12
+ DBPART = $(shell echo ${PART} | sed -e 's/-[0-9]//g')
13
+ SPEEDGRADE = $(shell echo ${PART} | sed -e 's/.*\-\([0-9]\)/\1/g')
14
+
15
+ CHIPDB ?= ./
16
+ ifeq ($(CHIPDB),)
17
+ CHIPDB = ./
18
+ endif
19
+
20
+ PYPY3 ?= pypy3
21
+
22
+ TOP ?= ${PROJECT}
23
+ TOP_MODULE ?= ${TOP}
24
+ TOP_VERILOG ?= ${TOP}.v
25
+
26
+ PNR_DEBUG ?= # --verbose --debug
27
+
28
+ JTAG_LINK ?= -c digilent_hs2
29
+
30
+ XDC ?= ${PROJECT}.xdc
31
+
32
+ .PHONY: openxc7
33
+ openxc7: ${PROJECT}_openxc7.bit
34
+
35
+ .PHONY: program
36
+ program: ${PROJECT}_openxc7.bit
37
+ openFPGALoader ${JTAG_LINK} --bitstream $<
38
+
39
+ ${PROJECT}.json: ${TOP_VERILOG} ${ADDITIONAL_SOURCES}
40
+ yosys -p "synth_xilinx -flatten -abc9 ${SYNTH_OPTS} -arch xc7 -top ${TOP_MODULE}; write_json ${PROJECT}.json" $< ${ADDITIONAL_SOURCES}
41
+
42
+ # The chip database only needs to be generated once
43
+ # that is why we don't clean it with make clean
44
+ ${CHIPDB}/${DBPART}.bin:
45
+ ${PYPY3} ${NEXTPNR_XILINX_PYTHON_DIR}/bbaexport.py --device ${PART} --bba ${DBPART}.bba
46
+ bbasm -l ${DBPART}.bba ${CHIPDB}/${DBPART}.bin
47
+ rm -f ${DBPART}.bba
48
+
49
+ ${PROJECT}.fasm: ${PROJECT}.json ${CHIPDB}/${DBPART}.bin ${XDC}
50
+ nextpnr-xilinx --chipdb ${CHIPDB}/${DBPART}.bin --xdc ${XDC} --json ${PROJECT}.json --fasm $@ ${PNR_ARGS} ${PNR_DEBUG}
51
+
52
+ ${PROJECT}.frames: ${PROJECT}.fasm
53
+ fasm2frames --part ${PART} --db-root ${PRJXRAY_DB_DIR}/${FAMILY} $< > $@
54
+
55
+ ${PROJECT}_openxc7.bit: ${PROJECT}.frames
56
+ xc7frames2bit --part_file ${PRJXRAY_DB_DIR}/${FAMILY}/${PART}/part.yaml --part_name ${PART} --frm_file $< --output_file $@
57
+
58
+
59
+ #############################################################################################
60
+ # SPDX-License-Identifier: MIT
61
+ # Generated from https://github.com/FPGAOL-CE/caas-wizard
62
+ #
63
+ BUILDDIR := ${CURDIR}/build
64
+
65
+ LOGFILE := ${BUILDDIR}/top.log
66
+
67
+ # Build design
68
+ .PHONY: vivado
69
+ vivado: ${BUILDDIR}/${PROJECT}_vivado.bit
70
+
71
+ ${BUILDDIR}:
72
+ mkdir -m 777 -p ${BUILDDIR} && chown -R nobody ${BUILDDIR} | true
73
+
74
+ .ONESHELL:
75
+ ${BUILDDIR}/vivado.tcl: ${BUILDDIR}
76
+ cat << EOF > $@
77
+ # vivado.tcl generated for FPGAOL-CE/caas-wizard
78
+ # can be launched from any directory
79
+ cd ${BUILDDIR}
80
+ create_project -part ${PART} -force v_proj
81
+ set_property target_language Verilog [current_project]
82
+ cd ..
83
+ read_verilog [glob ${PROJECT}.v ${ADDITIONAL_SOURCES}]
84
+ read_xdc [glob $(wildcard ${PROJECT}.xdc) ]
85
+ cd build
86
+ synth_design -top ${PROJECT}
87
+ opt_design
88
+ place_design
89
+ phys_opt_design
90
+ route_design
91
+ write_bitstream -verbose -force ${PROJECT}_vivado.bit
92
+ # report_utilization -file util.rpt
93
+ # report_timing_summary -file timing.rpt
94
+ EOF
95
+
96
+ ${BUILDDIR}/${PROJECT}_vivado.bit: ${BUILDDIR}/vivado.tcl
97
+ cd ${BUILDDIR} && vivado -mode batch -source $< > ${LOGFILE} 2>&1
98
+
99
+ .PHONY: program_vivado
100
+ program_vivado:
101
+ openFPGALoader ${JTAG_LINK} --bitstream ${BUILDDIR}/${PROJECT}_vivado.bit
102
+
103
+ #############################################################################################
104
+
105
+ .PHONY: clean
106
+ clean:
107
+ rm -f *.bit
108
+ rm -f *.frames
109
+ rm -f *.fasm
110
+ rm -f *.json
111
+ rm -f *.bin
112
+ rm -f *.bba
113
+ rm -rf ${BUILDDIR}
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ax7103_ddr3.v ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ax7103_ddr3.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: Example demo of UberDDR3 for ALINX AX7103 (xc7a100tfgg484-2). Mechanism:
7
+ // - four LEDs will light up once UberDDR3 is done calibrating
8
+ // - if UART (9600 Baud Rate)receives small letter ASCII (a-z), this value will be written to DDR3
9
+ // - if UART receives capital letter ASCII (A-Z), the small letter equivalent will be retrieved from DDR3 by doing
10
+ // - a read request, once read data is available this will be sent to UART to be streamed out.
11
+ // THUS:
12
+ // - Sendng "abcdefg" to the UART terminal will store that small latter to DDR3
13
+ // - Then sending "ABCDEFG" to the UART terminal will return the small letter equivalent: "abcdefg"
14
+ //
15
+ // Engineer: Angelo C. Jacobo
16
+ //
17
+ ////////////////////////////////////////////////////////////////////////////////
18
+ //
19
+ // Copyright (C) 2023-2025 Angelo Jacobo
20
+ //
21
+ // This program is free software: you can redistribute it and/or modify
22
+ // it under the terms of the GNU General Public License as published by
23
+ // the Free Software Foundation, either version 3 of the License, or
24
+ // (at your option) any later version.
25
+ //
26
+ // This program is distributed in the hope that it will be useful,
27
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
28
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
+ // GNU General Public License for more details.
30
+ //
31
+ // You should have received a copy of the GNU General Public License
32
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
33
+ //
34
+ ////////////////////////////////////////////////////////////////////////////////
35
+
36
+ `timescale 1ns / 1ps
37
+
38
+ module ax7103_ddr3
39
+ (
40
+ input wire sys_clk_p, // system clock positive on board
41
+ input wire sys_clk_n, //system clock negative on board
42
+ input wire i_rst_n,
43
+ // DDR3 I/O Interface
44
+ output wire ddr3_ck_p, ddr3_ck_n,
45
+ output wire ddr3_reset_n,
46
+ output wire ddr3_cke,
47
+ output wire ddr3_cs_n,
48
+ output wire ddr3_ras_n,
49
+ output wire ddr3_cas_n,
50
+ output wire ddr3_we_n,
51
+ output wire[15-1:0] ddr3_addr,
52
+ output wire[3-1:0] ddr3_ba,
53
+ inout wire[32-1:0] ddr3_dq,
54
+ inout wire[4-1:0] ddr3_dqs_p, ddr3_dqs_n,
55
+ output wire[4-1:0] ddr3_dm,
56
+ output wire ddr3_odt,
57
+ // UART line
58
+ input wire rx,
59
+ output wire tx,
60
+ //Debug LEDs
61
+ output wire[3:0] led
62
+ );
63
+ wire sys_clk_200MHz;
64
+
65
+ IBUFDS sys_clk_ibufgds
66
+ (
67
+ .O(sys_clk_200MHz),
68
+ .I(sys_clk_p),
69
+ .IB(sys_clk_n)
70
+ );
71
+
72
+ wire i_controller_clk, i_ddr3_clk, i_ref_clk, i_ddr3_clk_90;
73
+ wire m_axis_tvalid;
74
+ wire rx_empty;
75
+ wire tx_full;
76
+ wire o_wb_ack;
77
+ wire[7:0] o_wb_data;
78
+ wire o_aux;
79
+ wire[7:0] rd_data;
80
+ wire o_wb_stall;
81
+ reg i_wb_stb = 0, i_wb_we;
82
+ wire[63:0] o_debug1;
83
+ reg[7:0] i_wb_data;
84
+ reg[7:0] i_wb_addr;
85
+ // o_debug1 taps on value of state_calibrate (can be traced inside ddr3_controller module)
86
+ assign led[0] = !(o_debug1[4:0] != 23); //light up if not at DONE_CALIBRATE
87
+ assign led[1] = !(o_debug1[4:0] == 23); //light up if at DONE_CALIBRATE
88
+ assign led[2] = !(o_debug1[4:0] == 23); //light up if at DONE_CALIBRATE
89
+ assign led[3] = !(o_debug1[4:0] == 23); //light up if at DONE_CALIBRATE
90
+
91
+ always @(posedge i_controller_clk) begin
92
+ begin
93
+ i_wb_stb <= 0;
94
+ i_wb_we <= 0;
95
+ i_wb_addr <= 0;
96
+ i_wb_data <= 0;
97
+ if(!o_wb_stall && m_axis_tvalid) begin
98
+ if(rd_data >= 97 && rd_data <= 122) begin //write to DDR3 if ASCII is small letter
99
+ i_wb_stb <= 1;
100
+ i_wb_we <= 1;
101
+ i_wb_addr <= ~rd_data ;
102
+ i_wb_data <= rd_data;
103
+ end
104
+ else if(rd_data >= 65 && rd_data <= 90) begin //read from DDR3 if ASCII is capital letter
105
+ i_wb_stb <= 1; //make request
106
+ i_wb_we <= 0; //read
107
+ i_wb_addr <= ~(rd_data + 8'd32);
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ wire clk_locked;
114
+ clk_wiz clk_wiz_inst
115
+ (
116
+ // Clock out ports
117
+ .clk_out1(i_controller_clk), //83.333 Mhz
118
+ .clk_out2(i_ddr3_clk), // 333.333 MHz
119
+ .clk_out3(i_ref_clk), // 200 MHz
120
+ .clk_out4(i_ddr3_clk_90), // 333.333 MHz 90-degree
121
+ // Status and control signals
122
+ .reset(!i_rst_n),
123
+ .locked(clk_locked),
124
+ // Clock in ports
125
+ .clk_in1(sys_clk_200MHz)
126
+ );
127
+
128
+ // UART TX/RXmodule from https://github.com/ben-marshall/uart
129
+ uart_tx #(
130
+ .BIT_RATE(9600),
131
+ .CLK_HZ(83_333_333),
132
+ .PAYLOAD_BITS(8),
133
+ .STOP_BITS(1)
134
+ ) uart_tx_inst (
135
+ .clk(i_controller_clk), // Top level system clock input.
136
+ .resetn(i_rst_n && clk_locked && o_debug1[4:0] == 23), // Asynchronous active low reset.
137
+ .uart_txd(tx), // UART transmit pin.
138
+ .uart_tx_busy(), // Module busy sending previous item.
139
+ .uart_tx_en(o_wb_ack), // Send the data on uart_tx_data
140
+ .uart_tx_data(o_wb_data) // The data to be sent
141
+ );
142
+ uart_rx #(
143
+ .BIT_RATE(9600),
144
+ .CLK_HZ(83_333_333),
145
+ .PAYLOAD_BITS(8),
146
+ .STOP_BITS(1)
147
+ ) uart_rx_inst (
148
+ .clk(i_controller_clk), // Top level system clock input.
149
+ .resetn(i_rst_n && clk_locked && o_debug1[4:0] == 23), // Asynchronous active low reset.
150
+ .uart_rxd(rx), // UART Recieve pin.
151
+ .uart_rx_en(o_debug1[4:0] == 23), // Recieve enable
152
+ .uart_rx_break(), // Did we get a BREAK message?
153
+ .uart_rx_valid(m_axis_tvalid), // Valid data recieved/available.
154
+ .uart_rx_data(rd_data) // The recieved data.
155
+ );
156
+
157
+
158
+ // UART module from https://github.com/alexforencich/verilog-uart (DOES NOT WORK ON OPENXC7, UberDDR3 cannot finish calibration when this UART is used)
159
+ // uart #(.DATA_WIDTH(8)) uart_m
160
+ // (
161
+ // .clk(i_controller_clk),
162
+ // .rst(!i_rst_n),
163
+ // .s_axis_tdata(o_wb_data),
164
+ // .s_axis_tvalid(o_wb_ack),
165
+ // .s_axis_tready(),
166
+ // .m_axis_tdata(rd_data),
167
+ // .m_axis_tvalid(m_axis_tvalid),
168
+ // .m_axis_tready(1),
169
+ // .rxd(rx),
170
+ // .txd(tx),
171
+ // .prescale(1085) //9600 Baud Rate (83.33MHz/(8*9600))
172
+ // );
173
+
174
+ // DDR3 Controller
175
+ ddr3_top #(
176
+ .CONTROLLER_CLK_PERIOD(12_000), //ps, clock period of the controller interface
177
+ .DDR3_CLK_PERIOD(3_000), //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
178
+ .ROW_BITS(15), //width of row address
179
+ .COL_BITS(10), //width of column address
180
+ .BA_BITS(3), //width of bank address
181
+ .BYTE_LANES(4), //number of DDR3 modules to be controlled
182
+ .AUX_WIDTH(16), //width of aux line (must be >= 4)
183
+ .WB2_ADDR_BITS(32), //width of 2nd wishbone address bus
184
+ .WB2_DATA_BITS(32), //width of 2nd wishbone data bus
185
+ .MICRON_SIM(0), //enable faster simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
186
+ .ODELAY_SUPPORTED(0), //set to 1 when ODELAYE2 is supported
187
+ .SECOND_WISHBONE(0), //set to 1 if 2nd wishbone is needed
188
+ .ECC_ENABLE(0), // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
189
+ .WB_ERROR(0), // set to 1 to support Wishbone error (asserts at ECC double bit error)
190
+ .DIC(2'b01), //Output Driver Impedance Control (2'b00 = RZQ/6, 2'b01 = RZQ/7, RZQ = 240ohms) (only change when you know what you are doing)
191
+ .RTT_NOM(3'b001) //RTT Nominal (3'b000 = disabled, 3'b001 = RZQ/4, 3'b010 = RZQ/2 , 3'b011 = RZQ/6, RZQ = 240ohms) (only change when you know what you
192
+ ) ddr3_top
193
+ (
194
+ //clock and reset
195
+ .i_controller_clk(i_controller_clk),
196
+ .i_ddr3_clk(i_ddr3_clk), //i_controller_clk has period of CONTROLLER_CLK_PERIOD, i_ddr3_clk has period of DDR3_CLK_PERIOD
197
+ .i_ref_clk(i_ref_clk),
198
+ .i_ddr3_clk_90(i_ddr3_clk_90),
199
+ .i_rst_n(i_rst_n && clk_locked),
200
+ // Wishbone inputs
201
+ .i_wb_cyc(1), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
202
+ .i_wb_stb(i_wb_stb), //request a transfer
203
+ .i_wb_we(i_wb_we), //write-enable (1 = write, 0 = read)
204
+ .i_wb_addr(i_wb_addr), //burst-addressable {row,bank,col}
205
+ .i_wb_data(i_wb_data), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
206
+ .i_wb_sel(16'hffff), //byte strobe for write (1 = write the byte)
207
+ .i_aux(i_wb_we), //for AXI-interface compatibility (given upon strobe)
208
+ // Wishbone outputs
209
+ .o_wb_stall(o_wb_stall), //1 = busy, cannot accept requests
210
+ .o_wb_ack(o_wb_ack), //1 = read/write request has completed
211
+ .o_wb_data(o_wb_data), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
212
+ .o_aux(o_aux),
213
+ // Wishbone 2 (PHY) inputs
214
+ .i_wb2_cyc(), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
215
+ .i_wb2_stb(), //request a transfer
216
+ .i_wb2_we(), //write-enable (1 = write, 0 = read)
217
+ .i_wb2_addr(), //burst-addressable {row,bank,col}
218
+ .i_wb2_data(), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
219
+ .i_wb2_sel(), //byte strobe for write (1 = write the byte)
220
+ // Wishbone 2 (Controller) outputs
221
+ .o_wb2_stall(), //1 = busy, cannot accept requests
222
+ .o_wb2_ack(), //1 = read/write request has completed
223
+ .o_wb2_data(), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
224
+ // PHY Interface (to be added later)
225
+ // DDR3 I/O Interface
226
+ .o_ddr3_clk_p(ddr3_ck_p),
227
+ .o_ddr3_clk_n(ddr3_ck_n),
228
+ .o_ddr3_reset_n(ddr3_reset_n),
229
+ .o_ddr3_cke(ddr3_cke), // CKE
230
+ .o_ddr3_cs_n(ddr3_cs_n), // chip select signal (controls rank 1 only)
231
+ .o_ddr3_ras_n(ddr3_ras_n), // RAS#
232
+ .o_ddr3_cas_n(ddr3_cas_n), // CAS#
233
+ .o_ddr3_we_n(ddr3_we_n), // WE#
234
+ .o_ddr3_addr(ddr3_addr),
235
+ .o_ddr3_ba_addr(ddr3_ba),
236
+ .io_ddr3_dq(ddr3_dq),
237
+ .io_ddr3_dqs(ddr3_dqs_p),
238
+ .io_ddr3_dqs_n(ddr3_dqs_n),
239
+ .o_ddr3_dm(ddr3_dm),
240
+ .o_ddr3_odt(ddr3_odt), // on-die termination
241
+ .o_debug1(o_debug1)
242
+ );
243
+
244
+ endmodule
245
+
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ax7103_ddr3.xdc ADDED
@@ -0,0 +1,442 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ############## NET - IOSTANDARD #####################
2
+ set_property CFGBVS VCCO [current_design]
3
+ set_property CONFIG_VOLTAGE 3.3 [current_design]
4
+ #############SPI Configurate Setting##################
5
+ set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]
6
+ set_property CONFIG_MODE SPIx4 [current_design]
7
+ set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]
8
+ ############## clock define###########################
9
+ create_clock -period 5 [get_ports sys_clk_p]
10
+ set_property PACKAGE_PIN R4 [get_ports sys_clk_p]
11
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports sys_clk_p]
12
+
13
+ set_property PACKAGE_PIN T4 [get_ports sys_clk_n]
14
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports sys_clk_n]
15
+ ##############reset key define########################
16
+ set_property PACKAGE_PIN J21 [get_ports i_rst_n]
17
+ set_property IOSTANDARD LVCMOS33 [get_ports i_rst_n]
18
+
19
+
20
+ ##############LED define##########################
21
+ set_property PACKAGE_PIN B13 [get_ports {led[0]}]
22
+ set_property IOSTANDARD LVCMOS33 [get_ports {led[0]}]
23
+
24
+ set_property PACKAGE_PIN C13 [get_ports {led[1]}]
25
+ set_property IOSTANDARD LVCMOS33 [get_ports {led[1]}]
26
+
27
+ set_property PACKAGE_PIN D14 [get_ports {led[2]}]
28
+ set_property IOSTANDARD LVCMOS33 [get_ports {led[2]}]
29
+
30
+ set_property PACKAGE_PIN D15 [get_ports {led[3]}]
31
+ set_property IOSTANDARD LVCMOS33 [get_ports {led[3]}]
32
+
33
+
34
+ ##############UART define##########################
35
+ set_property PACKAGE_PIN P20 [get_ports {rx}]
36
+ set_property IOSTANDARD LVCMOS33 [get_ports {rx}]
37
+
38
+ set_property PACKAGE_PIN N15 [get_ports {tx}]
39
+ set_property IOSTANDARD LVCMOS33 [get_ports {tx}]
40
+
41
+ ############## NET - IOSTANDARD ##################
42
+
43
+
44
+ # PadFunction: IO_L2P_T0_AD12P_35
45
+ set_property SLEW FAST [get_ports {ddr3_dq[0]}]
46
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[0]}]
47
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[0]}]
48
+ set_property PACKAGE_PIN C2 [get_ports {ddr3_dq[0]}]
49
+
50
+ # PadFunction: IO_L5P_T0_AD13P_35
51
+ set_property SLEW FAST [get_ports {ddr3_dq[1]}]
52
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[1]}]
53
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[1]}]
54
+ set_property PACKAGE_PIN G1 [get_ports {ddr3_dq[1]}]
55
+
56
+ # PadFunction: IO_L1N_T0_AD4N_35
57
+ set_property SLEW FAST [get_ports {ddr3_dq[2]}]
58
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[2]}]
59
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[2]}]
60
+ set_property PACKAGE_PIN A1 [get_ports {ddr3_dq[2]}]
61
+
62
+ # PadFunction: IO_L6P_T0_35
63
+ set_property SLEW FAST [get_ports {ddr3_dq[3]}]
64
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[3]}]
65
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[3]}]
66
+ set_property PACKAGE_PIN F3 [get_ports {ddr3_dq[3]}]
67
+
68
+ # PadFunction: IO_L2N_T0_AD12N_35
69
+ set_property SLEW FAST [get_ports {ddr3_dq[4]}]
70
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[4]}]
71
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[4]}]
72
+ set_property PACKAGE_PIN B2 [get_ports {ddr3_dq[4]}]
73
+
74
+ # PadFunction: IO_L5N_T0_AD13N_35
75
+ set_property SLEW FAST [get_ports {ddr3_dq[5]}]
76
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[5]}]
77
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[5]}]
78
+ set_property PACKAGE_PIN F1 [get_ports {ddr3_dq[5]}]
79
+
80
+ # PadFunction: IO_L1P_T0_AD4P_35
81
+ set_property SLEW FAST [get_ports {ddr3_dq[6]}]
82
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[6]}]
83
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[6]}]
84
+ set_property PACKAGE_PIN B1 [get_ports {ddr3_dq[6]}]
85
+
86
+ # PadFunction: IO_L4P_T0_35
87
+ set_property SLEW FAST [get_ports {ddr3_dq[7]}]
88
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[7]}]
89
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[7]}]
90
+ set_property PACKAGE_PIN E2 [get_ports {ddr3_dq[7]}]
91
+
92
+ # PadFunction: IO_L11P_T1_SRCC_35
93
+ set_property SLEW FAST [get_ports {ddr3_dq[8]}]
94
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[8]}]
95
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[8]}]
96
+ set_property PACKAGE_PIN H3 [get_ports {ddr3_dq[8]}]
97
+
98
+ # PadFunction: IO_L11N_T1_SRCC_35
99
+ set_property SLEW FAST [get_ports {ddr3_dq[9]}]
100
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[9]}]
101
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[9]}]
102
+ set_property PACKAGE_PIN G3 [get_ports {ddr3_dq[9]}]
103
+
104
+ # PadFunction: IO_L8P_T1_AD14P_35
105
+ set_property SLEW FAST [get_ports {ddr3_dq[10]}]
106
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[10]}]
107
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[10]}]
108
+ set_property PACKAGE_PIN H2 [get_ports {ddr3_dq[10]}]
109
+
110
+ # PadFunction: IO_L10N_T1_AD15N_35
111
+ set_property SLEW FAST [get_ports {ddr3_dq[11]}]
112
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[11]}]
113
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[11]}]
114
+ set_property PACKAGE_PIN H5 [get_ports {ddr3_dq[11]}]
115
+
116
+ # PadFunction: IO_L7N_T1_AD6N_35
117
+ set_property SLEW FAST [get_ports {ddr3_dq[12]}]
118
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[12]}]
119
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[12]}]
120
+ set_property PACKAGE_PIN J1 [get_ports {ddr3_dq[12]}]
121
+
122
+ # PadFunction: IO_L10P_T1_AD15P_35
123
+ set_property SLEW FAST [get_ports {ddr3_dq[13]}]
124
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[13]}]
125
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[13]}]
126
+ set_property PACKAGE_PIN J5 [get_ports {ddr3_dq[13]}]
127
+
128
+ # PadFunction: IO_L7P_T1_AD6P_35
129
+ set_property SLEW FAST [get_ports {ddr3_dq[14]}]
130
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[14]}]
131
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[14]}]
132
+ set_property PACKAGE_PIN K1 [get_ports {ddr3_dq[14]}]
133
+
134
+ # PadFunction: IO_L12P_T1_MRCC_35
135
+ set_property SLEW FAST [get_ports {ddr3_dq[15]}]
136
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[15]}]
137
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[15]}]
138
+ set_property PACKAGE_PIN H4 [get_ports {ddr3_dq[15]}]
139
+
140
+ # PadFunction: IO_L18N_T2_35
141
+ set_property SLEW FAST [get_ports {ddr3_dq[16]}]
142
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[16]}]
143
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[16]}]
144
+ set_property PACKAGE_PIN L4 [get_ports {ddr3_dq[16]}]
145
+
146
+ # PadFunction: IO_L16P_T2_35
147
+ set_property SLEW FAST [get_ports {ddr3_dq[17]}]
148
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[17]}]
149
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[17]}]
150
+ set_property PACKAGE_PIN M3 [get_ports {ddr3_dq[17]}]
151
+
152
+ # PadFunction: IO_L14P_T2_SRCC_35
153
+ set_property SLEW FAST [get_ports {ddr3_dq[18]}]
154
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[18]}]
155
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[18]}]
156
+ set_property PACKAGE_PIN L3 [get_ports {ddr3_dq[18]}]
157
+
158
+ # PadFunction: IO_L17N_T2_35
159
+ set_property SLEW FAST [get_ports {ddr3_dq[19]}]
160
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[19]}]
161
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[19]}]
162
+ set_property PACKAGE_PIN J6 [get_ports {ddr3_dq[19]}]
163
+
164
+ # PadFunction: IO_L14N_T2_SRCC_35
165
+ set_property SLEW FAST [get_ports {ddr3_dq[20]}]
166
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[20]}]
167
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[20]}]
168
+ set_property PACKAGE_PIN K3 [get_ports {ddr3_dq[20]}]
169
+
170
+ # PadFunction: IO_L17P_T2_35
171
+ set_property SLEW FAST [get_ports {ddr3_dq[21]}]
172
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[21]}]
173
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[21]}]
174
+ set_property PACKAGE_PIN K6 [get_ports {ddr3_dq[21]}]
175
+
176
+ # PadFunction: IO_L13N_T2_MRCC_35
177
+ set_property SLEW FAST [get_ports {ddr3_dq[22]}]
178
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[22]}]
179
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[22]}]
180
+ set_property PACKAGE_PIN J4 [get_ports {ddr3_dq[22]}]
181
+
182
+ # PadFunction: IO_L18P_T2_35
183
+ set_property SLEW FAST [get_ports {ddr3_dq[23]}]
184
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[23]}]
185
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[23]}]
186
+ set_property PACKAGE_PIN L5 [get_ports {ddr3_dq[23]}]
187
+
188
+ # PadFunction: IO_L20N_T3_35
189
+ set_property SLEW FAST [get_ports {ddr3_dq[24]}]
190
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[24]}]
191
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[24]}]
192
+ set_property PACKAGE_PIN P1 [get_ports {ddr3_dq[24]}]
193
+
194
+ # PadFunction: IO_L19P_T3_35
195
+ set_property SLEW FAST [get_ports {ddr3_dq[25]}]
196
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[25]}]
197
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[25]}]
198
+ set_property PACKAGE_PIN N4 [get_ports {ddr3_dq[25]}]
199
+
200
+ # PadFunction: IO_L20P_T3_35
201
+ set_property SLEW FAST [get_ports {ddr3_dq[26]}]
202
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[26]}]
203
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[26]}]
204
+ set_property PACKAGE_PIN R1 [get_ports {ddr3_dq[26]}]
205
+
206
+ # PadFunction: IO_L22N_T3_35
207
+ set_property SLEW FAST [get_ports {ddr3_dq[27]}]
208
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[27]}]
209
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[27]}]
210
+ set_property PACKAGE_PIN N2 [get_ports {ddr3_dq[27]}]
211
+
212
+ # PadFunction: IO_L23P_T3_35
213
+ set_property SLEW FAST [get_ports {ddr3_dq[28]}]
214
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[28]}]
215
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[28]}]
216
+ set_property PACKAGE_PIN M6 [get_ports {ddr3_dq[28]}]
217
+
218
+ # PadFunction: IO_L24N_T3_35
219
+ set_property SLEW FAST [get_ports {ddr3_dq[29]}]
220
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[29]}]
221
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[29]}]
222
+ set_property PACKAGE_PIN N5 [get_ports {ddr3_dq[29]}]
223
+
224
+ # PadFunction: IO_L24P_T3_35
225
+ set_property SLEW FAST [get_ports {ddr3_dq[30]}]
226
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[30]}]
227
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[30]}]
228
+ set_property PACKAGE_PIN P6 [get_ports {ddr3_dq[30]}]
229
+
230
+ # PadFunction: IO_L22P_T3_35
231
+ set_property SLEW FAST [get_ports {ddr3_dq[31]}]
232
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[31]}]
233
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[31]}]
234
+ set_property PACKAGE_PIN P2 [get_ports {ddr3_dq[31]}]
235
+
236
+ # PadFunction: IO_L6N_T0_VREF_34
237
+ set_property SLEW FAST [get_ports {ddr3_addr[14]}]
238
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[14]}]
239
+ set_property PACKAGE_PIN V3 [get_ports {ddr3_addr[14]}]
240
+
241
+ # PadFunction: IO_L1N_T0_34
242
+ set_property SLEW FAST [get_ports {ddr3_addr[13]}]
243
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[13]}]
244
+ set_property PACKAGE_PIN U1 [get_ports {ddr3_addr[13]}]
245
+
246
+ # PadFunction: IO_L4N_T0_34
247
+ set_property SLEW FAST [get_ports {ddr3_addr[12]}]
248
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[12]}]
249
+ set_property PACKAGE_PIN Y2 [get_ports {ddr3_addr[12]}]
250
+
251
+ # PadFunction: IO_L4P_T0_34
252
+ set_property SLEW FAST [get_ports {ddr3_addr[11]}]
253
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[11]}]
254
+ set_property PACKAGE_PIN W2 [get_ports {ddr3_addr[11]}]
255
+
256
+ # PadFunction: IO_L5N_T0_34
257
+ set_property SLEW FAST [get_ports {ddr3_addr[10]}]
258
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[10]}]
259
+ set_property PACKAGE_PIN Y1 [get_ports {ddr3_addr[10]}]
260
+
261
+ # PadFunction: IO_L2P_T0_34
262
+ set_property SLEW FAST [get_ports {ddr3_addr[9]}]
263
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[9]}]
264
+ set_property PACKAGE_PIN U2 [get_ports {ddr3_addr[9]}]
265
+
266
+ # PadFunction: IO_L2N_T0_34
267
+ set_property SLEW FAST [get_ports {ddr3_addr[8]}]
268
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[8]}]
269
+ set_property PACKAGE_PIN V2 [get_ports {ddr3_addr[8]}]
270
+
271
+ # PadFunction: IO_L1P_T0_34
272
+ set_property SLEW FAST [get_ports {ddr3_addr[7]}]
273
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[7]}]
274
+ set_property PACKAGE_PIN T1 [get_ports {ddr3_addr[7]}]
275
+
276
+ # PadFunction: IO_L5P_T0_34
277
+ set_property SLEW FAST [get_ports {ddr3_addr[6]}]
278
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[6]}]
279
+ set_property PACKAGE_PIN W1 [get_ports {ddr3_addr[6]}]
280
+
281
+ # PadFunction: IO_L6P_T0_34
282
+ set_property SLEW FAST [get_ports {ddr3_addr[5]}]
283
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[5]}]
284
+ set_property PACKAGE_PIN U3 [get_ports {ddr3_addr[5]}]
285
+
286
+ # PadFunction: IO_L7N_T1_34
287
+ set_property SLEW FAST [get_ports {ddr3_addr[4]}]
288
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[4]}]
289
+ set_property PACKAGE_PIN AB1 [get_ports {ddr3_addr[4]}]
290
+
291
+ # PadFunction: IO_L10N_T1_34
292
+ set_property SLEW FAST [get_ports {ddr3_addr[3]}]
293
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[3]}]
294
+ set_property PACKAGE_PIN AB5 [get_ports {ddr3_addr[3]}]
295
+
296
+ # PadFunction: IO_L10P_T1_34
297
+ set_property SLEW FAST [get_ports {ddr3_addr[2]}]
298
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[2]}]
299
+ set_property PACKAGE_PIN AA5 [get_ports {ddr3_addr[2]}]
300
+
301
+ # PadFunction: IO_L8N_T1_34
302
+ set_property SLEW FAST [get_ports {ddr3_addr[1]}]
303
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[1]}]
304
+ set_property PACKAGE_PIN AB2 [get_ports {ddr3_addr[1]}]
305
+
306
+ # PadFunction: IO_L11N_T1_SRCC_34
307
+ set_property SLEW FAST [get_ports {ddr3_addr[0]}]
308
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[0]}]
309
+ set_property PACKAGE_PIN AA4 [get_ports {ddr3_addr[0]}]
310
+
311
+ # PadFunction: IO_L11P_T1_SRCC_34
312
+ set_property SLEW FAST [get_ports {ddr3_ba[2]}]
313
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_ba[2]}]
314
+ set_property PACKAGE_PIN Y4 [get_ports {ddr3_ba[2]}]
315
+
316
+ # PadFunction: IO_L9P_T1_DQS_34
317
+ set_property SLEW FAST [get_ports {ddr3_ba[1]}]
318
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_ba[1]}]
319
+ set_property PACKAGE_PIN Y3 [get_ports {ddr3_ba[1]}]
320
+
321
+ # PadFunction: IO_L9N_T1_DQS_34
322
+ set_property SLEW FAST [get_ports {ddr3_ba[0]}]
323
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_ba[0]}]
324
+ set_property PACKAGE_PIN AA3 [get_ports {ddr3_ba[0]}]
325
+
326
+ # PadFunction: IO_L12P_T1_MRCC_34
327
+ set_property SLEW FAST [get_ports {ddr3_ras_n}]
328
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_ras_n}]
329
+ set_property PACKAGE_PIN V4 [get_ports {ddr3_ras_n}]
330
+
331
+ # PadFunction: IO_L12N_T1_MRCC_34
332
+ set_property SLEW FAST [get_ports {ddr3_cas_n}]
333
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_cas_n}]
334
+ set_property PACKAGE_PIN W4 [get_ports {ddr3_cas_n}]
335
+
336
+ # PadFunction: IO_L7P_T1_34
337
+ set_property SLEW FAST [get_ports {ddr3_we_n}]
338
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_we_n}]
339
+ set_property PACKAGE_PIN AA1 [get_ports {ddr3_we_n}]
340
+
341
+ # PadFunction: IO_L15P_T2_DQS_34
342
+ set_property SLEW FAST [get_ports {ddr3_reset_n}]
343
+ set_property IOSTANDARD LVCMOS15 [get_ports {ddr3_reset_n}]
344
+ set_property PACKAGE_PIN W6 [get_ports {ddr3_reset_n}]
345
+
346
+ # PadFunction: IO_L14P_T2_SRCC_34
347
+ set_property SLEW FAST [get_ports {ddr3_cke}]
348
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_cke}]
349
+ set_property PACKAGE_PIN T5 [get_ports {ddr3_cke}]
350
+
351
+ # PadFunction: IO_L14N_T2_SRCC_34
352
+ set_property SLEW FAST [get_ports {ddr3_odt}]
353
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_odt}]
354
+ set_property PACKAGE_PIN U5 [get_ports {ddr3_odt}]
355
+
356
+ # PadFunction: IO_L8P_T1_34
357
+ set_property SLEW FAST [get_ports {ddr3_cs_n}]
358
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_cs_n}]
359
+ set_property PACKAGE_PIN AB3 [get_ports {ddr3_cs_n}]
360
+
361
+ # PadFunction: IO_L4N_T0_35
362
+ set_property SLEW FAST [get_ports {ddr3_dm[0]}]
363
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[0]}]
364
+ set_property PACKAGE_PIN D2 [get_ports {ddr3_dm[0]}]
365
+
366
+ # PadFunction: IO_L8N_T1_AD14N_35
367
+ set_property SLEW FAST [get_ports {ddr3_dm[1]}]
368
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[1]}]
369
+ set_property PACKAGE_PIN G2 [get_ports {ddr3_dm[1]}]
370
+
371
+ # PadFunction: IO_L16N_T2_35
372
+ set_property SLEW FAST [get_ports {ddr3_dm[2]}]
373
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[2]}]
374
+ set_property PACKAGE_PIN M2 [get_ports {ddr3_dm[2]}]
375
+
376
+ # PadFunction: IO_L23N_T3_35
377
+ set_property SLEW FAST [get_ports {ddr3_dm[3]}]
378
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[3]}]
379
+ set_property PACKAGE_PIN M5 [get_ports {ddr3_dm[3]}]
380
+
381
+ # PadFunction: IO_L3P_T0_DQS_AD5P_35
382
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[0]}]
383
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_p[0]}]
384
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_p[0]}]
385
+ set_property PACKAGE_PIN E1 [get_ports {ddr3_dqs_p[0]}]
386
+
387
+ # PadFunction: IO_L3N_T0_DQS_AD5N_35
388
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[0]}]
389
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_n[0]}]
390
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_n[0]}]
391
+ set_property PACKAGE_PIN D1 [get_ports {ddr3_dqs_n[0]}]
392
+
393
+ # PadFunction: IO_L9P_T1_DQS_AD7P_35
394
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[1]}]
395
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_p[1]}]
396
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_p[1]}]
397
+ set_property PACKAGE_PIN K2 [get_ports {ddr3_dqs_p[1]}]
398
+
399
+ # PadFunction: IO_L9N_T1_DQS_AD7N_35
400
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[1]}]
401
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_n[1]}]
402
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_n[1]}]
403
+ set_property PACKAGE_PIN J2 [get_ports {ddr3_dqs_n[1]}]
404
+
405
+ # PadFunction: IO_L15P_T2_DQS_35
406
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[2]}]
407
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_p[2]}]
408
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_p[2]}]
409
+ set_property PACKAGE_PIN M1 [get_ports {ddr3_dqs_p[2]}]
410
+
411
+ # PadFunction: IO_L15N_T2_DQS_35
412
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[2]}]
413
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_n[2]}]
414
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_n[2]}]
415
+ set_property PACKAGE_PIN L1 [get_ports {ddr3_dqs_n[2]}]
416
+
417
+ # PadFunction: IO_L21P_T3_DQS_35
418
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[3]}]
419
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_p[3]}]
420
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_p[3]}]
421
+ set_property PACKAGE_PIN P5 [get_ports {ddr3_dqs_p[3]}]
422
+
423
+ # PadFunction: IO_L21N_T3_DQS_35
424
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[3]}]
425
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_n[3]}]
426
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_n[3]}]
427
+ set_property PACKAGE_PIN P4 [get_ports {ddr3_dqs_n[3]}]
428
+
429
+ # PadFunction: IO_L3P_T0_DQS_34
430
+ set_property SLEW FAST [get_ports {ddr3_ck_p}]
431
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_ck_p}]
432
+ set_property PACKAGE_PIN R3 [get_ports {ddr3_ck_p}]
433
+
434
+ # PadFunction: IO_L3N_T0_DQS_34
435
+ set_property SLEW FAST [get_ports {ddr3_ck_n}]
436
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_ck_n}]
437
+ set_property PACKAGE_PIN R2 [get_ports {ddr3_ck_n}]
438
+
439
+
440
+
441
+
442
+
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/caas.conf ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ Backend = openxc7
3
+ Part = xc7a100tfgg484-2
4
+ Top = ax7103_ddr3
5
+ Constraint = ax7103_ddr3.xdc
6
+ Sources = *.v
7
+
8
+ [caas]
9
+ Server = https://caas.symbioticeda.com:18888/
10
+
11
+
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/clk_wiz.v ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ `timescale 1ps/1ps
2
+
3
+ module clk_wiz
4
+ (
5
+ input wire clk_in1,
6
+ output wire clk_out1,
7
+ output wire clk_out2,
8
+ output wire clk_out3,
9
+ output wire clk_out4,
10
+ input wire reset,
11
+ output wire locked
12
+ );
13
+ wire clk_out1_clk_wiz_0;
14
+ wire clk_out2_clk_wiz_0;
15
+ wire clk_out3_clk_wiz_0;
16
+ wire clk_out4_clk_wiz_0;
17
+
18
+ wire clkfbout;
19
+
20
+ PLLE2_ADV
21
+ #(.BANDWIDTH ("OPTIMIZED"),
22
+ .COMPENSATION ("INTERNAL"),
23
+ .STARTUP_WAIT ("FALSE"),
24
+ .DIVCLK_DIVIDE (1),
25
+ .CLKFBOUT_MULT (5), // 200 MHz * 5 = 1000 MHz
26
+ .CLKFBOUT_PHASE (0.000),
27
+ .CLKOUT0_DIVIDE (12), // 1000 MHz / 12 = 83.333 MHz
28
+ .CLKOUT0_PHASE (0.000),
29
+ .CLKOUT0_DUTY_CYCLE (0.500),
30
+ .CLKOUT1_DIVIDE (3), // 1000 MHz / 3 = 333.333 MHz
31
+ .CLKOUT1_PHASE (0.000),
32
+ .CLKOUT1_DUTY_CYCLE (0.500),
33
+ .CLKOUT2_DIVIDE (5), // 1000 MHz / 5 = 200 MHz
34
+ .CLKOUT2_PHASE (0.000),
35
+ .CLKOUT2_DUTY_CYCLE (0.500),
36
+ .CLKOUT3_DIVIDE (3), // 1000 MHz / 3 = 333.333 MHz
37
+ .CLKOUT3_PHASE (90),
38
+ .CLKOUT3_DUTY_CYCLE (0.500),
39
+ .CLKIN1_PERIOD (5.000) // 200 MHz input
40
+ )
41
+ plle2_adv_inst
42
+ (
43
+ .CLKFBOUT (clkfbout),
44
+ .CLKOUT0 (clk_out1_clk_wiz_0),
45
+ .CLKOUT1 (clk_out2_clk_wiz_0),
46
+ .CLKOUT2 (clk_out3_clk_wiz_0),
47
+ .CLKOUT3 (clk_out4_clk_wiz_0),
48
+ .CLKFBIN (clkfbout),
49
+ .CLKIN1 (clk_in1),
50
+ .LOCKED (locked),
51
+ .RST (reset)
52
+ );
53
+ BUFG clkout1_buf
54
+ (.O (clk_out1),
55
+ .I (clk_out1_clk_wiz_0));
56
+ BUFG clkout2_buf
57
+ (.O (clk_out2),
58
+ .I (clk_out2_clk_wiz_0));
59
+ BUFG clkout3_buf
60
+ (.O (clk_out3),
61
+ .I (clk_out3_clk_wiz_0));
62
+ BUFG clkout4_buf
63
+ (.O (clk_out4),
64
+ .I (clk_out4_clk_wiz_0));
65
+
66
+ endmodule
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ddr3_controller.v ADDED
The diff for this file is too large to render. See raw diff
 
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ddr3_phy.v ADDED
@@ -0,0 +1,1462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ddr3_phy.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: PHY component for the DDR3 controller. Handles the primitives such
7
+ // as IOSERDES, IODELAY, and IOBUF. These generates the signals connected to
8
+ // the DDR3 RAM.
9
+ //
10
+ // Engineer: Angelo C. Jacobo
11
+ //
12
+ ////////////////////////////////////////////////////////////////////////////////
13
+ //
14
+ // Copyright (C) 2023-2025 Angelo Jacobo
15
+ //
16
+ // This program is free software: you can redistribute it and/or modify
17
+ // it under the terms of the GNU General Public License as published by
18
+ // the Free Software Foundation, either version 3 of the License, or
19
+ // (at your option) any later version.
20
+ //
21
+ // This program is distributed in the hope that it will be useful,
22
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ // GNU General Public License for more details.
25
+ //
26
+ // You should have received a copy of the GNU General Public License
27
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
28
+ //
29
+ ////////////////////////////////////////////////////////////////////////////////
30
+
31
+ `default_nettype none
32
+ `timescale 1ps / 1ps
33
+ //`define DEBUG_DQS // uncomment to route the raw DQS to output port for debugging
34
+
35
+ module ddr3_phy #(
36
+ parameter CONTROLLER_CLK_PERIOD = 10_000, //ps, clock period of the controller interface
37
+ DDR3_CLK_PERIOD = 2_500, //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
38
+ ROW_BITS = 14, //width of row address
39
+ BA_BITS = 3,
40
+ DQ_BITS = 8,
41
+ LANES = 8,
42
+ DUAL_RANK_DIMM = 0, // enable dual rank DIMM (1 = enable, 0 = disable)
43
+ parameter[0:0] ODELAY_SUPPORTED = 1, //set to 1 when ODELAYE2 is supported
44
+ USE_IO_TERMINATION = 0, //use IOBUF_DCIEN and IOBUFDS_DCIEN when 1
45
+ NO_IOSERDES_LOOPBACK = 1, // don't use IOSERDES loopback for bitslip training
46
+ // The next parameters act more like a localparam (since user does not have to set this manually) but was added here to simplify port declaration
47
+ parameter serdes_ratio = 4, // this controller is fixed as a 4:1 memory controller (CONTROLLER_CLK_PERIOD/DDR3_CLK_PERIOD = 4)
48
+ wb_data_bits = DQ_BITS*LANES*serdes_ratio*2,
49
+ wb_sel_bits = wb_data_bits / 8,
50
+ //4 is the width of a single ddr3 command {cs_n, ras_n, cas_n, we_n} plus 3 (ck_en, odt, reset_n) plus bank bits plus row bits
51
+ cmd_len = 4 + 3 + BA_BITS + ROW_BITS + 2*DUAL_RANK_DIMM
52
+ )(
53
+ input wire i_controller_clk, i_ddr3_clk, i_ref_clk,
54
+ input wire i_ddr3_clk_90, //required only when ODELAY_SUPPORTED is zero
55
+ input wire i_rst_n,
56
+ // Controller Interface
57
+ input wire i_controller_reset,
58
+ input wire[cmd_len*serdes_ratio-1:0] i_controller_cmd,
59
+ input wire i_controller_dqs_tri_control, i_controller_dq_tri_control,
60
+ input wire i_controller_toggle_dqs,
61
+ input wire[wb_data_bits-1:0] i_controller_data,
62
+ input wire[wb_sel_bits-1:0] i_controller_dm,
63
+ input wire[4:0] i_controller_odelay_data_cntvaluein,i_controller_odelay_dqs_cntvaluein,
64
+ input wire[4:0] i_controller_idelay_data_cntvaluein,i_controller_idelay_dqs_cntvaluein,
65
+ input wire[LANES-1:0] i_controller_odelay_data_ld, i_controller_odelay_dqs_ld,
66
+ input wire[LANES-1:0] i_controller_idelay_data_ld, i_controller_idelay_dqs_ld,
67
+ input wire[LANES-1:0] i_controller_bitslip,
68
+ input wire i_controller_write_leveling_calib,
69
+ output wire[DQ_BITS*LANES*8-1:0] o_controller_iserdes_data,
70
+ output wire[LANES*8-1:0] o_controller_iserdes_dqs,
71
+ output wire[LANES*8-1:0] o_controller_iserdes_bitslip_reference,
72
+ output wire o_controller_idelayctrl_rdy,
73
+ // DDR3 I/O Interface
74
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_clk_p,o_ddr3_clk_n,
75
+ output wire o_ddr3_reset_n,
76
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cke, // CKE
77
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cs_n, // chip select signal
78
+ output wire o_ddr3_ras_n, // RAS#
79
+ output wire o_ddr3_cas_n, // CAS#
80
+ output wire o_ddr3_we_n, // WE#
81
+ output wire[ROW_BITS-1:0] o_ddr3_addr,
82
+ output wire[BA_BITS-1:0] o_ddr3_ba_addr,
83
+ inout wire[(DQ_BITS*LANES)-1:0] io_ddr3_dq,
84
+ inout wire[(DQ_BITS*LANES)/8-1:0] io_ddr3_dqs, io_ddr3_dqs_n,
85
+ output wire[LANES-1:0] o_ddr3_dm,
86
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_odt, // on-die termination
87
+ // DEBUG PHY
88
+ output wire[(DQ_BITS*LANES)/8-1:0] o_ddr3_debug_read_dqs_p,
89
+ output wire[(DQ_BITS*LANES)/8-1:0] o_ddr3_debug_read_dqs_n
90
+ );
91
+
92
+ // cmd bit assignment
93
+ localparam CMD_CS_N_2 = cmd_len - 1,
94
+ CMD_CS_N = DUAL_RANK_DIMM[0]? cmd_len - 2 : cmd_len - 1,
95
+ CMD_RAS_N = DUAL_RANK_DIMM[0]? cmd_len - 3 : cmd_len - 2,
96
+ CMD_CAS_N = DUAL_RANK_DIMM[0]? cmd_len - 4 : cmd_len - 3,
97
+ CMD_WE_N = DUAL_RANK_DIMM[0]? cmd_len - 5 : cmd_len - 4,
98
+ CMD_ODT = DUAL_RANK_DIMM[0]? cmd_len - 6 : cmd_len - 5,
99
+ CMD_CKE_2 = DUAL_RANK_DIMM[0]? cmd_len - 7 : cmd_len - 6,
100
+ CMD_CKE = DUAL_RANK_DIMM[0]? cmd_len - 8 : cmd_len - 6,
101
+ CMD_RESET_N = DUAL_RANK_DIMM[0]? cmd_len - 9 : cmd_len - 7,
102
+ CMD_BANK_START = BA_BITS + ROW_BITS - 1,
103
+ CMD_ADDRESS_START = ROW_BITS - 1;
104
+ localparam SYNC_RESET_DELAY = $rtoi($ceil(52_000/CONTROLLER_CLK_PERIOD)); //52_000 ps of reset pulse width required for IDELAYCTRL
105
+ //cmd needs to be center-aligned to the positive edge of the
106
+ //ddr3_clk. This means cmd needs to be delayed by half the ddr3
107
+ //clk period. Subtract by 600ps to include the IODELAY insertion
108
+ //delay. Divide by a delay resolution of 78.125ps per tap to get
109
+ //the needed tap value.
110
+ localparam CMD_ODELAY_TAP = ((DDR3_CLK_PERIOD/2) - 600)/78.125;
111
+
112
+ // Data does not have to be delayed (DQS is the on that has to be
113
+ // delayed and center-aligned to the center eye of data)
114
+ localparam DATA_ODELAY_TAP = 0;
115
+
116
+ //DQS needs to be edge-aligned to the center eye of the data.
117
+ //This means DQS needs to be delayed by a quarter of the ddr3
118
+ //clk period relative to the data. Subtract by 600ps to include
119
+ //the IODELAY insertion delay. Divide by a delay resolution of
120
+ //78.125ps per tap to get the needed tap value. Then add the tap
121
+ //value used in data to have the delay relative to the data.
122
+ localparam DQS_ODELAY_TAP = ((DDR3_CLK_PERIOD/4))/78.125 + DATA_ODELAY_TAP;
123
+
124
+ //Incoming DQS should be 90 degree delayed relative to incoming data
125
+ localparam DATA_IDELAY_TAP = 0; //600ps delay
126
+ localparam DQS_IDELAY_TAP = ((DDR3_CLK_PERIOD/4))/78.125 + DATA_IDELAY_TAP;
127
+
128
+ genvar gen_index;
129
+ wire[cmd_len-1:0] oserdes_cmd, //serialized(4:1) i_controller_cmd_slot_x
130
+ cmd;//delayed oserdes_cmd
131
+ wire[(DQ_BITS*LANES)-1:0] oserdes_data, odelay_data, idelay_data, read_dq;
132
+ wire[LANES-1:0] oserdes_dm, odelay_dm;
133
+ wire[LANES-1:0] odelay_dqs, read_dqs, idelay_dqs;
134
+ wire[DQ_BITS*LANES-1:0] oserdes_dq_tri_control;
135
+ wire[LANES-1:0] oserdes_dqs;
136
+ wire[LANES-1:0] oserdes_dqs_tri_control;
137
+ wire[LANES-1:0] oserdes_bitslip_reference;
138
+ reg[$clog2(SYNC_RESET_DELAY):0] delay_before_release_reset;
139
+ reg sync_rst = 0;
140
+ wire ddr3_clk;
141
+ reg toggle_dqs_q; //past value of i_controller_toggle_dqs
142
+ wire ddr3_clk_delayed;
143
+ wire idelayctrl_rdy;
144
+ wire dci_locked;
145
+ reg[LANES*8-1:0] o_controller_iserdes_bitslip_reference_reg;
146
+ reg[LANES - 1 : 0] shift_bitslip_index;
147
+
148
+ // initial value of bitslip reference
149
+ initial begin
150
+ o_controller_iserdes_bitslip_reference_reg = {LANES{8'b0001_1110}};
151
+ shift_bitslip_index = 0;
152
+ end
153
+
154
+ assign o_controller_idelayctrl_rdy = idelayctrl_rdy && dci_locked;
155
+
156
+ `ifdef DEBUG_DQS
157
+ assign o_ddr3_debug_read_dqs_p = io_ddr3_dqs;
158
+ assign o_ddr3_debug_read_dqs_n = io_ddr3_dqs_n;
159
+ `else
160
+ assign o_ddr3_debug_read_dqs_p = 0;
161
+ assign o_ddr3_debug_read_dqs_n = 0;
162
+ `endif
163
+
164
+ //synchronous reset
165
+ always @(posedge i_controller_clk) begin
166
+ if(!i_rst_n || i_controller_reset) begin
167
+ sync_rst <= 1'b1;
168
+ delay_before_release_reset <= SYNC_RESET_DELAY[$clog2(SYNC_RESET_DELAY):0];
169
+ toggle_dqs_q <= 0;
170
+ end
171
+ else begin
172
+ delay_before_release_reset <= (delay_before_release_reset == 0)? 0: delay_before_release_reset - 1;
173
+ sync_rst <= !(delay_before_release_reset == 0);
174
+ toggle_dqs_q <= i_controller_toggle_dqs;
175
+ end
176
+ end
177
+
178
+ //PHY cmd
179
+ generate
180
+ for(gen_index = 0; gen_index < cmd_len; gen_index = gen_index + 1) begin
181
+ // OSERDESE2: Output SERial/DESerializer with bitslip
182
+ //7 Series
183
+ // Xilinx HDL Libraries Guide, version 13.4
184
+ `ifndef SIM_MODEL
185
+ OSERDESE2 #(
186
+ `else
187
+ OSERDESE2_model #(
188
+ `endif
189
+ .DATA_RATE_OQ("SDR"), // DDR, SDR
190
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
191
+ .DATA_WIDTH(4), // Parallel data width (2-8,10,14)
192
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
193
+ .TRISTATE_WIDTH(1)
194
+ )
195
+ OSERDESE2_cmd(
196
+ .OFB(), // 1-bit output: Feedback path for data
197
+ .OQ(oserdes_cmd[gen_index]), // 1-bit output: Data path output
198
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
199
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
200
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
201
+ .D1(i_controller_cmd[cmd_len*0 + gen_index]),
202
+ .D2(i_controller_cmd[cmd_len*1 + gen_index]),
203
+ .D3(i_controller_cmd[cmd_len*2 + gen_index]),
204
+ .D4(i_controller_cmd[cmd_len*3 + gen_index]),
205
+ .OCE(1'b1), // 1-bit input: Output data clock enable
206
+ .RST(sync_rst), // 1-bit input: Reset
207
+ // unused signals but were added here to make vivado happy
208
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
209
+ .SHIFTOUT2(),
210
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
211
+ .TFB(), // 1-bit output: 3-state control
212
+ .TQ(), // 1-bit output: 3-state control
213
+ .D5(),
214
+ .D6(),
215
+ .D7(),
216
+ .D8(),
217
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
218
+ .SHIFTIN1(0),
219
+ .SHIFTIN2(0),
220
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
221
+ .T1(0),
222
+ .T2(0),
223
+ .T3(0),
224
+ .T4(0),
225
+ .TBYTEIN(0),
226
+ // 1-bit input: Byte group tristate
227
+ .TCE(0)
228
+ // 1-bit input: 3-state clock enable
229
+ );
230
+ // End of OSERDESE2_inst instantiation
231
+
232
+ end
233
+
234
+ if(DUAL_RANK_DIMM) begin // if dual rank enabled, odt_2 and odt_1 will be generated separately
235
+ // OSERDESE2: Output SERial/DESerializer with bitslip
236
+ //7 Series
237
+ // Xilinx HDL Libraries Guide, version 13.4
238
+ `ifndef SIM_MODEL
239
+ OSERDESE2 #(
240
+ `else
241
+ OSERDESE2_model #(
242
+ `endif
243
+ .DATA_RATE_OQ("SDR"), // DDR, SDR
244
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
245
+ .DATA_WIDTH(4), // Parallel data width (2-8,10,14)
246
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
247
+ .TRISTATE_WIDTH(1)
248
+ )
249
+ OSERDESE2_cmd(
250
+ .OFB(), // 1-bit output: Feedback path for data
251
+ .OQ(o_ddr3_odt[1]), // 1-bit output: Data path output
252
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
253
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
254
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
255
+ .D1(i_controller_cmd[cmd_len*0 + CMD_ODT]),
256
+ .D2(i_controller_cmd[cmd_len*1 + CMD_ODT]),
257
+ .D3(i_controller_cmd[cmd_len*2 + CMD_ODT]),
258
+ .D4(i_controller_cmd[cmd_len*3 + CMD_ODT]),
259
+ .OCE(1'b1), // 1-bit input: Output data clock enable
260
+ .RST(sync_rst), // 1-bit input: Reset
261
+ // unused signals but were added here to make vivado happy
262
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
263
+ .SHIFTOUT2(),
264
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
265
+ .TFB(), // 1-bit output: 3-state control
266
+ .TQ(), // 1-bit output: 3-state control
267
+ .D5(),
268
+ .D6(),
269
+ .D7(),
270
+ .D8(),
271
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
272
+ .SHIFTIN1(0),
273
+ .SHIFTIN2(0),
274
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
275
+ .T1(0),
276
+ .T2(0),
277
+ .T3(0),
278
+ .T4(0),
279
+ .TBYTEIN(0),
280
+ // 1-bit input: Byte group tristate
281
+ .TCE(0)
282
+ // 1-bit input: 3-state clock enable
283
+ );
284
+ // End of OSERDESE2_inst instantiation
285
+ end
286
+ endgenerate
287
+
288
+ // cs[1] when DUAL_RANK_DIMM enabled
289
+ generate
290
+ if(DUAL_RANK_DIMM) begin
291
+ assign o_ddr3_cs_n[1] = oserdes_cmd[CMD_CS_N_2];
292
+ assign o_ddr3_cs_n[0] = oserdes_cmd[CMD_CS_N];
293
+ assign o_ddr3_cke[1] = oserdes_cmd[CMD_CKE_2];
294
+ assign o_ddr3_cke[0] = oserdes_cmd[CMD_CKE];
295
+ assign o_ddr3_odt[0] = oserdes_cmd[CMD_ODT];
296
+ // o_ddr3_odt[1] will be generated directly by a separate OSERDES
297
+ // if odt[1] and odt[0] uses same output from oserdes, one of them will be unroutable
298
+ end
299
+ else begin
300
+ assign o_ddr3_cs_n = oserdes_cmd[CMD_CS_N];
301
+ assign o_ddr3_cke = oserdes_cmd[CMD_CKE];
302
+ assign o_ddr3_odt = oserdes_cmd[CMD_ODT];
303
+ end
304
+ endgenerate
305
+ assign o_ddr3_ras_n = oserdes_cmd[CMD_RAS_N],
306
+ o_ddr3_cas_n = oserdes_cmd[CMD_CAS_N],
307
+ o_ddr3_we_n = oserdes_cmd[CMD_WE_N],
308
+ o_ddr3_reset_n = oserdes_cmd[CMD_RESET_N],
309
+ o_ddr3_ba_addr = oserdes_cmd[CMD_BANK_START:CMD_ADDRESS_START+1],
310
+ o_ddr3_addr = oserdes_cmd[CMD_ADDRESS_START:0];
311
+
312
+ if(ODELAY_SUPPORTED) begin
313
+ // OSERDESE2: Output SERial/DESerializer with bitslip
314
+ //7 Series
315
+ // Xilinx HDL Libraries Guide, version 13.4
316
+ `ifndef SIM_MODEL
317
+ OSERDESE2 #(
318
+ `else
319
+ OSERDESE2_model #(
320
+ `endif
321
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
322
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
323
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
324
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
325
+ .TRISTATE_WIDTH(1)
326
+ )
327
+ OSERDESE2_clk(
328
+ .OFB(ddr3_clk), // 1-bit output: Feedback path for data
329
+ .OQ(), // 1-bit output: Data path output
330
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
331
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
332
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
333
+ .D1(1'b1),
334
+ .D2(1'b0),
335
+ .D3(1'b1),
336
+ .D4(1'b0),
337
+ .D5(1'b1),
338
+ .D6(1'b0),
339
+ .D7(1'b1),
340
+ .D8(1'b0),
341
+ .OCE(1'b1), // 1-bit input: Output data clock enable
342
+ .RST(sync_rst), // 1-bit input: Reset
343
+ // unused signals but were added here to make vivado happy
344
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
345
+ .SHIFTOUT2(),
346
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
347
+ .TFB(), // 1-bit output: 3-state control
348
+ .TQ(), // 1-bit output: 3-state control
349
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
350
+ .SHIFTIN1(0),
351
+ .SHIFTIN2(0),
352
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
353
+ .T1(0),
354
+ .T2(0),
355
+ .T3(0),
356
+ .T4(0),
357
+ .TBYTEIN(0),
358
+ // 1-bit input: Byte group tristate
359
+ .TCE(0)
360
+ // 1-bit input: 3-state clock enable
361
+ );
362
+ // End of OSERDESE2_inst instantiation
363
+
364
+ //Delay the DQ
365
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
366
+ (* IODELAY_GROUP="DDR3-GROUP" *)
367
+ `ifndef SIM_MODEL
368
+ ODELAYE2 #(
369
+ `else
370
+ ODELAYE2_model #(
371
+ `endif
372
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
373
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
374
+ .ODELAY_TYPE("FIXED"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
375
+ .ODELAY_VALUE(CMD_ODELAY_TAP), // Output delay tap setting (0-31)
376
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
377
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
378
+ )
379
+ ODELAYE2_clk (
380
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
381
+ .DATAOUT(ddr3_clk_delayed), // 1-bit output: Delayed data/clock output
382
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
383
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
384
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
385
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
386
+ .CNTVALUEIN(5'd0), // 5-bit input: Counter value input
387
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
388
+ .LD(1'b0), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
389
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
390
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
391
+ .ODATAIN(ddr3_clk), // 1-bit input: Output delay data input
392
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
393
+ );
394
+ // if dual rank enabled, then there will be two clk
395
+ if(DUAL_RANK_DIMM) begin
396
+ // OBUFDS: Differential Output Buffer
397
+ // 7 Series
398
+ // Xilinx HDL Libraries Guide, version 13.4
399
+ `ifndef SIM_MODEL
400
+ OBUFDS OBUFDS0_inst (
401
+ `else
402
+ OBUFDS_model OBUFDS0_inst (
403
+ `endif
404
+ .O(o_ddr3_clk_p[0]), // Diff_p output (connect directly to top-level port)
405
+ .OB(o_ddr3_clk_n[0]), // Diff_n output (connect directly to top-level port)
406
+ .I(ddr3_clk_delayed) // Buffer input
407
+ );
408
+ `ifndef SIM_MODEL
409
+ OBUFDS OBUFDS1_inst (
410
+ `else
411
+ OBUFDS_model OBUFDS1_inst (
412
+ `endif
413
+ .O(o_ddr3_clk_p[1]), // Diff_p output (connect directly to top-level port)
414
+ .OB(o_ddr3_clk_n[1]), // Diff_n output (connect directly to top-level port)
415
+ .I(ddr3_clk_delayed) // Buffer input
416
+ );
417
+ // End of OBUFDS_inst instantiation
418
+ end
419
+ else begin
420
+ // OBUFDS: Differential Output Buffer
421
+ // 7 Series
422
+ // Xilinx HDL Libraries Guide, version 13.4
423
+ `ifndef SIM_MODEL
424
+ OBUFDS OBUFDS_inst (
425
+ `else
426
+ OBUFDS_model OBUFDS_inst (
427
+ `endif
428
+ .O(o_ddr3_clk_p), // Diff_p output (connect directly to top-level port)
429
+ .OB(o_ddr3_clk_n), // Diff_n output (connect directly to top-level port)
430
+ .I(ddr3_clk_delayed) // Buffer input
431
+ );
432
+ // End of OBUFDS_inst instantiation
433
+ end
434
+ end
435
+ else begin //ODELAY is not supported
436
+
437
+ // if dual rank enabled, then there will be two clk
438
+ if(DUAL_RANK_DIMM) begin
439
+ // OBUFDS: Differential Output Buffer
440
+ // 7 Series
441
+ // Xilinx HDL Libraries Guide, version 13.4
442
+ `ifndef SIM_MODEL
443
+ OBUFDS OBUFDS0_inst (
444
+ `else
445
+ OBUFDS_model OBUFDS0_inst (
446
+ `endif
447
+ .O(o_ddr3_clk_p[1]), // Diff_p output (connect directly to top-level port)
448
+ .OB(o_ddr3_clk_n[1]), // Diff_n output (connect directly to top-level port)
449
+ .I(!i_ddr3_clk) // Buffer input
450
+ );
451
+ `ifndef SIM_MODEL
452
+ OBUFDS OBUFDS1_inst (
453
+ `else
454
+ OBUFDS_model OBUFDS1_inst (
455
+ `endif
456
+ .O(o_ddr3_clk_p[0]), // Diff_p output (connect directly to top-level port)
457
+ .OB(o_ddr3_clk_n[0]), // Diff_n output (connect directly to top-level port)
458
+ .I(!i_ddr3_clk) // Buffer input
459
+ );
460
+ // End of OBUFDS_inst instantiation
461
+ end
462
+ else begin
463
+ // OBUFDS: Differential Output Buffer
464
+ // 7 Series
465
+ // Xilinx HDL Libraries Guide, version 13.4
466
+ `ifndef SIM_MODEL
467
+ OBUFDS OBUFDS_inst (
468
+ `else
469
+ OBUFDS_model OBUFDS_inst (
470
+ `endif
471
+ .O(o_ddr3_clk_p), // Diff_p output (connect directly to top-level port)
472
+ .OB(o_ddr3_clk_n), // Diff_n output (connect directly to top-level port)
473
+ .I(!i_ddr3_clk) // Buffer input
474
+ );
475
+ end
476
+ end
477
+
478
+
479
+ // PHY data and dm
480
+ generate
481
+ // data: oserdes -> odelay -> iobuf
482
+ for(gen_index = 0; gen_index < (DQ_BITS*LANES); gen_index = gen_index + 1) begin
483
+
484
+ if (ODELAY_SUPPORTED) begin
485
+ // OSERDESE2: Output SERial/DESerializer with bitslip
486
+ //7 Series
487
+ // Xilinx HDL Libraries Guide, version 13.4
488
+ `ifndef SIM_MODEL
489
+ OSERDESE2 #(
490
+ `else
491
+ OSERDESE2_model #(
492
+ `endif
493
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
494
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
495
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
496
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
497
+ .TRISTATE_WIDTH(1)
498
+ )
499
+ OSERDESE2_data(
500
+ .OFB(oserdes_data[gen_index]), // 1-bit output: Feedback path for data
501
+ .OQ(), // 1-bit output: Data path output
502
+ .TQ(oserdes_dq_tri_control[gen_index]),
503
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
504
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
505
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
506
+ .D1(i_controller_data[gen_index + (DQ_BITS*LANES)*0]),
507
+ .D2(i_controller_data[gen_index + (DQ_BITS*LANES)*1]),
508
+ .D3(i_controller_data[gen_index + (DQ_BITS*LANES)*2]),
509
+ .D4(i_controller_data[gen_index + (DQ_BITS*LANES)*3]),
510
+ .D5(i_controller_data[gen_index + (DQ_BITS*LANES)*4]),
511
+ .D6(i_controller_data[gen_index + (DQ_BITS*LANES)*5]),
512
+ .D7(i_controller_data[gen_index + (DQ_BITS*LANES)*6]),
513
+ .D8(i_controller_data[gen_index + (DQ_BITS*LANES)*7]),
514
+ .T1(i_controller_dq_tri_control),
515
+ .TCE(1'b1),
516
+ .OCE(1'b1), // 1-bit input: Output data clock enable
517
+ .RST(sync_rst), // 1-bit input: Reset
518
+ // unused signals but were added here to make vivado happy
519
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
520
+ .SHIFTOUT2(),
521
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
522
+ .TFB(), // 1-bit output: 3-state control
523
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
524
+ .SHIFTIN1(0),
525
+ .SHIFTIN2(0),
526
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
527
+ .T2(0),
528
+ .T3(0),
529
+ .T4(0),
530
+ .TBYTEIN(0)
531
+ // 1-bit input: Byte group tristate
532
+ );
533
+ // End of OSERDESE2_inst instantiation
534
+
535
+ // ODELAYE2: Output Fixed or Variable Delay Element
536
+ // 7 Series
537
+ // Xilinx HDL Libraries Guide, version 13.4
538
+ //odelay adds an insertion delay of 600ps to the actual delay setting: https://support.xilinx.com/s/article/42133?language=en_US
539
+ //Delay the DQ
540
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
541
+ (* IODELAY_GROUP="DDR3-GROUP" *)
542
+ `ifndef SIM_MODEL
543
+ ODELAYE2 #(
544
+ `else
545
+ ODELAYE2_model #(
546
+ `endif
547
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
548
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
549
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
550
+ .ODELAY_VALUE(DATA_ODELAY_TAP), // Output delay tap setting (0-31)
551
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
552
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
553
+ )
554
+ ODELAYE2_data (
555
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
556
+ .DATAOUT(odelay_data[gen_index]), // 1-bit output: Delayed data/clock output
557
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
558
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
559
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
560
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
561
+ .CNTVALUEIN(i_controller_odelay_data_cntvaluein), // 5-bit input: Counter value input
562
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
563
+ .LD(i_controller_odelay_data_ld[gen_index/8]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
564
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
565
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
566
+ .ODATAIN(oserdes_data[gen_index]), // 1-bit input: Output delay data input
567
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
568
+ );
569
+
570
+ if(USE_IO_TERMINATION) begin
571
+ // IOBUF_DCIEN: Single-ended Bi-directional Buffer with Digital Controlled Impedance (DCI)
572
+ // and Input path enable/disable
573
+ // May only be placed in High Performance (HP) Banks
574
+ // 7 Series
575
+ // Xilinx HDL Libraries Guide, version 13.4
576
+ `ifndef SIM_MODEL
577
+ IOBUF_DCIEN #(
578
+ `else
579
+ IOBUF_DCIEN_model #(
580
+ `endif
581
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
582
+ .SLEW("FAST"), // Specify the output slew rate
583
+ .USE_IBUFDISABLE("FALSE") // Use IBUFDISABLE function, "TRUE" or "FALSE"
584
+ ) IOBUF_DCIEN_data (
585
+ .O(read_dq[gen_index]), // Buffer output
586
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
587
+ .DCITERMDISABLE(1'b0), // DCI Termination enable input
588
+ .I(odelay_data[gen_index]), // Buffer input
589
+ .IBUFDISABLE(1'b0), // Input disable input, low=disable
590
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=input, low=output
591
+ );
592
+ // End of IOBUF_DCIEN_inst instantiation
593
+
594
+ end
595
+ else begin
596
+ // IOBUF: Single-ended Bi-directional Buffer
597
+ //All devices
598
+ // Xilinx HDL Libraries Guide, version 13.4
599
+ `ifndef SIM_MODEL
600
+ IOBUF #(
601
+ `else
602
+ IOBUF_model #(
603
+ `endif
604
+ //.DRIVE(12), // Specify the output drive strength
605
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
606
+ //.IOSTANDARD("SSTL15"), // Specify the I/O standard
607
+ .SLEW("FAST") // Specify the output slew rate
608
+ ) IOBUF_data (
609
+ .O(read_dq[gen_index]),// Buffer output
610
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
611
+ .I(odelay_data[gen_index]), // Buffer input
612
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=read, low=write
613
+ );
614
+ end
615
+ end
616
+ else begin //ODELAY is not supported
617
+ // OSERDESE2: Output SERial/DESerializer with bitslip
618
+ //7 Series
619
+ // Xilinx HDL Libraries Guide, version 13.4
620
+ `ifndef SIM_MODEL
621
+ OSERDESE2 #(
622
+ `else
623
+ OSERDESE2_model #(
624
+ `endif
625
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
626
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
627
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
628
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
629
+ .TRISTATE_WIDTH(1)
630
+ )
631
+ OSERDESE2_data(
632
+ .OFB(), // 1-bit output: Feedback path for data
633
+ .OQ(oserdes_data[gen_index]), // 1-bit output: Data path output
634
+ .TQ(oserdes_dq_tri_control[gen_index]),
635
+ .CLK(i_ddr3_clk_90), // 1-bit input: High speed clock
636
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
637
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
638
+ .D1(i_controller_data[gen_index + (DQ_BITS*LANES)*0]),
639
+ .D2(i_controller_data[gen_index + (DQ_BITS*LANES)*1]),
640
+ .D3(i_controller_data[gen_index + (DQ_BITS*LANES)*2]),
641
+ .D4(i_controller_data[gen_index + (DQ_BITS*LANES)*3]),
642
+ .D5(i_controller_data[gen_index + (DQ_BITS*LANES)*4]),
643
+ .D6(i_controller_data[gen_index + (DQ_BITS*LANES)*5]),
644
+ .D7(i_controller_data[gen_index + (DQ_BITS*LANES)*6]),
645
+ .D8(i_controller_data[gen_index + (DQ_BITS*LANES)*7]),
646
+ .T1(i_controller_dq_tri_control),
647
+ .TCE(1'b1),
648
+ .OCE(1'b1), // 1-bit input: Output data clock enable
649
+ .RST(sync_rst), // 1-bit input: Reset
650
+ // unused signals but were added here to make vivado happy
651
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
652
+ .SHIFTOUT2(),
653
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
654
+ .TFB(), // 1-bit output: 3-state control
655
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
656
+ .SHIFTIN1(0),
657
+ .SHIFTIN2(0),
658
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
659
+ .T2(0),
660
+ .T3(0),
661
+ .T4(0),
662
+ .TBYTEIN(0)
663
+ // 1-bit input: Byte group tristate
664
+ );
665
+ // End of OSERDESE2_inst instantiation
666
+
667
+ // IOBUF: Single-ended Bi-directional Buffer
668
+ //All devices
669
+ // Xilinx HDL Libraries Guide, version 13.4
670
+ `ifndef SIM_MODEL
671
+ IOBUF #(
672
+ `else
673
+ IOBUF_model #(
674
+ `endif
675
+ //.DRIVE(12), // Specify the output drive strength
676
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
677
+ //.IOSTANDARD("SSTL15"), // Specify the I/O standard
678
+ .SLEW("FAST") // Specify the output slew rate
679
+ ) IOBUF_data (
680
+ .O(read_dq[gen_index]),// Buffer output
681
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
682
+ .I(oserdes_data[gen_index]), // Buffer input
683
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=read, low=write
684
+ );
685
+ end
686
+
687
+ // IDELAYE2: Input Fixed or Variable Delay Element
688
+ // 7 Series
689
+ // Xilinx HDL Libraries Guide, version 13.4
690
+ (* IODELAY_GROUP="DDR3-GROUP" *)
691
+ `ifndef SIM_MODEL
692
+ IDELAYE2 #(
693
+ `else
694
+ IDELAYE2_model #(
695
+ `endif
696
+ .DELAY_SRC("IDATAIN"), // Delay input (IDATAIN, DATAIN)
697
+ .HIGH_PERFORMANCE_MODE("TRUE"), //Reduced jitter ("TRUE"), Reduced power ("FALSE")
698
+ .IDELAY_TYPE("VAR_LOAD"), //FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
699
+ .IDELAY_VALUE(DATA_IDELAY_TAP), //Input delay tap setting (0-31)
700
+ .PIPE_SEL("FALSE"), //Select pipelined mode, FALSE, TRUE
701
+ .REFCLK_FREQUENCY(200.0), //IDELAYCTRL clock input frequency in MHz (190.0-210.0).
702
+ .SIGNAL_PATTERN("DATA") //DATA, CLOCK input signal
703
+ )
704
+ IDELAYE2_data (
705
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
706
+ .DATAOUT(idelay_data[gen_index]), // 1-bit output: Delayed data output
707
+ .C(i_controller_clk), // 1-bit input: Clock input
708
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
709
+ .CINVCTRL(1'b0),// 1-bit input: Dynamic clock inversion input
710
+ .CNTVALUEIN(i_controller_idelay_data_cntvaluein), // 5-bit input: Counter value input
711
+ .DATAIN(), //1-bit input: Internal delay data input
712
+ .IDATAIN(read_dq[gen_index]), // 1-bit input: Data input from the I/O
713
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
714
+ .LD(i_controller_idelay_data_ld[gen_index/8]), // 1-bit input: Load IDELAY_VALUE input
715
+ .LDPIPEEN(1'b0), // 1-bit input: Enable PIPELINE register to load data input
716
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
717
+ );
718
+ // End of IDELAYE2_inst instantiation
719
+
720
+ // End of IOBUF_inst instantiation
721
+ // ISERDESE2: Input SERial/DESerializer with bitslip
722
+ //7 Series
723
+ // Xilinx HDL Libraries Guide, version 13.4
724
+ `ifndef SIM_MODEL
725
+ ISERDESE2 #(
726
+ `else
727
+ ISERDESE2_model #(
728
+ `endif
729
+ .DATA_RATE("DDR"), // DDR, SDR
730
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
731
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
732
+ .INIT_Q1(1'b0),
733
+ .INIT_Q2(1'b0),
734
+ .INIT_Q3(1'b0),
735
+ .INIT_Q4(1'b0),
736
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
737
+ .IOBDELAY("IFD"), // NONE, BOTH, IBUF, IFD
738
+ .NUM_CE(1),// Number of clock enables (1,2)
739
+ .OFB_USED("FALSE"), // Select OFB path (FALSE, TRUE)
740
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
741
+ .SRVAL_Q1(1'b0),
742
+ .SRVAL_Q2(1'b0),
743
+ .SRVAL_Q3(1'b0),
744
+ .SRVAL_Q4(1'b0)
745
+ )
746
+ ISERDESE2_data (
747
+ .O(),
748
+ // 1-bit output: Combinatorial output
749
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
750
+ .Q1(o_controller_iserdes_data[(DQ_BITS*LANES)*7 + gen_index]),//56
751
+ .Q2(o_controller_iserdes_data[(DQ_BITS*LANES)*6 + gen_index]), //48
752
+ .Q3(o_controller_iserdes_data[(DQ_BITS*LANES)*5 + gen_index]),
753
+ .Q4(o_controller_iserdes_data[(DQ_BITS*LANES)*4 + gen_index]),
754
+ .Q5(o_controller_iserdes_data[(DQ_BITS*LANES)*3 + gen_index]),
755
+ .Q6(o_controller_iserdes_data[(DQ_BITS*LANES)*2 + gen_index]),
756
+ .Q7(o_controller_iserdes_data[(DQ_BITS*LANES)*1 + gen_index]),
757
+ .Q8(o_controller_iserdes_data[(DQ_BITS*LANES)*0 + gen_index]),
758
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
759
+ .SHIFTOUT1(),
760
+ .SHIFTOUT2(),
761
+ .BITSLIP(i_controller_bitslip[gen_index/8]),
762
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
763
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
764
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
765
+ // position every time Bitslip is invoked (DDR operation is different from
766
+ // SDR).
767
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
768
+ .CE1(1'b1),
769
+ .CE2(1'b1),
770
+ .CLKDIVP(), // 1-bit input: TBD
771
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
772
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
773
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
774
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
775
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
776
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
777
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
778
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
779
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
780
+ .D(), // 1-bit input: Data input
781
+ .DDLY(idelay_data[gen_index]), // 1-bit input: Serial data from IDELAYE2
782
+ .OFB(), // 1-bit input: Data feedback from OSERDESE2
783
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
784
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
785
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
786
+ .SHIFTIN1(),
787
+ .SHIFTIN2()
788
+ );
789
+ // End of ISERDESE2_inst instantiation
790
+
791
+ end
792
+
793
+ // data mask: oserdes -> odelay -> obuf
794
+ for(gen_index = 0; gen_index < LANES; gen_index = gen_index + 1) begin
795
+
796
+
797
+ if(ODELAY_SUPPORTED) begin
798
+ // OSERDESE2: Output SERial/DESerializer with bitslip
799
+ //7 Series
800
+ // Xilinx HDL Libraries Guide, version 13.4
801
+ `ifndef SIM_MODEL
802
+ OSERDESE2 #(
803
+ `else
804
+ OSERDESE2_model #(
805
+ `endif
806
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
807
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
808
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
809
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
810
+ .TRISTATE_WIDTH(1)
811
+ )
812
+ OSERDESE2_dm(
813
+ .OFB(oserdes_dm[gen_index]), // 1-bit output: Feedback path for data
814
+ .OQ(), // 1-bit output: Data path output
815
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
816
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
817
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
818
+ .D1(i_controller_dm[gen_index + LANES*0]),
819
+ .D2(i_controller_dm[gen_index + LANES*1]),
820
+ .D3(i_controller_dm[gen_index + LANES*2]),
821
+ .D4(i_controller_dm[gen_index + LANES*3]),
822
+ .D5(i_controller_dm[gen_index + LANES*4]),
823
+ .D6(i_controller_dm[gen_index + LANES*5]),
824
+ .D7(i_controller_dm[gen_index + LANES*6]),
825
+ .D8(i_controller_dm[gen_index + LANES*7]),
826
+ .TCE(1'b0),
827
+ .OCE(1'b1), // 1-bit input: Output data clock enable
828
+ .RST(sync_rst), // 1-bit input: Reset
829
+ // unused signals but were added here to make vivado happy
830
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
831
+ .SHIFTOUT2(),
832
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
833
+ .TFB(), // 1-bit output: 3-state control
834
+ .TQ(), // 1-bit output: 3-state control
835
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
836
+ .SHIFTIN1(0),
837
+ .SHIFTIN2(0),
838
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
839
+ .T1(0),
840
+ .T2(0),
841
+ .T3(0),
842
+ .T4(0),
843
+ .TBYTEIN(0)
844
+ // 1-bit input: Byte group tristate
845
+ );
846
+ // End of OSERDESE2_inst instantiation
847
+
848
+ // ODELAYE2: Output Fixed or Variable Delay Element
849
+ // 7 Series
850
+ // Xilinx HDL Libraries Guide, version 13.4
851
+ //odelay adds an insertion delay of 600ps to the actual delay setting: https://support.xilinx.com/s/article/42133?language=en_US
852
+ //Delay the DQ
853
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
854
+ (* IODELAY_GROUP="DDR3-GROUP" *)
855
+ `ifndef SIM_MODEL
856
+ ODELAYE2 #(
857
+ `else
858
+ ODELAYE2_model #(
859
+ `endif
860
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
861
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
862
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
863
+ .ODELAY_VALUE(DATA_ODELAY_TAP), // Output delay tap setting (0-31)
864
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
865
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
866
+ )
867
+ ODELAYE2_dm (
868
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
869
+ .DATAOUT(odelay_dm[gen_index]), // 1-bit output: Delayed data/clock output
870
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
871
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
872
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
873
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
874
+ .CNTVALUEIN(i_controller_odelay_data_cntvaluein), // 5-bit input: Counter value input
875
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
876
+ .LD(i_controller_odelay_data_ld[gen_index]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
877
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
878
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
879
+ .ODATAIN(oserdes_dm[gen_index]), // 1-bit input: Output delay data input
880
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
881
+ );
882
+
883
+ // OBUF: Single-ended Output Buffer
884
+ // 7 Series
885
+ // Xilinx HDL Libraries Guide, version 13.4
886
+ `ifndef SIM_MODEL
887
+ OBUF #(
888
+ `else
889
+ OBUF_model #(
890
+ `endif
891
+ //.IOSTANDARD("SSTL_15"), // Specify the output I/O standard
892
+ .SLEW("FAST") // Specify the output slew rate
893
+ ) OBUF_dm (
894
+ .O(o_ddr3_dm[gen_index]), // Buffer output (connect directly to top-level port)
895
+ .I(odelay_dm[gen_index]) // Buffer input
896
+ );
897
+ // End of OBUF_inst instantiation
898
+ end
899
+ else begin
900
+ // OSERDESE2: Output SERial/DESerializer with bitslip
901
+ //7 Series
902
+ // Xilinx HDL Libraries Guide, version 13.4
903
+ `ifndef SIM_MODEL
904
+ OSERDESE2 #(
905
+ `else
906
+ OSERDESE2_model #(
907
+ `endif
908
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
909
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
910
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
911
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
912
+ .TRISTATE_WIDTH(1)
913
+ )
914
+ OSERDESE2_dm(
915
+ .OFB(), // 1-bit output: Feedback path for data
916
+ .OQ(oserdes_dm[gen_index]), // 1-bit output: Data path output
917
+ .CLK(i_ddr3_clk_90), // 1-bit input: High speed clock
918
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
919
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
920
+ .D1(i_controller_dm[gen_index + LANES*0]),
921
+ .D2(i_controller_dm[gen_index + LANES*1]),
922
+ .D3(i_controller_dm[gen_index + LANES*2]),
923
+ .D4(i_controller_dm[gen_index + LANES*3]),
924
+ .D5(i_controller_dm[gen_index + LANES*4]),
925
+ .D6(i_controller_dm[gen_index + LANES*5]),
926
+ .D7(i_controller_dm[gen_index + LANES*6]),
927
+ .D8(i_controller_dm[gen_index + LANES*7]),
928
+ .TCE(1'b0),
929
+ .OCE(1'b1), // 1-bit input: Output data clock enable
930
+ .RST(sync_rst), // 1-bit input: Reset
931
+ // unused signals but were added here to make vivado happy
932
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
933
+ .SHIFTOUT2(),
934
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
935
+ .TFB(), // 1-bit output: 3-state control
936
+ .TQ(), // 1-bit output: 3-state control
937
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
938
+ .SHIFTIN1(0),
939
+ .SHIFTIN2(0),
940
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
941
+ .T1(0),
942
+ .T2(0),
943
+ .T3(0),
944
+ .T4(0),
945
+ .TBYTEIN(0)
946
+ // 1-bit input: Byte group tristate
947
+ );
948
+ // End of OSERDESE2_inst instantiation
949
+
950
+ // OBUF: Single-ended Output Buffer
951
+ // 7 Series
952
+ // Xilinx HDL Libraries Guide, version 13.4
953
+ `ifndef SIM_MODEL
954
+ OBUF #(
955
+ `else
956
+ OBUF_model #(
957
+ `endif
958
+ //.IOSTANDARD("SSTL_15"), // Specify the output I/O standard
959
+ .SLEW("FAST") // Specify the output slew rate
960
+ ) OBUF_dm (
961
+ .O(o_ddr3_dm[gen_index]), // Buffer output (connect directly to top-level port)
962
+ .I(oserdes_dm[gen_index]) // Buffer input
963
+ );
964
+ // End of OBUF_inst instantiation
965
+
966
+ end
967
+ end
968
+
969
+ // dqs: odelay -> iobuf
970
+ for(gen_index = 0; gen_index < LANES; gen_index = gen_index + 1) begin
971
+ `ifndef DEBUG_DQS //remove the logic for dqs if needs to be debugged (directed to output instead)
972
+ if(ODELAY_SUPPORTED) begin
973
+ // OSERDESE2: Output SERial/DESerializer with bitslip
974
+ //7 Series
975
+ // Xilinx HDL Libraries Guide, version 13.4
976
+ `ifndef SIM_MODEL
977
+ OSERDESE2 #(
978
+ `else
979
+ OSERDESE2_model #(
980
+ `endif
981
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
982
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
983
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
984
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
985
+ .TRISTATE_WIDTH(1)
986
+ )
987
+ OSERDESE2_dqs(
988
+ .OFB(oserdes_dqs[gen_index]), // 1-bit output: Feedback path for data
989
+ .OQ(), // 1-bit output: Data path output
990
+ .TQ(oserdes_dqs_tri_control[gen_index]),
991
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
992
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
993
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
994
+ .D1(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q)), //the last part will still have half dqs series
995
+ .D2(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
996
+ .D3(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q) && !i_controller_write_leveling_calib),
997
+ .D4(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
998
+ .D5(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
999
+ .D6(1'b0 && i_controller_toggle_dqs),
1000
+ .D7(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1001
+ .D8(1'b0 && i_controller_toggle_dqs),
1002
+ .T1(i_controller_dqs_tri_control),
1003
+ .TCE(1'b1),
1004
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1005
+ .RST(sync_rst), // 1-bit input: Reset
1006
+ // unused signals but were added here to make vivado happy
1007
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1008
+ .SHIFTOUT2(),
1009
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1010
+ .TFB(), // 1-bit output: 3-state control
1011
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1012
+ .SHIFTIN1(0),
1013
+ .SHIFTIN2(0),
1014
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1015
+ .T2(0),
1016
+ .T3(0),
1017
+ .T4(0),
1018
+ .TBYTEIN(0)
1019
+ // 1-bit input: Byte group tristate
1020
+ );
1021
+ // End of OSERDESE2_inst instantiation
1022
+
1023
+
1024
+ // ODELAYE2: Output Fixed or Variable Delay Element
1025
+ // 7 Series
1026
+ // Xilinx HDL Libraries Guide, version 13.4
1027
+ //Delay the DQ
1028
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1029
+ `ifndef SIM_MODEL
1030
+ ODELAYE2 #(
1031
+ `else
1032
+ ODELAYE2_model #(
1033
+ `endif
1034
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
1035
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter ("TRUE"), Reduced power ("FALSE")
1036
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
1037
+ .ODELAY_VALUE(DQS_ODELAY_TAP), // delay to align odelay_dqs to oserdes_dqs due to 600ps insertion delay: (1/800MHz - 600ps)/78.125ps = 8.32 taps
1038
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
1039
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
1040
+ )
1041
+ ODELAYE2_dqs (
1042
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
1043
+ .DATAOUT(odelay_dqs[gen_index]), // 1-bit output: Delayed data/clock output
1044
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
1045
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
1046
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
1047
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
1048
+ .CNTVALUEIN(i_controller_odelay_dqs_cntvaluein), // 5-bit input: Counter value input
1049
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
1050
+ .LD(i_controller_odelay_dqs_ld[gen_index]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
1051
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
1052
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
1053
+ .ODATAIN(oserdes_dqs[gen_index]), // 1-bit input: Output delay data input
1054
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
1055
+ );
1056
+
1057
+ if(USE_IO_TERMINATION) begin
1058
+ // IOBUFDS_DCIEN: Differential Bi-directional Buffer with Digital Controlled Impedance (DCI)
1059
+ // and Input path enable/disable
1060
+ // May only be placed in High Performance (HP) Banks
1061
+ // 7 Series
1062
+ // Xilinx HDL Libraries Guide, version 13.4
1063
+ `ifndef SIM_MODEL
1064
+ IOBUFDS_DCIEN #(
1065
+ `else
1066
+ IOBUFDS_DCIEN_model #(
1067
+ `endif
1068
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
1069
+ .SLEW("FAST"), // Specify the output slew rate
1070
+ .USE_IBUFDISABLE("FALSE") // Use IBUFDISABLE function, "TRUE" or "FALSE"
1071
+ ) IOBUFDS_DCIEN_inst (
1072
+ .O(read_dqs[gen_index]), // Buffer output
1073
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1074
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1075
+ .DCITERMDISABLE(1'b0), // DCI Termination enable input
1076
+ .I(odelay_dqs[gen_index]), // Buffer input
1077
+ .IBUFDISABLE(1'b0), // Input disable input, low=disable
1078
+ .T(oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1079
+ );
1080
+ // End of IOBUFDS_DCIEN_inst instantiation
1081
+
1082
+ end
1083
+ else begin
1084
+ // IOBUFDS: Differential Bi-directional Buffer
1085
+ //7 Series
1086
+ // Xilinx HDL Libraries Guide, version 13.4
1087
+ `ifndef SIM_MODEL
1088
+ IOBUFDS #(
1089
+ `else
1090
+ IOBUFDS_model #(
1091
+ `endif
1092
+ //.DIFF_TERM("FALSE"), // Differential Termination ("TRUE"/"FALSE")
1093
+ .IBUF_LOW_PWR("FALSE") // Low Power - "TRUE", High Performance = "FALSE"
1094
+ //.IOSTANDARD("DIFF_SSTL15") // Specify the I/O standard. CONSULT WITH DATASHEET
1095
+ //.SLEW("FAST") // Specify the output slew rate
1096
+ ) IOBUFDS_dqs (
1097
+ .O(read_dqs[gen_index]), // Buffer output
1098
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1099
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1100
+ .I(odelay_dqs[gen_index]), // Buffer input
1101
+ .T(/*!dqs_tri_control[gen_index]*/oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1102
+ ); // End of IOBUFDS_inst instantiation
1103
+ end
1104
+
1105
+ end
1106
+
1107
+ else begin //ODELAY not supported
1108
+ // OSERDESE2: Output SERial/DESerializer with bitslip
1109
+ //7 Series
1110
+ // Xilinx HDL Libraries Guide, version 13.4
1111
+ `ifndef SIM_MODEL
1112
+ OSERDESE2 #(
1113
+ `else
1114
+ OSERDESE2_model #(
1115
+ `endif
1116
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
1117
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
1118
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
1119
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
1120
+ .TRISTATE_WIDTH(1)
1121
+ )
1122
+ OSERDESE2_dqs(
1123
+ .OFB(), // 1-bit output: Feedback path for data
1124
+ .OQ(oserdes_dqs[gen_index]), // 1-bit output: Data path output
1125
+ .TQ(oserdes_dqs_tri_control[gen_index]),
1126
+ .CLK(!i_ddr3_clk), // 1-bit input: High speed clock
1127
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1128
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
1129
+ .D1(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q)), //the last part will still have half dqs series
1130
+ .D2(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
1131
+ .D3(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q) && !i_controller_write_leveling_calib),
1132
+ .D4(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
1133
+ .D5(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1134
+ .D6(1'b0 && i_controller_toggle_dqs),
1135
+ .D7(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1136
+ .D8(1'b0 && i_controller_toggle_dqs),
1137
+ .T1(i_controller_dqs_tri_control),
1138
+ .TCE(1'b1),
1139
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1140
+ .RST(sync_rst), // 1-bit input: Reset
1141
+ // unused signals but were added here to make vivado happy
1142
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1143
+ .SHIFTOUT2(),
1144
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1145
+ .TFB(), // 1-bit output: 3-state control
1146
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1147
+ .SHIFTIN1(0),
1148
+ .SHIFTIN2(0),
1149
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1150
+ .T2(0),
1151
+ .T3(0),
1152
+ .T4(0),
1153
+ .TBYTEIN(0)
1154
+ // 1-bit input: Byte group tristate
1155
+ );
1156
+ // End of OSERDESE2_inst instantiation
1157
+
1158
+ // IOBUFDS: Differential Bi-directional Buffer
1159
+ //7 Series
1160
+ // Xilinx HDL Libraries Guide, version 13.4
1161
+ `ifndef SIM_MODEL
1162
+ IOBUFDS #(
1163
+ `else
1164
+ IOBUFDS_model #(
1165
+ `endif
1166
+ //.DIFF_TERM("FALSE"), // Differential Termination ("TRUE"/"FALSE")
1167
+ .IBUF_LOW_PWR("FALSE") // Low Power - "TRUE", High Performance = "FALSE"
1168
+ //.IOSTANDARD("DIFF_SSTL15") // Specify the I/O standard. CONSULT WITH DATASHEET
1169
+ //.SLEW("FAST") // Specify the output slew rate
1170
+ ) IOBUFDS_dqs (
1171
+ .O(read_dqs[gen_index]), // Buffer output
1172
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1173
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1174
+ .I(oserdes_dqs[gen_index]), // Buffer input
1175
+ .T(/*!dqs_tri_control[gen_index]*/oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1176
+ ); // End of IOBUFDS_inst instantiation
1177
+
1178
+ end
1179
+
1180
+ // IDELAYE2: Input Fixed or Variable Delay Element
1181
+ // 7 Series
1182
+ // Xilinx HDL Libraries Guide, version 13.4
1183
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1184
+ `ifndef SIM_MODEL
1185
+ IDELAYE2 #(
1186
+ `else
1187
+ IDELAYE2_model #(
1188
+ `endif
1189
+ .DELAY_SRC("IDATAIN"), // Delay input (IDATAIN, DATAIN)
1190
+ .HIGH_PERFORMANCE_MODE("TRUE"), //Reduced jitter ("TRUE"), Reduced power ("FALSE")
1191
+ .IDELAY_TYPE("VAR_LOAD"), //FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
1192
+ .IDELAY_VALUE(DQS_IDELAY_TAP), //Input delay tap setting (0-31)
1193
+ .PIPE_SEL("FALSE"), //Select pipelined mode, FALSE, TRUE
1194
+ .REFCLK_FREQUENCY(200.0), //IDELAYCTRL clock input frequency in MHz (190.0-210.0).
1195
+ .SIGNAL_PATTERN("CLOCK") //DATA, CLOCK input signal
1196
+ )
1197
+ IDELAYE2_dqs (
1198
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
1199
+ .DATAOUT(idelay_dqs[gen_index]), // 1-bit output: Delayed data output
1200
+ .C(i_controller_clk), // 1-bit input: Clock input
1201
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
1202
+ .CINVCTRL(1'b0),// 1-bit input: Dynamic clock inversion input
1203
+ .CNTVALUEIN(i_controller_idelay_dqs_cntvaluein), // 5-bit input: Counter value input
1204
+ .DATAIN(), //1-bit input: Internal delay data input
1205
+ .IDATAIN(read_dqs[gen_index]), // 1-bit input: Data input from the I/O
1206
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
1207
+ .LD(i_controller_idelay_dqs_ld[gen_index]), // 1-bit input: Load IDELAY_VALUE input
1208
+ .LDPIPEEN(1'b0), // 1-bit input: Enable PIPELINE register to load data input
1209
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
1210
+ );
1211
+ // End of IDELAYE2_inst instantiation
1212
+
1213
+
1214
+ // End of IOBUF_inst instantiation
1215
+ // ISERDESE2: Input SERial/DESerializer with bitslip
1216
+ //7 Series
1217
+ // Xilinx HDL Libraries Guide, version 13.4
1218
+ `ifndef SIM_MODEL
1219
+ ISERDESE2 #(
1220
+ `else
1221
+ ISERDESE2_model #(
1222
+ `endif
1223
+ .DATA_RATE("DDR"), // DDR, SDR
1224
+ .DATA_WIDTH(serdes_ratio*2), // Parallel data width (2-8,10,14)
1225
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
1226
+ .INIT_Q1(1'b0),
1227
+ .INIT_Q2(1'b0),
1228
+ .INIT_Q3(1'b0),
1229
+ .INIT_Q4(1'b0),
1230
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
1231
+ .IOBDELAY("IFD"), // NONE, BOTH, IBUF, IFD
1232
+ .NUM_CE(1),// Number of clock enables (1,2)
1233
+ .OFB_USED("FALSE"), // Select OFB path (FALSE, TRUE)
1234
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
1235
+ .SRVAL_Q1(1'b0),
1236
+ .SRVAL_Q2(1'b0),
1237
+ .SRVAL_Q3(1'b0),
1238
+ .SRVAL_Q4(1'b0)
1239
+ )
1240
+ ISERDESE2_dqs (
1241
+ .O(),
1242
+ // 1-bit output: Combinatorial output
1243
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
1244
+ .Q1(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 7]),
1245
+ .Q2(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 6]),
1246
+ .Q3(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 5]),
1247
+ .Q4(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 4]),
1248
+ .Q5(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 3]),
1249
+ .Q6(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 2]), //
1250
+ .Q7(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 1]), //3
1251
+ .Q8(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 0]), //2
1252
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
1253
+ .SHIFTOUT1(),
1254
+ .SHIFTOUT2(),
1255
+ .BITSLIP(i_controller_bitslip[gen_index]),
1256
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
1257
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
1258
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
1259
+ // position every time Bitslip is invoked (DDR operation is different from
1260
+ // SDR).
1261
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
1262
+ .CE1(1'b1),
1263
+ .CE2(1'b1),
1264
+ .CLKDIVP(), // 1-bit input: TBD
1265
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
1266
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
1267
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
1268
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1269
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
1270
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
1271
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
1272
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
1273
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
1274
+ .D(), // 1-bit input: Data input
1275
+ .DDLY(idelay_dqs[gen_index]), // 1-bit input: Serial data from IDELAYE2
1276
+ .OFB(), // 1-bit input: Data feedback from OSERDESE2
1277
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
1278
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
1279
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
1280
+ .SHIFTIN1(),
1281
+ .SHIFTIN2()
1282
+ );
1283
+ // End of ISERDESE2_inst instantiation
1284
+ `endif
1285
+
1286
+ // generate IOSERDES loopback or not for bitslip training
1287
+ if(NO_IOSERDES_LOOPBACK) begin
1288
+ // logic that models OSERDES loopback to ISERDES
1289
+ // accdg to IOSELECT (UG471) for 7-series:
1290
+ // " In DDR mode, every Bitslip operation causes the output pattern to alternate between
1291
+ // a shift right by one and shift left by three"
1292
+ always @(posedge i_controller_clk) begin
1293
+ if(!i_rst_n || i_controller_reset) begin
1294
+ o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 0)] <= 8'b0001_1110;
1295
+ shift_bitslip_index[gen_index] <= 0;
1296
+ end
1297
+ else if(i_controller_bitslip[gen_index]) begin
1298
+ // if shift_bitslip_index high, shift right by 3, else shift left by 1 (this is reverse of the IOSelect document for ISERDES since vector o_controller_iserdes_bitslip_reference is reversed)
1299
+ o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 0)] <=
1300
+ shift_bitslip_index[gen_index]? {o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 2) : (serdes_ratio*2*gen_index + 0)], o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 3)]}
1301
+ : {o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 6) : (serdes_ratio*2*gen_index + 0)], o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7)]};
1302
+ shift_bitslip_index[gen_index] <= !shift_bitslip_index[gen_index];
1303
+ end
1304
+ end
1305
+ assign o_controller_iserdes_bitslip_reference = o_controller_iserdes_bitslip_reference_reg;
1306
+ end
1307
+ else begin // OSERDES will loopback to ISERDES for bitslip training
1308
+ //ISERDES train
1309
+ // End of IOBUF_inst instantiation
1310
+ // ISERDESE2: Input SERial/DESerializer with bitslip
1311
+ //7 Series
1312
+ // Xilinx HDL Libraries Guide, version 13.4
1313
+ `ifndef SIM_MODEL
1314
+ ISERDESE2 #(
1315
+ `else
1316
+ ISERDESE2_model #(
1317
+ `endif
1318
+ .DATA_RATE("DDR"), // DDR, SDR
1319
+ .DATA_WIDTH(serdes_ratio*2), // Parallel data width (2-8,10,14)
1320
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
1321
+ .INIT_Q1(1'b0),
1322
+ .INIT_Q2(1'b0),
1323
+ .INIT_Q3(1'b0),
1324
+ .INIT_Q4(1'b0),
1325
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
1326
+ .IOBDELAY("NONE"), // NONE, BOTH, IBUF, IFD
1327
+ .NUM_CE(1),// Number of clock enables (1,2)
1328
+ .OFB_USED("TRUE"), // Select OFB path (FALSE, TRUE)
1329
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
1330
+ .SRVAL_Q1(1'b0),
1331
+ .SRVAL_Q2(1'b0),
1332
+ .SRVAL_Q3(1'b0),
1333
+ .SRVAL_Q4(1'b0)
1334
+ )
1335
+ ISERDESE2_train (
1336
+ .O(),
1337
+ // 1-bit output: Combinatorial output
1338
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
1339
+ .Q1(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 7]),
1340
+ .Q2(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 6]),
1341
+ .Q3(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 5]),
1342
+ .Q4(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 4]),
1343
+ .Q5(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 3]),
1344
+ .Q6(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 2]),
1345
+ .Q7(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 1]),
1346
+ .Q8(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 0]),
1347
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
1348
+ .SHIFTOUT1(),
1349
+ .SHIFTOUT2(),
1350
+ .BITSLIP(i_controller_bitslip[gen_index]),
1351
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
1352
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
1353
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
1354
+ // position every time Bitslip is invoked (DDR operation is different from
1355
+ // SDR).
1356
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
1357
+ .CE1(1'b1),
1358
+ .CE2(1'b1),
1359
+ .CLKDIVP(), // 1-bit input: TBD
1360
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
1361
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
1362
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
1363
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1364
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
1365
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
1366
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
1367
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
1368
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
1369
+ .D(), // 1-bit input: Data input
1370
+ .DDLY(), // 1-bit input: Serial data from IDELAYE2
1371
+ .OFB(oserdes_bitslip_reference[gen_index]), // 1-bit input: Data feedback from OSERDESE2
1372
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
1373
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
1374
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
1375
+ .SHIFTIN1(),
1376
+ .SHIFTIN2()
1377
+ );
1378
+ // End of ISERDESE2_inst instantiation
1379
+
1380
+ // OSERDESE2: Output SERial/DESerializer with bitslip
1381
+ //7 Series
1382
+ // Xilinx HDL Libraries Guide, version 13.4
1383
+ `ifndef SIM_MODEL
1384
+ OSERDESE2 #(
1385
+ `else
1386
+ OSERDESE2_model #(
1387
+ `endif
1388
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
1389
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
1390
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
1391
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
1392
+ .TRISTATE_WIDTH(1)
1393
+ )
1394
+ OSERDESE2_train(
1395
+ .OFB(oserdes_bitslip_reference[gen_index]), // 1-bit output: Feedback path for data
1396
+ .OQ(), // 1-bit output: Data path output
1397
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
1398
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1399
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
1400
+ .D1(1'b0),
1401
+ .D2(1'b0),
1402
+ .D3(1'b0),
1403
+ .D4(1'b0),
1404
+ .D5(1'b1),
1405
+ .D6(1'b1),
1406
+ .D7(1'b1),
1407
+ .D8(1'b1),
1408
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1409
+ .RST(sync_rst), // 1-bit input: Reset
1410
+ // unused signals but were added here to make vivado happy
1411
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1412
+ .SHIFTOUT2(),
1413
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1414
+ .TFB(), // 1-bit output: 3-state control
1415
+ .TQ(), // 1-bit output: 3-state control
1416
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1417
+ .SHIFTIN1(0),
1418
+ .SHIFTIN2(0),
1419
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1420
+ .T1(0),
1421
+ .T2(0),
1422
+ .T3(0),
1423
+ .T4(0),
1424
+ .TBYTEIN(0),
1425
+ // 1-bit input: Byte group tristate
1426
+ .TCE(0)
1427
+ // 1-bit input: 3-state clock enable
1428
+ );
1429
+ // End of OSERDESE2_inst instantiation
1430
+ end
1431
+
1432
+ end
1433
+ endgenerate
1434
+
1435
+
1436
+ // IDELAYCTRL: IDELAYE2/ODELAYE2 Tap Delay Value Control
1437
+ // 7 Series
1438
+ // Xilinx HDL Libraries Guide, version 13.4
1439
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1440
+ `ifndef SIM_MODEL
1441
+ IDELAYCTRL IDELAYCTRL_inst (
1442
+ `else
1443
+ IDELAYCTRL_model IDELAYCTRL_inst (
1444
+ `endif
1445
+ .RDY(idelayctrl_rdy), // 1-bit output: Ready output
1446
+ .REFCLK(i_ref_clk), // 1-bit input: Reference clock input.The frequency of REFCLK must be 200 MHz to guarantee the tap-delay value specified in the applicable data sheet.
1447
+ .RST(sync_rst) // 1-bit input: Active high reset input, To ,Minimum Reset pulse width is 52ns
1448
+ );
1449
+ // End of IDELAYCTRL_inst instantiation
1450
+
1451
+
1452
+ // DCIRESET: Digitially Controlled Impedence Reset Component
1453
+ //7 Series
1454
+ // Xilinx HDL Libraries Guide, version 13.4
1455
+ // DCIRESET DCIRESET_inst (
1456
+ // .LOCKED(dci_locked), // 1-bit output: LOCK status output (When low, DCI I/O impedance is being calibrated and DCI I/Os are unavailable)
1457
+ // .RST(sync_rst) // 1-bit input: Active-high asynchronous reset input
1458
+ // );
1459
+ assign dci_locked = 1;
1460
+ // End of DCIRESET_inst instantiation
1461
+
1462
+ endmodule
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/ddr3_top.v ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ddr3_top.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: Top module which instantiates the ddr3_controller and ddr3_phy modules
7
+ // Use this as top module for instantiating UberDDR3 with Wishbone Interface.
8
+ //
9
+ // Engineer: Angelo C. Jacobo
10
+ //
11
+ ////////////////////////////////////////////////////////////////////////////////
12
+ //
13
+ // Copyright (C) 2023-2025 Angelo Jacobo
14
+ //
15
+ // This program is free software: you can redistribute it and/or modify
16
+ // it under the terms of the GNU General Public License as published by
17
+ // the Free Software Foundation, either version 3 of the License, or
18
+ // (at your option) any later version.
19
+ //
20
+ // This program is distributed in the hope that it will be useful,
21
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ // GNU General Public License for more details.
24
+ //
25
+ // You should have received a copy of the GNU General Public License
26
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
27
+ //
28
+ ////////////////////////////////////////////////////////////////////////////////
29
+
30
+ `default_nettype none
31
+ `timescale 1ps / 1ps
32
+
33
+ module ddr3_top #(
34
+ parameter CONTROLLER_CLK_PERIOD = 12_000, //ps, clock period of the controller interface
35
+ DDR3_CLK_PERIOD = 3_000, //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
36
+ ROW_BITS = 14, //width of row address
37
+ COL_BITS = 10, //width of column address
38
+ BA_BITS = 3, //width of bank address
39
+ BYTE_LANES = 2, //number of byte lanes of DDR3 RAM
40
+ AUX_WIDTH = 4, //width of aux line (must be >= 4)
41
+ WB2_ADDR_BITS = 7, //width of 2nd wishbone address bus
42
+ WB2_DATA_BITS = 32, //width of 2nd wishbone data bus
43
+ DUAL_RANK_DIMM = 0, // enable dual rank DIMM (1 = enable, 0 = disable)
44
+ // DDR3 timing parameter values
45
+ parameter SPEED_BIN = 3, // 0 = Use top-level parameters , 1 = DDR3-1066 (7-7-7) , 2 = DR3-1333 (9-9-9) , 3 = DDR3-1600 (11-11-11)
46
+ SDRAM_CAPACITY = 5, // 0 = 256Mb, 1 = 512Mb, 2 = 1Gb, 3 = 2Gb, 4 = 4Gb, 5 = 8Gb, 6 = 16Gb
47
+ TRCD = 13_750, // ps Active to Read/Write command time (only used if SPEED_BIN = 0)
48
+ TRP = 13_750, // ps Precharge command period (only used if SPEED_BIN = 0)
49
+ TRAS = 35_000, // ps ACT to PRE command period (only used if SPEED_BIN = 0)
50
+ parameter[0:0] MICRON_SIM = 0, //enable faster simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
51
+ ODELAY_SUPPORTED = 0, //set to 1 when ODELAYE2 is supported
52
+ SECOND_WISHBONE = 0, //set to 1 if 2nd wishbone for debugging is needed
53
+ DLL_OFF = 0, // 1 = DLL off for low frequency ddr3 clock (< 125MHz)
54
+ WB_ERROR = 0, // set to 1 to support Wishbone error (asserts at ECC double bit error)
55
+ parameter[1:0] BIST_MODE = 1, // 0 = No BIST, 1 = run through all address space ONCE , 2 = run through all address space for every test (burst w/r, random w/r, alternating r/w)
56
+ parameter[0:0] BIST_TEST_DATAMASK = 1, // 1 = include per-byte DM writes in BIST, 0 = all-byte writes only
57
+ parameter[1:0] ECC_ENABLE = 0, // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
58
+ parameter[1:0] DIC = 2'b00, //Output Driver Impedance Control (2'b00 = RZQ/6, 2'b01 = RZQ/7, RZQ = 240ohms) (only change when you know what you are doing)
59
+ parameter[2:0] RTT_NOM = 3'b011, //RTT Nominal (3'b000 = disabled, 3'b001 = RZQ/4, 3'b010 = RZQ/2 , 3'b011 = RZQ/6, RZQ = 240ohms) (only change when you know what you are doing)
60
+ parameter[1:0] SELF_REFRESH = 2'b00, // 0 = use i_user_self_refresh input, 1 = Self-refresh mode is enabled after 64 controller clock cycles of no requests, 2 = 128 cycles, 3 = 256 cycles
61
+ parameter // The next parameters act more like a localparam (since user does not have to set this manually) but was added here to simplify port declaration
62
+ DQ_BITS = 8, //device width (fixed to 8, if DDR3 is x16 then BYTE_LANES will be 2 while )
63
+ serdes_ratio = 4, // this controller is fixed as a 4:1 memory controller (CONTROLLER_CLK_PERIOD/DDR3_CLK_PERIOD = 4)
64
+ wb_addr_bits = ROW_BITS + COL_BITS + BA_BITS - $clog2(serdes_ratio*2) + DUAL_RANK_DIMM,
65
+ wb_data_bits = DQ_BITS*BYTE_LANES*serdes_ratio*2,
66
+ wb_sel_bits = wb_data_bits / 8,
67
+ wb2_sel_bits = WB2_DATA_BITS / 8,
68
+ //4 is the width of a single ddr3 command {cs_n, ras_n, cas_n, we_n} plus 3 (ck_en, odt, reset_n) plus bank bits plus row bits
69
+ cmd_len = 4 + 3 + BA_BITS + ROW_BITS + 2*DUAL_RANK_DIMM
70
+ )
71
+ (
72
+ input wire i_controller_clk, i_ddr3_clk, i_ref_clk, //i_controller_clk = CONTROLLER_CLK_PERIOD, i_ddr3_clk = DDR3_CLK_PERIOD, i_ref_clk = 200MHz
73
+ input wire i_ddr3_clk_90, //required only when ODELAY_SUPPORTED is zero
74
+ input wire i_rst_n,
75
+ //
76
+ // Wishbone inputs
77
+ input wire i_wb_cyc, //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
78
+ input wire i_wb_stb, //request a transfer
79
+ input wire i_wb_we, //write-enable (1 = write, 0 = read)
80
+ input wire[wb_addr_bits - 1:0] i_wb_addr, //burst-addressable {row,bank,col}
81
+ input wire[wb_data_bits - 1:0] i_wb_data, //write data, for a 4:1 controller data width is 8 times the number of pins on the device
82
+ input wire[wb_sel_bits - 1:0] i_wb_sel, //byte strobe for write (1 = write the byte)
83
+ input wire[AUX_WIDTH - 1:0] i_aux, //for AXI-interface compatibility (given upon strobe)
84
+ // Wishbone outputs
85
+ output wire o_wb_stall, //1 = busy, cannot accept requests
86
+ output wire o_wb_ack, //1 = read/write request has completed
87
+ output wire o_wb_err, //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
88
+ output wire[wb_data_bits - 1:0] o_wb_data, //read data, for a 4:1 controller data width is 8 times the number of pins on the device
89
+ output wire[AUX_WIDTH - 1:0] o_aux, //for AXI-interface compatibility (given upon strobe)
90
+ //
91
+ // Wishbone 2 (PHY) inputs
92
+ input wire i_wb2_cyc, //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
93
+ input wire i_wb2_stb, //request a transfer
94
+ input wire i_wb2_we, //write-enable (1 = write, 0 = read)
95
+ input wire[WB2_ADDR_BITS - 1:0] i_wb2_addr, // memory-mapped register to be accessed
96
+ input wire[WB2_DATA_BITS - 1:0] i_wb2_data, //write data
97
+ input wire[wb2_sel_bits - 1:0] i_wb2_sel, //byte strobe for write (1 = write the byte)
98
+ // Wishbone 2 (Controller) outputs
99
+ output wire o_wb2_stall, //1 = busy, cannot accept requests
100
+ output wire o_wb2_ack, //1 = read/write request has completed
101
+ output wire[WB2_DATA_BITS - 1:0] o_wb2_data, //read data
102
+ //
103
+ // DDR3 I/O Interface
104
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_clk_p, o_ddr3_clk_n,
105
+ output wire o_ddr3_reset_n,
106
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cke, // CKE
107
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cs_n, // chip select signal
108
+ output wire o_ddr3_ras_n, // RAS#
109
+ output wire o_ddr3_cas_n, // CAS#
110
+ output wire o_ddr3_we_n, // WE#
111
+ output wire[ROW_BITS-1:0] o_ddr3_addr,
112
+ output wire[BA_BITS-1:0] o_ddr3_ba_addr,
113
+ inout wire[(DQ_BITS*BYTE_LANES)-1:0] io_ddr3_dq,
114
+ inout wire[BYTE_LANES-1:0] io_ddr3_dqs, io_ddr3_dqs_n,
115
+ output wire[BYTE_LANES-1:0] o_ddr3_dm,
116
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_odt, // on-die termination
117
+ //
118
+ // Done Calibration pin
119
+ output wire o_calib_complete,
120
+ // Debug outputs
121
+ output wire[31:0] o_debug1,
122
+ // output wire[31:0] o_debug2,
123
+ // output wire[31:0] o_debug3,
124
+ // output wire[(DQ_BITS*BYTE_LANES)/8-1:0] o_ddr3_debug_read_dqs_p,
125
+ // output wire[(DQ_BITS*BYTE_LANES)/8-1:0] o_ddr3_debug_read_dqs_n
126
+ //
127
+ // User enabled self-refresh
128
+ input wire i_user_self_refresh,
129
+ output wire uart_tx
130
+ );
131
+
132
+ // Instantiation Template (DEFAULT VALUE IS FOR ARTY S7)
133
+ /*
134
+ // DDR3 Controller
135
+ ddr3_top #(
136
+ .CONTROLLER_CLK_PERIOD(12_000), //ps, clock period of the controller interface
137
+ .DDR3_CLK_PERIOD(3_000), //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
138
+ .ROW_BITS(14), //width of row address
139
+ .COL_BITS(10), //width of column address
140
+ .BA_BITS(3), //width of bank address
141
+ .BYTE_LANES(2), //number of byte lanes of DDR3 RAM
142
+ .AUX_WIDTH(4), //width of aux line (must be >= 4)
143
+ .MICRON_SIM(0), //enable faster simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
144
+ .ODELAY_SUPPORTED(0), //set to 1 if ODELAYE2 is supported
145
+ .SECOND_WISHBONE(0), //set to 1 if 2nd wishbone for debugging is needed
146
+ .ECC_ENABLE(0), // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
147
+ .WB_ERROR(0), // set to 1 to support Wishbone error (asserts at ECC double bit error)
148
+ ) ddr3_top
149
+ (
150
+ //clock and reset
151
+ .i_controller_clk(i_controller_clk),
152
+ .i_ddr3_clk(i_ddr3_clk), //i_controller_clk has period of CONTROLLER_CLK_PERIOD, i_ddr3_clk has period of DDR3_CLK_PERIOD
153
+ .i_ref_clk(i_ref_clk), // usually set to 200 MHz
154
+ .i_ddr3_clk_90(i_ddr3_clk_90), //90 degree phase shifted version i_ddr3_clk (required only when ODELAY_SUPPORTED is zero)
155
+ .i_rst_n(!i_rst && clk_locked),
156
+ //
157
+ // Wishbone inputs
158
+ .i_wb_cyc(1), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
159
+ .i_wb_stb(i_wb_stb), //request a transfer
160
+ .i_wb_we(i_wb_we), //write-enable (1 = write, 0 = read)
161
+ .i_wb_addr(i_wb_addr), //burst-addressable {row,bank,col}
162
+ .i_wb_data(i_wb_data), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
163
+ .i_wb_sel(16'hffff), //byte strobe for write (1 = write the byte)
164
+ .i_aux(i_wb_we), //for AXI-interface compatibility (given upon strobe)
165
+ // Wishbone outputs
166
+ .o_wb_stall(o_wb_stall), //1 = busy, cannot accept requests
167
+ .o_wb_ack(o_wb_ack), //1 = read/write request has completed
168
+ .o_wb_err(o_wb_err), //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
169
+ .o_wb_data(o_wb_data), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
170
+ .o_aux(o_aux),
171
+ //
172
+ // Wishbone 2 (PHY) inputs
173
+ .i_wb2_cyc(0), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
174
+ .i_wb2_stb(0), //request a transfer
175
+ .i_wb2_we(0), //write-enable (1 = write, 0 = read)
176
+ .i_wb2_addr(0), //burst-addressable {row,bank,col}
177
+ .i_wb2_data(0), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
178
+ .i_wb2_sel(0), //byte strobe for write (1 = write the byte)
179
+ // Wishbone 2 (Controller) outputs
180
+ .o_wb2_stall(), //1 = busy, cannot accept requests
181
+ .o_wb2_ack(), //1 = read/write request has completed
182
+ .o_wb2_data(), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
183
+ //
184
+ // DDR3 I/O Interface
185
+ .o_ddr3_clk_p(ddr3_clk_p),
186
+ .o_ddr3_clk_n(ddr3_clk_n),
187
+ .o_ddr3_reset_n(ddr3_reset_n),
188
+ .o_ddr3_cke(ddr3_cke),
189
+ .o_ddr3_cs_n(ddr3_cs_n), // width = number of DDR3 ranks
190
+ .o_ddr3_ras_n(ddr3_ras_n),
191
+ .o_ddr3_cas_n(ddr3_cas_n),
192
+ .o_ddr3_we_n(ddr3_we_n),
193
+ .o_ddr3_addr(ddr3_addr), // width = ROW_BITS
194
+ .o_ddr3_ba_addr(ddr3_ba), // width = BA_BITS
195
+ .io_ddr3_dq(ddr3_dq), // width = BYTE_LANES*8
196
+ .io_ddr3_dqs(ddr3_dqs_p), // width = BYTE_LANES
197
+ .io_ddr3_dqs_n(ddr3_dqs_n), // width = BYTE_LANES
198
+ .o_ddr3_dm(ddr3_dm), // width = BYTE_LANES
199
+ .o_ddr3_odt(ddr3_odt),
200
+ // Debug outputs
201
+ .o_debug1(),
202
+ ////////////////////////////////////
203
+ );
204
+ */
205
+
206
+ // Wire connections between controller and phy
207
+ wire[cmd_len*serdes_ratio-1:0] cmd;
208
+ wire dqs_tri_control, dq_tri_control;
209
+ wire toggle_dqs;
210
+ wire[wb_data_bits-1:0] data;
211
+ wire[wb_sel_bits-1:0] dm;
212
+ wire[BYTE_LANES-1:0] bitslip;
213
+ wire[DQ_BITS*BYTE_LANES*8-1:0] iserdes_data;
214
+ wire[BYTE_LANES*8-1:0] iserdes_dqs;
215
+ wire[BYTE_LANES*8-1:0] iserdes_bitslip_reference;
216
+ wire idelayctrl_rdy;
217
+ wire[4:0] odelay_data_cntvaluein, odelay_dqs_cntvaluein;
218
+ wire[4:0] idelay_data_cntvaluein, idelay_dqs_cntvaluein;
219
+ wire[BYTE_LANES-1:0] odelay_data_ld, odelay_dqs_ld;
220
+ wire[BYTE_LANES-1:0] idelay_data_ld, idelay_dqs_ld;
221
+ wire write_leveling_calib;
222
+ wire reset;
223
+
224
+ // logic for self-refresh
225
+ reg[8:0] refresh_counter = 0;
226
+ reg user_self_refresh;
227
+ // refresh counter
228
+ always @(posedge i_controller_clk) begin
229
+ if(i_wb_stb && i_wb_cyc) begin // if there is Wishbone request, then reset counter
230
+ refresh_counter <= 0;
231
+ end
232
+ else if(!o_wb_stall || user_self_refresh) begin // if no request (but not stalled) OR already on self-refresh, then increment counter
233
+ refresh_counter <= refresh_counter + 1;
234
+ end
235
+ end
236
+ // choose self-refresh options
237
+ always @* begin
238
+ case(SELF_REFRESH)
239
+ 2'b00: user_self_refresh = i_user_self_refresh; // use input i_user_self_refresh (high = enter self-refresh, low = exit self-refresh)
240
+ 2'b01: user_self_refresh = refresh_counter[6]; // Self-refresh mode is enabled after 64 controller clock cycles of no requests, then exit Self-refresh after another 64 controller clk cycles
241
+ 2'b10: user_self_refresh = refresh_counter[7]; // Self-refresh mode is enabled after 128 controller clock cycles of no requests, then exit Self-refresh after another 128 controller clk cycles
242
+ 2'b11: user_self_refresh = refresh_counter[8]; // Self-refresh mode is enabled after 256 controller clock cycles of no requests, then exit Self-refresh after another 256 controller clk cycles
243
+ endcase
244
+ end
245
+
246
+
247
+
248
+ //module instantiations
249
+ ddr3_controller #(
250
+ .CONTROLLER_CLK_PERIOD(CONTROLLER_CLK_PERIOD), //ps, clock period of the controller interface
251
+ .DDR3_CLK_PERIOD(DDR3_CLK_PERIOD), //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
252
+ .ROW_BITS(ROW_BITS), //width of row address
253
+ .COL_BITS(COL_BITS), //width of column address
254
+ .BA_BITS(BA_BITS), //width of bank address
255
+ .DQ_BITS(DQ_BITS), //width of DQ
256
+ .LANES(BYTE_LANES), // byte lanes
257
+ .AUX_WIDTH(AUX_WIDTH), //width of aux line (must be >= 4)
258
+ .WB2_ADDR_BITS(WB2_ADDR_BITS), //width of 2nd wishbone address bus
259
+ .WB2_DATA_BITS(WB2_DATA_BITS), //width of 2nd wishbone data bus
260
+ .MICRON_SIM(MICRON_SIM), //simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
261
+ .ODELAY_SUPPORTED(ODELAY_SUPPORTED), //set to 1 when ODELAYE2 is supported
262
+ .SECOND_WISHBONE(SECOND_WISHBONE), //set to 1 if 2nd wishbone is needed
263
+ .ECC_ENABLE(ECC_ENABLE), // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
264
+ .DLL_OFF(DLL_OFF), // 1 = DLL off for low frequency ddr3 clock (< 125MHz)
265
+ .WB_ERROR(WB_ERROR), // set to 1 to support Wishbone error (asserts at ECC double bit error)
266
+ .BIST_MODE(BIST_MODE), // 0 = No BIST, 1 = run through all address space ONCE , 2 = run through all address space for every test (burst w/r, random w/r, alternating r/w)
267
+ .BIST_TEST_DATAMASK(BIST_TEST_DATAMASK), // 1 = include per-byte DM writes in BIST, 0 = all-byte writes only
268
+ .DIC(DIC), //Output Driver Impedance Control (2'b00 = RZQ/6, 2'b01 = RZQ/7, RZQ = 240ohms)
269
+ .RTT_NOM(RTT_NOM), //RTT Nominal (3'b000 = disabled, 3'b001 = RZQ/4, 3'b010 = RZQ/2 , 3'b011 = RZQ/6, RZQ = 240ohms)
270
+ .DUAL_RANK_DIMM(DUAL_RANK_DIMM), // enable dual rank DIMM (1 = enable, 0 = disable)
271
+ .SPEED_BIN(SPEED_BIN), // 0 = Use top-level parameters , 1 = DDR3-1066 (7-7-7) , 2 = DR3-1333 (9-9-9) , 3 = DDR3-1600 (11-11-11)
272
+ .SDRAM_CAPACITY(SDRAM_CAPACITY), // 0 = 256Mb, 1 = 512Mb, 2 = 1Gb, 3 = 2Gb, 4 = 4Gb, 5 = 8Gb, 6 = 16Gb
273
+ .TRCD(TRCD), // ps Active to Read/Write command time (only used if SPEED_BIN = 0)
274
+ .TRP(TRP), // ps Precharge command period (only used if SPEED_BIN = 0)
275
+ .TRAS(TRAS) // ps ACT to PRE command period (only used if SPEED_BIN = 0)
276
+ ) ddr3_controller_inst (
277
+ .i_controller_clk(i_controller_clk), //i_controller_clk has period of CONTROLLER_CLK_PERIOD
278
+ .i_rst_n(i_rst_n), //200MHz input clock
279
+ // Wishbone inputs
280
+ .i_wb_cyc(i_wb_cyc), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
281
+ .i_wb_stb(i_wb_stb), //request a transfer
282
+ .i_wb_we(i_wb_we), //write-enable (1 = write, 0 = read)
283
+ .i_wb_addr(i_wb_addr), //burst-addressable {row,bank,col}
284
+ .i_wb_data(i_wb_data), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
285
+ .i_wb_sel(i_wb_sel), //byte strobe for write (1 = write the byte)
286
+ .i_aux(i_aux), //for AXI-interface compatibility (given upon strobe)
287
+ // Wishbone outputs
288
+ .o_wb_stall(o_wb_stall), //1 = busy, cannot accept requests
289
+ .o_wb_ack(o_wb_ack), //1 = read/write request has completed
290
+ .o_wb_err(o_wb_err), //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
291
+ .o_wb_data(o_wb_data), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
292
+ .o_aux(o_aux), //for AXI-interface compatibility (returned upon ack)
293
+ // Wishbone 2 (PHY) inputs
294
+ .i_wb2_cyc(i_wb2_cyc), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
295
+ .i_wb2_stb(i_wb2_stb), //request a transfer
296
+ .i_wb2_we(i_wb2_we), //write-enable (1 = write, 0 = read)
297
+ .i_wb2_addr(i_wb2_addr), // memory-mapped register to be accessed
298
+ .i_wb2_data(i_wb2_data), //write data
299
+ .i_wb2_sel(i_wb2_sel), //byte strobe for write (1 = write the byte)
300
+ // Wishbone 2 (Controller) outputs
301
+ .o_wb2_stall(o_wb2_stall), //1 = busy, cannot accept requests
302
+ .o_wb2_ack(o_wb2_ack), //1 = read/write request has completed
303
+ .o_wb2_data(o_wb2_data), //read data
304
+ //
305
+ // PHY interface
306
+ .i_phy_iserdes_data(iserdes_data),
307
+ .i_phy_iserdes_dqs(iserdes_dqs),
308
+ .i_phy_iserdes_bitslip_reference(iserdes_bitslip_reference),
309
+ .i_phy_idelayctrl_rdy(idelayctrl_rdy),
310
+ .o_phy_cmd(cmd),
311
+ .o_phy_dqs_tri_control(dqs_tri_control),
312
+ .o_phy_dq_tri_control(dq_tri_control),
313
+ .o_phy_toggle_dqs(toggle_dqs),
314
+ .o_phy_data(data),
315
+ .o_phy_dm(dm),
316
+ .o_phy_odelay_data_cntvaluein(odelay_data_cntvaluein),
317
+ .o_phy_odelay_dqs_cntvaluein(odelay_dqs_cntvaluein),
318
+ .o_phy_idelay_data_cntvaluein(idelay_data_cntvaluein),
319
+ .o_phy_idelay_dqs_cntvaluein(idelay_dqs_cntvaluein),
320
+ .o_phy_odelay_data_ld(odelay_data_ld),
321
+ .o_phy_odelay_dqs_ld(odelay_dqs_ld),
322
+ .o_phy_idelay_data_ld(idelay_data_ld),
323
+ .o_phy_idelay_dqs_ld(idelay_dqs_ld),
324
+ .o_phy_bitslip(bitslip),
325
+ .o_phy_write_leveling_calib(write_leveling_calib),
326
+ .o_phy_reset(reset),
327
+ // Done Calibration pin
328
+ .o_calib_complete(o_calib_complete),
329
+ // Debug outputs
330
+ .o_debug1(o_debug1),
331
+ // .o_debug2(o_debug2),
332
+ // .o_debug3(o_debug3)
333
+ // User enabled self-refresh
334
+ .i_user_self_refresh(user_self_refresh),
335
+ .uart_tx(uart_tx)
336
+ );
337
+ `ifndef LATTICE_ECP5_PHY // XILINX PHY
338
+ ddr3_phy #(
339
+ .ROW_BITS(ROW_BITS), //width of row address
340
+ .BA_BITS(BA_BITS), //width of bank address
341
+ .DQ_BITS(DQ_BITS), //width of DQ
342
+ .LANES(BYTE_LANES), //8 lanes of DQ
343
+ .CONTROLLER_CLK_PERIOD(CONTROLLER_CLK_PERIOD), //ps, period of clock input to this DDR3 controller module
344
+ .DDR3_CLK_PERIOD(DDR3_CLK_PERIOD), //ps, period of clock input to DDR3 RAM device
345
+ .ODELAY_SUPPORTED(ODELAY_SUPPORTED), //set to 1 when ODELAYE2 is supported
346
+ .DUAL_RANK_DIMM(DUAL_RANK_DIMM) // enable dual rank DIMM (1 = enable, 0 = disable)
347
+ ) ddr3_phy_inst (
348
+ .i_controller_clk(i_controller_clk),
349
+ .i_ddr3_clk(i_ddr3_clk),
350
+ .i_ref_clk(i_ref_clk),
351
+ .i_ddr3_clk_90(i_ddr3_clk_90),
352
+ .i_rst_n(i_rst_n),
353
+ // Controller Interface
354
+ .i_controller_reset(reset),
355
+ .i_controller_cmd(cmd),
356
+ .i_controller_dqs_tri_control(dqs_tri_control),
357
+ .i_controller_dq_tri_control(dq_tri_control),
358
+ .i_controller_toggle_dqs(toggle_dqs),
359
+ .i_controller_data(data),
360
+ .i_controller_dm(dm),
361
+ .i_controller_odelay_data_cntvaluein(odelay_data_cntvaluein),
362
+ .i_controller_odelay_dqs_cntvaluein(odelay_dqs_cntvaluein),
363
+ .i_controller_idelay_data_cntvaluein(idelay_data_cntvaluein),
364
+ .i_controller_idelay_dqs_cntvaluein(idelay_dqs_cntvaluein),
365
+ .i_controller_odelay_data_ld(odelay_data_ld),
366
+ .i_controller_odelay_dqs_ld(odelay_dqs_ld),
367
+ .i_controller_idelay_data_ld(idelay_data_ld),
368
+ .i_controller_idelay_dqs_ld(idelay_dqs_ld),
369
+ .i_controller_bitslip(bitslip),
370
+ .i_controller_write_leveling_calib(write_leveling_calib),
371
+ .o_controller_iserdes_data(iserdes_data),
372
+ .o_controller_iserdes_dqs(iserdes_dqs),
373
+ .o_controller_iserdes_bitslip_reference(iserdes_bitslip_reference),
374
+ .o_controller_idelayctrl_rdy(idelayctrl_rdy),
375
+ // DDR3 I/O Interface
376
+ .o_ddr3_clk_p(o_ddr3_clk_p),
377
+ .o_ddr3_clk_n(o_ddr3_clk_n),
378
+ .o_ddr3_reset_n(o_ddr3_reset_n),
379
+ .o_ddr3_cke(o_ddr3_cke), // CKE
380
+ .o_ddr3_cs_n(o_ddr3_cs_n), // chip select signal
381
+ .o_ddr3_ras_n(o_ddr3_ras_n), // RAS#
382
+ .o_ddr3_cas_n(o_ddr3_cas_n), // CAS#
383
+ .o_ddr3_we_n(o_ddr3_we_n), // WE#
384
+ .o_ddr3_addr(o_ddr3_addr),
385
+ .o_ddr3_ba_addr(o_ddr3_ba_addr),
386
+ .io_ddr3_dq(io_ddr3_dq),
387
+ .io_ddr3_dqs(io_ddr3_dqs),
388
+ .io_ddr3_dqs_n(io_ddr3_dqs_n),
389
+ .o_ddr3_dm(o_ddr3_dm),
390
+ .o_ddr3_odt(o_ddr3_odt), // on-die termination
391
+ .o_ddr3_debug_read_dqs_p(/*o_ddr3_debug_read_dqs_p*/),
392
+ .o_ddr3_debug_read_dqs_n(/*o_ddr3_debug_read_dqs_n*/)
393
+ );
394
+ `else // LATTICE ECP5 PHY
395
+ ddr3_phy_ecp5 #(
396
+ .ROW_BITS(ROW_BITS), //width of row address
397
+ .BA_BITS(BA_BITS), //width of bank address
398
+ .DQ_BITS(DQ_BITS), //width of DQ
399
+ .LANES(BYTE_LANES), //8 lanes of DQ
400
+ .CONTROLLER_CLK_PERIOD(CONTROLLER_CLK_PERIOD) //ps, period of clock input to this DDR3 controller module
401
+ ) ddr3_phy_inst (
402
+ .i_controller_clk(i_controller_clk),
403
+ .i_ddr3_clk(i_ddr3_clk),
404
+ .i_ref_clk(i_ref_clk),
405
+ .i_ddr3_clk_90(i_ddr3_clk_90),
406
+ .i_rst_n(i_rst_n),
407
+ // Controller Interface
408
+ .i_controller_reset(reset),
409
+ .i_controller_cmd(cmd),
410
+ .i_controller_dqs_tri_control(dqs_tri_control),
411
+ .i_controller_dq_tri_control(dq_tri_control),
412
+ .i_controller_toggle_dqs(toggle_dqs),
413
+ .i_controller_data(data),
414
+ .i_controller_dm(dm),
415
+ .i_controller_odelay_data_cntvaluein(odelay_data_cntvaluein),
416
+ .i_controller_odelay_dqs_cntvaluein(odelay_dqs_cntvaluein),
417
+ .i_controller_idelay_data_cntvaluein(idelay_data_cntvaluein),
418
+ .i_controller_idelay_dqs_cntvaluein(idelay_dqs_cntvaluein),
419
+ .i_controller_odelay_data_ld(odelay_data_ld),
420
+ .i_controller_odelay_dqs_ld(odelay_dqs_ld),
421
+ .i_controller_idelay_data_ld(idelay_data_ld),
422
+ .i_controller_idelay_dqs_ld(idelay_dqs_ld),
423
+ .i_controller_bitslip(bitslip),
424
+ .i_controller_write_leveling_calib(write_leveling_calib),
425
+ .o_controller_iserdes_data(iserdes_data),
426
+ .o_controller_iserdes_dqs(iserdes_dqs),
427
+ .o_controller_iserdes_bitslip_reference(iserdes_bitslip_reference),
428
+ .o_controller_idelayctrl_rdy(idelayctrl_rdy),
429
+ // DDR3 I/O Interface
430
+ .o_ddr3_clk_p(o_ddr3_clk_p),
431
+ .o_ddr3_clk_n(o_ddr3_clk_n),
432
+ .o_ddr3_reset_n(o_ddr3_reset_n),
433
+ .o_ddr3_cke(o_ddr3_cke), // CKE
434
+ .o_ddr3_cs_n(o_ddr3_cs_n), // chip select signal
435
+ .o_ddr3_ras_n(o_ddr3_ras_n), // RAS#
436
+ .o_ddr3_cas_n(o_ddr3_cas_n), // CAS#
437
+ .o_ddr3_we_n(o_ddr3_we_n), // WE#
438
+ .o_ddr3_addr(o_ddr3_addr),
439
+ .o_ddr3_ba_addr(o_ddr3_ba_addr),
440
+ .io_ddr3_dq(io_ddr3_dq),
441
+ .io_ddr3_dqs(io_ddr3_dqs),
442
+ .io_ddr3_dqs_n(io_ddr3_dqs_n),
443
+ .o_ddr3_dm(o_ddr3_dm),
444
+ .o_ddr3_odt(o_ddr3_odt), // on-die termination
445
+ .o_ddr3_debug_read_dqs_p(/*o_ddr3_debug_read_dqs_p*/),
446
+ .o_ddr3_debug_read_dqs_n(/*o_ddr3_debug_read_dqs_n*/)
447
+ );
448
+ `endif
449
+
450
+ // // display value of parameters for easy debugging
451
+ // initial begin
452
+ // $display("\nDDR3 TOP PARAMETERS:\n-----------------------------");
453
+ // $display("CONTROLLER_CLK_PERIOD = %0d", CONTROLLER_CLK_PERIOD);
454
+ // $display("DDR3_CLK_PERIOD = %0d", DDR3_CLK_PERIOD);
455
+ // $display("ROW_BITS = %0d", ROW_BITS);
456
+ // $display("COL_BITS = %0d", COL_BITS);
457
+ // $display("BA_BITS = %0d", BA_BITS);
458
+ // $display("BYTE_LANES = %0d", BYTE_LANES);
459
+ // $display("AUX_WIDTH = %0d", AUX_WIDTH);
460
+ // $display("WB2_ADDR_BITS = %0d", WB2_ADDR_BITS);
461
+ // $display("WB2_DATA_BITS = %0d", WB2_DATA_BITS);
462
+ // $display("MICRON_SIM = %0d", MICRON_SIM);
463
+ // $display("ODELAY_SUPPORTED = %0d", ODELAY_SUPPORTED);
464
+ // $display("SECOND_WISHBONE = %0d", SECOND_WISHBONE);
465
+ // $display("WB_ERROR = %0d", WB_ERROR);
466
+ // $display("BIST_MODE = %0d", BIST_MODE);
467
+ // $display("ECC_ENABLE = %0d", ECC_ENABLE);
468
+ // $display("DIC = %0d", DIC);
469
+ // $display("RTT_NOM = %0d", RTT_NOM);
470
+ // $display("SELF_REFRESH = %0d", SELF_REFRESH);
471
+ // $display("DUAL_RANK_DIMM = %0d", DUAL_RANK_DIMM);
472
+ // $display("End of DDR3 TOP PARAMETERS\n-----------------------------");
473
+ // end
474
+
475
+ endmodule
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/uart_rx.v ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ //
3
+ // Module: uart_rx
4
+ //
5
+ // Notes:
6
+ // - UART reciever module.
7
+ //
8
+
9
+ module uart_rx(
10
+ input wire clk , // Top level system clock input.
11
+ input wire resetn , // Asynchronous active low reset.
12
+ input wire uart_rxd , // UART Recieve pin.
13
+ input wire uart_rx_en , // Recieve enable
14
+ output wire uart_rx_break, // Did we get a BREAK message?
15
+ output wire uart_rx_valid, // Valid data recieved and available.
16
+ output reg [PAYLOAD_BITS-1:0] uart_rx_data // The recieved data.
17
+ );
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // External parameters.
21
+ //
22
+
23
+ //
24
+ // Input bit rate of the UART line.
25
+ parameter BIT_RATE = 9600; // bits / sec
26
+ localparam BIT_P = 1_000_000_000 * 1/BIT_RATE; // nanoseconds
27
+
28
+ //
29
+ // Clock frequency in hertz.
30
+ parameter CLK_HZ = 50_000_000;
31
+ localparam CLK_P = 1_000_000_000 * 1/CLK_HZ; // nanoseconds
32
+
33
+ //
34
+ // Number of data bits recieved per UART packet.
35
+ parameter PAYLOAD_BITS = 8;
36
+
37
+ //
38
+ // Number of stop bits indicating the end of a packet.
39
+ parameter STOP_BITS = 1;
40
+
41
+ // --------------------------------------------------------------------------
42
+ // Internal parameters.
43
+ //
44
+
45
+ //
46
+ // Number of clock cycles per uart bit.
47
+ localparam CYCLES_PER_BIT = BIT_P / CLK_P;
48
+
49
+ //
50
+ // Size of the registers which store sample counts and bit durations.
51
+ localparam COUNT_REG_LEN = 1+$clog2(CYCLES_PER_BIT);
52
+
53
+ // --------------------------------------------------------------------------
54
+ // Internal registers.
55
+ //
56
+
57
+ //
58
+ // Internally latched value of the uart_rxd line. Helps break long timing
59
+ // paths from input pins into the logic.
60
+ reg rxd_reg;
61
+ reg rxd_reg_0;
62
+
63
+ //
64
+ // Storage for the recieved serial data.
65
+ reg [PAYLOAD_BITS-1:0] recieved_data;
66
+
67
+ //
68
+ // Counter for the number of cycles over a packet bit.
69
+ reg [COUNT_REG_LEN-1:0] cycle_counter;
70
+
71
+ //
72
+ // Counter for the number of recieved bits of the packet.
73
+ reg [3:0] bit_counter;
74
+
75
+ //
76
+ // Sample of the UART input line whenever we are in the middle of a bit frame.
77
+ reg bit_sample;
78
+
79
+ //
80
+ // Current and next states of the internal FSM.
81
+ reg [2:0] fsm_state;
82
+ reg [2:0] n_fsm_state;
83
+
84
+ localparam FSM_IDLE = 0;
85
+ localparam FSM_START= 1;
86
+ localparam FSM_RECV = 2;
87
+ localparam FSM_STOP = 3;
88
+
89
+ // ---------------------------------------------------------------------------
90
+ // Output assignment
91
+ //
92
+
93
+ assign uart_rx_break = uart_rx_valid && ~|recieved_data;
94
+ assign uart_rx_valid = fsm_state == FSM_STOP && n_fsm_state == FSM_IDLE;
95
+
96
+ always @(posedge clk) begin
97
+ if(!resetn) begin
98
+ uart_rx_data <= {PAYLOAD_BITS{1'b0}};
99
+ end else if (fsm_state == FSM_STOP) begin
100
+ uart_rx_data <= recieved_data;
101
+ end
102
+ end
103
+
104
+ // ---------------------------------------------------------------------------
105
+ // FSM next state selection.
106
+ //
107
+
108
+ wire next_bit = cycle_counter == CYCLES_PER_BIT ||
109
+ fsm_state == FSM_STOP &&
110
+ cycle_counter == CYCLES_PER_BIT/2;
111
+ wire payload_done = bit_counter == PAYLOAD_BITS ;
112
+
113
+ //
114
+ // Handle picking the next state.
115
+ always @(*) begin : p_n_fsm_state
116
+ case(fsm_state)
117
+ FSM_IDLE : n_fsm_state = rxd_reg ? FSM_IDLE : FSM_START;
118
+ FSM_START: n_fsm_state = next_bit ? FSM_RECV : FSM_START;
119
+ FSM_RECV : n_fsm_state = payload_done ? FSM_STOP : FSM_RECV ;
120
+ FSM_STOP : n_fsm_state = next_bit ? FSM_IDLE : FSM_STOP ;
121
+ default : n_fsm_state = FSM_IDLE;
122
+ endcase
123
+ end
124
+
125
+ // ---------------------------------------------------------------------------
126
+ // Internal register setting and re-setting.
127
+ //
128
+
129
+ //
130
+ // Handle updates to the recieved data register.
131
+ integer i = 0;
132
+ always @(posedge clk) begin : p_recieved_data
133
+ if(!resetn) begin
134
+ recieved_data <= {PAYLOAD_BITS{1'b0}};
135
+ end else if(fsm_state == FSM_IDLE ) begin
136
+ recieved_data <= {PAYLOAD_BITS{1'b0}};
137
+ end else if(fsm_state == FSM_RECV && next_bit ) begin
138
+ recieved_data[PAYLOAD_BITS-1] <= bit_sample;
139
+ for ( i = PAYLOAD_BITS-2; i >= 0; i = i - 1) begin
140
+ recieved_data[i] <= recieved_data[i+1];
141
+ end
142
+ end
143
+ end
144
+
145
+ //
146
+ // Increments the bit counter when recieving.
147
+ always @(posedge clk) begin : p_bit_counter
148
+ if(!resetn) begin
149
+ bit_counter <= 4'b0;
150
+ end else if(fsm_state != FSM_RECV) begin
151
+ bit_counter <= {COUNT_REG_LEN{1'b0}};
152
+ end else if(fsm_state == FSM_RECV && next_bit) begin
153
+ bit_counter <= bit_counter + 1'b1;
154
+ end
155
+ end
156
+
157
+ //
158
+ // Sample the recieved bit when in the middle of a bit frame.
159
+ always @(posedge clk) begin : p_bit_sample
160
+ if(!resetn) begin
161
+ bit_sample <= 1'b0;
162
+ end else if (cycle_counter == CYCLES_PER_BIT/2) begin
163
+ bit_sample <= rxd_reg;
164
+ end
165
+ end
166
+
167
+
168
+ //
169
+ // Increments the cycle counter when recieving.
170
+ always @(posedge clk) begin : p_cycle_counter
171
+ if(!resetn) begin
172
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
173
+ end else if(next_bit) begin
174
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
175
+ end else if(fsm_state == FSM_START ||
176
+ fsm_state == FSM_RECV ||
177
+ fsm_state == FSM_STOP ) begin
178
+ cycle_counter <= cycle_counter + 1'b1;
179
+ end
180
+ end
181
+
182
+
183
+ //
184
+ // Progresses the next FSM state.
185
+ always @(posedge clk) begin : p_fsm_state
186
+ if(!resetn) begin
187
+ fsm_state <= FSM_IDLE;
188
+ end else begin
189
+ fsm_state <= n_fsm_state;
190
+ end
191
+ end
192
+
193
+
194
+ //
195
+ // Responsible for updating the internal value of the rxd_reg.
196
+ always @(posedge clk) begin : p_rxd_reg
197
+ if(!resetn) begin
198
+ rxd_reg <= 1'b1;
199
+ rxd_reg_0 <= 1'b1;
200
+ end else if(uart_rx_en) begin
201
+ rxd_reg <= rxd_reg_0;
202
+ rxd_reg_0 <= uart_rxd;
203
+ end
204
+ end
205
+
206
+
207
+ endmodule
AngeloJacobo_UberDDR3/example_demo/alinx_ax7103b/uart_tx.v ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ //
4
+ // Module: uart_tx
5
+ //
6
+ // Notes:
7
+ // - UART transmitter module.
8
+ //
9
+
10
+ module uart_tx(
11
+ input wire clk , // Top level system clock input.
12
+ input wire resetn , // Asynchronous active low reset.
13
+ output wire uart_txd , // UART transmit pin.
14
+ output wire uart_tx_busy, // Module busy sending previous item.
15
+ input wire uart_tx_en , // Send the data on uart_tx_data
16
+ input wire [PAYLOAD_BITS-1:0] uart_tx_data // The data to be sent
17
+ );
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // External parameters.
21
+ //
22
+
23
+ //
24
+ // Input bit rate of the UART line.
25
+ parameter BIT_RATE = 9600; // bits / sec
26
+ localparam BIT_P = 1_000_000_000 * 1/BIT_RATE; // nanoseconds
27
+
28
+ //
29
+ // Clock frequency in hertz.
30
+ parameter CLK_HZ = 50_000_000;
31
+ localparam CLK_P = 1_000_000_000 * 1/CLK_HZ; // nanoseconds
32
+
33
+ //
34
+ // Number of data bits recieved per UART packet.
35
+ parameter PAYLOAD_BITS = 8;
36
+
37
+ //
38
+ // Number of stop bits indicating the end of a packet.
39
+ parameter STOP_BITS = 1;
40
+
41
+ // ---------------------------------------------------------------------------
42
+ // Internal parameters.
43
+ //
44
+
45
+ //
46
+ // Number of clock cycles per uart bit.
47
+ localparam CYCLES_PER_BIT = BIT_P / CLK_P;
48
+
49
+ //
50
+ // Size of the registers which store sample counts and bit durations.
51
+ localparam COUNT_REG_LEN = 1+$clog2(CYCLES_PER_BIT);
52
+
53
+ // ---------------------------------------------------------------------------
54
+ // Internal registers.
55
+ //
56
+
57
+ //
58
+ // Internally latched value of the uart_txd line. Helps break long timing
59
+ // paths from the logic to the output pins.
60
+ reg txd_reg;
61
+
62
+ //
63
+ // Storage for the serial data to be sent.
64
+ reg [PAYLOAD_BITS-1:0] data_to_send;
65
+
66
+ //
67
+ // Counter for the number of cycles over a packet bit.
68
+ reg [COUNT_REG_LEN-1:0] cycle_counter;
69
+
70
+ //
71
+ // Counter for the number of sent bits of the packet.
72
+ reg [3:0] bit_counter;
73
+
74
+ //
75
+ // Current and next states of the internal FSM.
76
+ reg [2:0] fsm_state;
77
+ reg [2:0] n_fsm_state;
78
+
79
+ localparam FSM_IDLE = 0;
80
+ localparam FSM_START= 1;
81
+ localparam FSM_SEND = 2;
82
+ localparam FSM_STOP = 3;
83
+
84
+
85
+ // ---------------------------------------------------------------------------
86
+ // FSM next state selection.
87
+ //
88
+
89
+ assign uart_tx_busy = fsm_state != FSM_IDLE;
90
+ assign uart_txd = txd_reg;
91
+
92
+ wire next_bit = cycle_counter == CYCLES_PER_BIT;
93
+ wire payload_done = bit_counter == PAYLOAD_BITS ;
94
+ wire stop_done = bit_counter == STOP_BITS && fsm_state == FSM_STOP;
95
+
96
+ //
97
+ // Handle picking the next state.
98
+ always @(*) begin : p_n_fsm_state
99
+ case(fsm_state)
100
+ FSM_IDLE : n_fsm_state = uart_tx_en ? FSM_START: FSM_IDLE ;
101
+ FSM_START: n_fsm_state = next_bit ? FSM_SEND : FSM_START;
102
+ FSM_SEND : n_fsm_state = payload_done ? FSM_STOP : FSM_SEND ;
103
+ FSM_STOP : n_fsm_state = stop_done ? FSM_IDLE : FSM_STOP ;
104
+ default : n_fsm_state = FSM_IDLE;
105
+ endcase
106
+ end
107
+
108
+ // ---------------------------------------------------------------------------
109
+ // Internal register setting and re-setting.
110
+ //
111
+
112
+ //
113
+ // Handle updates to the sent data register.
114
+ integer i = 0;
115
+ always @(posedge clk) begin : p_data_to_send
116
+ if(!resetn) begin
117
+ data_to_send <= {PAYLOAD_BITS{1'b0}};
118
+ end else if(fsm_state == FSM_IDLE && uart_tx_en) begin
119
+ data_to_send <= uart_tx_data;
120
+ end else if(fsm_state == FSM_SEND && next_bit ) begin
121
+ for ( i = PAYLOAD_BITS-2; i >= 0; i = i - 1) begin
122
+ data_to_send[i] <= data_to_send[i+1];
123
+ end
124
+ end
125
+ end
126
+
127
+
128
+ //
129
+ // Increments the bit counter each time a new bit frame is sent.
130
+ always @(posedge clk) begin : p_bit_counter
131
+ if(!resetn) begin
132
+ bit_counter <= 4'b0;
133
+ end else if(fsm_state != FSM_SEND && fsm_state != FSM_STOP) begin
134
+ bit_counter <= {COUNT_REG_LEN{1'b0}};
135
+ end else if(fsm_state == FSM_SEND && n_fsm_state == FSM_STOP) begin
136
+ bit_counter <= {COUNT_REG_LEN{1'b0}};
137
+ end else if(fsm_state == FSM_STOP&& next_bit) begin
138
+ bit_counter <= bit_counter + 1'b1;
139
+ end else if(fsm_state == FSM_SEND && next_bit) begin
140
+ bit_counter <= bit_counter + 1'b1;
141
+ end
142
+ end
143
+
144
+
145
+ //
146
+ // Increments the cycle counter when sending.
147
+ always @(posedge clk) begin : p_cycle_counter
148
+ if(!resetn) begin
149
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
150
+ end else if(next_bit) begin
151
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
152
+ end else if(fsm_state == FSM_START ||
153
+ fsm_state == FSM_SEND ||
154
+ fsm_state == FSM_STOP ) begin
155
+ cycle_counter <= cycle_counter + 1'b1;
156
+ end
157
+ end
158
+
159
+
160
+ //
161
+ // Progresses the next FSM state.
162
+ always @(posedge clk) begin : p_fsm_state
163
+ if(!resetn) begin
164
+ fsm_state <= FSM_IDLE;
165
+ end else begin
166
+ fsm_state <= n_fsm_state;
167
+ end
168
+ end
169
+
170
+
171
+ //
172
+ // Responsible for updating the internal value of the txd_reg.
173
+ always @(posedge clk) begin : p_txd_reg
174
+ if(!resetn) begin
175
+ txd_reg <= 1'b1;
176
+ end else if(fsm_state == FSM_IDLE) begin
177
+ txd_reg <= 1'b1;
178
+ end else if(fsm_state == FSM_START) begin
179
+ txd_reg <= 1'b0;
180
+ end else if(fsm_state == FSM_SEND) begin
181
+ txd_reg <= data_to_send[0];
182
+ end else if(fsm_state == FSM_STOP) begin
183
+ txd_reg <= 1'b1;
184
+ end
185
+ end
186
+
187
+ endmodule
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/Makefile ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PROJECT = ax7325b_ddr3
2
+ FAMILY = kintex7
3
+ PART = xc7k325tffg900-2
4
+ CHIPDB = ${KINTEX7_CHIPDB}
5
+ ADDITIONAL_SOURCES = ../../rtl/ddr3_controller.v ../../rtl/ddr3_phy.v ../../rtl/ddr3_top.v uart_rx.v uart_tx.v clk_wiz.v
6
+
7
+
8
+ #############################################################################################
9
+ NEXTPNR_XILINX_DIR ?= /snap/openxc7/current/opt/nextpnr-xilinx
10
+ NEXTPNR_XILINX_PYTHON_DIR ?= ${NEXTPNR_XILINX_DIR}/python
11
+ PRJXRAY_DB_DIR ?= ${NEXTPNR_XILINX_DIR}/external/prjxray-db
12
+
13
+ DBPART = $(shell echo ${PART} | sed -e 's/-[0-9]//g')
14
+ SPEEDGRADE = $(shell echo ${PART} | sed -e 's/.*\-\([0-9]\)/\1/g')
15
+
16
+ CHIPDB ?= ./
17
+ ifeq ($(CHIPDB),)
18
+ CHIPDB = ./
19
+ endif
20
+
21
+ PYPY3 ?= pypy3
22
+
23
+ TOP ?= ${PROJECT}
24
+ TOP_MODULE ?= ${TOP}
25
+ TOP_VERILOG ?= ${TOP}.v
26
+
27
+ PNR_DEBUG ?= # --verbose --debug
28
+
29
+ JTAG_LINK ?= -c digilent_hs2
30
+
31
+ XDC ?= ${PROJECT}.xdc
32
+
33
+ .PHONY: openxc7
34
+ openxc7: ${PROJECT}_openxc7.bit
35
+
36
+ .PHONY: program
37
+ program: ${PROJECT}_openxc7.bit
38
+ openFPGALoader ${JTAG_LINK} --bitstream $<
39
+
40
+ ${PROJECT}.json: ${TOP_VERILOG} ${ADDITIONAL_SOURCES}
41
+ yosys -p "synth_xilinx -flatten -abc9 ${SYNTH_OPTS} -arch xc7 -top ${TOP_MODULE}; write_json ${PROJECT}.json" $< ${ADDITIONAL_SOURCES}
42
+
43
+ # The chip database only needs to be generated once
44
+ # that is why we don't clean it with make clean
45
+ ${CHIPDB}/${DBPART}.bin:
46
+ ${PYPY3} ${NEXTPNR_XILINX_PYTHON_DIR}/bbaexport.py --device ${PART} --bba ${DBPART}.bba
47
+ bbasm -l ${DBPART}.bba ${CHIPDB}/${DBPART}.bin
48
+ rm -f ${DBPART}.bba
49
+
50
+ ${PROJECT}.fasm: ${PROJECT}.json ${CHIPDB}/${DBPART}.bin ${XDC}
51
+ nextpnr-xilinx --chipdb ${CHIPDB}/${DBPART}.bin --xdc ${XDC} --json ${PROJECT}.json --fasm $@ ${PNR_ARGS} ${PNR_DEBUG}
52
+
53
+ ${PROJECT}.frames: ${PROJECT}.fasm
54
+ fasm2frames --part ${PART} --db-root ${PRJXRAY_DB_DIR}/${FAMILY} $< > $@
55
+
56
+ ${PROJECT}_openxc7.bit: ${PROJECT}.frames
57
+ xc7frames2bit --part_file ${PRJXRAY_DB_DIR}/${FAMILY}/${PART}/part.yaml --part_name ${PART} --frm_file $< --output_file $@
58
+
59
+
60
+ #############################################################################################
61
+ # SPDX-License-Identifier: MIT
62
+ # Generated from https://github.com/FPGAOL-CE/caas-wizard
63
+ #
64
+ BUILDDIR := ${CURDIR}/build
65
+
66
+ LOGFILE := ${BUILDDIR}/top.log
67
+
68
+ # Build design
69
+ .PHONY: vivado
70
+ vivado: ${BUILDDIR}/${PROJECT}_vivado.bit
71
+
72
+ ${BUILDDIR}:
73
+ mkdir -m 777 -p ${BUILDDIR} && chown -R nobody ${BUILDDIR} | true
74
+
75
+ .ONESHELL:
76
+ ${BUILDDIR}/vivado.tcl: ${BUILDDIR}
77
+ cat << EOF > $@
78
+ # vivado.tcl generated for FPGAOL-CE/caas-wizard
79
+ # can be launched from any directory
80
+ cd ${BUILDDIR}
81
+ create_project -part ${PART} -force v_proj
82
+ set_property target_language Verilog [current_project]
83
+ cd ..
84
+ read_verilog [glob ${PROJECT}.v ${ADDITIONAL_SOURCES}]
85
+ read_xdc [glob $(wildcard ${PROJECT}.xdc) ]
86
+ cd build
87
+ synth_design -top ${PROJECT}
88
+ opt_design
89
+ place_design
90
+ phys_opt_design
91
+ route_design
92
+ write_bitstream -verbose -force ${PROJECT}_vivado.bit
93
+ # report_utilization -file util.rpt
94
+ # report_timing_summary -file timing.rpt
95
+ EOF
96
+
97
+ ${BUILDDIR}/${PROJECT}_vivado.bit: ${BUILDDIR}/vivado.tcl
98
+ cd ${BUILDDIR} && vivado -mode batch -source $< > ${LOGFILE} 2>&1
99
+
100
+ .PHONY: program_vivado
101
+ program_vivado:
102
+ openFPGALoader ${JTAG_LINK} --bitstream ${BUILDDIR}/${PROJECT}_vivado.bit
103
+
104
+
105
+ #############################################################################################
106
+
107
+ .PHONY: clean
108
+ clean:
109
+ rm -f *.bit
110
+ rm -f *.frames
111
+ rm -f *.fasm
112
+ rm -f *.json
113
+ rm -f *.bin
114
+ rm -f *.bba
115
+ rm -rf ${BUILDDIR}
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ax7325b_ddr3.v ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ax7325b_ddr3.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: Example demo of UberDDR3 for AX7325B FPGA board from ALINX (xc7k325tffg900-2).
7
+ // Mechanism:
8
+ // - four LEDs will light up once UberDDR3 is done calibrating
9
+ // - if UART (9600 Baud Rate)receives small letter ASCII (a-z), this value will be written to DDR3
10
+ // - if UART receives capital letter ASCII (A-Z), the small letter equivalent will be retrieved from DDR3 by doing
11
+ // - a read request, once read data is available this will be sent to UART to be streamed out.
12
+ // THUS:
13
+ // - Sendng "abcdefg" to the UART terminal will store that small latter to DDR3
14
+ // - Then sending "ABCDEFG" to the UART terminal will return the small letter equivalent: "abcdefg"
15
+ //
16
+ // Engineer: Angelo C. Jacobo
17
+ //
18
+ ////////////////////////////////////////////////////////////////////////////////
19
+ //
20
+ // Copyright (C) 2023-2025 Angelo Jacobo
21
+ //
22
+ // This program is free software: you can redistribute it and/or modify
23
+ // it under the terms of the GNU General Public License as published by
24
+ // the Free Software Foundation, either version 3 of the License, or
25
+ // (at your option) any later version.
26
+ //
27
+ // This program is distributed in the hope that it will be useful,
28
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
29
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30
+ // GNU General Public License for more details.
31
+ //
32
+ // You should have received a copy of the GNU General Public License
33
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
34
+ //
35
+ ////////////////////////////////////////////////////////////////////////////////
36
+
37
+ `timescale 1ns / 1ps
38
+
39
+ module ax7325b_ddr3
40
+ (
41
+ //Differential system clocks
42
+ input wire sys_clk_p, sys_clk_n,
43
+ input wire i_rst_n,
44
+ output wire fan_pwm,
45
+ // DDR3 I/O Interface
46
+ output wire ddr3_ck_p, ddr3_ck_n,
47
+ output wire ddr3_reset_n,
48
+ output wire ddr3_cke,
49
+ output wire ddr3_cs_n,
50
+ output wire ddr3_ras_n,
51
+ output wire ddr3_cas_n,
52
+ output wire ddr3_we_n,
53
+ output wire[15-1:0] ddr3_addr,
54
+ output wire[3-1:0] ddr3_ba,
55
+ inout wire[64-1:0] ddr3_dq,
56
+ inout wire[8-1:0] ddr3_dqs_p, ddr3_dqs_n,
57
+ output wire[8-1:0] ddr3_dm,
58
+ output wire ddr3_odt,
59
+ // UART line
60
+ input wire rx,
61
+ output wire tx,
62
+ //Debug LEDs
63
+ output wire[3:0] led
64
+ );
65
+ // for dual-rank, all [0:0] will become [1:0]
66
+ wire i_controller_clk, i_ddr3_clk, i_ref_clk, i_ddr3_clk_90;
67
+ wire m_axis_tvalid;
68
+ wire rx_empty;
69
+ wire tx_full;
70
+ wire o_wb_ack;
71
+ wire[7:0] o_wb_data;
72
+ wire o_aux;
73
+ wire[7:0] rd_data;
74
+ wire o_wb_stall;
75
+ reg i_wb_stb = 0, i_wb_we;
76
+ wire[63:0] o_debug1;
77
+ reg[7:0] i_wb_data;
78
+ reg[7:0] i_wb_addr;
79
+ // o_debug1 taps on value of state_calibrate (can be traced inside ddr3_controller module)
80
+ assign led[0] = (o_debug1[4:0] == 23); //light up if at DONE_CALIBRATE
81
+ assign led[1] = (o_debug1[4:0] == 23); //light up if at DONE_CALIBRATE
82
+ assign led[2] = (o_debug1[4:0] == 23); //light up if at DONE_CALIBRATE
83
+ assign led[3] = (o_debug1[4:0] == 23); //light up if at DONE_CALIBRATE
84
+ assign fan_pwm = 1'b0; // turn on fan
85
+ //assign ddr3_cs_n[1] = 1'b1;
86
+
87
+ //===========================================================================
88
+ //Differential system clock to single end clock
89
+ //===========================================================================
90
+ wire sys_clk; // 200MHz
91
+ IBUFDS u_ibufg_sys_clk
92
+ (
93
+ .I (sys_clk_p),
94
+ .IB (sys_clk_n),
95
+ .O (sys_clk)
96
+ );
97
+
98
+ always @(posedge i_controller_clk) begin
99
+ begin
100
+ i_wb_stb <= 0;
101
+ i_wb_we <= 0;
102
+ i_wb_addr <= 0;
103
+ i_wb_data <= 0;
104
+ if(!o_wb_stall && m_axis_tvalid) begin
105
+ if(rd_data >= 97 && rd_data <= 122) begin //write to DDR3 if ASCII is small letter
106
+ i_wb_stb <= 1;
107
+ i_wb_we <= 1;
108
+ i_wb_addr <= ~rd_data ;
109
+ i_wb_data <= rd_data;
110
+ end
111
+ else if(rd_data >= 65 && rd_data <= 90) begin //read from DDR3 if ASCII is capital letter
112
+ i_wb_stb <= 1; //make request
113
+ i_wb_we <= 0; //read
114
+ i_wb_addr <= ~(rd_data + 8'd32);
115
+ end
116
+ end
117
+ end
118
+ end
119
+
120
+ wire clk_locked;
121
+ clk_wiz clk_wiz_inst
122
+ (
123
+ // Clock out ports
124
+ .clk_out1(i_controller_clk), //83.3333 Mhz
125
+ .clk_out2(i_ddr3_clk), // 333.333 MHz
126
+ .clk_out3(i_ref_clk), // 200 MHz
127
+ .clk_out4(i_ddr3_clk_90), // 333.333 MHz with 90 degree shift
128
+ // Status and control signals
129
+ .reset(!i_rst_n),
130
+ .locked(clk_locked),
131
+ // Clock in ports
132
+ .clk_in1(sys_clk)
133
+ );
134
+
135
+
136
+ // UART TX/RX module from https://github.com/ben-marshall/uart
137
+ uart_tx #(
138
+ .BIT_RATE(9600),
139
+ .CLK_HZ(83_333_333),
140
+ .PAYLOAD_BITS(8),
141
+ .STOP_BITS(1)
142
+ ) uart_tx_inst (
143
+ .clk(i_controller_clk), // Top level system clock input.
144
+ .resetn(i_rst_n && clk_locked && o_debug1[4:0] == 23), // Asynchronous active low reset.
145
+ .uart_txd(tx), // UART transmit pin.
146
+ .uart_tx_busy(), // Module busy sending previous item.
147
+ .uart_tx_en(o_wb_ack), // Send the data on uart_tx_data
148
+ .uart_tx_data(o_wb_data) // The data to be sent
149
+ );
150
+ uart_rx #(
151
+ .BIT_RATE(9600),
152
+ .CLK_HZ(83_333_333),
153
+ .PAYLOAD_BITS(8),
154
+ .STOP_BITS(1)
155
+ ) uart_rx_inst (
156
+ .clk(i_controller_clk), // Top level system clock input.
157
+ .resetn(i_rst_n && clk_locked && o_debug1[4:0] == 23), // Asynchronous active low reset.
158
+ .uart_rxd(rx), // UART Recieve pin.
159
+ .uart_rx_en(o_debug1[4:0] == 23), // Recieve enable
160
+ .uart_rx_break(), // Did we get a BREAK message?
161
+ .uart_rx_valid(m_axis_tvalid), // Valid data recieved/available.
162
+ .uart_rx_data(rd_data) // The recieved data.
163
+ );
164
+
165
+ // DDR3 Controller
166
+ ddr3_top #(
167
+ .CONTROLLER_CLK_PERIOD(10_000), //ps, clock period of the controller interface
168
+ .DDR3_CLK_PERIOD(2_500), //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
169
+ .ROW_BITS(15), //width of row address
170
+ .COL_BITS(10), //width of column address
171
+ .BA_BITS(3), //width of bank address
172
+ .BYTE_LANES(2), //number of DDR3 modules to be controlled
173
+ .AUX_WIDTH(4), //width of aux line (must be >= 4)
174
+ .WB2_ADDR_BITS(32), //width of 2nd wishbone address bus
175
+ .WB2_DATA_BITS(32), //width of 2nd wishbone data bus
176
+ .MICRON_SIM(0), //enable faster simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
177
+ .ODELAY_SUPPORTED(1), //set to 1 when ODELAYE2 is supported
178
+ .SECOND_WISHBONE(0), //set to 1 if 2nd wishbone is needed
179
+ .ECC_ENABLE(0), // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
180
+ .WB_ERROR(0), // set to 1 to support Wishbone error (asserts at ECC double bit error)
181
+ .BIST_MODE(1), // 0 = No BIST, 1 = run through all address space ONCE , 2 = run through all address space for every test (burst w/r, random w/r, alternating r/w)
182
+ .SPEED_BIN(1) // 0 = Use top-level parameters , 1 = DDR3-1066 (7-7-7) , 2 = DR3-1333 (9-9-9) , 3 = DDR3-1600 (11-11-11)
183
+ ) ddr3_top
184
+ (
185
+ //clock and reset
186
+ .i_controller_clk(i_controller_clk),
187
+ .i_ddr3_clk(i_ddr3_clk), //i_controller_clk has period of CONTROLLER_CLK_PERIOD, i_ddr3_clk has period of DDR3_CLK_PERIOD
188
+ .i_ref_clk(i_ref_clk),
189
+ .i_ddr3_clk_90(i_ddr3_clk_90),
190
+ .i_rst_n(i_rst_n && clk_locked),
191
+ // Wishbone inputs
192
+ .i_wb_cyc(1), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
193
+ .i_wb_stb(i_wb_stb), //request a transfer
194
+ .i_wb_we(i_wb_we), //write-enable (1 = write, 0 = read)
195
+ .i_wb_addr(i_wb_addr), //burst-addressable {row,bank,col}
196
+ .i_wb_data(i_wb_data), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
197
+ .i_wb_sel(16'hffff), //byte strobe for write (1 = write the byte)
198
+ .i_aux(i_wb_we), //for AXI-interface compatibility (given upon strobe)
199
+ // Wishbone outputs
200
+ .o_wb_stall(o_wb_stall), //1 = busy, cannot accept requests
201
+ .o_wb_ack(o_wb_ack), //1 = read/write request has completed
202
+ .o_wb_data(o_wb_data), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
203
+ .o_aux(o_aux),
204
+ // Wishbone 2 (PHY) inputs
205
+ .i_wb2_cyc(), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
206
+ .i_wb2_stb(), //request a transfer
207
+ .i_wb2_we(), //write-enable (1 = write, 0 = read)
208
+ .i_wb2_addr(), //burst-addressable {row,bank,col}
209
+ .i_wb2_data(), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
210
+ .i_wb2_sel(), //byte strobe for write (1 = write the byte)
211
+ // Wishbone 2 (Controller) outputs
212
+ .o_wb2_stall(), //1 = busy, cannot accept requests
213
+ .o_wb2_ack(), //1 = read/write request has completed
214
+ .o_wb2_data(), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
215
+ // PHY Interface (to be added later)
216
+ // DDR3 I/O Interface
217
+ .o_ddr3_clk_p(ddr3_ck_p),
218
+ .o_ddr3_clk_n(ddr3_ck_n),
219
+ .o_ddr3_reset_n(ddr3_reset_n),
220
+ .o_ddr3_cke(ddr3_cke), // CKE
221
+ .o_ddr3_cs_n(ddr3_cs_n), // chip select signal (controls rank 1 only)
222
+ .o_ddr3_ras_n(ddr3_ras_n), // RAS#
223
+ .o_ddr3_cas_n(ddr3_cas_n), // CAS#
224
+ .o_ddr3_we_n(ddr3_we_n), // WE#
225
+ .o_ddr3_addr(ddr3_addr),
226
+ .o_ddr3_ba_addr(ddr3_ba),
227
+ .io_ddr3_dq(ddr3_dq),
228
+ .io_ddr3_dqs(ddr3_dqs_p),
229
+ .io_ddr3_dqs_n(ddr3_dqs_n),
230
+ .o_ddr3_dm(ddr3_dm),
231
+ .o_ddr3_odt(ddr3_odt), // on-die termination
232
+ .o_debug1(o_debug1)
233
+ );
234
+
235
+ endmodule
236
+
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ax7325b_ddr3.xdc ADDED
@@ -0,0 +1,759 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ############## clock define##################
2
+ create_clock -period 5.000 [get_ports sys_clk_p]
3
+ set_property PACKAGE_PIN AE10 [get_ports sys_clk_p]
4
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports sys_clk_p]
5
+
6
+ # no need to constrain N side (only P side) or else tool will analyze interclock oaths and show failure in timing
7
+ # https://support.xilinx.com/s/article/57109?language=en_US
8
+ #create_clock -period 5.000 [get_ports sys_clk_n]
9
+ set_property PACKAGE_PIN AF10 [get_ports sys_clk_n]
10
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports sys_clk_n]
11
+
12
+
13
+ ############## key define##################
14
+ set_property PACKAGE_PIN AG27 [get_ports i_rst_n]
15
+ set_property IOSTANDARD LVCMOS25 [get_ports i_rst_n]
16
+
17
+
18
+ ############## fan define##################
19
+ set_property IOSTANDARD LVCMOS25 [get_ports fan_pwm]
20
+ set_property PACKAGE_PIN AE26 [get_ports fan_pwm]
21
+
22
+
23
+ ##############LED define##################
24
+ set_property PACKAGE_PIN A22 [get_ports {led[0]}]
25
+ set_property IOSTANDARD LVCMOS15 [get_ports {led[0]}]
26
+
27
+ set_property PACKAGE_PIN C19 [get_ports {led[1]}]
28
+ set_property IOSTANDARD LVCMOS15 [get_ports {led[1]}]
29
+
30
+ set_property PACKAGE_PIN B19 [get_ports {led[2]}]
31
+ set_property IOSTANDARD LVCMOS15 [get_ports {led[2]}]
32
+
33
+ set_property PACKAGE_PIN E18 [get_ports {led[3]}]
34
+ set_property IOSTANDARD LVCMOS15 [get_ports {led[3]}]
35
+
36
+
37
+ ##############uart define###########################
38
+ set_property IOSTANDARD LVCMOS25 [get_ports rx]
39
+ set_property PACKAGE_PIN AJ26 [get_ports rx]
40
+
41
+ set_property IOSTANDARD LVCMOS25 [get_ports tx]
42
+ set_property PACKAGE_PIN AK26 [get_ports tx]
43
+
44
+ ############## NET - IOSTANDARD ##################
45
+
46
+
47
+ ############## NET - IOSTANDARD ##################
48
+
49
+
50
+ # PadFunction: IO_L13P_T2_MRCC_32
51
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[0]}]
52
+ set_property SLEW FAST [get_ports {ddr3_dq[0]}]
53
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[0]}]
54
+ set_property PACKAGE_PIN AD18 [get_ports {ddr3_dq[0]}]
55
+
56
+ # PadFunction: IO_L16N_T2_32
57
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[1]}]
58
+ set_property SLEW FAST [get_ports {ddr3_dq[1]}]
59
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[1]}]
60
+ set_property PACKAGE_PIN AB18 [get_ports {ddr3_dq[1]}]
61
+
62
+ # PadFunction: IO_L14P_T2_SRCC_32
63
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[2]}]
64
+ set_property SLEW FAST [get_ports {ddr3_dq[2]}]
65
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[2]}]
66
+ set_property PACKAGE_PIN AD17 [get_ports {ddr3_dq[2]}]
67
+
68
+ # PadFunction: IO_L17P_T2_32
69
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[3]}]
70
+ set_property SLEW FAST [get_ports {ddr3_dq[3]}]
71
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[3]}]
72
+ set_property PACKAGE_PIN AB19 [get_ports {ddr3_dq[3]}]
73
+
74
+ # PadFunction: IO_L14N_T2_SRCC_32
75
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[4]}]
76
+ set_property SLEW FAST [get_ports {ddr3_dq[4]}]
77
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[4]}]
78
+ set_property PACKAGE_PIN AD16 [get_ports {ddr3_dq[4]}]
79
+
80
+ # PadFunction: IO_L17N_T2_32
81
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[5]}]
82
+ set_property SLEW FAST [get_ports {ddr3_dq[5]}]
83
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[5]}]
84
+ set_property PACKAGE_PIN AC19 [get_ports {ddr3_dq[5]}]
85
+
86
+ # PadFunction: IO_L13N_T2_MRCC_32
87
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[6]}]
88
+ set_property SLEW FAST [get_ports {ddr3_dq[6]}]
89
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[6]}]
90
+ set_property PACKAGE_PIN AE18 [get_ports {ddr3_dq[6]}]
91
+
92
+ # PadFunction: IO_L18P_T2_32
93
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[7]}]
94
+ set_property SLEW FAST [get_ports {ddr3_dq[7]}]
95
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[7]}]
96
+ set_property PACKAGE_PIN AB17 [get_ports {ddr3_dq[7]}]
97
+
98
+ # PadFunction: IO_L8P_T1_32
99
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[8]}]
100
+ set_property SLEW FAST [get_ports {ddr3_dq[8]}]
101
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[8]}]
102
+ set_property PACKAGE_PIN AG19 [get_ports {ddr3_dq[8]}]
103
+
104
+ # PadFunction: IO_L7N_T1_32
105
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[9]}]
106
+ set_property SLEW FAST [get_ports {ddr3_dq[9]}]
107
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[9]}]
108
+ set_property PACKAGE_PIN AK19 [get_ports {ddr3_dq[9]}]
109
+
110
+ # PadFunction: IO_L10P_T1_32
111
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[10]}]
112
+ set_property SLEW FAST [get_ports {ddr3_dq[10]}]
113
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[10]}]
114
+ set_property PACKAGE_PIN AD19 [get_ports {ddr3_dq[10]}]
115
+
116
+ # PadFunction: IO_L7P_T1_32
117
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[11]}]
118
+ set_property SLEW FAST [get_ports {ddr3_dq[11]}]
119
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[11]}]
120
+ set_property PACKAGE_PIN AJ19 [get_ports {ddr3_dq[11]}]
121
+
122
+ # PadFunction: IO_L11P_T1_SRCC_32
123
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[12]}]
124
+ set_property SLEW FAST [get_ports {ddr3_dq[12]}]
125
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[12]}]
126
+ set_property PACKAGE_PIN AF18 [get_ports {ddr3_dq[12]}]
127
+
128
+ # PadFunction: IO_L8N_T1_32
129
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[13]}]
130
+ set_property SLEW FAST [get_ports {ddr3_dq[13]}]
131
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[13]}]
132
+ set_property PACKAGE_PIN AH19 [get_ports {ddr3_dq[13]}]
133
+
134
+ # PadFunction: IO_L10N_T1_32
135
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[14]}]
136
+ set_property SLEW FAST [get_ports {ddr3_dq[14]}]
137
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[14]}]
138
+ set_property PACKAGE_PIN AE19 [get_ports {ddr3_dq[14]}]
139
+
140
+ # PadFunction: IO_L11N_T1_SRCC_32
141
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[15]}]
142
+ set_property SLEW FAST [get_ports {ddr3_dq[15]}]
143
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[15]}]
144
+ set_property PACKAGE_PIN AG18 [get_ports {ddr3_dq[15]}]
145
+
146
+ # PadFunction: IO_L1N_T0_32
147
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[16]}]
148
+ set_property SLEW FAST [get_ports {ddr3_dq[16]}]
149
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[16]}]
150
+ set_property PACKAGE_PIN AK15 [get_ports {ddr3_dq[16]}]
151
+
152
+ # PadFunction: IO_L5N_T0_32
153
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[17]}]
154
+ set_property SLEW FAST [get_ports {ddr3_dq[17]}]
155
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[17]}]
156
+ set_property PACKAGE_PIN AJ17 [get_ports {ddr3_dq[17]}]
157
+
158
+ # PadFunction: IO_L2N_T0_32
159
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[18]}]
160
+ set_property SLEW FAST [get_ports {ddr3_dq[18]}]
161
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[18]}]
162
+ set_property PACKAGE_PIN AH15 [get_ports {ddr3_dq[18]}]
163
+
164
+ # PadFunction: IO_L4P_T0_32
165
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[19]}]
166
+ set_property SLEW FAST [get_ports {ddr3_dq[19]}]
167
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[19]}]
168
+ set_property PACKAGE_PIN AF15 [get_ports {ddr3_dq[19]}]
169
+
170
+ # PadFunction: IO_L4N_T0_32
171
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[20]}]
172
+ set_property SLEW FAST [get_ports {ddr3_dq[20]}]
173
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[20]}]
174
+ set_property PACKAGE_PIN AG14 [get_ports {ddr3_dq[20]}]
175
+
176
+ # PadFunction: IO_L5P_T0_32
177
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[21]}]
178
+ set_property SLEW FAST [get_ports {ddr3_dq[21]}]
179
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[21]}]
180
+ set_property PACKAGE_PIN AH17 [get_ports {ddr3_dq[21]}]
181
+
182
+ # PadFunction: IO_L2P_T0_32
183
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[22]}]
184
+ set_property SLEW FAST [get_ports {ddr3_dq[22]}]
185
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[22]}]
186
+ set_property PACKAGE_PIN AG15 [get_ports {ddr3_dq[22]}]
187
+
188
+ # PadFunction: IO_L1P_T0_32
189
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[23]}]
190
+ set_property SLEW FAST [get_ports {ddr3_dq[23]}]
191
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[23]}]
192
+ set_property PACKAGE_PIN AK16 [get_ports {ddr3_dq[23]}]
193
+
194
+ # PadFunction: IO_L19P_T3_32
195
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[24]}]
196
+ set_property SLEW FAST [get_ports {ddr3_dq[24]}]
197
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[24]}]
198
+ set_property PACKAGE_PIN AE15 [get_ports {ddr3_dq[24]}]
199
+
200
+ # PadFunction: IO_L24P_T3_32
201
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[25]}]
202
+ set_property SLEW FAST [get_ports {ddr3_dq[25]}]
203
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[25]}]
204
+ set_property PACKAGE_PIN Y16 [get_ports {ddr3_dq[25]}]
205
+
206
+ # PadFunction: IO_L22P_T3_32
207
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[26]}]
208
+ set_property SLEW FAST [get_ports {ddr3_dq[26]}]
209
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[26]}]
210
+ set_property PACKAGE_PIN AC14 [get_ports {ddr3_dq[26]}]
211
+
212
+ # PadFunction: IO_L20P_T3_32
213
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[27]}]
214
+ set_property SLEW FAST [get_ports {ddr3_dq[27]}]
215
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[27]}]
216
+ set_property PACKAGE_PIN AA15 [get_ports {ddr3_dq[27]}]
217
+
218
+ # PadFunction: IO_L23P_T3_32
219
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[28]}]
220
+ set_property SLEW FAST [get_ports {ddr3_dq[28]}]
221
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[28]}]
222
+ set_property PACKAGE_PIN AA17 [get_ports {ddr3_dq[28]}]
223
+
224
+ # PadFunction: IO_L22N_T3_32
225
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[29]}]
226
+ set_property SLEW FAST [get_ports {ddr3_dq[29]}]
227
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[29]}]
228
+ set_property PACKAGE_PIN AD14 [get_ports {ddr3_dq[29]}]
229
+
230
+ # PadFunction: IO_L23N_T3_32
231
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[30]}]
232
+ set_property SLEW FAST [get_ports {ddr3_dq[30]}]
233
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[30]}]
234
+ set_property PACKAGE_PIN AA16 [get_ports {ddr3_dq[30]}]
235
+
236
+ # PadFunction: IO_L20N_T3_32
237
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[31]}]
238
+ set_property SLEW FAST [get_ports {ddr3_dq[31]}]
239
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[31]}]
240
+ set_property PACKAGE_PIN AB15 [get_ports {ddr3_dq[31]}]
241
+
242
+ # PadFunction: IO_L22N_T3_34
243
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[32]}]
244
+ set_property SLEW FAST [get_ports {ddr3_dq[32]}]
245
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[32]}]
246
+ set_property PACKAGE_PIN AK6 [get_ports {ddr3_dq[32]}]
247
+
248
+ # PadFunction: IO_L23P_T3_34
249
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[33]}]
250
+ set_property SLEW FAST [get_ports {ddr3_dq[33]}]
251
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[33]}]
252
+ set_property PACKAGE_PIN AJ8 [get_ports {ddr3_dq[33]}]
253
+
254
+ # PadFunction: IO_L22P_T3_34
255
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[34]}]
256
+ set_property SLEW FAST [get_ports {ddr3_dq[34]}]
257
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[34]}]
258
+ set_property PACKAGE_PIN AJ6 [get_ports {ddr3_dq[34]}]
259
+
260
+ # PadFunction: IO_L19P_T3_34
261
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[35]}]
262
+ set_property SLEW FAST [get_ports {ddr3_dq[35]}]
263
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[35]}]
264
+ set_property PACKAGE_PIN AF8 [get_ports {ddr3_dq[35]}]
265
+
266
+ # PadFunction: IO_L24N_T3_34
267
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[36]}]
268
+ set_property SLEW FAST [get_ports {ddr3_dq[36]}]
269
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[36]}]
270
+ set_property PACKAGE_PIN AK4 [get_ports {ddr3_dq[36]}]
271
+
272
+ # PadFunction: IO_L23N_T3_34
273
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[37]}]
274
+ set_property SLEW FAST [get_ports {ddr3_dq[37]}]
275
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[37]}]
276
+ set_property PACKAGE_PIN AK8 [get_ports {ddr3_dq[37]}]
277
+
278
+ # PadFunction: IO_L24P_T3_34
279
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[38]}]
280
+ set_property SLEW FAST [get_ports {ddr3_dq[38]}]
281
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[38]}]
282
+ set_property PACKAGE_PIN AK5 [get_ports {ddr3_dq[38]}]
283
+
284
+ # PadFunction: IO_L20N_T3_34
285
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[39]}]
286
+ set_property SLEW FAST [get_ports {ddr3_dq[39]}]
287
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[39]}]
288
+ set_property PACKAGE_PIN AG7 [get_ports {ddr3_dq[39]}]
289
+
290
+ # PadFunction: IO_L10P_T1_34
291
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[40]}]
292
+ set_property SLEW FAST [get_ports {ddr3_dq[40]}]
293
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[40]}]
294
+ set_property PACKAGE_PIN AE4 [get_ports {ddr3_dq[40]}]
295
+
296
+ # PadFunction: IO_L8N_T1_34
297
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[41]}]
298
+ set_property SLEW FAST [get_ports {ddr3_dq[41]}]
299
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[41]}]
300
+ set_property PACKAGE_PIN AF1 [get_ports {ddr3_dq[41]}]
301
+
302
+ # PadFunction: IO_L11P_T1_SRCC_34
303
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[42]}]
304
+ set_property SLEW FAST [get_ports {ddr3_dq[42]}]
305
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[42]}]
306
+ set_property PACKAGE_PIN AE5 [get_ports {ddr3_dq[42]}]
307
+
308
+ # PadFunction: IO_L8P_T1_34
309
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[43]}]
310
+ set_property SLEW FAST [get_ports {ddr3_dq[43]}]
311
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[43]}]
312
+ set_property PACKAGE_PIN AE1 [get_ports {ddr3_dq[43]}]
313
+
314
+ # PadFunction: IO_L12P_T1_MRCC_34
315
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[44]}]
316
+ set_property SLEW FAST [get_ports {ddr3_dq[44]}]
317
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[44]}]
318
+ set_property PACKAGE_PIN AF6 [get_ports {ddr3_dq[44]}]
319
+
320
+ # PadFunction: IO_L10N_T1_34
321
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[45]}]
322
+ set_property SLEW FAST [get_ports {ddr3_dq[45]}]
323
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[45]}]
324
+ set_property PACKAGE_PIN AE3 [get_ports {ddr3_dq[45]}]
325
+
326
+ # PadFunction: IO_L11N_T1_SRCC_34
327
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[46]}]
328
+ set_property SLEW FAST [get_ports {ddr3_dq[46]}]
329
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[46]}]
330
+ set_property PACKAGE_PIN AF5 [get_ports {ddr3_dq[46]}]
331
+
332
+ # PadFunction: IO_L7N_T1_34
333
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[47]}]
334
+ set_property SLEW FAST [get_ports {ddr3_dq[47]}]
335
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[47]}]
336
+ set_property PACKAGE_PIN AF2 [get_ports {ddr3_dq[47]}]
337
+
338
+ # PadFunction: IO_L13P_T2_MRCC_34
339
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[48]}]
340
+ set_property SLEW FAST [get_ports {ddr3_dq[48]}]
341
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[48]}]
342
+ set_property PACKAGE_PIN AH4 [get_ports {ddr3_dq[48]}]
343
+
344
+ # PadFunction: IO_L16N_T2_34
345
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[49]}]
346
+ set_property SLEW FAST [get_ports {ddr3_dq[49]}]
347
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[49]}]
348
+ set_property PACKAGE_PIN AJ2 [get_ports {ddr3_dq[49]}]
349
+
350
+ # PadFunction: IO_L14N_T2_SRCC_34
351
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[50]}]
352
+ set_property SLEW FAST [get_ports {ddr3_dq[50]}]
353
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[50]}]
354
+ set_property PACKAGE_PIN AH5 [get_ports {ddr3_dq[50]}]
355
+
356
+ # PadFunction: IO_L13N_T2_MRCC_34
357
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[51]}]
358
+ set_property SLEW FAST [get_ports {ddr3_dq[51]}]
359
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[51]}]
360
+ set_property PACKAGE_PIN AJ4 [get_ports {ddr3_dq[51]}]
361
+
362
+ # PadFunction: IO_L16P_T2_34
363
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[52]}]
364
+ set_property SLEW FAST [get_ports {ddr3_dq[52]}]
365
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[52]}]
366
+ set_property PACKAGE_PIN AH2 [get_ports {ddr3_dq[52]}]
367
+
368
+ # PadFunction: IO_L17N_T2_34
369
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[53]}]
370
+ set_property SLEW FAST [get_ports {ddr3_dq[53]}]
371
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[53]}]
372
+ set_property PACKAGE_PIN AK1 [get_ports {ddr3_dq[53]}]
373
+
374
+ # PadFunction: IO_L14P_T2_SRCC_34
375
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[54]}]
376
+ set_property SLEW FAST [get_ports {ddr3_dq[54]}]
377
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[54]}]
378
+ set_property PACKAGE_PIN AH6 [get_ports {ddr3_dq[54]}]
379
+
380
+ # PadFunction: IO_L17P_T2_34
381
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[55]}]
382
+ set_property SLEW FAST [get_ports {ddr3_dq[55]}]
383
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[55]}]
384
+ set_property PACKAGE_PIN AJ1 [get_ports {ddr3_dq[55]}]
385
+
386
+ # PadFunction: IO_L2P_T0_34
387
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[56]}]
388
+ set_property SLEW FAST [get_ports {ddr3_dq[56]}]
389
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[56]}]
390
+ set_property PACKAGE_PIN AC2 [get_ports {ddr3_dq[56]}]
391
+
392
+ # PadFunction: IO_L4P_T0_34
393
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[57]}]
394
+ set_property SLEW FAST [get_ports {ddr3_dq[57]}]
395
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[57]}]
396
+ set_property PACKAGE_PIN AC5 [get_ports {ddr3_dq[57]}]
397
+
398
+ # PadFunction: IO_L1N_T0_34
399
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[58]}]
400
+ set_property SLEW FAST [get_ports {ddr3_dq[58]}]
401
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[58]}]
402
+ set_property PACKAGE_PIN AD3 [get_ports {ddr3_dq[58]}]
403
+
404
+ # PadFunction: IO_L6P_T0_34
405
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[59]}]
406
+ set_property SLEW FAST [get_ports {ddr3_dq[59]}]
407
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[59]}]
408
+ set_property PACKAGE_PIN AC7 [get_ports {ddr3_dq[59]}]
409
+
410
+ # PadFunction: IO_L5N_T0_34
411
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[60]}]
412
+ set_property SLEW FAST [get_ports {ddr3_dq[60]}]
413
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[60]}]
414
+ set_property PACKAGE_PIN AE6 [get_ports {ddr3_dq[60]}]
415
+
416
+ # PadFunction: IO_L5P_T0_34
417
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[61]}]
418
+ set_property SLEW FAST [get_ports {ddr3_dq[61]}]
419
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[61]}]
420
+ set_property PACKAGE_PIN AD6 [get_ports {ddr3_dq[61]}]
421
+
422
+ # PadFunction: IO_L2N_T0_34
423
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[62]}]
424
+ set_property SLEW FAST [get_ports {ddr3_dq[62]}]
425
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[62]}]
426
+ set_property PACKAGE_PIN AC1 [get_ports {ddr3_dq[62]}]
427
+
428
+ # PadFunction: IO_L4N_T0_34
429
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dq[63]}]
430
+ set_property SLEW FAST [get_ports {ddr3_dq[63]}]
431
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dq[63]}]
432
+ set_property PACKAGE_PIN AC4 [get_ports {ddr3_dq[63]}]
433
+
434
+ # PadFunction: IO_L15P_T2_DQS_33
435
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[14]}]
436
+ set_property SLEW FAST [get_ports {ddr3_addr[14]}]
437
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[14]}]
438
+ set_property PACKAGE_PIN AJ9 [get_ports {ddr3_addr[14]}]
439
+
440
+ # PadFunction: IO_L7N_T1_33
441
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[13]}]
442
+ set_property SLEW FAST [get_ports {ddr3_addr[13]}]
443
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[13]}]
444
+ set_property PACKAGE_PIN AC10 [get_ports {ddr3_addr[13]}]
445
+
446
+ # PadFunction: IO_L7P_T1_33
447
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[12]}]
448
+ set_property SLEW FAST [get_ports {ddr3_addr[12]}]
449
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[12]}]
450
+ set_property PACKAGE_PIN AB10 [get_ports {ddr3_addr[12]}]
451
+
452
+ # PadFunction: IO_L8P_T1_33
453
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[11]}]
454
+ set_property SLEW FAST [get_ports {ddr3_addr[11]}]
455
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[11]}]
456
+ set_property PACKAGE_PIN AD8 [get_ports {ddr3_addr[11]}]
457
+
458
+ # PadFunction: IO_L6P_T0_33
459
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[10]}]
460
+ set_property SLEW FAST [get_ports {ddr3_addr[10]}]
461
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[10]}]
462
+ set_property PACKAGE_PIN AA13 [get_ports {ddr3_addr[10]}]
463
+
464
+ # PadFunction: IO_L5N_T0_33
465
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[9]}]
466
+ set_property SLEW FAST [get_ports {ddr3_addr[9]}]
467
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[9]}]
468
+ set_property PACKAGE_PIN AA10 [get_ports {ddr3_addr[9]}]
469
+
470
+ # PadFunction: IO_L5P_T0_33
471
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[8]}]
472
+ set_property SLEW FAST [get_ports {ddr3_addr[8]}]
473
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[8]}]
474
+ set_property PACKAGE_PIN AA11 [get_ports {ddr3_addr[8]}]
475
+
476
+ # PadFunction: IO_L4N_T0_33
477
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[7]}]
478
+ set_property SLEW FAST [get_ports {ddr3_addr[7]}]
479
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[7]}]
480
+ set_property PACKAGE_PIN Y10 [get_ports {ddr3_addr[7]}]
481
+
482
+ # PadFunction: IO_L6N_T0_VREF_33
483
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[6]}]
484
+ set_property SLEW FAST [get_ports {ddr3_addr[6]}]
485
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[6]}]
486
+ set_property PACKAGE_PIN AB13 [get_ports {ddr3_addr[6]}]
487
+
488
+ # PadFunction: IO_L3N_T0_DQS_33
489
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[5]}]
490
+ set_property SLEW FAST [get_ports {ddr3_addr[5]}]
491
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[5]}]
492
+ set_property PACKAGE_PIN AC9 [get_ports {ddr3_addr[5]}]
493
+
494
+ # PadFunction: IO_L3P_T0_DQS_33
495
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[4]}]
496
+ set_property SLEW FAST [get_ports {ddr3_addr[4]}]
497
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[4]}]
498
+ set_property PACKAGE_PIN AB9 [get_ports {ddr3_addr[4]}]
499
+
500
+ # PadFunction: IO_L2N_T0_33
501
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[3]}]
502
+ set_property SLEW FAST [get_ports {ddr3_addr[3]}]
503
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[3]}]
504
+ set_property PACKAGE_PIN AB8 [get_ports {ddr3_addr[3]}]
505
+
506
+ # PadFunction: IO_L2P_T0_33
507
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[2]}]
508
+ set_property SLEW FAST [get_ports {ddr3_addr[2]}]
509
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[2]}]
510
+ set_property PACKAGE_PIN AA8 [get_ports {ddr3_addr[2]}]
511
+
512
+ # PadFunction: IO_L1N_T0_33
513
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[1]}]
514
+ set_property SLEW FAST [get_ports {ddr3_addr[1]}]
515
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[1]}]
516
+ set_property PACKAGE_PIN AB12 [get_ports {ddr3_addr[1]}]
517
+
518
+ # PadFunction: IO_L1P_T0_33
519
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_addr[0]}]
520
+ set_property SLEW FAST [get_ports {ddr3_addr[0]}]
521
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_addr[0]}]
522
+ set_property PACKAGE_PIN AA12 [get_ports {ddr3_addr[0]}]
523
+
524
+ # PadFunction: IO_L9N_T1_DQS_33
525
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_ba[2]}]
526
+ set_property SLEW FAST [get_ports {ddr3_ba[2]}]
527
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_ba[2]}]
528
+ set_property PACKAGE_PIN AC11 [get_ports {ddr3_ba[2]}]
529
+
530
+ # PadFunction: IO_L9P_T1_DQS_33
531
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_ba[1]}]
532
+ set_property SLEW FAST [get_ports {ddr3_ba[1]}]
533
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_ba[1]}]
534
+ set_property PACKAGE_PIN AC12 [get_ports {ddr3_ba[1]}]
535
+
536
+ # PadFunction: IO_L8N_T1_33
537
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_ba[0]}]
538
+ set_property SLEW FAST [get_ports {ddr3_ba[0]}]
539
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_ba[0]}]
540
+ set_property PACKAGE_PIN AE8 [get_ports {ddr3_ba[0]}]
541
+
542
+ # PadFunction: IO_L10N_T1_33
543
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_ras_n}]
544
+ set_property SLEW FAST [get_ports {ddr3_ras_n}]
545
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_ras_n}]
546
+ set_property PACKAGE_PIN AE9 [get_ports {ddr3_ras_n}]
547
+
548
+ # PadFunction: IO_L11P_T1_SRCC_33
549
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_cas_n}]
550
+ set_property SLEW FAST [get_ports {ddr3_cas_n}]
551
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_cas_n}]
552
+ set_property PACKAGE_PIN AE11 [get_ports {ddr3_cas_n}]
553
+
554
+ # PadFunction: IO_L10P_T1_33
555
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_we_n}]
556
+ set_property SLEW FAST [get_ports {ddr3_we_n}]
557
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_we_n}]
558
+ set_property PACKAGE_PIN AD9 [get_ports {ddr3_we_n}]
559
+
560
+ # PadFunction: IO_L4P_T0_33
561
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_reset_n}]
562
+ set_property SLEW FAST [get_ports {ddr3_reset_n}]
563
+ set_property IOSTANDARD LVCMOS15 [get_ports {ddr3_reset_n}]
564
+ set_property PACKAGE_PIN Y11 [get_ports {ddr3_reset_n}]
565
+
566
+ # PadFunction: IO_L12P_T1_MRCC_33
567
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_cke}]
568
+ set_property SLEW FAST [get_ports {ddr3_cke}]
569
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_cke}]
570
+ set_property PACKAGE_PIN AD12 [get_ports {ddr3_cke}]
571
+
572
+ # PadFunction: IO_L12N_T1_MRCC_33
573
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_odt}]
574
+ set_property SLEW FAST [get_ports {ddr3_odt}]
575
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_odt}]
576
+ set_property PACKAGE_PIN AD11 [get_ports {ddr3_odt}]
577
+
578
+ # PadFunction: IO_L11N_T1_SRCC_33
579
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_cs_n}]
580
+ set_property SLEW FAST [get_ports {ddr3_cs_n}]
581
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_cs_n}]
582
+ set_property PACKAGE_PIN AF11 [get_ports {ddr3_cs_n}]
583
+
584
+ # PadFunction: IO_L16P_T2_32
585
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dm[0]}]
586
+ set_property SLEW FAST [get_ports {ddr3_dm[0]}]
587
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[0]}]
588
+ set_property PACKAGE_PIN AA18 [get_ports {ddr3_dm[0]}]
589
+
590
+ # PadFunction: IO_L12P_T1_MRCC_32
591
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dm[1]}]
592
+ set_property SLEW FAST [get_ports {ddr3_dm[1]}]
593
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[1]}]
594
+ set_property PACKAGE_PIN AF17 [get_ports {ddr3_dm[1]}]
595
+
596
+ # PadFunction: IO_L6P_T0_32
597
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dm[2]}]
598
+ set_property SLEW FAST [get_ports {ddr3_dm[2]}]
599
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[2]}]
600
+ set_property PACKAGE_PIN AE16 [get_ports {ddr3_dm[2]}]
601
+
602
+ # PadFunction: IO_L24N_T3_32
603
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dm[3]}]
604
+ set_property SLEW FAST [get_ports {ddr3_dm[3]}]
605
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[3]}]
606
+ set_property PACKAGE_PIN Y15 [get_ports {ddr3_dm[3]}]
607
+
608
+ # PadFunction: IO_L20P_T3_34
609
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dm[4]}]
610
+ set_property SLEW FAST [get_ports {ddr3_dm[4]}]
611
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[4]}]
612
+ set_property PACKAGE_PIN AF7 [get_ports {ddr3_dm[4]}]
613
+
614
+ # PadFunction: IO_L7P_T1_34
615
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dm[5]}]
616
+ set_property SLEW FAST [get_ports {ddr3_dm[5]}]
617
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[5]}]
618
+ set_property PACKAGE_PIN AF3 [get_ports {ddr3_dm[5]}]
619
+
620
+ # PadFunction: IO_L18P_T2_34
621
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dm[6]}]
622
+ set_property SLEW FAST [get_ports {ddr3_dm[6]}]
623
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[6]}]
624
+ set_property PACKAGE_PIN AJ3 [get_ports {ddr3_dm[6]}]
625
+
626
+ # PadFunction: IO_L1P_T0_34
627
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dm[7]}]
628
+ set_property SLEW FAST [get_ports {ddr3_dm[7]}]
629
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dm[7]}]
630
+ set_property PACKAGE_PIN AD4 [get_ports {ddr3_dm[7]}]
631
+
632
+ # PadFunction: IO_L15P_T2_DQS_32
633
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_p[0]}]
634
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[0]}]
635
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_p[0]}]
636
+ set_property PACKAGE_PIN Y19 [get_ports {ddr3_dqs_p[0]}]
637
+
638
+ # PadFunction: IO_L15N_T2_DQS_32
639
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_n[0]}]
640
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[0]}]
641
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_n[0]}]
642
+ set_property PACKAGE_PIN Y18 [get_ports {ddr3_dqs_n[0]}]
643
+
644
+ # PadFunction: IO_L9P_T1_DQS_32
645
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_p[1]}]
646
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[1]}]
647
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_p[1]}]
648
+ set_property PACKAGE_PIN AJ18 [get_ports {ddr3_dqs_p[1]}]
649
+
650
+ # PadFunction: IO_L9N_T1_DQS_32
651
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_n[1]}]
652
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[1]}]
653
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_dqs_n[1]}]
654
+ set_property PACKAGE_PIN AK18 [get_ports {ddr3_dqs_n[1]}]
655
+
656
+ # PadFunction: IO_L3P_T0_DQS_32
657
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_p[2]}]
658
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[2]}]
659
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_p[2]}]
660
+ set_property PACKAGE_PIN AH16 [get_ports {ddr3_dqs_p[2]}]
661
+
662
+ # PadFunction: IO_L3N_T0_DQS_32
663
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_n[2]}]
664
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[2]}]
665
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_n[2]}]
666
+ set_property PACKAGE_PIN AJ16 [get_ports {ddr3_dqs_n[2]}]
667
+
668
+ # PadFunction: IO_L21P_T3_DQS_32
669
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_p[3]}]
670
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[3]}]
671
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_p[3]}]
672
+ set_property PACKAGE_PIN AC16 [get_ports {ddr3_dqs_p[3]}]
673
+
674
+ # PadFunction: IO_L21N_T3_DQS_32
675
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_n[3]}]
676
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[3]}]
677
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_n[3]}]
678
+ set_property PACKAGE_PIN AC15 [get_ports {ddr3_dqs_n[3]}]
679
+
680
+ # PadFunction: IO_L21P_T3_DQS_34
681
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_p[4]}]
682
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[4]}]
683
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_p[4]}]
684
+ set_property PACKAGE_PIN AH7 [get_ports {ddr3_dqs_p[4]}]
685
+
686
+ # PadFunction: IO_L21N_T3_DQS_34
687
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_n[4]}]
688
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[4]}]
689
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_n[4]}]
690
+ set_property PACKAGE_PIN AJ7 [get_ports {ddr3_dqs_n[4]}]
691
+
692
+ # PadFunction: IO_L9P_T1_DQS_34
693
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_p[5]}]
694
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[5]}]
695
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_p[5]}]
696
+ set_property PACKAGE_PIN AG4 [get_ports {ddr3_dqs_p[5]}]
697
+
698
+ # PadFunction: IO_L9N_T1_DQS_34
699
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_n[5]}]
700
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[5]}]
701
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_n[5]}]
702
+ set_property PACKAGE_PIN AG3 [get_ports {ddr3_dqs_n[5]}]
703
+
704
+ # PadFunction: IO_L15P_T2_DQS_34
705
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_p[6]}]
706
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[6]}]
707
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_p[6]}]
708
+ set_property PACKAGE_PIN AG2 [get_ports {ddr3_dqs_p[6]}]
709
+
710
+ # PadFunction: IO_L15N_T2_DQS_34
711
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_n[6]}]
712
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[6]}]
713
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_n[6]}]
714
+ set_property PACKAGE_PIN AH1 [get_ports {ddr3_dqs_n[6]}]
715
+
716
+ # PadFunction: IO_L3P_T0_DQS_34
717
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_p[7]}]
718
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[7]}]
719
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_p[7]}]
720
+ set_property PACKAGE_PIN AD2 [get_ports {ddr3_dqs_p[7]}]
721
+
722
+ # PadFunction: IO_L3N_T0_DQS_34
723
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_dqs_n[7]}]
724
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[7]}]
725
+ set_property IOSTANDARD SSTL15 [get_ports {ddr3_dqs_n[7]}]
726
+ set_property PACKAGE_PIN AD1 [get_ports {ddr3_dqs_n[7]}]
727
+
728
+ # PadFunction: IO_L13P_T2_MRCC_33
729
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_ck_p}]
730
+ set_property SLEW FAST [get_ports {ddr3_ck_p}]
731
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_ck_p}]
732
+ set_property PACKAGE_PIN AG10 [get_ports {ddr3_ck_p}]
733
+
734
+ # PadFunction: IO_L13N_T2_MRCC_33
735
+ set_property VCCAUX_IO HIGH [get_ports {ddr3_ck_n}]
736
+ set_property SLEW FAST [get_ports {ddr3_ck_n}]
737
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports {ddr3_ck_n}]
738
+ set_property PACKAGE_PIN AH10 [get_ports {ddr3_ck_n}]
739
+
740
+
741
+
742
+
743
+ #############SPI Configurate Setting##################
744
+ set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]
745
+ set_property CONFIG_MODE SPIx4 [current_design]
746
+ set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]
747
+ set_property BITSTREAM.GENERAL.COMPRESS TRUE [current_design]
748
+ set_property BITSTREAM.CONFIG.UNUSEDPIN Pullup [current_design]
749
+ set_property CFGBVS VCCO [current_design]
750
+ set_property CONFIG_VOLTAGE 3.3 [current_design]
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ax7325b_spd_reader.xdc ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ############## clock define##################
2
+ create_clock -period 5.000 [get_ports sys_clk_p]
3
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports sys_clk_p]
4
+ # no need to create_clock for N side (only P side) or else tool will analyze interclock oaths and show failure in timing
5
+ # https://support.xilinx.com/s/article/57109?language=en_US
6
+ #create_clock -period 5.000 [get_ports sys_clk_n]
7
+ set_property PACKAGE_PIN AE10 [get_ports sys_clk_p]
8
+ set_property PACKAGE_PIN AF10 [get_ports sys_clk_n]
9
+ set_property IOSTANDARD DIFF_SSTL15 [get_ports sys_clk_n]
10
+
11
+ ############## SODIMM SPD define##################
12
+ set_property IOSTANDARD LVCMOS33 [get_ports i2c_scl]
13
+ set_property PACKAGE_PIN B20 [get_ports i2c_scl]
14
+ set_property IOSTANDARD LVCMOS33 [get_ports i2c_sda]
15
+ set_property PACKAGE_PIN C20 [get_ports i2c_sda]
16
+
17
+ ############## fan define##################
18
+ set_property IOSTANDARD LVCMOS25 [get_ports fan_pwm]
19
+ set_property PACKAGE_PIN AE26 [get_ports fan_pwm]
20
+
21
+ ############## key define##################
22
+ set_property PACKAGE_PIN AG27 [get_ports i_rst_n]
23
+ set_property IOSTANDARD LVCMOS25 [get_ports i_rst_n]
24
+
25
+ ##############LED define##################
26
+ set_property PACKAGE_PIN A22 [get_ports {led[0]}]
27
+ set_property IOSTANDARD LVCMOS33 [get_ports {led[0]}]
28
+ set_property PACKAGE_PIN C19 [get_ports {led[1]}]
29
+ set_property IOSTANDARD LVCMOS33 [get_ports {led[1]}]
30
+ set_property PACKAGE_PIN B19 [get_ports {led[2]}]
31
+ set_property IOSTANDARD LVCMOS33 [get_ports {led[2]}]
32
+ set_property PACKAGE_PIN E18 [get_ports {led[3]}]
33
+ set_property IOSTANDARD LVCMOS33 [get_ports {led[3]}]
34
+
35
+ ##############uart define###########################
36
+ set_property IOSTANDARD LVCMOS25 [get_ports uart_tx]
37
+ set_property PACKAGE_PIN AK26 [get_ports uart_tx]
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/caas.conf ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ Backend = openxc7
3
+ Part = xc7k325tffg900-2
4
+ Top = ax7325b_ddr3
5
+ Constraint = ax7325b_ddr3.xdc
6
+ Sources = *.v
7
+
8
+ [caas]
9
+ Server = https://caas.symbioticeda.com:18888/
10
+
11
+
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/clk_wiz.v ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ `timescale 1ps/1ps
2
+
3
+ module clk_wiz
4
+ (
5
+ input wire clk_in1,
6
+ output wire clk_out1,
7
+ output wire clk_out2,
8
+ output wire clk_out3,
9
+ output wire clk_out4,
10
+ input wire reset,
11
+ output wire locked
12
+ );
13
+ wire clk_out1_clk_wiz_0;
14
+ wire clk_out2_clk_wiz_0;
15
+ wire clk_out3_clk_wiz_0;
16
+ wire clk_out4_clk_wiz_0;
17
+
18
+
19
+ wire clkfbout;
20
+
21
+ PLLE2_ADV
22
+ #(.BANDWIDTH ("OPTIMIZED"),
23
+ .COMPENSATION ("INTERNAL"),
24
+ .STARTUP_WAIT ("FALSE"),
25
+ .DIVCLK_DIVIDE (1),
26
+ .CLKFBOUT_MULT (8), // 200 MHz * 8 = 1600 MHz
27
+ .CLKFBOUT_PHASE (0.000),
28
+ .CLKOUT0_DIVIDE (12), // 1600 MHz / 12 = 133.333 MHz
29
+ .CLKOUT0_PHASE (0.000),
30
+ .CLKOUT0_DUTY_CYCLE (0.500),
31
+ .CLKOUT1_DIVIDE (3), // 1600 MHz / 3 = 533.333 MHz, 0 phase
32
+ .CLKOUT1_PHASE (0.000),
33
+ .CLKOUT1_DUTY_CYCLE (0.500),
34
+ .CLKOUT2_DIVIDE (8), // 1600 MHz / 8 = 200 MHz
35
+ .CLKOUT2_PHASE (0.000),
36
+ .CLKOUT2_DUTY_CYCLE (0.500),
37
+ .CLKOUT3_DIVIDE (3), // 1600 MHz / 3 = 533.333 MHz, 90 phase
38
+ .CLKOUT3_PHASE (90.000),
39
+ .CLKOUT3_DUTY_CYCLE (0.500),
40
+ .CLKIN1_PERIOD (5.000) // 200 MHz input
41
+ )
42
+ plle2_adv_inst
43
+ (
44
+ .CLKFBOUT (clkfbout),
45
+ .CLKOUT0 (clk_out1_clk_wiz_0),
46
+ .CLKOUT1 (clk_out2_clk_wiz_0),
47
+ .CLKOUT2 (clk_out3_clk_wiz_0),
48
+ .CLKOUT3 (clk_out4_clk_wiz_0),
49
+ .CLKFBIN (clkfbout),
50
+ .CLKIN1 (clk_in1),
51
+ .LOCKED (locked),
52
+ .RST (reset)
53
+ );
54
+ BUFG clkout1_buf
55
+ (.O (clk_out1),
56
+ .I (clk_out1_clk_wiz_0));
57
+ BUFG clkout2_buf
58
+ (.O (clk_out2),
59
+ .I (clk_out2_clk_wiz_0));
60
+ BUFG clkout3_buf
61
+ (.O (clk_out3),
62
+ .I (clk_out3_clk_wiz_0));
63
+ BUFG clkout4_buf
64
+ (.O (clk_out4),
65
+ .I (clk_out4_clk_wiz_0));
66
+ endmodule
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ddr3_controller.v ADDED
The diff for this file is too large to render. See raw diff
 
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ddr3_phy.v ADDED
@@ -0,0 +1,1462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ddr3_phy.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: PHY component for the DDR3 controller. Handles the primitives such
7
+ // as IOSERDES, IODELAY, and IOBUF. These generates the signals connected to
8
+ // the DDR3 RAM.
9
+ //
10
+ // Engineer: Angelo C. Jacobo
11
+ //
12
+ ////////////////////////////////////////////////////////////////////////////////
13
+ //
14
+ // Copyright (C) 2023-2025 Angelo Jacobo
15
+ //
16
+ // This program is free software: you can redistribute it and/or modify
17
+ // it under the terms of the GNU General Public License as published by
18
+ // the Free Software Foundation, either version 3 of the License, or
19
+ // (at your option) any later version.
20
+ //
21
+ // This program is distributed in the hope that it will be useful,
22
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ // GNU General Public License for more details.
25
+ //
26
+ // You should have received a copy of the GNU General Public License
27
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
28
+ //
29
+ ////////////////////////////////////////////////////////////////////////////////
30
+
31
+ `default_nettype none
32
+ `timescale 1ps / 1ps
33
+ //`define DEBUG_DQS // uncomment to route the raw DQS to output port for debugging
34
+
35
+ module ddr3_phy #(
36
+ parameter CONTROLLER_CLK_PERIOD = 10_000, //ps, clock period of the controller interface
37
+ DDR3_CLK_PERIOD = 2_500, //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
38
+ ROW_BITS = 14, //width of row address
39
+ BA_BITS = 3,
40
+ DQ_BITS = 8,
41
+ LANES = 8,
42
+ DUAL_RANK_DIMM = 0, // enable dual rank DIMM (1 = enable, 0 = disable)
43
+ parameter[0:0] ODELAY_SUPPORTED = 1, //set to 1 when ODELAYE2 is supported
44
+ USE_IO_TERMINATION = 0, //use IOBUF_DCIEN and IOBUFDS_DCIEN when 1
45
+ NO_IOSERDES_LOOPBACK = 1, // don't use IOSERDES loopback for bitslip training
46
+ // The next parameters act more like a localparam (since user does not have to set this manually) but was added here to simplify port declaration
47
+ parameter serdes_ratio = 4, // this controller is fixed as a 4:1 memory controller (CONTROLLER_CLK_PERIOD/DDR3_CLK_PERIOD = 4)
48
+ wb_data_bits = DQ_BITS*LANES*serdes_ratio*2,
49
+ wb_sel_bits = wb_data_bits / 8,
50
+ //4 is the width of a single ddr3 command {cs_n, ras_n, cas_n, we_n} plus 3 (ck_en, odt, reset_n) plus bank bits plus row bits
51
+ cmd_len = 4 + 3 + BA_BITS + ROW_BITS + 2*DUAL_RANK_DIMM
52
+ )(
53
+ input wire i_controller_clk, i_ddr3_clk, i_ref_clk,
54
+ input wire i_ddr3_clk_90, //required only when ODELAY_SUPPORTED is zero
55
+ input wire i_rst_n,
56
+ // Controller Interface
57
+ input wire i_controller_reset,
58
+ input wire[cmd_len*serdes_ratio-1:0] i_controller_cmd,
59
+ input wire i_controller_dqs_tri_control, i_controller_dq_tri_control,
60
+ input wire i_controller_toggle_dqs,
61
+ input wire[wb_data_bits-1:0] i_controller_data,
62
+ input wire[wb_sel_bits-1:0] i_controller_dm,
63
+ input wire[4:0] i_controller_odelay_data_cntvaluein,i_controller_odelay_dqs_cntvaluein,
64
+ input wire[4:0] i_controller_idelay_data_cntvaluein,i_controller_idelay_dqs_cntvaluein,
65
+ input wire[LANES-1:0] i_controller_odelay_data_ld, i_controller_odelay_dqs_ld,
66
+ input wire[LANES-1:0] i_controller_idelay_data_ld, i_controller_idelay_dqs_ld,
67
+ input wire[LANES-1:0] i_controller_bitslip,
68
+ input wire i_controller_write_leveling_calib,
69
+ output wire[DQ_BITS*LANES*8-1:0] o_controller_iserdes_data,
70
+ output wire[LANES*8-1:0] o_controller_iserdes_dqs,
71
+ output wire[LANES*8-1:0] o_controller_iserdes_bitslip_reference,
72
+ output wire o_controller_idelayctrl_rdy,
73
+ // DDR3 I/O Interface
74
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_clk_p,o_ddr3_clk_n,
75
+ output wire o_ddr3_reset_n,
76
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cke, // CKE
77
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cs_n, // chip select signal
78
+ output wire o_ddr3_ras_n, // RAS#
79
+ output wire o_ddr3_cas_n, // CAS#
80
+ output wire o_ddr3_we_n, // WE#
81
+ output wire[ROW_BITS-1:0] o_ddr3_addr,
82
+ output wire[BA_BITS-1:0] o_ddr3_ba_addr,
83
+ inout wire[(DQ_BITS*LANES)-1:0] io_ddr3_dq,
84
+ inout wire[(DQ_BITS*LANES)/8-1:0] io_ddr3_dqs, io_ddr3_dqs_n,
85
+ output wire[LANES-1:0] o_ddr3_dm,
86
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_odt, // on-die termination
87
+ // DEBUG PHY
88
+ output wire[(DQ_BITS*LANES)/8-1:0] o_ddr3_debug_read_dqs_p,
89
+ output wire[(DQ_BITS*LANES)/8-1:0] o_ddr3_debug_read_dqs_n
90
+ );
91
+
92
+ // cmd bit assignment
93
+ localparam CMD_CS_N_2 = cmd_len - 1,
94
+ CMD_CS_N = DUAL_RANK_DIMM[0]? cmd_len - 2 : cmd_len - 1,
95
+ CMD_RAS_N = DUAL_RANK_DIMM[0]? cmd_len - 3 : cmd_len - 2,
96
+ CMD_CAS_N = DUAL_RANK_DIMM[0]? cmd_len - 4 : cmd_len - 3,
97
+ CMD_WE_N = DUAL_RANK_DIMM[0]? cmd_len - 5 : cmd_len - 4,
98
+ CMD_ODT = DUAL_RANK_DIMM[0]? cmd_len - 6 : cmd_len - 5,
99
+ CMD_CKE_2 = DUAL_RANK_DIMM[0]? cmd_len - 7 : cmd_len - 6,
100
+ CMD_CKE = DUAL_RANK_DIMM[0]? cmd_len - 8 : cmd_len - 6,
101
+ CMD_RESET_N = DUAL_RANK_DIMM[0]? cmd_len - 9 : cmd_len - 7,
102
+ CMD_BANK_START = BA_BITS + ROW_BITS - 1,
103
+ CMD_ADDRESS_START = ROW_BITS - 1;
104
+ localparam SYNC_RESET_DELAY = $rtoi($ceil(52_000/CONTROLLER_CLK_PERIOD)); //52_000 ps of reset pulse width required for IDELAYCTRL
105
+ //cmd needs to be center-aligned to the positive edge of the
106
+ //ddr3_clk. This means cmd needs to be delayed by half the ddr3
107
+ //clk period. Subtract by 600ps to include the IODELAY insertion
108
+ //delay. Divide by a delay resolution of 78.125ps per tap to get
109
+ //the needed tap value.
110
+ localparam CMD_ODELAY_TAP = ((DDR3_CLK_PERIOD/2) - 600)/78.125;
111
+
112
+ // Data does not have to be delayed (DQS is the on that has to be
113
+ // delayed and center-aligned to the center eye of data)
114
+ localparam DATA_ODELAY_TAP = 0;
115
+
116
+ //DQS needs to be edge-aligned to the center eye of the data.
117
+ //This means DQS needs to be delayed by a quarter of the ddr3
118
+ //clk period relative to the data. Subtract by 600ps to include
119
+ //the IODELAY insertion delay. Divide by a delay resolution of
120
+ //78.125ps per tap to get the needed tap value. Then add the tap
121
+ //value used in data to have the delay relative to the data.
122
+ localparam DQS_ODELAY_TAP = ((DDR3_CLK_PERIOD/4))/78.125 + DATA_ODELAY_TAP;
123
+
124
+ //Incoming DQS should be 90 degree delayed relative to incoming data
125
+ localparam DATA_IDELAY_TAP = 0; //600ps delay
126
+ localparam DQS_IDELAY_TAP = ((DDR3_CLK_PERIOD/4))/78.125 + DATA_IDELAY_TAP;
127
+
128
+ genvar gen_index;
129
+ wire[cmd_len-1:0] oserdes_cmd, //serialized(4:1) i_controller_cmd_slot_x
130
+ cmd;//delayed oserdes_cmd
131
+ wire[(DQ_BITS*LANES)-1:0] oserdes_data, odelay_data, idelay_data, read_dq;
132
+ wire[LANES-1:0] oserdes_dm, odelay_dm;
133
+ wire[LANES-1:0] odelay_dqs, read_dqs, idelay_dqs;
134
+ wire[DQ_BITS*LANES-1:0] oserdes_dq_tri_control;
135
+ wire[LANES-1:0] oserdes_dqs;
136
+ wire[LANES-1:0] oserdes_dqs_tri_control;
137
+ wire[LANES-1:0] oserdes_bitslip_reference;
138
+ reg[$clog2(SYNC_RESET_DELAY):0] delay_before_release_reset;
139
+ reg sync_rst = 0;
140
+ wire ddr3_clk;
141
+ reg toggle_dqs_q; //past value of i_controller_toggle_dqs
142
+ wire ddr3_clk_delayed;
143
+ wire idelayctrl_rdy;
144
+ wire dci_locked;
145
+ reg[LANES*8-1:0] o_controller_iserdes_bitslip_reference_reg;
146
+ reg[LANES - 1 : 0] shift_bitslip_index;
147
+
148
+ // initial value of bitslip reference
149
+ initial begin
150
+ o_controller_iserdes_bitslip_reference_reg = {LANES{8'b0001_1110}};
151
+ shift_bitslip_index = 0;
152
+ end
153
+
154
+ assign o_controller_idelayctrl_rdy = idelayctrl_rdy && dci_locked;
155
+
156
+ `ifdef DEBUG_DQS
157
+ assign o_ddr3_debug_read_dqs_p = io_ddr3_dqs;
158
+ assign o_ddr3_debug_read_dqs_n = io_ddr3_dqs_n;
159
+ `else
160
+ assign o_ddr3_debug_read_dqs_p = 0;
161
+ assign o_ddr3_debug_read_dqs_n = 0;
162
+ `endif
163
+
164
+ //synchronous reset
165
+ always @(posedge i_controller_clk) begin
166
+ if(!i_rst_n || i_controller_reset) begin
167
+ sync_rst <= 1'b1;
168
+ delay_before_release_reset <= SYNC_RESET_DELAY[$clog2(SYNC_RESET_DELAY):0];
169
+ toggle_dqs_q <= 0;
170
+ end
171
+ else begin
172
+ delay_before_release_reset <= (delay_before_release_reset == 0)? 0: delay_before_release_reset - 1;
173
+ sync_rst <= !(delay_before_release_reset == 0);
174
+ toggle_dqs_q <= i_controller_toggle_dqs;
175
+ end
176
+ end
177
+
178
+ //PHY cmd
179
+ generate
180
+ for(gen_index = 0; gen_index < cmd_len; gen_index = gen_index + 1) begin
181
+ // OSERDESE2: Output SERial/DESerializer with bitslip
182
+ //7 Series
183
+ // Xilinx HDL Libraries Guide, version 13.4
184
+ `ifndef SIM_MODEL
185
+ OSERDESE2 #(
186
+ `else
187
+ OSERDESE2_model #(
188
+ `endif
189
+ .DATA_RATE_OQ("SDR"), // DDR, SDR
190
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
191
+ .DATA_WIDTH(4), // Parallel data width (2-8,10,14)
192
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
193
+ .TRISTATE_WIDTH(1)
194
+ )
195
+ OSERDESE2_cmd(
196
+ .OFB(), // 1-bit output: Feedback path for data
197
+ .OQ(oserdes_cmd[gen_index]), // 1-bit output: Data path output
198
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
199
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
200
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
201
+ .D1(i_controller_cmd[cmd_len*0 + gen_index]),
202
+ .D2(i_controller_cmd[cmd_len*1 + gen_index]),
203
+ .D3(i_controller_cmd[cmd_len*2 + gen_index]),
204
+ .D4(i_controller_cmd[cmd_len*3 + gen_index]),
205
+ .OCE(1'b1), // 1-bit input: Output data clock enable
206
+ .RST(sync_rst), // 1-bit input: Reset
207
+ // unused signals but were added here to make vivado happy
208
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
209
+ .SHIFTOUT2(),
210
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
211
+ .TFB(), // 1-bit output: 3-state control
212
+ .TQ(), // 1-bit output: 3-state control
213
+ .D5(),
214
+ .D6(),
215
+ .D7(),
216
+ .D8(),
217
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
218
+ .SHIFTIN1(0),
219
+ .SHIFTIN2(0),
220
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
221
+ .T1(0),
222
+ .T2(0),
223
+ .T3(0),
224
+ .T4(0),
225
+ .TBYTEIN(0),
226
+ // 1-bit input: Byte group tristate
227
+ .TCE(0)
228
+ // 1-bit input: 3-state clock enable
229
+ );
230
+ // End of OSERDESE2_inst instantiation
231
+
232
+ end
233
+
234
+ if(DUAL_RANK_DIMM) begin // if dual rank enabled, odt_2 and odt_1 will be generated separately
235
+ // OSERDESE2: Output SERial/DESerializer with bitslip
236
+ //7 Series
237
+ // Xilinx HDL Libraries Guide, version 13.4
238
+ `ifndef SIM_MODEL
239
+ OSERDESE2 #(
240
+ `else
241
+ OSERDESE2_model #(
242
+ `endif
243
+ .DATA_RATE_OQ("SDR"), // DDR, SDR
244
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
245
+ .DATA_WIDTH(4), // Parallel data width (2-8,10,14)
246
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
247
+ .TRISTATE_WIDTH(1)
248
+ )
249
+ OSERDESE2_cmd(
250
+ .OFB(), // 1-bit output: Feedback path for data
251
+ .OQ(o_ddr3_odt[1]), // 1-bit output: Data path output
252
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
253
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
254
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
255
+ .D1(i_controller_cmd[cmd_len*0 + CMD_ODT]),
256
+ .D2(i_controller_cmd[cmd_len*1 + CMD_ODT]),
257
+ .D3(i_controller_cmd[cmd_len*2 + CMD_ODT]),
258
+ .D4(i_controller_cmd[cmd_len*3 + CMD_ODT]),
259
+ .OCE(1'b1), // 1-bit input: Output data clock enable
260
+ .RST(sync_rst), // 1-bit input: Reset
261
+ // unused signals but were added here to make vivado happy
262
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
263
+ .SHIFTOUT2(),
264
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
265
+ .TFB(), // 1-bit output: 3-state control
266
+ .TQ(), // 1-bit output: 3-state control
267
+ .D5(),
268
+ .D6(),
269
+ .D7(),
270
+ .D8(),
271
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
272
+ .SHIFTIN1(0),
273
+ .SHIFTIN2(0),
274
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
275
+ .T1(0),
276
+ .T2(0),
277
+ .T3(0),
278
+ .T4(0),
279
+ .TBYTEIN(0),
280
+ // 1-bit input: Byte group tristate
281
+ .TCE(0)
282
+ // 1-bit input: 3-state clock enable
283
+ );
284
+ // End of OSERDESE2_inst instantiation
285
+ end
286
+ endgenerate
287
+
288
+ // cs[1] when DUAL_RANK_DIMM enabled
289
+ generate
290
+ if(DUAL_RANK_DIMM) begin
291
+ assign o_ddr3_cs_n[1] = oserdes_cmd[CMD_CS_N_2];
292
+ assign o_ddr3_cs_n[0] = oserdes_cmd[CMD_CS_N];
293
+ assign o_ddr3_cke[1] = oserdes_cmd[CMD_CKE_2];
294
+ assign o_ddr3_cke[0] = oserdes_cmd[CMD_CKE];
295
+ assign o_ddr3_odt[0] = oserdes_cmd[CMD_ODT];
296
+ // o_ddr3_odt[1] will be generated directly by a separate OSERDES
297
+ // if odt[1] and odt[0] uses same output from oserdes, one of them will be unroutable
298
+ end
299
+ else begin
300
+ assign o_ddr3_cs_n = oserdes_cmd[CMD_CS_N];
301
+ assign o_ddr3_cke = oserdes_cmd[CMD_CKE];
302
+ assign o_ddr3_odt = oserdes_cmd[CMD_ODT];
303
+ end
304
+ endgenerate
305
+ assign o_ddr3_ras_n = oserdes_cmd[CMD_RAS_N],
306
+ o_ddr3_cas_n = oserdes_cmd[CMD_CAS_N],
307
+ o_ddr3_we_n = oserdes_cmd[CMD_WE_N],
308
+ o_ddr3_reset_n = oserdes_cmd[CMD_RESET_N],
309
+ o_ddr3_ba_addr = oserdes_cmd[CMD_BANK_START:CMD_ADDRESS_START+1],
310
+ o_ddr3_addr = oserdes_cmd[CMD_ADDRESS_START:0];
311
+
312
+ if(ODELAY_SUPPORTED) begin
313
+ // OSERDESE2: Output SERial/DESerializer with bitslip
314
+ //7 Series
315
+ // Xilinx HDL Libraries Guide, version 13.4
316
+ `ifndef SIM_MODEL
317
+ OSERDESE2 #(
318
+ `else
319
+ OSERDESE2_model #(
320
+ `endif
321
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
322
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
323
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
324
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
325
+ .TRISTATE_WIDTH(1)
326
+ )
327
+ OSERDESE2_clk(
328
+ .OFB(ddr3_clk), // 1-bit output: Feedback path for data
329
+ .OQ(), // 1-bit output: Data path output
330
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
331
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
332
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
333
+ .D1(1'b1),
334
+ .D2(1'b0),
335
+ .D3(1'b1),
336
+ .D4(1'b0),
337
+ .D5(1'b1),
338
+ .D6(1'b0),
339
+ .D7(1'b1),
340
+ .D8(1'b0),
341
+ .OCE(1'b1), // 1-bit input: Output data clock enable
342
+ .RST(sync_rst), // 1-bit input: Reset
343
+ // unused signals but were added here to make vivado happy
344
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
345
+ .SHIFTOUT2(),
346
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
347
+ .TFB(), // 1-bit output: 3-state control
348
+ .TQ(), // 1-bit output: 3-state control
349
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
350
+ .SHIFTIN1(0),
351
+ .SHIFTIN2(0),
352
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
353
+ .T1(0),
354
+ .T2(0),
355
+ .T3(0),
356
+ .T4(0),
357
+ .TBYTEIN(0),
358
+ // 1-bit input: Byte group tristate
359
+ .TCE(0)
360
+ // 1-bit input: 3-state clock enable
361
+ );
362
+ // End of OSERDESE2_inst instantiation
363
+
364
+ //Delay the DQ
365
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
366
+ (* IODELAY_GROUP="DDR3-GROUP" *)
367
+ `ifndef SIM_MODEL
368
+ ODELAYE2 #(
369
+ `else
370
+ ODELAYE2_model #(
371
+ `endif
372
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
373
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
374
+ .ODELAY_TYPE("FIXED"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
375
+ .ODELAY_VALUE(CMD_ODELAY_TAP), // Output delay tap setting (0-31)
376
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
377
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
378
+ )
379
+ ODELAYE2_clk (
380
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
381
+ .DATAOUT(ddr3_clk_delayed), // 1-bit output: Delayed data/clock output
382
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
383
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
384
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
385
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
386
+ .CNTVALUEIN(5'd0), // 5-bit input: Counter value input
387
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
388
+ .LD(1'b0), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
389
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
390
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
391
+ .ODATAIN(ddr3_clk), // 1-bit input: Output delay data input
392
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
393
+ );
394
+ // if dual rank enabled, then there will be two clk
395
+ if(DUAL_RANK_DIMM) begin
396
+ // OBUFDS: Differential Output Buffer
397
+ // 7 Series
398
+ // Xilinx HDL Libraries Guide, version 13.4
399
+ `ifndef SIM_MODEL
400
+ OBUFDS OBUFDS0_inst (
401
+ `else
402
+ OBUFDS_model OBUFDS0_inst (
403
+ `endif
404
+ .O(o_ddr3_clk_p[0]), // Diff_p output (connect directly to top-level port)
405
+ .OB(o_ddr3_clk_n[0]), // Diff_n output (connect directly to top-level port)
406
+ .I(ddr3_clk_delayed) // Buffer input
407
+ );
408
+ `ifndef SIM_MODEL
409
+ OBUFDS OBUFDS1_inst (
410
+ `else
411
+ OBUFDS_model OBUFDS1_inst (
412
+ `endif
413
+ .O(o_ddr3_clk_p[1]), // Diff_p output (connect directly to top-level port)
414
+ .OB(o_ddr3_clk_n[1]), // Diff_n output (connect directly to top-level port)
415
+ .I(ddr3_clk_delayed) // Buffer input
416
+ );
417
+ // End of OBUFDS_inst instantiation
418
+ end
419
+ else begin
420
+ // OBUFDS: Differential Output Buffer
421
+ // 7 Series
422
+ // Xilinx HDL Libraries Guide, version 13.4
423
+ `ifndef SIM_MODEL
424
+ OBUFDS OBUFDS_inst (
425
+ `else
426
+ OBUFDS_model OBUFDS_inst (
427
+ `endif
428
+ .O(o_ddr3_clk_p), // Diff_p output (connect directly to top-level port)
429
+ .OB(o_ddr3_clk_n), // Diff_n output (connect directly to top-level port)
430
+ .I(ddr3_clk_delayed) // Buffer input
431
+ );
432
+ // End of OBUFDS_inst instantiation
433
+ end
434
+ end
435
+ else begin //ODELAY is not supported
436
+
437
+ // if dual rank enabled, then there will be two clk
438
+ if(DUAL_RANK_DIMM) begin
439
+ // OBUFDS: Differential Output Buffer
440
+ // 7 Series
441
+ // Xilinx HDL Libraries Guide, version 13.4
442
+ `ifndef SIM_MODEL
443
+ OBUFDS OBUFDS0_inst (
444
+ `else
445
+ OBUFDS_model OBUFDS0_inst (
446
+ `endif
447
+ .O(o_ddr3_clk_p[1]), // Diff_p output (connect directly to top-level port)
448
+ .OB(o_ddr3_clk_n[1]), // Diff_n output (connect directly to top-level port)
449
+ .I(!i_ddr3_clk) // Buffer input
450
+ );
451
+ `ifndef SIM_MODEL
452
+ OBUFDS OBUFDS1_inst (
453
+ `else
454
+ OBUFDS_model OBUFDS1_inst (
455
+ `endif
456
+ .O(o_ddr3_clk_p[0]), // Diff_p output (connect directly to top-level port)
457
+ .OB(o_ddr3_clk_n[0]), // Diff_n output (connect directly to top-level port)
458
+ .I(!i_ddr3_clk) // Buffer input
459
+ );
460
+ // End of OBUFDS_inst instantiation
461
+ end
462
+ else begin
463
+ // OBUFDS: Differential Output Buffer
464
+ // 7 Series
465
+ // Xilinx HDL Libraries Guide, version 13.4
466
+ `ifndef SIM_MODEL
467
+ OBUFDS OBUFDS_inst (
468
+ `else
469
+ OBUFDS_model OBUFDS_inst (
470
+ `endif
471
+ .O(o_ddr3_clk_p), // Diff_p output (connect directly to top-level port)
472
+ .OB(o_ddr3_clk_n), // Diff_n output (connect directly to top-level port)
473
+ .I(!i_ddr3_clk) // Buffer input
474
+ );
475
+ end
476
+ end
477
+
478
+
479
+ // PHY data and dm
480
+ generate
481
+ // data: oserdes -> odelay -> iobuf
482
+ for(gen_index = 0; gen_index < (DQ_BITS*LANES); gen_index = gen_index + 1) begin
483
+
484
+ if (ODELAY_SUPPORTED) begin
485
+ // OSERDESE2: Output SERial/DESerializer with bitslip
486
+ //7 Series
487
+ // Xilinx HDL Libraries Guide, version 13.4
488
+ `ifndef SIM_MODEL
489
+ OSERDESE2 #(
490
+ `else
491
+ OSERDESE2_model #(
492
+ `endif
493
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
494
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
495
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
496
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
497
+ .TRISTATE_WIDTH(1)
498
+ )
499
+ OSERDESE2_data(
500
+ .OFB(oserdes_data[gen_index]), // 1-bit output: Feedback path for data
501
+ .OQ(), // 1-bit output: Data path output
502
+ .TQ(oserdes_dq_tri_control[gen_index]),
503
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
504
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
505
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
506
+ .D1(i_controller_data[gen_index + (DQ_BITS*LANES)*0]),
507
+ .D2(i_controller_data[gen_index + (DQ_BITS*LANES)*1]),
508
+ .D3(i_controller_data[gen_index + (DQ_BITS*LANES)*2]),
509
+ .D4(i_controller_data[gen_index + (DQ_BITS*LANES)*3]),
510
+ .D5(i_controller_data[gen_index + (DQ_BITS*LANES)*4]),
511
+ .D6(i_controller_data[gen_index + (DQ_BITS*LANES)*5]),
512
+ .D7(i_controller_data[gen_index + (DQ_BITS*LANES)*6]),
513
+ .D8(i_controller_data[gen_index + (DQ_BITS*LANES)*7]),
514
+ .T1(i_controller_dq_tri_control),
515
+ .TCE(1'b1),
516
+ .OCE(1'b1), // 1-bit input: Output data clock enable
517
+ .RST(sync_rst), // 1-bit input: Reset
518
+ // unused signals but were added here to make vivado happy
519
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
520
+ .SHIFTOUT2(),
521
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
522
+ .TFB(), // 1-bit output: 3-state control
523
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
524
+ .SHIFTIN1(0),
525
+ .SHIFTIN2(0),
526
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
527
+ .T2(0),
528
+ .T3(0),
529
+ .T4(0),
530
+ .TBYTEIN(0)
531
+ // 1-bit input: Byte group tristate
532
+ );
533
+ // End of OSERDESE2_inst instantiation
534
+
535
+ // ODELAYE2: Output Fixed or Variable Delay Element
536
+ // 7 Series
537
+ // Xilinx HDL Libraries Guide, version 13.4
538
+ //odelay adds an insertion delay of 600ps to the actual delay setting: https://support.xilinx.com/s/article/42133?language=en_US
539
+ //Delay the DQ
540
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
541
+ (* IODELAY_GROUP="DDR3-GROUP" *)
542
+ `ifndef SIM_MODEL
543
+ ODELAYE2 #(
544
+ `else
545
+ ODELAYE2_model #(
546
+ `endif
547
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
548
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
549
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
550
+ .ODELAY_VALUE(DATA_ODELAY_TAP), // Output delay tap setting (0-31)
551
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
552
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
553
+ )
554
+ ODELAYE2_data (
555
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
556
+ .DATAOUT(odelay_data[gen_index]), // 1-bit output: Delayed data/clock output
557
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
558
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
559
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
560
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
561
+ .CNTVALUEIN(i_controller_odelay_data_cntvaluein), // 5-bit input: Counter value input
562
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
563
+ .LD(i_controller_odelay_data_ld[gen_index/8]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
564
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
565
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
566
+ .ODATAIN(oserdes_data[gen_index]), // 1-bit input: Output delay data input
567
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
568
+ );
569
+
570
+ if(USE_IO_TERMINATION) begin
571
+ // IOBUF_DCIEN: Single-ended Bi-directional Buffer with Digital Controlled Impedance (DCI)
572
+ // and Input path enable/disable
573
+ // May only be placed in High Performance (HP) Banks
574
+ // 7 Series
575
+ // Xilinx HDL Libraries Guide, version 13.4
576
+ `ifndef SIM_MODEL
577
+ IOBUF_DCIEN #(
578
+ `else
579
+ IOBUF_DCIEN_model #(
580
+ `endif
581
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
582
+ .SLEW("FAST"), // Specify the output slew rate
583
+ .USE_IBUFDISABLE("FALSE") // Use IBUFDISABLE function, "TRUE" or "FALSE"
584
+ ) IOBUF_DCIEN_data (
585
+ .O(read_dq[gen_index]), // Buffer output
586
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
587
+ .DCITERMDISABLE(1'b0), // DCI Termination enable input
588
+ .I(odelay_data[gen_index]), // Buffer input
589
+ .IBUFDISABLE(1'b0), // Input disable input, low=disable
590
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=input, low=output
591
+ );
592
+ // End of IOBUF_DCIEN_inst instantiation
593
+
594
+ end
595
+ else begin
596
+ // IOBUF: Single-ended Bi-directional Buffer
597
+ //All devices
598
+ // Xilinx HDL Libraries Guide, version 13.4
599
+ `ifndef SIM_MODEL
600
+ IOBUF #(
601
+ `else
602
+ IOBUF_model #(
603
+ `endif
604
+ //.DRIVE(12), // Specify the output drive strength
605
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
606
+ //.IOSTANDARD("SSTL15"), // Specify the I/O standard
607
+ .SLEW("FAST") // Specify the output slew rate
608
+ ) IOBUF_data (
609
+ .O(read_dq[gen_index]),// Buffer output
610
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
611
+ .I(odelay_data[gen_index]), // Buffer input
612
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=read, low=write
613
+ );
614
+ end
615
+ end
616
+ else begin //ODELAY is not supported
617
+ // OSERDESE2: Output SERial/DESerializer with bitslip
618
+ //7 Series
619
+ // Xilinx HDL Libraries Guide, version 13.4
620
+ `ifndef SIM_MODEL
621
+ OSERDESE2 #(
622
+ `else
623
+ OSERDESE2_model #(
624
+ `endif
625
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
626
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
627
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
628
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
629
+ .TRISTATE_WIDTH(1)
630
+ )
631
+ OSERDESE2_data(
632
+ .OFB(), // 1-bit output: Feedback path for data
633
+ .OQ(oserdes_data[gen_index]), // 1-bit output: Data path output
634
+ .TQ(oserdes_dq_tri_control[gen_index]),
635
+ .CLK(i_ddr3_clk_90), // 1-bit input: High speed clock
636
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
637
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
638
+ .D1(i_controller_data[gen_index + (DQ_BITS*LANES)*0]),
639
+ .D2(i_controller_data[gen_index + (DQ_BITS*LANES)*1]),
640
+ .D3(i_controller_data[gen_index + (DQ_BITS*LANES)*2]),
641
+ .D4(i_controller_data[gen_index + (DQ_BITS*LANES)*3]),
642
+ .D5(i_controller_data[gen_index + (DQ_BITS*LANES)*4]),
643
+ .D6(i_controller_data[gen_index + (DQ_BITS*LANES)*5]),
644
+ .D7(i_controller_data[gen_index + (DQ_BITS*LANES)*6]),
645
+ .D8(i_controller_data[gen_index + (DQ_BITS*LANES)*7]),
646
+ .T1(i_controller_dq_tri_control),
647
+ .TCE(1'b1),
648
+ .OCE(1'b1), // 1-bit input: Output data clock enable
649
+ .RST(sync_rst), // 1-bit input: Reset
650
+ // unused signals but were added here to make vivado happy
651
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
652
+ .SHIFTOUT2(),
653
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
654
+ .TFB(), // 1-bit output: 3-state control
655
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
656
+ .SHIFTIN1(0),
657
+ .SHIFTIN2(0),
658
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
659
+ .T2(0),
660
+ .T3(0),
661
+ .T4(0),
662
+ .TBYTEIN(0)
663
+ // 1-bit input: Byte group tristate
664
+ );
665
+ // End of OSERDESE2_inst instantiation
666
+
667
+ // IOBUF: Single-ended Bi-directional Buffer
668
+ //All devices
669
+ // Xilinx HDL Libraries Guide, version 13.4
670
+ `ifndef SIM_MODEL
671
+ IOBUF #(
672
+ `else
673
+ IOBUF_model #(
674
+ `endif
675
+ //.DRIVE(12), // Specify the output drive strength
676
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
677
+ //.IOSTANDARD("SSTL15"), // Specify the I/O standard
678
+ .SLEW("FAST") // Specify the output slew rate
679
+ ) IOBUF_data (
680
+ .O(read_dq[gen_index]),// Buffer output
681
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
682
+ .I(oserdes_data[gen_index]), // Buffer input
683
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=read, low=write
684
+ );
685
+ end
686
+
687
+ // IDELAYE2: Input Fixed or Variable Delay Element
688
+ // 7 Series
689
+ // Xilinx HDL Libraries Guide, version 13.4
690
+ (* IODELAY_GROUP="DDR3-GROUP" *)
691
+ `ifndef SIM_MODEL
692
+ IDELAYE2 #(
693
+ `else
694
+ IDELAYE2_model #(
695
+ `endif
696
+ .DELAY_SRC("IDATAIN"), // Delay input (IDATAIN, DATAIN)
697
+ .HIGH_PERFORMANCE_MODE("TRUE"), //Reduced jitter ("TRUE"), Reduced power ("FALSE")
698
+ .IDELAY_TYPE("VAR_LOAD"), //FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
699
+ .IDELAY_VALUE(DATA_IDELAY_TAP), //Input delay tap setting (0-31)
700
+ .PIPE_SEL("FALSE"), //Select pipelined mode, FALSE, TRUE
701
+ .REFCLK_FREQUENCY(200.0), //IDELAYCTRL clock input frequency in MHz (190.0-210.0).
702
+ .SIGNAL_PATTERN("DATA") //DATA, CLOCK input signal
703
+ )
704
+ IDELAYE2_data (
705
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
706
+ .DATAOUT(idelay_data[gen_index]), // 1-bit output: Delayed data output
707
+ .C(i_controller_clk), // 1-bit input: Clock input
708
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
709
+ .CINVCTRL(1'b0),// 1-bit input: Dynamic clock inversion input
710
+ .CNTVALUEIN(i_controller_idelay_data_cntvaluein), // 5-bit input: Counter value input
711
+ .DATAIN(), //1-bit input: Internal delay data input
712
+ .IDATAIN(read_dq[gen_index]), // 1-bit input: Data input from the I/O
713
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
714
+ .LD(i_controller_idelay_data_ld[gen_index/8]), // 1-bit input: Load IDELAY_VALUE input
715
+ .LDPIPEEN(1'b0), // 1-bit input: Enable PIPELINE register to load data input
716
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
717
+ );
718
+ // End of IDELAYE2_inst instantiation
719
+
720
+ // End of IOBUF_inst instantiation
721
+ // ISERDESE2: Input SERial/DESerializer with bitslip
722
+ //7 Series
723
+ // Xilinx HDL Libraries Guide, version 13.4
724
+ `ifndef SIM_MODEL
725
+ ISERDESE2 #(
726
+ `else
727
+ ISERDESE2_model #(
728
+ `endif
729
+ .DATA_RATE("DDR"), // DDR, SDR
730
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
731
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
732
+ .INIT_Q1(1'b0),
733
+ .INIT_Q2(1'b0),
734
+ .INIT_Q3(1'b0),
735
+ .INIT_Q4(1'b0),
736
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
737
+ .IOBDELAY("IFD"), // NONE, BOTH, IBUF, IFD
738
+ .NUM_CE(1),// Number of clock enables (1,2)
739
+ .OFB_USED("FALSE"), // Select OFB path (FALSE, TRUE)
740
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
741
+ .SRVAL_Q1(1'b0),
742
+ .SRVAL_Q2(1'b0),
743
+ .SRVAL_Q3(1'b0),
744
+ .SRVAL_Q4(1'b0)
745
+ )
746
+ ISERDESE2_data (
747
+ .O(),
748
+ // 1-bit output: Combinatorial output
749
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
750
+ .Q1(o_controller_iserdes_data[(DQ_BITS*LANES)*7 + gen_index]),//56
751
+ .Q2(o_controller_iserdes_data[(DQ_BITS*LANES)*6 + gen_index]), //48
752
+ .Q3(o_controller_iserdes_data[(DQ_BITS*LANES)*5 + gen_index]),
753
+ .Q4(o_controller_iserdes_data[(DQ_BITS*LANES)*4 + gen_index]),
754
+ .Q5(o_controller_iserdes_data[(DQ_BITS*LANES)*3 + gen_index]),
755
+ .Q6(o_controller_iserdes_data[(DQ_BITS*LANES)*2 + gen_index]),
756
+ .Q7(o_controller_iserdes_data[(DQ_BITS*LANES)*1 + gen_index]),
757
+ .Q8(o_controller_iserdes_data[(DQ_BITS*LANES)*0 + gen_index]),
758
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
759
+ .SHIFTOUT1(),
760
+ .SHIFTOUT2(),
761
+ .BITSLIP(i_controller_bitslip[gen_index/8]),
762
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
763
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
764
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
765
+ // position every time Bitslip is invoked (DDR operation is different from
766
+ // SDR).
767
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
768
+ .CE1(1'b1),
769
+ .CE2(1'b1),
770
+ .CLKDIVP(), // 1-bit input: TBD
771
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
772
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
773
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
774
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
775
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
776
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
777
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
778
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
779
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
780
+ .D(), // 1-bit input: Data input
781
+ .DDLY(idelay_data[gen_index]), // 1-bit input: Serial data from IDELAYE2
782
+ .OFB(), // 1-bit input: Data feedback from OSERDESE2
783
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
784
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
785
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
786
+ .SHIFTIN1(),
787
+ .SHIFTIN2()
788
+ );
789
+ // End of ISERDESE2_inst instantiation
790
+
791
+ end
792
+
793
+ // data mask: oserdes -> odelay -> obuf
794
+ for(gen_index = 0; gen_index < LANES; gen_index = gen_index + 1) begin
795
+
796
+
797
+ if(ODELAY_SUPPORTED) begin
798
+ // OSERDESE2: Output SERial/DESerializer with bitslip
799
+ //7 Series
800
+ // Xilinx HDL Libraries Guide, version 13.4
801
+ `ifndef SIM_MODEL
802
+ OSERDESE2 #(
803
+ `else
804
+ OSERDESE2_model #(
805
+ `endif
806
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
807
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
808
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
809
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
810
+ .TRISTATE_WIDTH(1)
811
+ )
812
+ OSERDESE2_dm(
813
+ .OFB(oserdes_dm[gen_index]), // 1-bit output: Feedback path for data
814
+ .OQ(), // 1-bit output: Data path output
815
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
816
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
817
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
818
+ .D1(i_controller_dm[gen_index + LANES*0]),
819
+ .D2(i_controller_dm[gen_index + LANES*1]),
820
+ .D3(i_controller_dm[gen_index + LANES*2]),
821
+ .D4(i_controller_dm[gen_index + LANES*3]),
822
+ .D5(i_controller_dm[gen_index + LANES*4]),
823
+ .D6(i_controller_dm[gen_index + LANES*5]),
824
+ .D7(i_controller_dm[gen_index + LANES*6]),
825
+ .D8(i_controller_dm[gen_index + LANES*7]),
826
+ .TCE(1'b0),
827
+ .OCE(1'b1), // 1-bit input: Output data clock enable
828
+ .RST(sync_rst), // 1-bit input: Reset
829
+ // unused signals but were added here to make vivado happy
830
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
831
+ .SHIFTOUT2(),
832
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
833
+ .TFB(), // 1-bit output: 3-state control
834
+ .TQ(), // 1-bit output: 3-state control
835
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
836
+ .SHIFTIN1(0),
837
+ .SHIFTIN2(0),
838
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
839
+ .T1(0),
840
+ .T2(0),
841
+ .T3(0),
842
+ .T4(0),
843
+ .TBYTEIN(0)
844
+ // 1-bit input: Byte group tristate
845
+ );
846
+ // End of OSERDESE2_inst instantiation
847
+
848
+ // ODELAYE2: Output Fixed or Variable Delay Element
849
+ // 7 Series
850
+ // Xilinx HDL Libraries Guide, version 13.4
851
+ //odelay adds an insertion delay of 600ps to the actual delay setting: https://support.xilinx.com/s/article/42133?language=en_US
852
+ //Delay the DQ
853
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
854
+ (* IODELAY_GROUP="DDR3-GROUP" *)
855
+ `ifndef SIM_MODEL
856
+ ODELAYE2 #(
857
+ `else
858
+ ODELAYE2_model #(
859
+ `endif
860
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
861
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
862
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
863
+ .ODELAY_VALUE(DATA_ODELAY_TAP), // Output delay tap setting (0-31)
864
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
865
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
866
+ )
867
+ ODELAYE2_dm (
868
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
869
+ .DATAOUT(odelay_dm[gen_index]), // 1-bit output: Delayed data/clock output
870
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
871
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
872
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
873
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
874
+ .CNTVALUEIN(i_controller_odelay_data_cntvaluein), // 5-bit input: Counter value input
875
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
876
+ .LD(i_controller_odelay_data_ld[gen_index]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
877
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
878
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
879
+ .ODATAIN(oserdes_dm[gen_index]), // 1-bit input: Output delay data input
880
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
881
+ );
882
+
883
+ // OBUF: Single-ended Output Buffer
884
+ // 7 Series
885
+ // Xilinx HDL Libraries Guide, version 13.4
886
+ `ifndef SIM_MODEL
887
+ OBUF #(
888
+ `else
889
+ OBUF_model #(
890
+ `endif
891
+ //.IOSTANDARD("SSTL_15"), // Specify the output I/O standard
892
+ .SLEW("FAST") // Specify the output slew rate
893
+ ) OBUF_dm (
894
+ .O(o_ddr3_dm[gen_index]), // Buffer output (connect directly to top-level port)
895
+ .I(odelay_dm[gen_index]) // Buffer input
896
+ );
897
+ // End of OBUF_inst instantiation
898
+ end
899
+ else begin
900
+ // OSERDESE2: Output SERial/DESerializer with bitslip
901
+ //7 Series
902
+ // Xilinx HDL Libraries Guide, version 13.4
903
+ `ifndef SIM_MODEL
904
+ OSERDESE2 #(
905
+ `else
906
+ OSERDESE2_model #(
907
+ `endif
908
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
909
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
910
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
911
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
912
+ .TRISTATE_WIDTH(1)
913
+ )
914
+ OSERDESE2_dm(
915
+ .OFB(), // 1-bit output: Feedback path for data
916
+ .OQ(oserdes_dm[gen_index]), // 1-bit output: Data path output
917
+ .CLK(i_ddr3_clk_90), // 1-bit input: High speed clock
918
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
919
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
920
+ .D1(i_controller_dm[gen_index + LANES*0]),
921
+ .D2(i_controller_dm[gen_index + LANES*1]),
922
+ .D3(i_controller_dm[gen_index + LANES*2]),
923
+ .D4(i_controller_dm[gen_index + LANES*3]),
924
+ .D5(i_controller_dm[gen_index + LANES*4]),
925
+ .D6(i_controller_dm[gen_index + LANES*5]),
926
+ .D7(i_controller_dm[gen_index + LANES*6]),
927
+ .D8(i_controller_dm[gen_index + LANES*7]),
928
+ .TCE(1'b0),
929
+ .OCE(1'b1), // 1-bit input: Output data clock enable
930
+ .RST(sync_rst), // 1-bit input: Reset
931
+ // unused signals but were added here to make vivado happy
932
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
933
+ .SHIFTOUT2(),
934
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
935
+ .TFB(), // 1-bit output: 3-state control
936
+ .TQ(), // 1-bit output: 3-state control
937
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
938
+ .SHIFTIN1(0),
939
+ .SHIFTIN2(0),
940
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
941
+ .T1(0),
942
+ .T2(0),
943
+ .T3(0),
944
+ .T4(0),
945
+ .TBYTEIN(0)
946
+ // 1-bit input: Byte group tristate
947
+ );
948
+ // End of OSERDESE2_inst instantiation
949
+
950
+ // OBUF: Single-ended Output Buffer
951
+ // 7 Series
952
+ // Xilinx HDL Libraries Guide, version 13.4
953
+ `ifndef SIM_MODEL
954
+ OBUF #(
955
+ `else
956
+ OBUF_model #(
957
+ `endif
958
+ //.IOSTANDARD("SSTL_15"), // Specify the output I/O standard
959
+ .SLEW("FAST") // Specify the output slew rate
960
+ ) OBUF_dm (
961
+ .O(o_ddr3_dm[gen_index]), // Buffer output (connect directly to top-level port)
962
+ .I(oserdes_dm[gen_index]) // Buffer input
963
+ );
964
+ // End of OBUF_inst instantiation
965
+
966
+ end
967
+ end
968
+
969
+ // dqs: odelay -> iobuf
970
+ for(gen_index = 0; gen_index < LANES; gen_index = gen_index + 1) begin
971
+ `ifndef DEBUG_DQS //remove the logic for dqs if needs to be debugged (directed to output instead)
972
+ if(ODELAY_SUPPORTED) begin
973
+ // OSERDESE2: Output SERial/DESerializer with bitslip
974
+ //7 Series
975
+ // Xilinx HDL Libraries Guide, version 13.4
976
+ `ifndef SIM_MODEL
977
+ OSERDESE2 #(
978
+ `else
979
+ OSERDESE2_model #(
980
+ `endif
981
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
982
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
983
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
984
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
985
+ .TRISTATE_WIDTH(1)
986
+ )
987
+ OSERDESE2_dqs(
988
+ .OFB(oserdes_dqs[gen_index]), // 1-bit output: Feedback path for data
989
+ .OQ(), // 1-bit output: Data path output
990
+ .TQ(oserdes_dqs_tri_control[gen_index]),
991
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
992
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
993
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
994
+ .D1(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q)), //the last part will still have half dqs series
995
+ .D2(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
996
+ .D3(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q) && !i_controller_write_leveling_calib),
997
+ .D4(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
998
+ .D5(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
999
+ .D6(1'b0 && i_controller_toggle_dqs),
1000
+ .D7(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1001
+ .D8(1'b0 && i_controller_toggle_dqs),
1002
+ .T1(i_controller_dqs_tri_control),
1003
+ .TCE(1'b1),
1004
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1005
+ .RST(sync_rst), // 1-bit input: Reset
1006
+ // unused signals but were added here to make vivado happy
1007
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1008
+ .SHIFTOUT2(),
1009
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1010
+ .TFB(), // 1-bit output: 3-state control
1011
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1012
+ .SHIFTIN1(0),
1013
+ .SHIFTIN2(0),
1014
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1015
+ .T2(0),
1016
+ .T3(0),
1017
+ .T4(0),
1018
+ .TBYTEIN(0)
1019
+ // 1-bit input: Byte group tristate
1020
+ );
1021
+ // End of OSERDESE2_inst instantiation
1022
+
1023
+
1024
+ // ODELAYE2: Output Fixed or Variable Delay Element
1025
+ // 7 Series
1026
+ // Xilinx HDL Libraries Guide, version 13.4
1027
+ //Delay the DQ
1028
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1029
+ `ifndef SIM_MODEL
1030
+ ODELAYE2 #(
1031
+ `else
1032
+ ODELAYE2_model #(
1033
+ `endif
1034
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
1035
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter ("TRUE"), Reduced power ("FALSE")
1036
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
1037
+ .ODELAY_VALUE(DQS_ODELAY_TAP), // delay to align odelay_dqs to oserdes_dqs due to 600ps insertion delay: (1/800MHz - 600ps)/78.125ps = 8.32 taps
1038
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
1039
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
1040
+ )
1041
+ ODELAYE2_dqs (
1042
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
1043
+ .DATAOUT(odelay_dqs[gen_index]), // 1-bit output: Delayed data/clock output
1044
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
1045
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
1046
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
1047
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
1048
+ .CNTVALUEIN(i_controller_odelay_dqs_cntvaluein), // 5-bit input: Counter value input
1049
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
1050
+ .LD(i_controller_odelay_dqs_ld[gen_index]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
1051
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
1052
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
1053
+ .ODATAIN(oserdes_dqs[gen_index]), // 1-bit input: Output delay data input
1054
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
1055
+ );
1056
+
1057
+ if(USE_IO_TERMINATION) begin
1058
+ // IOBUFDS_DCIEN: Differential Bi-directional Buffer with Digital Controlled Impedance (DCI)
1059
+ // and Input path enable/disable
1060
+ // May only be placed in High Performance (HP) Banks
1061
+ // 7 Series
1062
+ // Xilinx HDL Libraries Guide, version 13.4
1063
+ `ifndef SIM_MODEL
1064
+ IOBUFDS_DCIEN #(
1065
+ `else
1066
+ IOBUFDS_DCIEN_model #(
1067
+ `endif
1068
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
1069
+ .SLEW("FAST"), // Specify the output slew rate
1070
+ .USE_IBUFDISABLE("FALSE") // Use IBUFDISABLE function, "TRUE" or "FALSE"
1071
+ ) IOBUFDS_DCIEN_inst (
1072
+ .O(read_dqs[gen_index]), // Buffer output
1073
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1074
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1075
+ .DCITERMDISABLE(1'b0), // DCI Termination enable input
1076
+ .I(odelay_dqs[gen_index]), // Buffer input
1077
+ .IBUFDISABLE(1'b0), // Input disable input, low=disable
1078
+ .T(oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1079
+ );
1080
+ // End of IOBUFDS_DCIEN_inst instantiation
1081
+
1082
+ end
1083
+ else begin
1084
+ // IOBUFDS: Differential Bi-directional Buffer
1085
+ //7 Series
1086
+ // Xilinx HDL Libraries Guide, version 13.4
1087
+ `ifndef SIM_MODEL
1088
+ IOBUFDS #(
1089
+ `else
1090
+ IOBUFDS_model #(
1091
+ `endif
1092
+ //.DIFF_TERM("FALSE"), // Differential Termination ("TRUE"/"FALSE")
1093
+ .IBUF_LOW_PWR("FALSE") // Low Power - "TRUE", High Performance = "FALSE"
1094
+ //.IOSTANDARD("DIFF_SSTL15") // Specify the I/O standard. CONSULT WITH DATASHEET
1095
+ //.SLEW("FAST") // Specify the output slew rate
1096
+ ) IOBUFDS_dqs (
1097
+ .O(read_dqs[gen_index]), // Buffer output
1098
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1099
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1100
+ .I(odelay_dqs[gen_index]), // Buffer input
1101
+ .T(/*!dqs_tri_control[gen_index]*/oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1102
+ ); // End of IOBUFDS_inst instantiation
1103
+ end
1104
+
1105
+ end
1106
+
1107
+ else begin //ODELAY not supported
1108
+ // OSERDESE2: Output SERial/DESerializer with bitslip
1109
+ //7 Series
1110
+ // Xilinx HDL Libraries Guide, version 13.4
1111
+ `ifndef SIM_MODEL
1112
+ OSERDESE2 #(
1113
+ `else
1114
+ OSERDESE2_model #(
1115
+ `endif
1116
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
1117
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
1118
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
1119
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
1120
+ .TRISTATE_WIDTH(1)
1121
+ )
1122
+ OSERDESE2_dqs(
1123
+ .OFB(), // 1-bit output: Feedback path for data
1124
+ .OQ(oserdes_dqs[gen_index]), // 1-bit output: Data path output
1125
+ .TQ(oserdes_dqs_tri_control[gen_index]),
1126
+ .CLK(!i_ddr3_clk), // 1-bit input: High speed clock
1127
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1128
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
1129
+ .D1(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q)), //the last part will still have half dqs series
1130
+ .D2(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
1131
+ .D3(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q) && !i_controller_write_leveling_calib),
1132
+ .D4(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
1133
+ .D5(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1134
+ .D6(1'b0 && i_controller_toggle_dqs),
1135
+ .D7(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1136
+ .D8(1'b0 && i_controller_toggle_dqs),
1137
+ .T1(i_controller_dqs_tri_control),
1138
+ .TCE(1'b1),
1139
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1140
+ .RST(sync_rst), // 1-bit input: Reset
1141
+ // unused signals but were added here to make vivado happy
1142
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1143
+ .SHIFTOUT2(),
1144
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1145
+ .TFB(), // 1-bit output: 3-state control
1146
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1147
+ .SHIFTIN1(0),
1148
+ .SHIFTIN2(0),
1149
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1150
+ .T2(0),
1151
+ .T3(0),
1152
+ .T4(0),
1153
+ .TBYTEIN(0)
1154
+ // 1-bit input: Byte group tristate
1155
+ );
1156
+ // End of OSERDESE2_inst instantiation
1157
+
1158
+ // IOBUFDS: Differential Bi-directional Buffer
1159
+ //7 Series
1160
+ // Xilinx HDL Libraries Guide, version 13.4
1161
+ `ifndef SIM_MODEL
1162
+ IOBUFDS #(
1163
+ `else
1164
+ IOBUFDS_model #(
1165
+ `endif
1166
+ //.DIFF_TERM("FALSE"), // Differential Termination ("TRUE"/"FALSE")
1167
+ .IBUF_LOW_PWR("FALSE") // Low Power - "TRUE", High Performance = "FALSE"
1168
+ //.IOSTANDARD("DIFF_SSTL15") // Specify the I/O standard. CONSULT WITH DATASHEET
1169
+ //.SLEW("FAST") // Specify the output slew rate
1170
+ ) IOBUFDS_dqs (
1171
+ .O(read_dqs[gen_index]), // Buffer output
1172
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1173
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1174
+ .I(oserdes_dqs[gen_index]), // Buffer input
1175
+ .T(/*!dqs_tri_control[gen_index]*/oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1176
+ ); // End of IOBUFDS_inst instantiation
1177
+
1178
+ end
1179
+
1180
+ // IDELAYE2: Input Fixed or Variable Delay Element
1181
+ // 7 Series
1182
+ // Xilinx HDL Libraries Guide, version 13.4
1183
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1184
+ `ifndef SIM_MODEL
1185
+ IDELAYE2 #(
1186
+ `else
1187
+ IDELAYE2_model #(
1188
+ `endif
1189
+ .DELAY_SRC("IDATAIN"), // Delay input (IDATAIN, DATAIN)
1190
+ .HIGH_PERFORMANCE_MODE("TRUE"), //Reduced jitter ("TRUE"), Reduced power ("FALSE")
1191
+ .IDELAY_TYPE("VAR_LOAD"), //FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
1192
+ .IDELAY_VALUE(DQS_IDELAY_TAP), //Input delay tap setting (0-31)
1193
+ .PIPE_SEL("FALSE"), //Select pipelined mode, FALSE, TRUE
1194
+ .REFCLK_FREQUENCY(200.0), //IDELAYCTRL clock input frequency in MHz (190.0-210.0).
1195
+ .SIGNAL_PATTERN("CLOCK") //DATA, CLOCK input signal
1196
+ )
1197
+ IDELAYE2_dqs (
1198
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
1199
+ .DATAOUT(idelay_dqs[gen_index]), // 1-bit output: Delayed data output
1200
+ .C(i_controller_clk), // 1-bit input: Clock input
1201
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
1202
+ .CINVCTRL(1'b0),// 1-bit input: Dynamic clock inversion input
1203
+ .CNTVALUEIN(i_controller_idelay_dqs_cntvaluein), // 5-bit input: Counter value input
1204
+ .DATAIN(), //1-bit input: Internal delay data input
1205
+ .IDATAIN(read_dqs[gen_index]), // 1-bit input: Data input from the I/O
1206
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
1207
+ .LD(i_controller_idelay_dqs_ld[gen_index]), // 1-bit input: Load IDELAY_VALUE input
1208
+ .LDPIPEEN(1'b0), // 1-bit input: Enable PIPELINE register to load data input
1209
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
1210
+ );
1211
+ // End of IDELAYE2_inst instantiation
1212
+
1213
+
1214
+ // End of IOBUF_inst instantiation
1215
+ // ISERDESE2: Input SERial/DESerializer with bitslip
1216
+ //7 Series
1217
+ // Xilinx HDL Libraries Guide, version 13.4
1218
+ `ifndef SIM_MODEL
1219
+ ISERDESE2 #(
1220
+ `else
1221
+ ISERDESE2_model #(
1222
+ `endif
1223
+ .DATA_RATE("DDR"), // DDR, SDR
1224
+ .DATA_WIDTH(serdes_ratio*2), // Parallel data width (2-8,10,14)
1225
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
1226
+ .INIT_Q1(1'b0),
1227
+ .INIT_Q2(1'b0),
1228
+ .INIT_Q3(1'b0),
1229
+ .INIT_Q4(1'b0),
1230
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
1231
+ .IOBDELAY("IFD"), // NONE, BOTH, IBUF, IFD
1232
+ .NUM_CE(1),// Number of clock enables (1,2)
1233
+ .OFB_USED("FALSE"), // Select OFB path (FALSE, TRUE)
1234
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
1235
+ .SRVAL_Q1(1'b0),
1236
+ .SRVAL_Q2(1'b0),
1237
+ .SRVAL_Q3(1'b0),
1238
+ .SRVAL_Q4(1'b0)
1239
+ )
1240
+ ISERDESE2_dqs (
1241
+ .O(),
1242
+ // 1-bit output: Combinatorial output
1243
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
1244
+ .Q1(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 7]),
1245
+ .Q2(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 6]),
1246
+ .Q3(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 5]),
1247
+ .Q4(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 4]),
1248
+ .Q5(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 3]),
1249
+ .Q6(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 2]), //
1250
+ .Q7(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 1]), //3
1251
+ .Q8(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 0]), //2
1252
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
1253
+ .SHIFTOUT1(),
1254
+ .SHIFTOUT2(),
1255
+ .BITSLIP(i_controller_bitslip[gen_index]),
1256
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
1257
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
1258
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
1259
+ // position every time Bitslip is invoked (DDR operation is different from
1260
+ // SDR).
1261
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
1262
+ .CE1(1'b1),
1263
+ .CE2(1'b1),
1264
+ .CLKDIVP(), // 1-bit input: TBD
1265
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
1266
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
1267
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
1268
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1269
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
1270
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
1271
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
1272
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
1273
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
1274
+ .D(), // 1-bit input: Data input
1275
+ .DDLY(idelay_dqs[gen_index]), // 1-bit input: Serial data from IDELAYE2
1276
+ .OFB(), // 1-bit input: Data feedback from OSERDESE2
1277
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
1278
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
1279
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
1280
+ .SHIFTIN1(),
1281
+ .SHIFTIN2()
1282
+ );
1283
+ // End of ISERDESE2_inst instantiation
1284
+ `endif
1285
+
1286
+ // generate IOSERDES loopback or not for bitslip training
1287
+ if(NO_IOSERDES_LOOPBACK) begin
1288
+ // logic that models OSERDES loopback to ISERDES
1289
+ // accdg to IOSELECT (UG471) for 7-series:
1290
+ // " In DDR mode, every Bitslip operation causes the output pattern to alternate between
1291
+ // a shift right by one and shift left by three"
1292
+ always @(posedge i_controller_clk) begin
1293
+ if(!i_rst_n || i_controller_reset) begin
1294
+ o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 0)] <= 8'b0001_1110;
1295
+ shift_bitslip_index[gen_index] <= 0;
1296
+ end
1297
+ else if(i_controller_bitslip[gen_index]) begin
1298
+ // if shift_bitslip_index high, shift right by 3, else shift left by 1 (this is reverse of the IOSelect document for ISERDES since vector o_controller_iserdes_bitslip_reference is reversed)
1299
+ o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 0)] <=
1300
+ shift_bitslip_index[gen_index]? {o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 2) : (serdes_ratio*2*gen_index + 0)], o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 3)]}
1301
+ : {o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 6) : (serdes_ratio*2*gen_index + 0)], o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7)]};
1302
+ shift_bitslip_index[gen_index] <= !shift_bitslip_index[gen_index];
1303
+ end
1304
+ end
1305
+ assign o_controller_iserdes_bitslip_reference = o_controller_iserdes_bitslip_reference_reg;
1306
+ end
1307
+ else begin // OSERDES will loopback to ISERDES for bitslip training
1308
+ //ISERDES train
1309
+ // End of IOBUF_inst instantiation
1310
+ // ISERDESE2: Input SERial/DESerializer with bitslip
1311
+ //7 Series
1312
+ // Xilinx HDL Libraries Guide, version 13.4
1313
+ `ifndef SIM_MODEL
1314
+ ISERDESE2 #(
1315
+ `else
1316
+ ISERDESE2_model #(
1317
+ `endif
1318
+ .DATA_RATE("DDR"), // DDR, SDR
1319
+ .DATA_WIDTH(serdes_ratio*2), // Parallel data width (2-8,10,14)
1320
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
1321
+ .INIT_Q1(1'b0),
1322
+ .INIT_Q2(1'b0),
1323
+ .INIT_Q3(1'b0),
1324
+ .INIT_Q4(1'b0),
1325
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
1326
+ .IOBDELAY("NONE"), // NONE, BOTH, IBUF, IFD
1327
+ .NUM_CE(1),// Number of clock enables (1,2)
1328
+ .OFB_USED("TRUE"), // Select OFB path (FALSE, TRUE)
1329
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
1330
+ .SRVAL_Q1(1'b0),
1331
+ .SRVAL_Q2(1'b0),
1332
+ .SRVAL_Q3(1'b0),
1333
+ .SRVAL_Q4(1'b0)
1334
+ )
1335
+ ISERDESE2_train (
1336
+ .O(),
1337
+ // 1-bit output: Combinatorial output
1338
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
1339
+ .Q1(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 7]),
1340
+ .Q2(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 6]),
1341
+ .Q3(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 5]),
1342
+ .Q4(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 4]),
1343
+ .Q5(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 3]),
1344
+ .Q6(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 2]),
1345
+ .Q7(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 1]),
1346
+ .Q8(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 0]),
1347
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
1348
+ .SHIFTOUT1(),
1349
+ .SHIFTOUT2(),
1350
+ .BITSLIP(i_controller_bitslip[gen_index]),
1351
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
1352
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
1353
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
1354
+ // position every time Bitslip is invoked (DDR operation is different from
1355
+ // SDR).
1356
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
1357
+ .CE1(1'b1),
1358
+ .CE2(1'b1),
1359
+ .CLKDIVP(), // 1-bit input: TBD
1360
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
1361
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
1362
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
1363
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1364
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
1365
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
1366
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
1367
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
1368
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
1369
+ .D(), // 1-bit input: Data input
1370
+ .DDLY(), // 1-bit input: Serial data from IDELAYE2
1371
+ .OFB(oserdes_bitslip_reference[gen_index]), // 1-bit input: Data feedback from OSERDESE2
1372
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
1373
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
1374
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
1375
+ .SHIFTIN1(),
1376
+ .SHIFTIN2()
1377
+ );
1378
+ // End of ISERDESE2_inst instantiation
1379
+
1380
+ // OSERDESE2: Output SERial/DESerializer with bitslip
1381
+ //7 Series
1382
+ // Xilinx HDL Libraries Guide, version 13.4
1383
+ `ifndef SIM_MODEL
1384
+ OSERDESE2 #(
1385
+ `else
1386
+ OSERDESE2_model #(
1387
+ `endif
1388
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
1389
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
1390
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
1391
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
1392
+ .TRISTATE_WIDTH(1)
1393
+ )
1394
+ OSERDESE2_train(
1395
+ .OFB(oserdes_bitslip_reference[gen_index]), // 1-bit output: Feedback path for data
1396
+ .OQ(), // 1-bit output: Data path output
1397
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
1398
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1399
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
1400
+ .D1(1'b0),
1401
+ .D2(1'b0),
1402
+ .D3(1'b0),
1403
+ .D4(1'b0),
1404
+ .D5(1'b1),
1405
+ .D6(1'b1),
1406
+ .D7(1'b1),
1407
+ .D8(1'b1),
1408
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1409
+ .RST(sync_rst), // 1-bit input: Reset
1410
+ // unused signals but were added here to make vivado happy
1411
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1412
+ .SHIFTOUT2(),
1413
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1414
+ .TFB(), // 1-bit output: 3-state control
1415
+ .TQ(), // 1-bit output: 3-state control
1416
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1417
+ .SHIFTIN1(0),
1418
+ .SHIFTIN2(0),
1419
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1420
+ .T1(0),
1421
+ .T2(0),
1422
+ .T3(0),
1423
+ .T4(0),
1424
+ .TBYTEIN(0),
1425
+ // 1-bit input: Byte group tristate
1426
+ .TCE(0)
1427
+ // 1-bit input: 3-state clock enable
1428
+ );
1429
+ // End of OSERDESE2_inst instantiation
1430
+ end
1431
+
1432
+ end
1433
+ endgenerate
1434
+
1435
+
1436
+ // IDELAYCTRL: IDELAYE2/ODELAYE2 Tap Delay Value Control
1437
+ // 7 Series
1438
+ // Xilinx HDL Libraries Guide, version 13.4
1439
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1440
+ `ifndef SIM_MODEL
1441
+ IDELAYCTRL IDELAYCTRL_inst (
1442
+ `else
1443
+ IDELAYCTRL_model IDELAYCTRL_inst (
1444
+ `endif
1445
+ .RDY(idelayctrl_rdy), // 1-bit output: Ready output
1446
+ .REFCLK(i_ref_clk), // 1-bit input: Reference clock input.The frequency of REFCLK must be 200 MHz to guarantee the tap-delay value specified in the applicable data sheet.
1447
+ .RST(sync_rst) // 1-bit input: Active high reset input, To ,Minimum Reset pulse width is 52ns
1448
+ );
1449
+ // End of IDELAYCTRL_inst instantiation
1450
+
1451
+
1452
+ // DCIRESET: Digitially Controlled Impedence Reset Component
1453
+ //7 Series
1454
+ // Xilinx HDL Libraries Guide, version 13.4
1455
+ // DCIRESET DCIRESET_inst (
1456
+ // .LOCKED(dci_locked), // 1-bit output: LOCK status output (When low, DCI I/O impedance is being calibrated and DCI I/Os are unavailable)
1457
+ // .RST(sync_rst) // 1-bit input: Active-high asynchronous reset input
1458
+ // );
1459
+ assign dci_locked = 1;
1460
+ // End of DCIRESET_inst instantiation
1461
+
1462
+ endmodule
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/ddr3_top.v ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ddr3_top.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: Top module which instantiates the ddr3_controller and ddr3_phy modules
7
+ // Use this as top module for instantiating UberDDR3 with Wishbone Interface.
8
+ //
9
+ // Engineer: Angelo C. Jacobo
10
+ //
11
+ ////////////////////////////////////////////////////////////////////////////////
12
+ //
13
+ // Copyright (C) 2023-2025 Angelo Jacobo
14
+ //
15
+ // This program is free software: you can redistribute it and/or modify
16
+ // it under the terms of the GNU General Public License as published by
17
+ // the Free Software Foundation, either version 3 of the License, or
18
+ // (at your option) any later version.
19
+ //
20
+ // This program is distributed in the hope that it will be useful,
21
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ // GNU General Public License for more details.
24
+ //
25
+ // You should have received a copy of the GNU General Public License
26
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
27
+ //
28
+ ////////////////////////////////////////////////////////////////////////////////
29
+
30
+ `default_nettype none
31
+ `timescale 1ps / 1ps
32
+
33
+ module ddr3_top #(
34
+ parameter CONTROLLER_CLK_PERIOD = 12_000, //ps, clock period of the controller interface
35
+ DDR3_CLK_PERIOD = 3_000, //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
36
+ ROW_BITS = 14, //width of row address
37
+ COL_BITS = 10, //width of column address
38
+ BA_BITS = 3, //width of bank address
39
+ BYTE_LANES = 2, //number of byte lanes of DDR3 RAM
40
+ AUX_WIDTH = 4, //width of aux line (must be >= 4)
41
+ WB2_ADDR_BITS = 7, //width of 2nd wishbone address bus
42
+ WB2_DATA_BITS = 32, //width of 2nd wishbone data bus
43
+ DUAL_RANK_DIMM = 0, // enable dual rank DIMM (1 = enable, 0 = disable)
44
+ // DDR3 timing parameter values
45
+ parameter SPEED_BIN = 3, // 0 = Use top-level parameters , 1 = DDR3-1066 (7-7-7) , 2 = DR3-1333 (9-9-9) , 3 = DDR3-1600 (11-11-11)
46
+ SDRAM_CAPACITY = 5, // 0 = 256Mb, 1 = 512Mb, 2 = 1Gb, 3 = 2Gb, 4 = 4Gb, 5 = 8Gb, 6 = 16Gb
47
+ TRCD = 13_750, // ps Active to Read/Write command time (only used if SPEED_BIN = 0)
48
+ TRP = 13_750, // ps Precharge command period (only used if SPEED_BIN = 0)
49
+ TRAS = 35_000, // ps ACT to PRE command period (only used if SPEED_BIN = 0)
50
+ parameter[0:0] MICRON_SIM = 0, //enable faster simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
51
+ ODELAY_SUPPORTED = 0, //set to 1 when ODELAYE2 is supported
52
+ SECOND_WISHBONE = 0, //set to 1 if 2nd wishbone for debugging is needed
53
+ DLL_OFF = 0, // 1 = DLL off for low frequency ddr3 clock (< 125MHz)
54
+ WB_ERROR = 0, // set to 1 to support Wishbone error (asserts at ECC double bit error)
55
+ parameter[1:0] BIST_MODE = 1, // 0 = No BIST, 1 = run through all address space ONCE , 2 = run through all address space for every test (burst w/r, random w/r, alternating r/w)
56
+ parameter[0:0] BIST_TEST_DATAMASK = 1, // 1 = include per-byte DM writes in BIST, 0 = all-byte writes only
57
+ parameter[1:0] ECC_ENABLE = 0, // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
58
+ parameter[1:0] DIC = 2'b00, //Output Driver Impedance Control (2'b00 = RZQ/6, 2'b01 = RZQ/7, RZQ = 240ohms) (only change when you know what you are doing)
59
+ parameter[2:0] RTT_NOM = 3'b011, //RTT Nominal (3'b000 = disabled, 3'b001 = RZQ/4, 3'b010 = RZQ/2 , 3'b011 = RZQ/6, RZQ = 240ohms) (only change when you know what you are doing)
60
+ parameter[1:0] SELF_REFRESH = 2'b00, // 0 = use i_user_self_refresh input, 1 = Self-refresh mode is enabled after 64 controller clock cycles of no requests, 2 = 128 cycles, 3 = 256 cycles
61
+ parameter // The next parameters act more like a localparam (since user does not have to set this manually) but was added here to simplify port declaration
62
+ DQ_BITS = 8, //device width (fixed to 8, if DDR3 is x16 then BYTE_LANES will be 2 while )
63
+ serdes_ratio = 4, // this controller is fixed as a 4:1 memory controller (CONTROLLER_CLK_PERIOD/DDR3_CLK_PERIOD = 4)
64
+ wb_addr_bits = ROW_BITS + COL_BITS + BA_BITS - $clog2(serdes_ratio*2) + DUAL_RANK_DIMM,
65
+ wb_data_bits = DQ_BITS*BYTE_LANES*serdes_ratio*2,
66
+ wb_sel_bits = wb_data_bits / 8,
67
+ wb2_sel_bits = WB2_DATA_BITS / 8,
68
+ //4 is the width of a single ddr3 command {cs_n, ras_n, cas_n, we_n} plus 3 (ck_en, odt, reset_n) plus bank bits plus row bits
69
+ cmd_len = 4 + 3 + BA_BITS + ROW_BITS + 2*DUAL_RANK_DIMM
70
+ )
71
+ (
72
+ input wire i_controller_clk, i_ddr3_clk, i_ref_clk, //i_controller_clk = CONTROLLER_CLK_PERIOD, i_ddr3_clk = DDR3_CLK_PERIOD, i_ref_clk = 200MHz
73
+ input wire i_ddr3_clk_90, //required only when ODELAY_SUPPORTED is zero
74
+ input wire i_rst_n,
75
+ //
76
+ // Wishbone inputs
77
+ input wire i_wb_cyc, //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
78
+ input wire i_wb_stb, //request a transfer
79
+ input wire i_wb_we, //write-enable (1 = write, 0 = read)
80
+ input wire[wb_addr_bits - 1:0] i_wb_addr, //burst-addressable {row,bank,col}
81
+ input wire[wb_data_bits - 1:0] i_wb_data, //write data, for a 4:1 controller data width is 8 times the number of pins on the device
82
+ input wire[wb_sel_bits - 1:0] i_wb_sel, //byte strobe for write (1 = write the byte)
83
+ input wire[AUX_WIDTH - 1:0] i_aux, //for AXI-interface compatibility (given upon strobe)
84
+ // Wishbone outputs
85
+ output wire o_wb_stall, //1 = busy, cannot accept requests
86
+ output wire o_wb_ack, //1 = read/write request has completed
87
+ output wire o_wb_err, //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
88
+ output wire[wb_data_bits - 1:0] o_wb_data, //read data, for a 4:1 controller data width is 8 times the number of pins on the device
89
+ output wire[AUX_WIDTH - 1:0] o_aux, //for AXI-interface compatibility (given upon strobe)
90
+ //
91
+ // Wishbone 2 (PHY) inputs
92
+ input wire i_wb2_cyc, //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
93
+ input wire i_wb2_stb, //request a transfer
94
+ input wire i_wb2_we, //write-enable (1 = write, 0 = read)
95
+ input wire[WB2_ADDR_BITS - 1:0] i_wb2_addr, // memory-mapped register to be accessed
96
+ input wire[WB2_DATA_BITS - 1:0] i_wb2_data, //write data
97
+ input wire[wb2_sel_bits - 1:0] i_wb2_sel, //byte strobe for write (1 = write the byte)
98
+ // Wishbone 2 (Controller) outputs
99
+ output wire o_wb2_stall, //1 = busy, cannot accept requests
100
+ output wire o_wb2_ack, //1 = read/write request has completed
101
+ output wire[WB2_DATA_BITS - 1:0] o_wb2_data, //read data
102
+ //
103
+ // DDR3 I/O Interface
104
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_clk_p, o_ddr3_clk_n,
105
+ output wire o_ddr3_reset_n,
106
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cke, // CKE
107
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cs_n, // chip select signal
108
+ output wire o_ddr3_ras_n, // RAS#
109
+ output wire o_ddr3_cas_n, // CAS#
110
+ output wire o_ddr3_we_n, // WE#
111
+ output wire[ROW_BITS-1:0] o_ddr3_addr,
112
+ output wire[BA_BITS-1:0] o_ddr3_ba_addr,
113
+ inout wire[(DQ_BITS*BYTE_LANES)-1:0] io_ddr3_dq,
114
+ inout wire[BYTE_LANES-1:0] io_ddr3_dqs, io_ddr3_dqs_n,
115
+ output wire[BYTE_LANES-1:0] o_ddr3_dm,
116
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_odt, // on-die termination
117
+ //
118
+ // Done Calibration pin
119
+ output wire o_calib_complete,
120
+ // Debug outputs
121
+ output wire[31:0] o_debug1,
122
+ // output wire[31:0] o_debug2,
123
+ // output wire[31:0] o_debug3,
124
+ // output wire[(DQ_BITS*BYTE_LANES)/8-1:0] o_ddr3_debug_read_dqs_p,
125
+ // output wire[(DQ_BITS*BYTE_LANES)/8-1:0] o_ddr3_debug_read_dqs_n
126
+ //
127
+ // User enabled self-refresh
128
+ input wire i_user_self_refresh,
129
+ output wire uart_tx
130
+ );
131
+
132
+ // Instantiation Template (DEFAULT VALUE IS FOR ARTY S7)
133
+ /*
134
+ // DDR3 Controller
135
+ ddr3_top #(
136
+ .CONTROLLER_CLK_PERIOD(12_000), //ps, clock period of the controller interface
137
+ .DDR3_CLK_PERIOD(3_000), //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
138
+ .ROW_BITS(14), //width of row address
139
+ .COL_BITS(10), //width of column address
140
+ .BA_BITS(3), //width of bank address
141
+ .BYTE_LANES(2), //number of byte lanes of DDR3 RAM
142
+ .AUX_WIDTH(4), //width of aux line (must be >= 4)
143
+ .MICRON_SIM(0), //enable faster simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
144
+ .ODELAY_SUPPORTED(0), //set to 1 if ODELAYE2 is supported
145
+ .SECOND_WISHBONE(0), //set to 1 if 2nd wishbone for debugging is needed
146
+ .ECC_ENABLE(0), // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
147
+ .WB_ERROR(0), // set to 1 to support Wishbone error (asserts at ECC double bit error)
148
+ ) ddr3_top
149
+ (
150
+ //clock and reset
151
+ .i_controller_clk(i_controller_clk),
152
+ .i_ddr3_clk(i_ddr3_clk), //i_controller_clk has period of CONTROLLER_CLK_PERIOD, i_ddr3_clk has period of DDR3_CLK_PERIOD
153
+ .i_ref_clk(i_ref_clk), // usually set to 200 MHz
154
+ .i_ddr3_clk_90(i_ddr3_clk_90), //90 degree phase shifted version i_ddr3_clk (required only when ODELAY_SUPPORTED is zero)
155
+ .i_rst_n(!i_rst && clk_locked),
156
+ //
157
+ // Wishbone inputs
158
+ .i_wb_cyc(1), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
159
+ .i_wb_stb(i_wb_stb), //request a transfer
160
+ .i_wb_we(i_wb_we), //write-enable (1 = write, 0 = read)
161
+ .i_wb_addr(i_wb_addr), //burst-addressable {row,bank,col}
162
+ .i_wb_data(i_wb_data), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
163
+ .i_wb_sel(16'hffff), //byte strobe for write (1 = write the byte)
164
+ .i_aux(i_wb_we), //for AXI-interface compatibility (given upon strobe)
165
+ // Wishbone outputs
166
+ .o_wb_stall(o_wb_stall), //1 = busy, cannot accept requests
167
+ .o_wb_ack(o_wb_ack), //1 = read/write request has completed
168
+ .o_wb_err(o_wb_err), //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
169
+ .o_wb_data(o_wb_data), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
170
+ .o_aux(o_aux),
171
+ //
172
+ // Wishbone 2 (PHY) inputs
173
+ .i_wb2_cyc(0), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
174
+ .i_wb2_stb(0), //request a transfer
175
+ .i_wb2_we(0), //write-enable (1 = write, 0 = read)
176
+ .i_wb2_addr(0), //burst-addressable {row,bank,col}
177
+ .i_wb2_data(0), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
178
+ .i_wb2_sel(0), //byte strobe for write (1 = write the byte)
179
+ // Wishbone 2 (Controller) outputs
180
+ .o_wb2_stall(), //1 = busy, cannot accept requests
181
+ .o_wb2_ack(), //1 = read/write request has completed
182
+ .o_wb2_data(), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
183
+ //
184
+ // DDR3 I/O Interface
185
+ .o_ddr3_clk_p(ddr3_clk_p),
186
+ .o_ddr3_clk_n(ddr3_clk_n),
187
+ .o_ddr3_reset_n(ddr3_reset_n),
188
+ .o_ddr3_cke(ddr3_cke),
189
+ .o_ddr3_cs_n(ddr3_cs_n), // width = number of DDR3 ranks
190
+ .o_ddr3_ras_n(ddr3_ras_n),
191
+ .o_ddr3_cas_n(ddr3_cas_n),
192
+ .o_ddr3_we_n(ddr3_we_n),
193
+ .o_ddr3_addr(ddr3_addr), // width = ROW_BITS
194
+ .o_ddr3_ba_addr(ddr3_ba), // width = BA_BITS
195
+ .io_ddr3_dq(ddr3_dq), // width = BYTE_LANES*8
196
+ .io_ddr3_dqs(ddr3_dqs_p), // width = BYTE_LANES
197
+ .io_ddr3_dqs_n(ddr3_dqs_n), // width = BYTE_LANES
198
+ .o_ddr3_dm(ddr3_dm), // width = BYTE_LANES
199
+ .o_ddr3_odt(ddr3_odt),
200
+ // Debug outputs
201
+ .o_debug1(),
202
+ ////////////////////////////////////
203
+ );
204
+ */
205
+
206
+ // Wire connections between controller and phy
207
+ wire[cmd_len*serdes_ratio-1:0] cmd;
208
+ wire dqs_tri_control, dq_tri_control;
209
+ wire toggle_dqs;
210
+ wire[wb_data_bits-1:0] data;
211
+ wire[wb_sel_bits-1:0] dm;
212
+ wire[BYTE_LANES-1:0] bitslip;
213
+ wire[DQ_BITS*BYTE_LANES*8-1:0] iserdes_data;
214
+ wire[BYTE_LANES*8-1:0] iserdes_dqs;
215
+ wire[BYTE_LANES*8-1:0] iserdes_bitslip_reference;
216
+ wire idelayctrl_rdy;
217
+ wire[4:0] odelay_data_cntvaluein, odelay_dqs_cntvaluein;
218
+ wire[4:0] idelay_data_cntvaluein, idelay_dqs_cntvaluein;
219
+ wire[BYTE_LANES-1:0] odelay_data_ld, odelay_dqs_ld;
220
+ wire[BYTE_LANES-1:0] idelay_data_ld, idelay_dqs_ld;
221
+ wire write_leveling_calib;
222
+ wire reset;
223
+
224
+ // logic for self-refresh
225
+ reg[8:0] refresh_counter = 0;
226
+ reg user_self_refresh;
227
+ // refresh counter
228
+ always @(posedge i_controller_clk) begin
229
+ if(i_wb_stb && i_wb_cyc) begin // if there is Wishbone request, then reset counter
230
+ refresh_counter <= 0;
231
+ end
232
+ else if(!o_wb_stall || user_self_refresh) begin // if no request (but not stalled) OR already on self-refresh, then increment counter
233
+ refresh_counter <= refresh_counter + 1;
234
+ end
235
+ end
236
+ // choose self-refresh options
237
+ always @* begin
238
+ case(SELF_REFRESH)
239
+ 2'b00: user_self_refresh = i_user_self_refresh; // use input i_user_self_refresh (high = enter self-refresh, low = exit self-refresh)
240
+ 2'b01: user_self_refresh = refresh_counter[6]; // Self-refresh mode is enabled after 64 controller clock cycles of no requests, then exit Self-refresh after another 64 controller clk cycles
241
+ 2'b10: user_self_refresh = refresh_counter[7]; // Self-refresh mode is enabled after 128 controller clock cycles of no requests, then exit Self-refresh after another 128 controller clk cycles
242
+ 2'b11: user_self_refresh = refresh_counter[8]; // Self-refresh mode is enabled after 256 controller clock cycles of no requests, then exit Self-refresh after another 256 controller clk cycles
243
+ endcase
244
+ end
245
+
246
+
247
+
248
+ //module instantiations
249
+ ddr3_controller #(
250
+ .CONTROLLER_CLK_PERIOD(CONTROLLER_CLK_PERIOD), //ps, clock period of the controller interface
251
+ .DDR3_CLK_PERIOD(DDR3_CLK_PERIOD), //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
252
+ .ROW_BITS(ROW_BITS), //width of row address
253
+ .COL_BITS(COL_BITS), //width of column address
254
+ .BA_BITS(BA_BITS), //width of bank address
255
+ .DQ_BITS(DQ_BITS), //width of DQ
256
+ .LANES(BYTE_LANES), // byte lanes
257
+ .AUX_WIDTH(AUX_WIDTH), //width of aux line (must be >= 4)
258
+ .WB2_ADDR_BITS(WB2_ADDR_BITS), //width of 2nd wishbone address bus
259
+ .WB2_DATA_BITS(WB2_DATA_BITS), //width of 2nd wishbone data bus
260
+ .MICRON_SIM(MICRON_SIM), //simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
261
+ .ODELAY_SUPPORTED(ODELAY_SUPPORTED), //set to 1 when ODELAYE2 is supported
262
+ .SECOND_WISHBONE(SECOND_WISHBONE), //set to 1 if 2nd wishbone is needed
263
+ .ECC_ENABLE(ECC_ENABLE), // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
264
+ .DLL_OFF(DLL_OFF), // 1 = DLL off for low frequency ddr3 clock (< 125MHz)
265
+ .WB_ERROR(WB_ERROR), // set to 1 to support Wishbone error (asserts at ECC double bit error)
266
+ .BIST_MODE(BIST_MODE), // 0 = No BIST, 1 = run through all address space ONCE , 2 = run through all address space for every test (burst w/r, random w/r, alternating r/w)
267
+ .BIST_TEST_DATAMASK(BIST_TEST_DATAMASK), // 1 = include per-byte DM writes in BIST, 0 = all-byte writes only
268
+ .DIC(DIC), //Output Driver Impedance Control (2'b00 = RZQ/6, 2'b01 = RZQ/7, RZQ = 240ohms)
269
+ .RTT_NOM(RTT_NOM), //RTT Nominal (3'b000 = disabled, 3'b001 = RZQ/4, 3'b010 = RZQ/2 , 3'b011 = RZQ/6, RZQ = 240ohms)
270
+ .DUAL_RANK_DIMM(DUAL_RANK_DIMM), // enable dual rank DIMM (1 = enable, 0 = disable)
271
+ .SPEED_BIN(SPEED_BIN), // 0 = Use top-level parameters , 1 = DDR3-1066 (7-7-7) , 2 = DR3-1333 (9-9-9) , 3 = DDR3-1600 (11-11-11)
272
+ .SDRAM_CAPACITY(SDRAM_CAPACITY), // 0 = 256Mb, 1 = 512Mb, 2 = 1Gb, 3 = 2Gb, 4 = 4Gb, 5 = 8Gb, 6 = 16Gb
273
+ .TRCD(TRCD), // ps Active to Read/Write command time (only used if SPEED_BIN = 0)
274
+ .TRP(TRP), // ps Precharge command period (only used if SPEED_BIN = 0)
275
+ .TRAS(TRAS) // ps ACT to PRE command period (only used if SPEED_BIN = 0)
276
+ ) ddr3_controller_inst (
277
+ .i_controller_clk(i_controller_clk), //i_controller_clk has period of CONTROLLER_CLK_PERIOD
278
+ .i_rst_n(i_rst_n), //200MHz input clock
279
+ // Wishbone inputs
280
+ .i_wb_cyc(i_wb_cyc), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
281
+ .i_wb_stb(i_wb_stb), //request a transfer
282
+ .i_wb_we(i_wb_we), //write-enable (1 = write, 0 = read)
283
+ .i_wb_addr(i_wb_addr), //burst-addressable {row,bank,col}
284
+ .i_wb_data(i_wb_data), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
285
+ .i_wb_sel(i_wb_sel), //byte strobe for write (1 = write the byte)
286
+ .i_aux(i_aux), //for AXI-interface compatibility (given upon strobe)
287
+ // Wishbone outputs
288
+ .o_wb_stall(o_wb_stall), //1 = busy, cannot accept requests
289
+ .o_wb_ack(o_wb_ack), //1 = read/write request has completed
290
+ .o_wb_err(o_wb_err), //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
291
+ .o_wb_data(o_wb_data), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
292
+ .o_aux(o_aux), //for AXI-interface compatibility (returned upon ack)
293
+ // Wishbone 2 (PHY) inputs
294
+ .i_wb2_cyc(i_wb2_cyc), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
295
+ .i_wb2_stb(i_wb2_stb), //request a transfer
296
+ .i_wb2_we(i_wb2_we), //write-enable (1 = write, 0 = read)
297
+ .i_wb2_addr(i_wb2_addr), // memory-mapped register to be accessed
298
+ .i_wb2_data(i_wb2_data), //write data
299
+ .i_wb2_sel(i_wb2_sel), //byte strobe for write (1 = write the byte)
300
+ // Wishbone 2 (Controller) outputs
301
+ .o_wb2_stall(o_wb2_stall), //1 = busy, cannot accept requests
302
+ .o_wb2_ack(o_wb2_ack), //1 = read/write request has completed
303
+ .o_wb2_data(o_wb2_data), //read data
304
+ //
305
+ // PHY interface
306
+ .i_phy_iserdes_data(iserdes_data),
307
+ .i_phy_iserdes_dqs(iserdes_dqs),
308
+ .i_phy_iserdes_bitslip_reference(iserdes_bitslip_reference),
309
+ .i_phy_idelayctrl_rdy(idelayctrl_rdy),
310
+ .o_phy_cmd(cmd),
311
+ .o_phy_dqs_tri_control(dqs_tri_control),
312
+ .o_phy_dq_tri_control(dq_tri_control),
313
+ .o_phy_toggle_dqs(toggle_dqs),
314
+ .o_phy_data(data),
315
+ .o_phy_dm(dm),
316
+ .o_phy_odelay_data_cntvaluein(odelay_data_cntvaluein),
317
+ .o_phy_odelay_dqs_cntvaluein(odelay_dqs_cntvaluein),
318
+ .o_phy_idelay_data_cntvaluein(idelay_data_cntvaluein),
319
+ .o_phy_idelay_dqs_cntvaluein(idelay_dqs_cntvaluein),
320
+ .o_phy_odelay_data_ld(odelay_data_ld),
321
+ .o_phy_odelay_dqs_ld(odelay_dqs_ld),
322
+ .o_phy_idelay_data_ld(idelay_data_ld),
323
+ .o_phy_idelay_dqs_ld(idelay_dqs_ld),
324
+ .o_phy_bitslip(bitslip),
325
+ .o_phy_write_leveling_calib(write_leveling_calib),
326
+ .o_phy_reset(reset),
327
+ // Done Calibration pin
328
+ .o_calib_complete(o_calib_complete),
329
+ // Debug outputs
330
+ .o_debug1(o_debug1),
331
+ // .o_debug2(o_debug2),
332
+ // .o_debug3(o_debug3)
333
+ // User enabled self-refresh
334
+ .i_user_self_refresh(user_self_refresh),
335
+ .uart_tx(uart_tx)
336
+ );
337
+ `ifndef LATTICE_ECP5_PHY // XILINX PHY
338
+ ddr3_phy #(
339
+ .ROW_BITS(ROW_BITS), //width of row address
340
+ .BA_BITS(BA_BITS), //width of bank address
341
+ .DQ_BITS(DQ_BITS), //width of DQ
342
+ .LANES(BYTE_LANES), //8 lanes of DQ
343
+ .CONTROLLER_CLK_PERIOD(CONTROLLER_CLK_PERIOD), //ps, period of clock input to this DDR3 controller module
344
+ .DDR3_CLK_PERIOD(DDR3_CLK_PERIOD), //ps, period of clock input to DDR3 RAM device
345
+ .ODELAY_SUPPORTED(ODELAY_SUPPORTED), //set to 1 when ODELAYE2 is supported
346
+ .DUAL_RANK_DIMM(DUAL_RANK_DIMM) // enable dual rank DIMM (1 = enable, 0 = disable)
347
+ ) ddr3_phy_inst (
348
+ .i_controller_clk(i_controller_clk),
349
+ .i_ddr3_clk(i_ddr3_clk),
350
+ .i_ref_clk(i_ref_clk),
351
+ .i_ddr3_clk_90(i_ddr3_clk_90),
352
+ .i_rst_n(i_rst_n),
353
+ // Controller Interface
354
+ .i_controller_reset(reset),
355
+ .i_controller_cmd(cmd),
356
+ .i_controller_dqs_tri_control(dqs_tri_control),
357
+ .i_controller_dq_tri_control(dq_tri_control),
358
+ .i_controller_toggle_dqs(toggle_dqs),
359
+ .i_controller_data(data),
360
+ .i_controller_dm(dm),
361
+ .i_controller_odelay_data_cntvaluein(odelay_data_cntvaluein),
362
+ .i_controller_odelay_dqs_cntvaluein(odelay_dqs_cntvaluein),
363
+ .i_controller_idelay_data_cntvaluein(idelay_data_cntvaluein),
364
+ .i_controller_idelay_dqs_cntvaluein(idelay_dqs_cntvaluein),
365
+ .i_controller_odelay_data_ld(odelay_data_ld),
366
+ .i_controller_odelay_dqs_ld(odelay_dqs_ld),
367
+ .i_controller_idelay_data_ld(idelay_data_ld),
368
+ .i_controller_idelay_dqs_ld(idelay_dqs_ld),
369
+ .i_controller_bitslip(bitslip),
370
+ .i_controller_write_leveling_calib(write_leveling_calib),
371
+ .o_controller_iserdes_data(iserdes_data),
372
+ .o_controller_iserdes_dqs(iserdes_dqs),
373
+ .o_controller_iserdes_bitslip_reference(iserdes_bitslip_reference),
374
+ .o_controller_idelayctrl_rdy(idelayctrl_rdy),
375
+ // DDR3 I/O Interface
376
+ .o_ddr3_clk_p(o_ddr3_clk_p),
377
+ .o_ddr3_clk_n(o_ddr3_clk_n),
378
+ .o_ddr3_reset_n(o_ddr3_reset_n),
379
+ .o_ddr3_cke(o_ddr3_cke), // CKE
380
+ .o_ddr3_cs_n(o_ddr3_cs_n), // chip select signal
381
+ .o_ddr3_ras_n(o_ddr3_ras_n), // RAS#
382
+ .o_ddr3_cas_n(o_ddr3_cas_n), // CAS#
383
+ .o_ddr3_we_n(o_ddr3_we_n), // WE#
384
+ .o_ddr3_addr(o_ddr3_addr),
385
+ .o_ddr3_ba_addr(o_ddr3_ba_addr),
386
+ .io_ddr3_dq(io_ddr3_dq),
387
+ .io_ddr3_dqs(io_ddr3_dqs),
388
+ .io_ddr3_dqs_n(io_ddr3_dqs_n),
389
+ .o_ddr3_dm(o_ddr3_dm),
390
+ .o_ddr3_odt(o_ddr3_odt), // on-die termination
391
+ .o_ddr3_debug_read_dqs_p(/*o_ddr3_debug_read_dqs_p*/),
392
+ .o_ddr3_debug_read_dqs_n(/*o_ddr3_debug_read_dqs_n*/)
393
+ );
394
+ `else // LATTICE ECP5 PHY
395
+ ddr3_phy_ecp5 #(
396
+ .ROW_BITS(ROW_BITS), //width of row address
397
+ .BA_BITS(BA_BITS), //width of bank address
398
+ .DQ_BITS(DQ_BITS), //width of DQ
399
+ .LANES(BYTE_LANES), //8 lanes of DQ
400
+ .CONTROLLER_CLK_PERIOD(CONTROLLER_CLK_PERIOD) //ps, period of clock input to this DDR3 controller module
401
+ ) ddr3_phy_inst (
402
+ .i_controller_clk(i_controller_clk),
403
+ .i_ddr3_clk(i_ddr3_clk),
404
+ .i_ref_clk(i_ref_clk),
405
+ .i_ddr3_clk_90(i_ddr3_clk_90),
406
+ .i_rst_n(i_rst_n),
407
+ // Controller Interface
408
+ .i_controller_reset(reset),
409
+ .i_controller_cmd(cmd),
410
+ .i_controller_dqs_tri_control(dqs_tri_control),
411
+ .i_controller_dq_tri_control(dq_tri_control),
412
+ .i_controller_toggle_dqs(toggle_dqs),
413
+ .i_controller_data(data),
414
+ .i_controller_dm(dm),
415
+ .i_controller_odelay_data_cntvaluein(odelay_data_cntvaluein),
416
+ .i_controller_odelay_dqs_cntvaluein(odelay_dqs_cntvaluein),
417
+ .i_controller_idelay_data_cntvaluein(idelay_data_cntvaluein),
418
+ .i_controller_idelay_dqs_cntvaluein(idelay_dqs_cntvaluein),
419
+ .i_controller_odelay_data_ld(odelay_data_ld),
420
+ .i_controller_odelay_dqs_ld(odelay_dqs_ld),
421
+ .i_controller_idelay_data_ld(idelay_data_ld),
422
+ .i_controller_idelay_dqs_ld(idelay_dqs_ld),
423
+ .i_controller_bitslip(bitslip),
424
+ .i_controller_write_leveling_calib(write_leveling_calib),
425
+ .o_controller_iserdes_data(iserdes_data),
426
+ .o_controller_iserdes_dqs(iserdes_dqs),
427
+ .o_controller_iserdes_bitslip_reference(iserdes_bitslip_reference),
428
+ .o_controller_idelayctrl_rdy(idelayctrl_rdy),
429
+ // DDR3 I/O Interface
430
+ .o_ddr3_clk_p(o_ddr3_clk_p),
431
+ .o_ddr3_clk_n(o_ddr3_clk_n),
432
+ .o_ddr3_reset_n(o_ddr3_reset_n),
433
+ .o_ddr3_cke(o_ddr3_cke), // CKE
434
+ .o_ddr3_cs_n(o_ddr3_cs_n), // chip select signal
435
+ .o_ddr3_ras_n(o_ddr3_ras_n), // RAS#
436
+ .o_ddr3_cas_n(o_ddr3_cas_n), // CAS#
437
+ .o_ddr3_we_n(o_ddr3_we_n), // WE#
438
+ .o_ddr3_addr(o_ddr3_addr),
439
+ .o_ddr3_ba_addr(o_ddr3_ba_addr),
440
+ .io_ddr3_dq(io_ddr3_dq),
441
+ .io_ddr3_dqs(io_ddr3_dqs),
442
+ .io_ddr3_dqs_n(io_ddr3_dqs_n),
443
+ .o_ddr3_dm(o_ddr3_dm),
444
+ .o_ddr3_odt(o_ddr3_odt), // on-die termination
445
+ .o_ddr3_debug_read_dqs_p(/*o_ddr3_debug_read_dqs_p*/),
446
+ .o_ddr3_debug_read_dqs_n(/*o_ddr3_debug_read_dqs_n*/)
447
+ );
448
+ `endif
449
+
450
+ // // display value of parameters for easy debugging
451
+ // initial begin
452
+ // $display("\nDDR3 TOP PARAMETERS:\n-----------------------------");
453
+ // $display("CONTROLLER_CLK_PERIOD = %0d", CONTROLLER_CLK_PERIOD);
454
+ // $display("DDR3_CLK_PERIOD = %0d", DDR3_CLK_PERIOD);
455
+ // $display("ROW_BITS = %0d", ROW_BITS);
456
+ // $display("COL_BITS = %0d", COL_BITS);
457
+ // $display("BA_BITS = %0d", BA_BITS);
458
+ // $display("BYTE_LANES = %0d", BYTE_LANES);
459
+ // $display("AUX_WIDTH = %0d", AUX_WIDTH);
460
+ // $display("WB2_ADDR_BITS = %0d", WB2_ADDR_BITS);
461
+ // $display("WB2_DATA_BITS = %0d", WB2_DATA_BITS);
462
+ // $display("MICRON_SIM = %0d", MICRON_SIM);
463
+ // $display("ODELAY_SUPPORTED = %0d", ODELAY_SUPPORTED);
464
+ // $display("SECOND_WISHBONE = %0d", SECOND_WISHBONE);
465
+ // $display("WB_ERROR = %0d", WB_ERROR);
466
+ // $display("BIST_MODE = %0d", BIST_MODE);
467
+ // $display("ECC_ENABLE = %0d", ECC_ENABLE);
468
+ // $display("DIC = %0d", DIC);
469
+ // $display("RTT_NOM = %0d", RTT_NOM);
470
+ // $display("SELF_REFRESH = %0d", SELF_REFRESH);
471
+ // $display("DUAL_RANK_DIMM = %0d", DUAL_RANK_DIMM);
472
+ // $display("End of DDR3 TOP PARAMETERS\n-----------------------------");
473
+ // end
474
+
475
+ endmodule
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/uart_rx.v ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ //
3
+ // Module: uart_rx
4
+ //
5
+ // Notes:
6
+ // - UART reciever module.
7
+ //
8
+
9
+ module uart_rx(
10
+ input wire clk , // Top level system clock input.
11
+ input wire resetn , // Asynchronous active low reset.
12
+ input wire uart_rxd , // UART Recieve pin.
13
+ input wire uart_rx_en , // Recieve enable
14
+ output wire uart_rx_break, // Did we get a BREAK message?
15
+ output wire uart_rx_valid, // Valid data recieved and available.
16
+ output reg [PAYLOAD_BITS-1:0] uart_rx_data // The recieved data.
17
+ );
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // External parameters.
21
+ //
22
+
23
+ //
24
+ // Input bit rate of the UART line.
25
+ parameter BIT_RATE = 9600; // bits / sec
26
+ localparam BIT_P = 1_000_000_000 * 1/BIT_RATE; // nanoseconds
27
+
28
+ //
29
+ // Clock frequency in hertz.
30
+ parameter CLK_HZ = 50_000_000;
31
+ localparam CLK_P = 1_000_000_000 * 1/CLK_HZ; // nanoseconds
32
+
33
+ //
34
+ // Number of data bits recieved per UART packet.
35
+ parameter PAYLOAD_BITS = 8;
36
+
37
+ //
38
+ // Number of stop bits indicating the end of a packet.
39
+ parameter STOP_BITS = 1;
40
+
41
+ // --------------------------------------------------------------------------
42
+ // Internal parameters.
43
+ //
44
+
45
+ //
46
+ // Number of clock cycles per uart bit.
47
+ localparam CYCLES_PER_BIT = BIT_P / CLK_P;
48
+
49
+ //
50
+ // Size of the registers which store sample counts and bit durations.
51
+ localparam COUNT_REG_LEN = 1+$clog2(CYCLES_PER_BIT);
52
+
53
+ // --------------------------------------------------------------------------
54
+ // Internal registers.
55
+ //
56
+
57
+ //
58
+ // Internally latched value of the uart_rxd line. Helps break long timing
59
+ // paths from input pins into the logic.
60
+ reg rxd_reg;
61
+ reg rxd_reg_0;
62
+
63
+ //
64
+ // Storage for the recieved serial data.
65
+ reg [PAYLOAD_BITS-1:0] recieved_data;
66
+
67
+ //
68
+ // Counter for the number of cycles over a packet bit.
69
+ reg [COUNT_REG_LEN-1:0] cycle_counter;
70
+
71
+ //
72
+ // Counter for the number of recieved bits of the packet.
73
+ reg [3:0] bit_counter;
74
+
75
+ //
76
+ // Sample of the UART input line whenever we are in the middle of a bit frame.
77
+ reg bit_sample;
78
+
79
+ //
80
+ // Current and next states of the internal FSM.
81
+ reg [2:0] fsm_state;
82
+ reg [2:0] n_fsm_state;
83
+
84
+ localparam FSM_IDLE = 0;
85
+ localparam FSM_START= 1;
86
+ localparam FSM_RECV = 2;
87
+ localparam FSM_STOP = 3;
88
+
89
+ // ---------------------------------------------------------------------------
90
+ // Output assignment
91
+ //
92
+
93
+ assign uart_rx_break = uart_rx_valid && ~|recieved_data;
94
+ assign uart_rx_valid = fsm_state == FSM_STOP && n_fsm_state == FSM_IDLE;
95
+
96
+ always @(posedge clk) begin
97
+ if(!resetn) begin
98
+ uart_rx_data <= {PAYLOAD_BITS{1'b0}};
99
+ end else if (fsm_state == FSM_STOP) begin
100
+ uart_rx_data <= recieved_data;
101
+ end
102
+ end
103
+
104
+ // ---------------------------------------------------------------------------
105
+ // FSM next state selection.
106
+ //
107
+
108
+ wire next_bit = cycle_counter == CYCLES_PER_BIT ||
109
+ fsm_state == FSM_STOP &&
110
+ cycle_counter == CYCLES_PER_BIT/2;
111
+ wire payload_done = bit_counter == PAYLOAD_BITS ;
112
+
113
+ //
114
+ // Handle picking the next state.
115
+ always @(*) begin : p_n_fsm_state
116
+ case(fsm_state)
117
+ FSM_IDLE : n_fsm_state = rxd_reg ? FSM_IDLE : FSM_START;
118
+ FSM_START: n_fsm_state = next_bit ? FSM_RECV : FSM_START;
119
+ FSM_RECV : n_fsm_state = payload_done ? FSM_STOP : FSM_RECV ;
120
+ FSM_STOP : n_fsm_state = next_bit ? FSM_IDLE : FSM_STOP ;
121
+ default : n_fsm_state = FSM_IDLE;
122
+ endcase
123
+ end
124
+
125
+ // ---------------------------------------------------------------------------
126
+ // Internal register setting and re-setting.
127
+ //
128
+
129
+ //
130
+ // Handle updates to the recieved data register.
131
+ integer i = 0;
132
+ always @(posedge clk) begin : p_recieved_data
133
+ if(!resetn) begin
134
+ recieved_data <= {PAYLOAD_BITS{1'b0}};
135
+ end else if(fsm_state == FSM_IDLE ) begin
136
+ recieved_data <= {PAYLOAD_BITS{1'b0}};
137
+ end else if(fsm_state == FSM_RECV && next_bit ) begin
138
+ recieved_data[PAYLOAD_BITS-1] <= bit_sample;
139
+ for ( i = PAYLOAD_BITS-2; i >= 0; i = i - 1) begin
140
+ recieved_data[i] <= recieved_data[i+1];
141
+ end
142
+ end
143
+ end
144
+
145
+ //
146
+ // Increments the bit counter when recieving.
147
+ always @(posedge clk) begin : p_bit_counter
148
+ if(!resetn) begin
149
+ bit_counter <= 4'b0;
150
+ end else if(fsm_state != FSM_RECV) begin
151
+ bit_counter <= {COUNT_REG_LEN{1'b0}};
152
+ end else if(fsm_state == FSM_RECV && next_bit) begin
153
+ bit_counter <= bit_counter + 1'b1;
154
+ end
155
+ end
156
+
157
+ //
158
+ // Sample the recieved bit when in the middle of a bit frame.
159
+ always @(posedge clk) begin : p_bit_sample
160
+ if(!resetn) begin
161
+ bit_sample <= 1'b0;
162
+ end else if (cycle_counter == CYCLES_PER_BIT/2) begin
163
+ bit_sample <= rxd_reg;
164
+ end
165
+ end
166
+
167
+
168
+ //
169
+ // Increments the cycle counter when recieving.
170
+ always @(posedge clk) begin : p_cycle_counter
171
+ if(!resetn) begin
172
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
173
+ end else if(next_bit) begin
174
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
175
+ end else if(fsm_state == FSM_START ||
176
+ fsm_state == FSM_RECV ||
177
+ fsm_state == FSM_STOP ) begin
178
+ cycle_counter <= cycle_counter + 1'b1;
179
+ end
180
+ end
181
+
182
+
183
+ //
184
+ // Progresses the next FSM state.
185
+ always @(posedge clk) begin : p_fsm_state
186
+ if(!resetn) begin
187
+ fsm_state <= FSM_IDLE;
188
+ end else begin
189
+ fsm_state <= n_fsm_state;
190
+ end
191
+ end
192
+
193
+
194
+ //
195
+ // Responsible for updating the internal value of the rxd_reg.
196
+ always @(posedge clk) begin : p_rxd_reg
197
+ if(!resetn) begin
198
+ rxd_reg <= 1'b1;
199
+ rxd_reg_0 <= 1'b1;
200
+ end else if(uart_rx_en) begin
201
+ rxd_reg <= rxd_reg_0;
202
+ rxd_reg_0 <= uart_rxd;
203
+ end
204
+ end
205
+
206
+
207
+ endmodule
AngeloJacobo_UberDDR3/example_demo/alinx_ax7325b/uart_tx.v ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ //
4
+ // Module: uart_tx
5
+ //
6
+ // Notes:
7
+ // - UART transmitter module.
8
+ //
9
+
10
+ module uart_tx(
11
+ input wire clk , // Top level system clock input.
12
+ input wire resetn , // Asynchronous active low reset.
13
+ output wire uart_txd , // UART transmit pin.
14
+ output wire uart_tx_busy, // Module busy sending previous item.
15
+ input wire uart_tx_en , // Send the data on uart_tx_data
16
+ input wire [PAYLOAD_BITS-1:0] uart_tx_data // The data to be sent
17
+ );
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // External parameters.
21
+ //
22
+
23
+ //
24
+ // Input bit rate of the UART line.
25
+ parameter BIT_RATE = 9600; // bits / sec
26
+ localparam BIT_P = 1_000_000_000 * 1/BIT_RATE; // nanoseconds
27
+
28
+ //
29
+ // Clock frequency in hertz.
30
+ parameter CLK_HZ = 50_000_000;
31
+ localparam CLK_P = 1_000_000_000 * 1/CLK_HZ; // nanoseconds
32
+
33
+ //
34
+ // Number of data bits recieved per UART packet.
35
+ parameter PAYLOAD_BITS = 8;
36
+
37
+ //
38
+ // Number of stop bits indicating the end of a packet.
39
+ parameter STOP_BITS = 1;
40
+
41
+ // ---------------------------------------------------------------------------
42
+ // Internal parameters.
43
+ //
44
+
45
+ //
46
+ // Number of clock cycles per uart bit.
47
+ localparam CYCLES_PER_BIT = BIT_P / CLK_P;
48
+
49
+ //
50
+ // Size of the registers which store sample counts and bit durations.
51
+ localparam COUNT_REG_LEN = 1+$clog2(CYCLES_PER_BIT);
52
+
53
+ // ---------------------------------------------------------------------------
54
+ // Internal registers.
55
+ //
56
+
57
+ //
58
+ // Internally latched value of the uart_txd line. Helps break long timing
59
+ // paths from the logic to the output pins.
60
+ reg txd_reg;
61
+
62
+ //
63
+ // Storage for the serial data to be sent.
64
+ reg [PAYLOAD_BITS-1:0] data_to_send;
65
+
66
+ //
67
+ // Counter for the number of cycles over a packet bit.
68
+ reg [COUNT_REG_LEN-1:0] cycle_counter;
69
+
70
+ //
71
+ // Counter for the number of sent bits of the packet.
72
+ reg [3:0] bit_counter;
73
+
74
+ //
75
+ // Current and next states of the internal FSM.
76
+ reg [2:0] fsm_state;
77
+ reg [2:0] n_fsm_state;
78
+
79
+ localparam FSM_IDLE = 0;
80
+ localparam FSM_START= 1;
81
+ localparam FSM_SEND = 2;
82
+ localparam FSM_STOP = 3;
83
+
84
+
85
+ // ---------------------------------------------------------------------------
86
+ // FSM next state selection.
87
+ //
88
+
89
+ assign uart_tx_busy = fsm_state != FSM_IDLE;
90
+ assign uart_txd = txd_reg;
91
+
92
+ wire next_bit = cycle_counter == CYCLES_PER_BIT;
93
+ wire payload_done = bit_counter == PAYLOAD_BITS ;
94
+ wire stop_done = bit_counter == STOP_BITS && fsm_state == FSM_STOP;
95
+
96
+ //
97
+ // Handle picking the next state.
98
+ always @(*) begin : p_n_fsm_state
99
+ case(fsm_state)
100
+ FSM_IDLE : n_fsm_state = uart_tx_en ? FSM_START: FSM_IDLE ;
101
+ FSM_START: n_fsm_state = next_bit ? FSM_SEND : FSM_START;
102
+ FSM_SEND : n_fsm_state = payload_done ? FSM_STOP : FSM_SEND ;
103
+ FSM_STOP : n_fsm_state = stop_done ? FSM_IDLE : FSM_STOP ;
104
+ default : n_fsm_state = FSM_IDLE;
105
+ endcase
106
+ end
107
+
108
+ // ---------------------------------------------------------------------------
109
+ // Internal register setting and re-setting.
110
+ //
111
+
112
+ //
113
+ // Handle updates to the sent data register.
114
+ integer i = 0;
115
+ always @(posedge clk) begin : p_data_to_send
116
+ if(!resetn) begin
117
+ data_to_send <= {PAYLOAD_BITS{1'b0}};
118
+ end else if(fsm_state == FSM_IDLE && uart_tx_en) begin
119
+ data_to_send <= uart_tx_data;
120
+ end else if(fsm_state == FSM_SEND && next_bit ) begin
121
+ for ( i = PAYLOAD_BITS-2; i >= 0; i = i - 1) begin
122
+ data_to_send[i] <= data_to_send[i+1];
123
+ end
124
+ end
125
+ end
126
+
127
+
128
+ //
129
+ // Increments the bit counter each time a new bit frame is sent.
130
+ always @(posedge clk) begin : p_bit_counter
131
+ if(!resetn) begin
132
+ bit_counter <= 4'b0;
133
+ end else if(fsm_state != FSM_SEND && fsm_state != FSM_STOP) begin
134
+ bit_counter <= {COUNT_REG_LEN{1'b0}};
135
+ end else if(fsm_state == FSM_SEND && n_fsm_state == FSM_STOP) begin
136
+ bit_counter <= {COUNT_REG_LEN{1'b0}};
137
+ end else if(fsm_state == FSM_STOP&& next_bit) begin
138
+ bit_counter <= bit_counter + 1'b1;
139
+ end else if(fsm_state == FSM_SEND && next_bit) begin
140
+ bit_counter <= bit_counter + 1'b1;
141
+ end
142
+ end
143
+
144
+
145
+ //
146
+ // Increments the cycle counter when sending.
147
+ always @(posedge clk) begin : p_cycle_counter
148
+ if(!resetn) begin
149
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
150
+ end else if(next_bit) begin
151
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
152
+ end else if(fsm_state == FSM_START ||
153
+ fsm_state == FSM_SEND ||
154
+ fsm_state == FSM_STOP ) begin
155
+ cycle_counter <= cycle_counter + 1'b1;
156
+ end
157
+ end
158
+
159
+
160
+ //
161
+ // Progresses the next FSM state.
162
+ always @(posedge clk) begin : p_fsm_state
163
+ if(!resetn) begin
164
+ fsm_state <= FSM_IDLE;
165
+ end else begin
166
+ fsm_state <= n_fsm_state;
167
+ end
168
+ end
169
+
170
+
171
+ //
172
+ // Responsible for updating the internal value of the txd_reg.
173
+ always @(posedge clk) begin : p_txd_reg
174
+ if(!resetn) begin
175
+ txd_reg <= 1'b1;
176
+ end else if(fsm_state == FSM_IDLE) begin
177
+ txd_reg <= 1'b1;
178
+ end else if(fsm_state == FSM_START) begin
179
+ txd_reg <= 1'b0;
180
+ end else if(fsm_state == FSM_SEND) begin
181
+ txd_reg <= data_to_send[0];
182
+ end else if(fsm_state == FSM_STOP) begin
183
+ txd_reg <= 1'b1;
184
+ end
185
+ end
186
+
187
+ endmodule
AngeloJacobo_UberDDR3/example_demo/arty_s7/Makefile ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PROJECT = arty_ddr3
2
+ BOARD = arty_s7_50
3
+ FAMILY = spartan7
4
+ PART = xc7s50csga324-1
5
+ CHIPDB = ${SPARTAN7_CHIPDB}
6
+ ADDITIONAL_SOURCES = ../../rtl/ddr3_controller.v ../../rtl/ddr3_phy.v ../../rtl/ddr3_top.v uart_rx.v uart_tx.v clk_wiz.v
7
+
8
+
9
+ #############################################################################################
10
+ NEXTPNR_XILINX_DIR ?= /snap/openxc7/current/opt/nextpnr-xilinx
11
+ NEXTPNR_XILINX_PYTHON_DIR ?= ${NEXTPNR_XILINX_DIR}/python
12
+ PRJXRAY_DB_DIR ?= ${NEXTPNR_XILINX_DIR}/external/prjxray-db
13
+
14
+ DBPART = $(shell echo ${PART} | sed -e 's/-[0-9]//g')
15
+ SPEEDGRADE = $(shell echo ${PART} | sed -e 's/.*\-\([0-9]\)/\1/g')
16
+
17
+ CHIPDB ?= ./
18
+ ifeq ($(CHIPDB),)
19
+ CHIPDB = ./
20
+ endif
21
+
22
+ PYPY3 ?= pypy3
23
+
24
+ TOP ?= ${PROJECT}
25
+ TOP_MODULE ?= ${TOP}
26
+ TOP_VERILOG ?= ${TOP}.v
27
+
28
+ PNR_DEBUG ?= # --verbose --debug
29
+
30
+ JTAG_LINK ?= --board ${BOARD}
31
+
32
+ XDC ?= ${PROJECT}.xdc
33
+
34
+ .PHONY: openxc7
35
+ openxc7: ${PROJECT}_openxc7.bit
36
+
37
+ .PHONY: program
38
+ program: ${PROJECT}_openxc7.bit
39
+ openFPGALoader ${JTAG_LINK} --bitstream $<
40
+
41
+ ${PROJECT}.json: ${TOP_VERILOG} ${ADDITIONAL_SOURCES}
42
+ yosys -p "synth_xilinx -flatten -abc9 ${SYNTH_OPTS} -arch xc7 -top ${TOP_MODULE}; write_json ${PROJECT}.json" $< ${ADDITIONAL_SOURCES}
43
+
44
+ # The chip database only needs to be generated once
45
+ # that is why we don't clean it with make clean
46
+ ${CHIPDB}/${DBPART}.bin:
47
+ ${PYPY3} ${NEXTPNR_XILINX_PYTHON_DIR}/bbaexport.py --device ${PART} --bba ${DBPART}.bba
48
+ bbasm -l ${DBPART}.bba ${CHIPDB}/${DBPART}.bin
49
+ rm -f ${DBPART}.bba
50
+
51
+ ${PROJECT}.fasm: ${PROJECT}.json ${CHIPDB}/${DBPART}.bin ${XDC}
52
+ nextpnr-xilinx --chipdb ${CHIPDB}/${DBPART}.bin --xdc ${XDC} --json ${PROJECT}.json --fasm $@ ${PNR_ARGS} ${PNR_DEBUG}
53
+
54
+ ${PROJECT}.frames: ${PROJECT}.fasm
55
+ fasm2frames --part ${PART} --db-root ${PRJXRAY_DB_DIR}/${FAMILY} $< > $@
56
+
57
+ ${PROJECT}_openxc7.bit: ${PROJECT}.frames
58
+ xc7frames2bit --part_file ${PRJXRAY_DB_DIR}/${FAMILY}/${PART}/part.yaml --part_name ${PART} --frm_file $< --output_file $@
59
+
60
+
61
+ #############################################################################################
62
+ # SPDX-License-Identifier: MIT
63
+ # Generated from https://github.com/FPGAOL-CE/caas-wizard
64
+ #
65
+ BUILDDIR := ${CURDIR}/build
66
+
67
+ LOGFILE := ${BUILDDIR}/top.log
68
+
69
+ # Build design
70
+ .PHONY: vivado
71
+ vivado: ${BUILDDIR}/${PROJECT}_vivado.bit
72
+
73
+ ${BUILDDIR}:
74
+ mkdir -m 777 -p ${BUILDDIR} && chown -R nobody ${BUILDDIR} | true
75
+
76
+ .ONESHELL:
77
+ ${BUILDDIR}/vivado.tcl: ${BUILDDIR}
78
+ cat << EOF > $@
79
+ # vivado.tcl generated for FPGAOL-CE/caas-wizard
80
+ # can be launched from any directory
81
+ cd ${BUILDDIR}
82
+ create_project -part ${PART} -force v_proj
83
+ set_property target_language Verilog [current_project]
84
+ cd ..
85
+ read_verilog [glob ${PROJECT}.v ${ADDITIONAL_SOURCES}]
86
+ read_xdc [glob $(wildcard ${PROJECT}_vivado.xdc) ]
87
+ cd build
88
+ synth_design -top ${PROJECT}
89
+ opt_design
90
+ place_design
91
+ phys_opt_design
92
+ route_design
93
+ write_bitstream -verbose -force ${PROJECT}_vivado.bit
94
+ # report_utilization -file util.rpt
95
+ # report_timing_summary -file timing.rpt
96
+ EOF
97
+
98
+ ${BUILDDIR}/${PROJECT}_vivado.bit: ${BUILDDIR}/vivado.tcl
99
+ cd ${BUILDDIR} && vivado -mode batch -source $< > ${LOGFILE} 2>&1
100
+
101
+ .PHONY: program_vivado
102
+ program_vivado:
103
+ openFPGALoader ${JTAG_LINK} --bitstream ${BUILDDIR}/${PROJECT}_vivado.bit
104
+
105
+
106
+ #############################################################################################
107
+
108
+ .PHONY: clean
109
+ clean:
110
+ rm -f *.bit
111
+ rm -f *.frames
112
+ rm -f *.fasm
113
+ rm -f *.json
114
+ rm -f *.bin
115
+ rm -f *.bba
116
+ rm -rf ${BUILDDIR}
AngeloJacobo_UberDDR3/example_demo/arty_s7/arty_ddr3.v ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: arty_ddr3.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: Example demo of UberDDR3 for Arty-S7. Mechanism:
7
+ // - four LEDs will light up once UberDDR3 is done calibrating
8
+ // - if UART (9600 Baud Rate)receives small letter ASCII (a-z), this value will be written to DDR3
9
+ // - if UART receives capital letter ASCII (A-Z), the small letter equivalent will be retrieved from DDR3 by doing
10
+ // - a read request, once read data is available this will be sent to UART to be streamed out.
11
+ // THUS:
12
+ // - Sendng "abcdefg" to the UART terminal will store that small latter to DDR3
13
+ // - Then sending "ABCDEFG" to the UART terminal will return the small letter equivalent: "abcdefg"
14
+ //
15
+ // Engineer: Angelo C. Jacobo
16
+ //
17
+ ////////////////////////////////////////////////////////////////////////////////
18
+ //
19
+ // Copyright (C) 2023-2025 Angelo Jacobo
20
+ //
21
+ // This program is free software: you can redistribute it and/or modify
22
+ // it under the terms of the GNU General Public License as published by
23
+ // the Free Software Foundation, either version 3 of the License, or
24
+ // (at your option) any later version.
25
+ //
26
+ // This program is distributed in the hope that it will be useful,
27
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
28
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
+ // GNU General Public License for more details.
30
+ //
31
+ // You should have received a copy of the GNU General Public License
32
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
33
+ //
34
+ ////////////////////////////////////////////////////////////////////////////////
35
+
36
+ `timescale 1ns / 1ps
37
+
38
+ module arty_ddr3
39
+ (
40
+ input wire i_clk,
41
+ input wire i_rst,
42
+ // DDR3 I/O Interface
43
+ output wire ddr3_clk_p, ddr3_clk_n,
44
+ output wire ddr3_reset_n,
45
+ output wire ddr3_cke, // CKE
46
+ output wire ddr3_cs_n, // chip select signal
47
+ output wire ddr3_ras_n, // RAS#
48
+ output wire ddr3_cas_n, // CAS#
49
+ output wire ddr3_we_n, // WE#
50
+ output wire[14-1:0] ddr3_addr,
51
+ output wire[3-1:0] ddr3_ba,
52
+ inout wire[16-1:0] ddr3_dq,
53
+ inout wire[2-1:0] ddr3_dqs_p, ddr3_dqs_n,
54
+ output wire[2-1:0] ddr3_dm,
55
+ output wire ddr3_odt, // on-die termination
56
+ // UART line
57
+ input wire rx,
58
+ output wire tx,
59
+ //Debug LEDs
60
+ output wire[3:0] led
61
+ );
62
+
63
+ wire i_controller_clk, i_ddr3_clk, i_ref_clk, i_ddr3_clk_90;
64
+ wire m_axis_tvalid;
65
+ wire rx_empty;
66
+ wire tx_full;
67
+ wire o_wb_ack;
68
+ wire[7:0] o_wb_data;
69
+ wire[7:0] rd_data;
70
+ wire o_wb_stall;
71
+ reg i_wb_stb = 0, i_wb_we;
72
+ wire[31:0] o_debug1;
73
+ reg[7:0] i_wb_data;
74
+ reg[7:0] i_wb_addr;
75
+ wire user_temp_alarm_out; // asserts if XADC detects internal temp to be above user temp alarm
76
+
77
+ // o_debug1 taps on value of state_calibrate (can be traced inside ddr3_controller module)
78
+ assign led[0] = (o_debug1[4:0] != 23); //light up if not at DONE_CALIBRATE
79
+ assign led[1] = (o_debug1[4:0] == 23 && !user_temp_alarm_out); //light up if at DONE_CALIBRATE
80
+ assign led[2] = (o_debug1[4:0] == 23 && !user_temp_alarm_out); //light up if at DONE_CALIBRATE
81
+ assign led[3] = (o_debug1[4:0] == 23 && !user_temp_alarm_out); //light up if at DONE_CALIBRATE
82
+
83
+ // always @(posedge i_controller_clk) begin
84
+ // begin
85
+ // i_wb_stb <= 0;
86
+ // i_wb_we <= 0;
87
+ // i_wb_addr <= 0;
88
+ // i_wb_data <= 0;
89
+ // if(!o_wb_stall && m_axis_tvalid) begin
90
+ // if(rd_data >= 97 && rd_data <= 122) begin //write to DDR3 if ASCII is small letter
91
+ // i_wb_stb <= 1;
92
+ // i_wb_we <= 1;
93
+ // i_wb_addr <= ~rd_data ;
94
+ // i_wb_data <= rd_data;
95
+ // end
96
+ // else if(rd_data >= 65 && rd_data <= 90) begin //read from DDR3 if ASCII is capital letter
97
+ // i_wb_stb <= 1; //make request
98
+ // i_wb_we <= 0; //read
99
+ // i_wb_addr <= ~(rd_data + 8'd32);
100
+ // end
101
+ // end
102
+ // end
103
+ // end
104
+
105
+ (* mark_debug = "true" *) wire clk_locked;
106
+ clk_wiz clk_wiz_inst
107
+ (
108
+ // Clock out ports
109
+ .clk_out1(i_controller_clk), //83.333 Mhz
110
+ .clk_out2(i_ddr3_clk), // 333.333 MHz
111
+ .clk_out3(i_ref_clk), //200MHz
112
+ .clk_out4(i_ddr3_clk_90), // 333.333 MHz with 90degree shift
113
+ // Status and control signals
114
+ .reset(i_rst),
115
+ .locked(clk_locked),
116
+ // Clock in ports
117
+ .clk_in1(i_clk)
118
+ );
119
+
120
+ // // UART TX/RXmodule from https://github.com/ben-marshall/uart
121
+ // uart_tx #(
122
+ // .BIT_RATE(9600),
123
+ // .CLK_HZ(83_333_333),
124
+ // .PAYLOAD_BITS(8),
125
+ // .STOP_BITS(1)
126
+ // ) uart_tx_inst (
127
+ // .clk(i_controller_clk), // Top level system clock input.
128
+ // .resetn(!i_rst && clk_locked && o_debug1[4:0] == 23), // Asynchronous active low reset.
129
+ // .uart_txd(tx), // UART transmit pin.
130
+ // .uart_tx_busy(), // Module busy sending previous item.
131
+ // .uart_tx_en(o_wb_ack), // Send the data on uart_tx_data
132
+ // .uart_tx_data(o_wb_data) // The data to be sent
133
+ // );
134
+ // uart_rx #(
135
+ // .BIT_RATE(9600),
136
+ // .CLK_HZ(83_333_333),
137
+ // .PAYLOAD_BITS(8),
138
+ // .STOP_BITS(1)
139
+ // ) uart_rx_inst (
140
+ // .clk(i_controller_clk), // Top level system clock input.
141
+ // .resetn(!i_rst && clk_locked && o_debug1[4:0] == 23), // Asynchronous active low reset.
142
+ // .uart_rxd(rx), // UART Recieve pin.
143
+ // .uart_rx_en(o_debug1[4:0] == 23), // Recieve enable
144
+ // .uart_rx_break(), // Did we get a BREAK message?
145
+ // .uart_rx_valid(m_axis_tvalid), // Valid data recieved/available.
146
+ // .uart_rx_data(rd_data) // The recieved data.
147
+ // );
148
+
149
+ // `define XADC
150
+ `ifdef XADC
151
+ xadc_wiz_0 xadc_inst (
152
+ .dclk_in(i_controller_clk), // Clock input for the dynamic reconfiguration port
153
+ .user_temp_alarm_out(user_temp_alarm_out) // Temperature-sensor alarm output
154
+ );
155
+ `else
156
+ assign user_temp_alarm_out = 1'b0;
157
+ `endif
158
+
159
+ // UART module from https://github.com/alexforencich/verilog-uart (DOES NOT WORK ON OPENXC7, UberDDR3 cannot finish calibration when this UART is used)
160
+ // uart #(.DATA_WIDTH(8)) uart_m
161
+ // (
162
+ // .clk(i_controller_clk),
163
+ // .rst(i_rst),
164
+ // .s_axis_tdata(o_wb_data),
165
+ // .s_axis_tvalid(o_wb_ack),
166
+ // .s_axis_tready(),
167
+ // .m_axis_tdata(rd_data),
168
+ // .m_axis_tvalid(m_axis_tvalid),
169
+ // .m_axis_tready(1),
170
+ // .rxd(rx),
171
+ // .txd(tx),
172
+ // .prescale(1085) //9600 Baud Rate (83.33MHz/(8*9600))
173
+ // );
174
+
175
+ // DDR3 Controller
176
+ ddr3_top #(
177
+ .CONTROLLER_CLK_PERIOD(12_000), //ps, clock period of the controller interface
178
+ .DDR3_CLK_PERIOD(3_000), //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
179
+ .ROW_BITS(14), //width of row address
180
+ .COL_BITS(10), //width of column address
181
+ .BA_BITS(3), //width of bank address
182
+ .BYTE_LANES(2), //number of DDR3 modules to be controlled
183
+ .AUX_WIDTH(4), //width of aux line (must be >= 4)
184
+ .WB2_ADDR_BITS(32), //width of 2nd wishbone address bus
185
+ .WB2_DATA_BITS(32), //width of 2nd wishbone data bus
186
+ .MICRON_SIM(0), //enable faster simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
187
+ .ODELAY_SUPPORTED(0), //set to 1 when ODELAYE2 is supported
188
+ .SECOND_WISHBONE(0), //set to 1 if 2nd wishbone is needed
189
+ .ECC_ENABLE(0), // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
190
+ .WB_ERROR(0), // set to 1 to support Wishbone error (asserts at ECC double bit error)
191
+ .BIST_MODE(1), // 0 = No BIST, 1 = run through all address space ONCE , 2 = run through all address space for every test (burst w/r, random w/r, alternating r/w)
192
+ .SPEED_BIN(1) // 0 = Use top-level parameters , 1 = DDR3-1066 (7-7-7) , 2 = DR3-1333 (9-9-9) , 3 = DDR3-1600 (11-11-11)
193
+ ) ddr3_top
194
+ (
195
+ //clock and reset
196
+ .i_controller_clk(i_controller_clk),
197
+ .i_ddr3_clk(i_ddr3_clk), //i_controller_clk has period of CONTROLLER_CLK_PERIOD, i_ddr3_clk has period of DDR3_CLK_PERIOD
198
+ .i_ref_clk(i_ref_clk),
199
+ .i_ddr3_clk_90(i_ddr3_clk_90),
200
+ .i_rst_n(!i_rst && clk_locked && !user_temp_alarm_out),
201
+ // Wishbone inputs
202
+ .i_wb_cyc(1), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
203
+ .i_wb_stb(i_wb_stb), //request a transfer
204
+ .i_wb_we(i_wb_we), //write-enable (1 = write, 0 = read)
205
+ .i_wb_addr(i_wb_addr), //burst-addressable {row,bank,col}
206
+ .i_wb_data(i_wb_data), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
207
+ .i_wb_sel(16'hffff), //byte strobe for write (1 = write the byte)
208
+ .i_aux(i_wb_we), //for AXI-interface compatibility (given upon strobe)
209
+ // Wishbone outputs
210
+ .o_wb_stall(o_wb_stall), //1 = busy, cannot accept requests
211
+ .o_wb_ack(o_wb_ack), //1 = read/write request has completed
212
+ .o_wb_err(), //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
213
+ .o_wb_data(o_wb_data), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
214
+ .o_aux(),
215
+ // Wishbone 2 (PHY) inputs
216
+ .i_wb2_cyc(), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
217
+ .i_wb2_stb(), //request a transfer
218
+ .i_wb2_we(), //write-enable (1 = write, 0 = read)
219
+ .i_wb2_addr(), //burst-addressable {row,bank,col}
220
+ .i_wb2_data(), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
221
+ .i_wb2_sel(), //byte strobe for write (1 = write the byte)
222
+ // Wishbone 2 (Controller) outputs
223
+ .o_wb2_stall(), //1 = busy, cannot accept requests
224
+ .o_wb2_ack(), //1 = read/write request has completed
225
+ .o_wb2_data(), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
226
+ // PHY Interface (to be added later)
227
+ // DDR3 I/O Interface
228
+ .o_ddr3_clk_p(ddr3_clk_p),
229
+ .o_ddr3_clk_n(ddr3_clk_n),
230
+ .o_ddr3_reset_n(ddr3_reset_n),
231
+ .o_ddr3_cke(ddr3_cke), // CKE
232
+ .o_ddr3_cs_n(ddr3_cs_n), // chip select signal (controls rank 1 only)
233
+ .o_ddr3_ras_n(ddr3_ras_n), // RAS#
234
+ .o_ddr3_cas_n(ddr3_cas_n), // CAS#
235
+ .o_ddr3_we_n(ddr3_we_n), // WE#
236
+ .o_ddr3_addr(ddr3_addr),
237
+ .o_ddr3_ba_addr(ddr3_ba),
238
+ .io_ddr3_dq(ddr3_dq),
239
+ .io_ddr3_dqs(ddr3_dqs_p),
240
+ .io_ddr3_dqs_n(ddr3_dqs_n),
241
+ .o_ddr3_dm(ddr3_dm),
242
+ .o_ddr3_odt(ddr3_odt), // on-die termination
243
+ .o_debug1(o_debug1)
244
+ );
245
+
246
+ endmodule
247
+
AngeloJacobo_UberDDR3/example_demo/arty_s7/arty_ddr3.xdc ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## This file is a general .xdc for the Arty S7-50 Rev. E
2
+ ## To use it in a project:
3
+ ## - uncomment the lines corresponding to used pins
4
+ ## - rename the used ports (in each line, after get_ports) according to the top level signal names in the project
5
+
6
+ ## Clock Signals
7
+ set_property -dict {PACKAGE_PIN R2 IOSTANDARD SSTL135} [get_ports i_clk]
8
+ create_clock -period 10.000 -name sys_clk_pin -waveform {0.000 5.000} -add [get_ports i_clk]
9
+
10
+ ## LEDs
11
+ set_property -dict {PACKAGE_PIN E18 IOSTANDARD LVCMOS33} [get_ports {led[0]}]
12
+ set_property -dict {PACKAGE_PIN F13 IOSTANDARD LVCMOS33} [get_ports {led[1]}]
13
+ set_property -dict {PACKAGE_PIN E13 IOSTANDARD LVCMOS33} [get_ports {led[2]}]
14
+ set_property -dict {PACKAGE_PIN H15 IOSTANDARD LVCMOS33} [get_ports {led[3]}]
15
+
16
+ ## Buttons
17
+ set_property -dict {PACKAGE_PIN G15 IOSTANDARD LVCMOS33} [get_ports i_rst]
18
+
19
+ ## USB-UART Interface
20
+ set_property -dict {PACKAGE_PIN R12 IOSTANDARD LVCMOS33} [get_ports tx]
21
+ set_property -dict {PACKAGE_PIN V12 IOSTANDARD LVCMOS33} [get_ports rx]
22
+
23
+
24
+ ############## DDR3 ##################
25
+ # DQ PINS
26
+ set_property SLEW FAST [get_ports {ddr3_dq[0]}]
27
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[0]}]
28
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[0]}]
29
+ set_property PACKAGE_PIN K2 [get_ports {ddr3_dq[0]}]
30
+
31
+ set_property SLEW FAST [get_ports {ddr3_dq[1]}]
32
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[1]}]
33
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[1]}]
34
+ set_property PACKAGE_PIN K3 [get_ports {ddr3_dq[1]}]
35
+
36
+ set_property SLEW FAST [get_ports {ddr3_dq[2]}]
37
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[2]}]
38
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[2]}]
39
+ set_property PACKAGE_PIN L4 [get_ports {ddr3_dq[2]}]
40
+
41
+ set_property SLEW FAST [get_ports {ddr3_dq[3]}]
42
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[3]}]
43
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[3]}]
44
+ set_property PACKAGE_PIN M6 [get_ports {ddr3_dq[3]}]
45
+
46
+ set_property SLEW FAST [get_ports {ddr3_dq[4]}]
47
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[4]}]
48
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[4]}]
49
+ set_property PACKAGE_PIN K6 [get_ports {ddr3_dq[4]}]
50
+
51
+ set_property SLEW FAST [get_ports {ddr3_dq[5]}]
52
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[5]}]
53
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[5]}]
54
+ set_property PACKAGE_PIN M4 [get_ports {ddr3_dq[5]}]
55
+
56
+ set_property SLEW FAST [get_ports {ddr3_dq[6]}]
57
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[6]}]
58
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[6]}]
59
+ set_property PACKAGE_PIN L5 [get_ports {ddr3_dq[6]}]
60
+
61
+ set_property SLEW FAST [get_ports {ddr3_dq[7]}]
62
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[7]}]
63
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[7]}]
64
+ set_property PACKAGE_PIN L6 [get_ports {ddr3_dq[7]}]
65
+
66
+ set_property SLEW FAST [get_ports {ddr3_dq[8]}]
67
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[8]}]
68
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[8]}]
69
+ set_property PACKAGE_PIN N4 [get_ports {ddr3_dq[8]}]
70
+
71
+ set_property SLEW FAST [get_ports {ddr3_dq[9]}]
72
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[9]}]
73
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[9]}]
74
+ set_property PACKAGE_PIN R1 [get_ports {ddr3_dq[9]}]
75
+
76
+ set_property SLEW FAST [get_ports {ddr3_dq[10]}]
77
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[10]}]
78
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[10]}]
79
+ set_property PACKAGE_PIN N1 [get_ports {ddr3_dq[10]}]
80
+
81
+ set_property SLEW FAST [get_ports {ddr3_dq[11]}]
82
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[11]}]
83
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[11]}]
84
+ set_property PACKAGE_PIN N5 [get_ports {ddr3_dq[11]}]
85
+
86
+ set_property SLEW FAST [get_ports {ddr3_dq[12]}]
87
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[12]}]
88
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[12]}]
89
+ set_property PACKAGE_PIN M2 [get_ports {ddr3_dq[12]}]
90
+
91
+ set_property SLEW FAST [get_ports {ddr3_dq[13]}]
92
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[13]}]
93
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[13]}]
94
+ set_property PACKAGE_PIN P1 [get_ports {ddr3_dq[13]}]
95
+
96
+ set_property SLEW FAST [get_ports {ddr3_dq[14]}]
97
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[14]}]
98
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[14]}]
99
+ set_property PACKAGE_PIN M1 [get_ports {ddr3_dq[14]}]
100
+
101
+ set_property SLEW FAST [get_ports {ddr3_dq[15]}]
102
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[15]}]
103
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[15]}]
104
+ set_property PACKAGE_PIN P2 [get_ports {ddr3_dq[15]}]
105
+
106
+ # Address Pins
107
+ set_property SLEW FAST [get_ports {ddr3_addr[13]}]
108
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[13]}]
109
+ set_property PACKAGE_PIN U6 [get_ports {ddr3_addr[13]}]
110
+
111
+ set_property SLEW FAST [get_ports {ddr3_addr[12]}]
112
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[12]}]
113
+ set_property PACKAGE_PIN R6 [get_ports {ddr3_addr[12]}]
114
+
115
+ set_property SLEW FAST [get_ports {ddr3_addr[11]}]
116
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[11]}]
117
+ set_property PACKAGE_PIN T5 [get_ports {ddr3_addr[11]}]
118
+
119
+ set_property SLEW FAST [get_ports {ddr3_addr[10]}]
120
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[10]}]
121
+ set_property PACKAGE_PIN P6 [get_ports {ddr3_addr[10]}]
122
+
123
+ set_property SLEW FAST [get_ports {ddr3_addr[9]}]
124
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[9]}]
125
+ set_property PACKAGE_PIN V7 [get_ports {ddr3_addr[9]}]
126
+
127
+ set_property SLEW FAST [get_ports {ddr3_addr[8]}]
128
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[8]}]
129
+ set_property PACKAGE_PIN U7 [get_ports {ddr3_addr[8]}]
130
+
131
+ set_property SLEW FAST [get_ports {ddr3_addr[7]}]
132
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[7]}]
133
+ set_property PACKAGE_PIN T6 [get_ports {ddr3_addr[7]}]
134
+
135
+ set_property SLEW FAST [get_ports {ddr3_addr[6]}]
136
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[6]}]
137
+ set_property PACKAGE_PIN V6 [get_ports {ddr3_addr[6]}]
138
+
139
+ set_property SLEW FAST [get_ports {ddr3_addr[5]}]
140
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[5]}]
141
+ set_property PACKAGE_PIN R7 [get_ports {ddr3_addr[5]}]
142
+
143
+ set_property SLEW FAST [get_ports {ddr3_addr[4]}]
144
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[4]}]
145
+ set_property PACKAGE_PIN T3 [get_ports {ddr3_addr[4]}]
146
+
147
+ set_property SLEW FAST [get_ports {ddr3_addr[3]}]
148
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[3]}]
149
+ set_property PACKAGE_PIN V4 [get_ports {ddr3_addr[3]}]
150
+
151
+ set_property SLEW FAST [get_ports {ddr3_addr[2]}]
152
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[2]}]
153
+ set_property PACKAGE_PIN V2 [get_ports {ddr3_addr[2]}]
154
+
155
+ set_property SLEW FAST [get_ports {ddr3_addr[1]}]
156
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[1]}]
157
+ set_property PACKAGE_PIN R4 [get_ports {ddr3_addr[1]}]
158
+
159
+ set_property SLEW FAST [get_ports {ddr3_addr[0]}]
160
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[0]}]
161
+ set_property PACKAGE_PIN U2 [get_ports {ddr3_addr[0]}]
162
+
163
+ # Bank Pins
164
+ set_property SLEW FAST [get_ports {ddr3_ba[2]}]
165
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_ba[2]}]
166
+ set_property PACKAGE_PIN U3 [get_ports {ddr3_ba[2]}]
167
+
168
+ set_property SLEW FAST [get_ports {ddr3_ba[1]}]
169
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_ba[1]}]
170
+ set_property PACKAGE_PIN T1 [get_ports {ddr3_ba[1]}]
171
+
172
+ set_property SLEW FAST [get_ports {ddr3_ba[0]}]
173
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_ba[0]}]
174
+ set_property PACKAGE_PIN V5 [get_ports {ddr3_ba[0]}]
175
+
176
+ # Command Pins
177
+ set_property SLEW FAST [get_ports ddr3_ras_n]
178
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_ras_n]
179
+ set_property PACKAGE_PIN U1 [get_ports ddr3_ras_n]
180
+
181
+ set_property SLEW FAST [get_ports ddr3_cas_n]
182
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_cas_n]
183
+ set_property PACKAGE_PIN V3 [get_ports ddr3_cas_n]
184
+
185
+ set_property SLEW FAST [get_ports ddr3_we_n]
186
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_we_n]
187
+ set_property PACKAGE_PIN P7 [get_ports ddr3_we_n]
188
+
189
+ set_property SLEW FAST [get_ports ddr3_reset_n]
190
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_reset_n]
191
+ set_property PACKAGE_PIN J6 [get_ports ddr3_reset_n]
192
+
193
+ set_property SLEW FAST [get_ports ddr3_cke]
194
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_cke]
195
+ set_property PACKAGE_PIN T2 [get_ports ddr3_cke]
196
+
197
+
198
+ set_property SLEW FAST [get_ports ddr3_odt]
199
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_odt]
200
+ set_property PACKAGE_PIN P5 [get_ports ddr3_odt]
201
+
202
+
203
+ set_property SLEW FAST [get_ports ddr3_cs_n]
204
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_cs_n]
205
+ set_property PACKAGE_PIN R3 [get_ports ddr3_cs_n]
206
+
207
+ # Data Mask Pins
208
+ set_property SLEW FAST [get_ports {ddr3_dm[0]}]
209
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dm[0]}]
210
+ set_property PACKAGE_PIN K4 [get_ports {ddr3_dm[0]}]
211
+
212
+ set_property SLEW FAST [get_ports {ddr3_dm[1]}]
213
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dm[1]}]
214
+ set_property PACKAGE_PIN M3 [get_ports {ddr3_dm[1]}]
215
+
216
+ # DQS Pins
217
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[0]}]
218
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_p[0]}]
219
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports {ddr3_dqs_p[0]}]
220
+
221
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[0]}]
222
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_n[0]}]
223
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports {ddr3_dqs_n[0]}]
224
+ set_property PACKAGE_PIN K1 [get_ports {ddr3_dqs_p[0]}]
225
+ set_property PACKAGE_PIN L1 [get_ports {ddr3_dqs_n[0]}]
226
+
227
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[1]}]
228
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_p[1]}]
229
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports {ddr3_dqs_p[1]}]
230
+
231
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[1]}]
232
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_n[1]}]
233
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports {ddr3_dqs_n[1]}]
234
+ set_property PACKAGE_PIN N3 [get_ports {ddr3_dqs_p[1]}]
235
+ set_property PACKAGE_PIN N2 [get_ports {ddr3_dqs_n[1]}]
236
+
237
+ # Clock Pins
238
+ set_property SLEW FAST [get_ports ddr3_clk_p]
239
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports ddr3_clk_p]
240
+
241
+ set_property SLEW FAST [get_ports ddr3_clk_n]
242
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports ddr3_clk_n]
243
+ set_property PACKAGE_PIN R5 [get_ports ddr3_clk_p]
244
+ set_property PACKAGE_PIN T4 [get_ports ddr3_clk_n]
245
+
246
+
247
+
248
+
249
+
250
+ ## Configuration options, can be used for all designs
251
+ set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]
252
+ set_property CONFIG_VOLTAGE 3.3 [current_design]
253
+ set_property CFGBVS VCCO [current_design]
254
+ set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]
255
+ set_property CONFIG_MODE SPIx4 [current_design]
256
+
257
+ ## SW3 is assigned to a pin M5 in the 1.35v bank. This pin can also be used as
258
+ ## the VREF for BANK 34. To ensure that SW3 does not define the reference voltage
259
+ ## and to be able to use this pin as an ordinary I/O the following property must
260
+ ## be set to enable an internal VREF for BANK 34. Since a 1.35v supply is being
261
+ ## used the internal reference is set to half that value (i.e. 0.675v). Note that
262
+ ## this property must be set even if SW3 is not used in the design.
263
+ # set_property INTERNAL_VREF 0.675 [get_iobanks 34]
264
+
265
+
AngeloJacobo_UberDDR3/example_demo/arty_s7/arty_ddr3_vivado.xdc ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## This file is a general .xdc for the Arty S7-50 Rev. E
2
+ ## To use it in a project:
3
+ ## - uncomment the lines corresponding to used pins
4
+ ## - rename the used ports (in each line, after get_ports) according to the top level signal names in the project
5
+
6
+ ## Clock Signals
7
+ set_property -dict {PACKAGE_PIN R2 IOSTANDARD SSTL135} [get_ports i_clk]
8
+ create_clock -period 10.000 -name sys_clk_pin -waveform {0.000 5.000} -add [get_ports i_clk]
9
+
10
+ ## LEDs
11
+ set_property -dict {PACKAGE_PIN E18 IOSTANDARD LVCMOS33} [get_ports {led[0]}]
12
+ set_property -dict {PACKAGE_PIN F13 IOSTANDARD LVCMOS33} [get_ports {led[1]}]
13
+ set_property -dict {PACKAGE_PIN E13 IOSTANDARD LVCMOS33} [get_ports {led[2]}]
14
+ set_property -dict {PACKAGE_PIN H15 IOSTANDARD LVCMOS33} [get_ports {led[3]}]
15
+
16
+ ## Buttons
17
+ set_property -dict {PACKAGE_PIN G15 IOSTANDARD LVCMOS33} [get_ports i_rst]
18
+
19
+ ## USB-UART Interface
20
+ set_property -dict {PACKAGE_PIN R12 IOSTANDARD LVCMOS33} [get_ports tx]
21
+ set_property -dict {PACKAGE_PIN V12 IOSTANDARD LVCMOS33} [get_ports rx]
22
+
23
+
24
+ ############## DDR3 ##################
25
+ # DQ PINS
26
+ set_property SLEW FAST [get_ports {ddr3_dq[0]}]
27
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[0]}]
28
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[0]}]
29
+ set_property PACKAGE_PIN K2 [get_ports {ddr3_dq[0]}]
30
+
31
+ set_property SLEW FAST [get_ports {ddr3_dq[1]}]
32
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[1]}]
33
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[1]}]
34
+ set_property PACKAGE_PIN K3 [get_ports {ddr3_dq[1]}]
35
+
36
+ set_property SLEW FAST [get_ports {ddr3_dq[2]}]
37
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[2]}]
38
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[2]}]
39
+ set_property PACKAGE_PIN L4 [get_ports {ddr3_dq[2]}]
40
+
41
+ set_property SLEW FAST [get_ports {ddr3_dq[3]}]
42
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[3]}]
43
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[3]}]
44
+ set_property PACKAGE_PIN M6 [get_ports {ddr3_dq[3]}]
45
+
46
+ set_property SLEW FAST [get_ports {ddr3_dq[4]}]
47
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[4]}]
48
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[4]}]
49
+ set_property PACKAGE_PIN K6 [get_ports {ddr3_dq[4]}]
50
+
51
+ set_property SLEW FAST [get_ports {ddr3_dq[5]}]
52
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[5]}]
53
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[5]}]
54
+ set_property PACKAGE_PIN M4 [get_ports {ddr3_dq[5]}]
55
+
56
+ set_property SLEW FAST [get_ports {ddr3_dq[6]}]
57
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[6]}]
58
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[6]}]
59
+ set_property PACKAGE_PIN L5 [get_ports {ddr3_dq[6]}]
60
+
61
+ set_property SLEW FAST [get_ports {ddr3_dq[7]}]
62
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[7]}]
63
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[7]}]
64
+ set_property PACKAGE_PIN L6 [get_ports {ddr3_dq[7]}]
65
+
66
+ set_property SLEW FAST [get_ports {ddr3_dq[8]}]
67
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[8]}]
68
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[8]}]
69
+ set_property PACKAGE_PIN N4 [get_ports {ddr3_dq[8]}]
70
+
71
+ set_property SLEW FAST [get_ports {ddr3_dq[9]}]
72
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[9]}]
73
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[9]}]
74
+ set_property PACKAGE_PIN R1 [get_ports {ddr3_dq[9]}]
75
+
76
+ set_property SLEW FAST [get_ports {ddr3_dq[10]}]
77
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[10]}]
78
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[10]}]
79
+ set_property PACKAGE_PIN N1 [get_ports {ddr3_dq[10]}]
80
+
81
+ set_property SLEW FAST [get_ports {ddr3_dq[11]}]
82
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[11]}]
83
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[11]}]
84
+ set_property PACKAGE_PIN N5 [get_ports {ddr3_dq[11]}]
85
+
86
+ set_property SLEW FAST [get_ports {ddr3_dq[12]}]
87
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[12]}]
88
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[12]}]
89
+ set_property PACKAGE_PIN M2 [get_ports {ddr3_dq[12]}]
90
+
91
+ set_property SLEW FAST [get_ports {ddr3_dq[13]}]
92
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[13]}]
93
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[13]}]
94
+ set_property PACKAGE_PIN P1 [get_ports {ddr3_dq[13]}]
95
+
96
+ set_property SLEW FAST [get_ports {ddr3_dq[14]}]
97
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[14]}]
98
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[14]}]
99
+ set_property PACKAGE_PIN M1 [get_ports {ddr3_dq[14]}]
100
+
101
+ set_property SLEW FAST [get_ports {ddr3_dq[15]}]
102
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dq[15]}]
103
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dq[15]}]
104
+ set_property PACKAGE_PIN P2 [get_ports {ddr3_dq[15]}]
105
+
106
+ # Address Pins
107
+ set_property SLEW FAST [get_ports {ddr3_addr[13]}]
108
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[13]}]
109
+ set_property PACKAGE_PIN U6 [get_ports {ddr3_addr[13]}]
110
+
111
+ set_property SLEW FAST [get_ports {ddr3_addr[12]}]
112
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[12]}]
113
+ set_property PACKAGE_PIN R6 [get_ports {ddr3_addr[12]}]
114
+
115
+ set_property SLEW FAST [get_ports {ddr3_addr[11]}]
116
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[11]}]
117
+ set_property PACKAGE_PIN T5 [get_ports {ddr3_addr[11]}]
118
+
119
+ set_property SLEW FAST [get_ports {ddr3_addr[10]}]
120
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[10]}]
121
+ set_property PACKAGE_PIN P6 [get_ports {ddr3_addr[10]}]
122
+
123
+ set_property SLEW FAST [get_ports {ddr3_addr[9]}]
124
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[9]}]
125
+ set_property PACKAGE_PIN V7 [get_ports {ddr3_addr[9]}]
126
+
127
+ set_property SLEW FAST [get_ports {ddr3_addr[8]}]
128
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[8]}]
129
+ set_property PACKAGE_PIN U7 [get_ports {ddr3_addr[8]}]
130
+
131
+ set_property SLEW FAST [get_ports {ddr3_addr[7]}]
132
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[7]}]
133
+ set_property PACKAGE_PIN T6 [get_ports {ddr3_addr[7]}]
134
+
135
+ set_property SLEW FAST [get_ports {ddr3_addr[6]}]
136
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[6]}]
137
+ set_property PACKAGE_PIN V6 [get_ports {ddr3_addr[6]}]
138
+
139
+ set_property SLEW FAST [get_ports {ddr3_addr[5]}]
140
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[5]}]
141
+ set_property PACKAGE_PIN R7 [get_ports {ddr3_addr[5]}]
142
+
143
+ set_property SLEW FAST [get_ports {ddr3_addr[4]}]
144
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[4]}]
145
+ set_property PACKAGE_PIN T3 [get_ports {ddr3_addr[4]}]
146
+
147
+ set_property SLEW FAST [get_ports {ddr3_addr[3]}]
148
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[3]}]
149
+ set_property PACKAGE_PIN V4 [get_ports {ddr3_addr[3]}]
150
+
151
+ set_property SLEW FAST [get_ports {ddr3_addr[2]}]
152
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[2]}]
153
+ set_property PACKAGE_PIN V2 [get_ports {ddr3_addr[2]}]
154
+
155
+ set_property SLEW FAST [get_ports {ddr3_addr[1]}]
156
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[1]}]
157
+ set_property PACKAGE_PIN R4 [get_ports {ddr3_addr[1]}]
158
+
159
+ set_property SLEW FAST [get_ports {ddr3_addr[0]}]
160
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_addr[0]}]
161
+ set_property PACKAGE_PIN U2 [get_ports {ddr3_addr[0]}]
162
+
163
+ # Bank Pins
164
+ set_property SLEW FAST [get_ports {ddr3_ba[2]}]
165
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_ba[2]}]
166
+ set_property PACKAGE_PIN U3 [get_ports {ddr3_ba[2]}]
167
+
168
+ set_property SLEW FAST [get_ports {ddr3_ba[1]}]
169
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_ba[1]}]
170
+ set_property PACKAGE_PIN T1 [get_ports {ddr3_ba[1]}]
171
+
172
+ set_property SLEW FAST [get_ports {ddr3_ba[0]}]
173
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_ba[0]}]
174
+ set_property PACKAGE_PIN V5 [get_ports {ddr3_ba[0]}]
175
+
176
+ # Command Pins
177
+ set_property SLEW FAST [get_ports ddr3_ras_n]
178
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_ras_n]
179
+ set_property PACKAGE_PIN U1 [get_ports ddr3_ras_n]
180
+
181
+ set_property SLEW FAST [get_ports ddr3_cas_n]
182
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_cas_n]
183
+ set_property PACKAGE_PIN V3 [get_ports ddr3_cas_n]
184
+
185
+ set_property SLEW FAST [get_ports ddr3_we_n]
186
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_we_n]
187
+ set_property PACKAGE_PIN P7 [get_ports ddr3_we_n]
188
+
189
+ set_property SLEW FAST [get_ports ddr3_reset_n]
190
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_reset_n]
191
+ set_property PACKAGE_PIN J6 [get_ports ddr3_reset_n]
192
+
193
+ set_property SLEW FAST [get_ports ddr3_cke]
194
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_cke]
195
+ set_property PACKAGE_PIN T2 [get_ports ddr3_cke]
196
+
197
+
198
+ set_property SLEW FAST [get_ports ddr3_odt]
199
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_odt]
200
+ set_property PACKAGE_PIN P5 [get_ports ddr3_odt]
201
+
202
+
203
+ set_property SLEW FAST [get_ports ddr3_cs_n]
204
+ set_property IOSTANDARD SSTL135 [get_ports ddr3_cs_n]
205
+ set_property PACKAGE_PIN R3 [get_ports ddr3_cs_n]
206
+
207
+ # Data Mask Pins
208
+ set_property SLEW FAST [get_ports {ddr3_dm[0]}]
209
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dm[0]}]
210
+ set_property PACKAGE_PIN K4 [get_ports {ddr3_dm[0]}]
211
+
212
+ set_property SLEW FAST [get_ports {ddr3_dm[1]}]
213
+ set_property IOSTANDARD SSTL135 [get_ports {ddr3_dm[1]}]
214
+ set_property PACKAGE_PIN M3 [get_ports {ddr3_dm[1]}]
215
+
216
+ # DQS Pins
217
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[0]}]
218
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_p[0]}]
219
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports {ddr3_dqs_p[0]}]
220
+
221
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[0]}]
222
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_n[0]}]
223
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports {ddr3_dqs_n[0]}]
224
+ set_property PACKAGE_PIN K1 [get_ports {ddr3_dqs_p[0]}]
225
+ set_property PACKAGE_PIN L1 [get_ports {ddr3_dqs_n[0]}]
226
+
227
+ set_property SLEW FAST [get_ports {ddr3_dqs_p[1]}]
228
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_p[1]}]
229
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports {ddr3_dqs_p[1]}]
230
+
231
+ set_property SLEW FAST [get_ports {ddr3_dqs_n[1]}]
232
+ set_property IN_TERM UNTUNED_SPLIT_50 [get_ports {ddr3_dqs_n[1]}]
233
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports {ddr3_dqs_n[1]}]
234
+ set_property PACKAGE_PIN N3 [get_ports {ddr3_dqs_p[1]}]
235
+ set_property PACKAGE_PIN N2 [get_ports {ddr3_dqs_n[1]}]
236
+
237
+ # Clock Pins
238
+ set_property SLEW FAST [get_ports ddr3_clk_p]
239
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports ddr3_clk_p]
240
+
241
+ set_property SLEW FAST [get_ports ddr3_clk_n]
242
+ set_property IOSTANDARD DIFF_SSTL135 [get_ports ddr3_clk_n]
243
+ set_property PACKAGE_PIN R5 [get_ports ddr3_clk_p]
244
+ set_property PACKAGE_PIN T4 [get_ports ddr3_clk_n]
245
+
246
+
247
+
248
+
249
+
250
+ ## Configuration options, can be used for all designs
251
+ set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]
252
+ set_property CONFIG_VOLTAGE 3.3 [current_design]
253
+ set_property CFGBVS VCCO [current_design]
254
+ set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]
255
+ set_property CONFIG_MODE SPIx4 [current_design]
256
+
257
+ ## SW3 is assigned to a pin M5 in the 1.35v bank. This pin can also be used as
258
+ ## the VREF for BANK 34. To ensure that SW3 does not define the reference voltage
259
+ ## and to be able to use this pin as an ordinary I/O the following property must
260
+ ## be set to enable an internal VREF for BANK 34. Since a 1.35v supply is being
261
+ ## used the internal reference is set to half that value (i.e. 0.675v). Note that
262
+ ## this property must be set even if SW3 is not used in the design.
263
+ set_property INTERNAL_VREF 0.675 [get_iobanks 34]
264
+
265
+
AngeloJacobo_UberDDR3/example_demo/arty_s7/caas.conf ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ Backend = openxc7
3
+ Part = xc7s50csga324-1
4
+ Top = arty_ddr3
5
+ Constraint = arty_ddr3.xdc
6
+ Sources = *.v
7
+
8
+ [caas]
9
+ Server = https://caas.symbioticeda.com:18888/
10
+
11
+
AngeloJacobo_UberDDR3/example_demo/arty_s7/clk_wiz.v ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ `timescale 1ps/1ps
2
+
3
+ module clk_wiz
4
+ (
5
+ input wire clk_in1,
6
+ output wire clk_out1,
7
+ output wire clk_out2,
8
+ output wire clk_out3,
9
+ output wire clk_out4,
10
+ input wire reset,
11
+ output wire locked
12
+ );
13
+ wire clk_out1_clk_wiz_0;
14
+ wire clk_out2_clk_wiz_0;
15
+ wire clk_out3_clk_wiz_0;
16
+ wire clk_out4_clk_wiz_0;
17
+
18
+ wire clkfbout;
19
+
20
+ PLLE2_ADV
21
+ #(.BANDWIDTH ("OPTIMIZED"),
22
+ .COMPENSATION ("INTERNAL"),
23
+ .STARTUP_WAIT ("FALSE"),
24
+ .DIVCLK_DIVIDE (1),
25
+ .CLKFBOUT_MULT (12), // 100 MHz * 12 = 1200 MHz
26
+ .CLKFBOUT_PHASE (0.000),
27
+ .CLKOUT0_DIVIDE (12), // 1200 MHz / 12 = 100 MHz
28
+ .CLKOUT0_PHASE (0.000),
29
+ .CLKOUT0_DUTY_CYCLE (0.500),
30
+ .CLKOUT1_DIVIDE (3), // 1200 MHz / 3 = 400 MHz
31
+ .CLKOUT1_PHASE (0.000),
32
+ .CLKOUT1_DUTY_CYCLE (0.500),
33
+ .CLKOUT2_DIVIDE (6), // 1200 MHz / 6 = 200 MHz
34
+ .CLKOUT2_PHASE (0.000),
35
+ .CLKOUT2_DUTY_CYCLE (0.500),
36
+ .CLKOUT3_DIVIDE (3), // 1200 MHz / 3 = 400 MHz, 90 phase
37
+ .CLKOUT3_PHASE (90.000),
38
+ .CLKOUT3_DUTY_CYCLE (0.500),
39
+ .CLKIN1_PERIOD (10.000) // 100 MHz input
40
+ )
41
+ plle2_adv_inst
42
+ (
43
+ .CLKFBOUT (clkfbout),
44
+ .CLKOUT0 (clk_out1_clk_wiz_0),
45
+ .CLKOUT1 (clk_out2_clk_wiz_0),
46
+ .CLKOUT2 (clk_out3_clk_wiz_0),
47
+ .CLKOUT3 (clk_out4_clk_wiz_0),
48
+ .CLKFBIN (clkfbout),
49
+ .CLKIN1 (clk_in1),
50
+ .LOCKED (locked),
51
+ .RST (reset)
52
+ );
53
+ BUFG clkout1_buf
54
+ (.O (clk_out1),
55
+ .I (clk_out1_clk_wiz_0));
56
+ BUFG clkout2_buf
57
+ (.O (clk_out2),
58
+ .I (clk_out2_clk_wiz_0));
59
+ BUFG clkout3_buf
60
+ (.O (clk_out3),
61
+ .I (clk_out3_clk_wiz_0));
62
+ BUFG clkout4_buf
63
+ (.O (clk_out4),
64
+ .I (clk_out4_clk_wiz_0));
65
+
66
+ endmodule
AngeloJacobo_UberDDR3/example_demo/arty_s7/ddr3_controller.v ADDED
The diff for this file is too large to render. See raw diff
 
AngeloJacobo_UberDDR3/example_demo/arty_s7/ddr3_phy.v ADDED
@@ -0,0 +1,1462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ddr3_phy.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: PHY component for the DDR3 controller. Handles the primitives such
7
+ // as IOSERDES, IODELAY, and IOBUF. These generates the signals connected to
8
+ // the DDR3 RAM.
9
+ //
10
+ // Engineer: Angelo C. Jacobo
11
+ //
12
+ ////////////////////////////////////////////////////////////////////////////////
13
+ //
14
+ // Copyright (C) 2023-2025 Angelo Jacobo
15
+ //
16
+ // This program is free software: you can redistribute it and/or modify
17
+ // it under the terms of the GNU General Public License as published by
18
+ // the Free Software Foundation, either version 3 of the License, or
19
+ // (at your option) any later version.
20
+ //
21
+ // This program is distributed in the hope that it will be useful,
22
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ // GNU General Public License for more details.
25
+ //
26
+ // You should have received a copy of the GNU General Public License
27
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
28
+ //
29
+ ////////////////////////////////////////////////////////////////////////////////
30
+
31
+ `default_nettype none
32
+ `timescale 1ps / 1ps
33
+ //`define DEBUG_DQS // uncomment to route the raw DQS to output port for debugging
34
+
35
+ module ddr3_phy #(
36
+ parameter CONTROLLER_CLK_PERIOD = 10_000, //ps, clock period of the controller interface
37
+ DDR3_CLK_PERIOD = 2_500, //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
38
+ ROW_BITS = 14, //width of row address
39
+ BA_BITS = 3,
40
+ DQ_BITS = 8,
41
+ LANES = 8,
42
+ DUAL_RANK_DIMM = 0, // enable dual rank DIMM (1 = enable, 0 = disable)
43
+ parameter[0:0] ODELAY_SUPPORTED = 1, //set to 1 when ODELAYE2 is supported
44
+ USE_IO_TERMINATION = 0, //use IOBUF_DCIEN and IOBUFDS_DCIEN when 1
45
+ NO_IOSERDES_LOOPBACK = 1, // don't use IOSERDES loopback for bitslip training
46
+ // The next parameters act more like a localparam (since user does not have to set this manually) but was added here to simplify port declaration
47
+ parameter serdes_ratio = 4, // this controller is fixed as a 4:1 memory controller (CONTROLLER_CLK_PERIOD/DDR3_CLK_PERIOD = 4)
48
+ wb_data_bits = DQ_BITS*LANES*serdes_ratio*2,
49
+ wb_sel_bits = wb_data_bits / 8,
50
+ //4 is the width of a single ddr3 command {cs_n, ras_n, cas_n, we_n} plus 3 (ck_en, odt, reset_n) plus bank bits plus row bits
51
+ cmd_len = 4 + 3 + BA_BITS + ROW_BITS + 2*DUAL_RANK_DIMM
52
+ )(
53
+ input wire i_controller_clk, i_ddr3_clk, i_ref_clk,
54
+ input wire i_ddr3_clk_90, //required only when ODELAY_SUPPORTED is zero
55
+ input wire i_rst_n,
56
+ // Controller Interface
57
+ input wire i_controller_reset,
58
+ input wire[cmd_len*serdes_ratio-1:0] i_controller_cmd,
59
+ input wire i_controller_dqs_tri_control, i_controller_dq_tri_control,
60
+ input wire i_controller_toggle_dqs,
61
+ input wire[wb_data_bits-1:0] i_controller_data,
62
+ input wire[wb_sel_bits-1:0] i_controller_dm,
63
+ input wire[4:0] i_controller_odelay_data_cntvaluein,i_controller_odelay_dqs_cntvaluein,
64
+ input wire[4:0] i_controller_idelay_data_cntvaluein,i_controller_idelay_dqs_cntvaluein,
65
+ input wire[LANES-1:0] i_controller_odelay_data_ld, i_controller_odelay_dqs_ld,
66
+ input wire[LANES-1:0] i_controller_idelay_data_ld, i_controller_idelay_dqs_ld,
67
+ input wire[LANES-1:0] i_controller_bitslip,
68
+ input wire i_controller_write_leveling_calib,
69
+ output wire[DQ_BITS*LANES*8-1:0] o_controller_iserdes_data,
70
+ output wire[LANES*8-1:0] o_controller_iserdes_dqs,
71
+ output wire[LANES*8-1:0] o_controller_iserdes_bitslip_reference,
72
+ output wire o_controller_idelayctrl_rdy,
73
+ // DDR3 I/O Interface
74
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_clk_p,o_ddr3_clk_n,
75
+ output wire o_ddr3_reset_n,
76
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cke, // CKE
77
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cs_n, // chip select signal
78
+ output wire o_ddr3_ras_n, // RAS#
79
+ output wire o_ddr3_cas_n, // CAS#
80
+ output wire o_ddr3_we_n, // WE#
81
+ output wire[ROW_BITS-1:0] o_ddr3_addr,
82
+ output wire[BA_BITS-1:0] o_ddr3_ba_addr,
83
+ inout wire[(DQ_BITS*LANES)-1:0] io_ddr3_dq,
84
+ inout wire[(DQ_BITS*LANES)/8-1:0] io_ddr3_dqs, io_ddr3_dqs_n,
85
+ output wire[LANES-1:0] o_ddr3_dm,
86
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_odt, // on-die termination
87
+ // DEBUG PHY
88
+ output wire[(DQ_BITS*LANES)/8-1:0] o_ddr3_debug_read_dqs_p,
89
+ output wire[(DQ_BITS*LANES)/8-1:0] o_ddr3_debug_read_dqs_n
90
+ );
91
+
92
+ // cmd bit assignment
93
+ localparam CMD_CS_N_2 = cmd_len - 1,
94
+ CMD_CS_N = DUAL_RANK_DIMM[0]? cmd_len - 2 : cmd_len - 1,
95
+ CMD_RAS_N = DUAL_RANK_DIMM[0]? cmd_len - 3 : cmd_len - 2,
96
+ CMD_CAS_N = DUAL_RANK_DIMM[0]? cmd_len - 4 : cmd_len - 3,
97
+ CMD_WE_N = DUAL_RANK_DIMM[0]? cmd_len - 5 : cmd_len - 4,
98
+ CMD_ODT = DUAL_RANK_DIMM[0]? cmd_len - 6 : cmd_len - 5,
99
+ CMD_CKE_2 = DUAL_RANK_DIMM[0]? cmd_len - 7 : cmd_len - 6,
100
+ CMD_CKE = DUAL_RANK_DIMM[0]? cmd_len - 8 : cmd_len - 6,
101
+ CMD_RESET_N = DUAL_RANK_DIMM[0]? cmd_len - 9 : cmd_len - 7,
102
+ CMD_BANK_START = BA_BITS + ROW_BITS - 1,
103
+ CMD_ADDRESS_START = ROW_BITS - 1;
104
+ localparam SYNC_RESET_DELAY = $rtoi($ceil(52_000/CONTROLLER_CLK_PERIOD)); //52_000 ps of reset pulse width required for IDELAYCTRL
105
+ //cmd needs to be center-aligned to the positive edge of the
106
+ //ddr3_clk. This means cmd needs to be delayed by half the ddr3
107
+ //clk period. Subtract by 600ps to include the IODELAY insertion
108
+ //delay. Divide by a delay resolution of 78.125ps per tap to get
109
+ //the needed tap value.
110
+ localparam CMD_ODELAY_TAP = ((DDR3_CLK_PERIOD/2) - 600)/78.125;
111
+
112
+ // Data does not have to be delayed (DQS is the on that has to be
113
+ // delayed and center-aligned to the center eye of data)
114
+ localparam DATA_ODELAY_TAP = 0;
115
+
116
+ //DQS needs to be edge-aligned to the center eye of the data.
117
+ //This means DQS needs to be delayed by a quarter of the ddr3
118
+ //clk period relative to the data. Subtract by 600ps to include
119
+ //the IODELAY insertion delay. Divide by a delay resolution of
120
+ //78.125ps per tap to get the needed tap value. Then add the tap
121
+ //value used in data to have the delay relative to the data.
122
+ localparam DQS_ODELAY_TAP = ((DDR3_CLK_PERIOD/4))/78.125 + DATA_ODELAY_TAP;
123
+
124
+ //Incoming DQS should be 90 degree delayed relative to incoming data
125
+ localparam DATA_IDELAY_TAP = 0; //600ps delay
126
+ localparam DQS_IDELAY_TAP = ((DDR3_CLK_PERIOD/4))/78.125 + DATA_IDELAY_TAP;
127
+
128
+ genvar gen_index;
129
+ wire[cmd_len-1:0] oserdes_cmd, //serialized(4:1) i_controller_cmd_slot_x
130
+ cmd;//delayed oserdes_cmd
131
+ wire[(DQ_BITS*LANES)-1:0] oserdes_data, odelay_data, idelay_data, read_dq;
132
+ wire[LANES-1:0] oserdes_dm, odelay_dm;
133
+ wire[LANES-1:0] odelay_dqs, read_dqs, idelay_dqs;
134
+ wire[DQ_BITS*LANES-1:0] oserdes_dq_tri_control;
135
+ wire[LANES-1:0] oserdes_dqs;
136
+ wire[LANES-1:0] oserdes_dqs_tri_control;
137
+ wire[LANES-1:0] oserdes_bitslip_reference;
138
+ reg[$clog2(SYNC_RESET_DELAY):0] delay_before_release_reset;
139
+ reg sync_rst = 0;
140
+ wire ddr3_clk;
141
+ reg toggle_dqs_q; //past value of i_controller_toggle_dqs
142
+ wire ddr3_clk_delayed;
143
+ wire idelayctrl_rdy;
144
+ wire dci_locked;
145
+ reg[LANES*8-1:0] o_controller_iserdes_bitslip_reference_reg;
146
+ reg[LANES - 1 : 0] shift_bitslip_index;
147
+
148
+ // initial value of bitslip reference
149
+ initial begin
150
+ o_controller_iserdes_bitslip_reference_reg = {LANES{8'b0001_1110}};
151
+ shift_bitslip_index = 0;
152
+ end
153
+
154
+ assign o_controller_idelayctrl_rdy = idelayctrl_rdy && dci_locked;
155
+
156
+ `ifdef DEBUG_DQS
157
+ assign o_ddr3_debug_read_dqs_p = io_ddr3_dqs;
158
+ assign o_ddr3_debug_read_dqs_n = io_ddr3_dqs_n;
159
+ `else
160
+ assign o_ddr3_debug_read_dqs_p = 0;
161
+ assign o_ddr3_debug_read_dqs_n = 0;
162
+ `endif
163
+
164
+ //synchronous reset
165
+ always @(posedge i_controller_clk) begin
166
+ if(!i_rst_n || i_controller_reset) begin
167
+ sync_rst <= 1'b1;
168
+ delay_before_release_reset <= SYNC_RESET_DELAY[$clog2(SYNC_RESET_DELAY):0];
169
+ toggle_dqs_q <= 0;
170
+ end
171
+ else begin
172
+ delay_before_release_reset <= (delay_before_release_reset == 0)? 0: delay_before_release_reset - 1;
173
+ sync_rst <= !(delay_before_release_reset == 0);
174
+ toggle_dqs_q <= i_controller_toggle_dqs;
175
+ end
176
+ end
177
+
178
+ //PHY cmd
179
+ generate
180
+ for(gen_index = 0; gen_index < cmd_len; gen_index = gen_index + 1) begin
181
+ // OSERDESE2: Output SERial/DESerializer with bitslip
182
+ //7 Series
183
+ // Xilinx HDL Libraries Guide, version 13.4
184
+ `ifndef SIM_MODEL
185
+ OSERDESE2 #(
186
+ `else
187
+ OSERDESE2_model #(
188
+ `endif
189
+ .DATA_RATE_OQ("SDR"), // DDR, SDR
190
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
191
+ .DATA_WIDTH(4), // Parallel data width (2-8,10,14)
192
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
193
+ .TRISTATE_WIDTH(1)
194
+ )
195
+ OSERDESE2_cmd(
196
+ .OFB(), // 1-bit output: Feedback path for data
197
+ .OQ(oserdes_cmd[gen_index]), // 1-bit output: Data path output
198
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
199
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
200
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
201
+ .D1(i_controller_cmd[cmd_len*0 + gen_index]),
202
+ .D2(i_controller_cmd[cmd_len*1 + gen_index]),
203
+ .D3(i_controller_cmd[cmd_len*2 + gen_index]),
204
+ .D4(i_controller_cmd[cmd_len*3 + gen_index]),
205
+ .OCE(1'b1), // 1-bit input: Output data clock enable
206
+ .RST(sync_rst), // 1-bit input: Reset
207
+ // unused signals but were added here to make vivado happy
208
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
209
+ .SHIFTOUT2(),
210
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
211
+ .TFB(), // 1-bit output: 3-state control
212
+ .TQ(), // 1-bit output: 3-state control
213
+ .D5(),
214
+ .D6(),
215
+ .D7(),
216
+ .D8(),
217
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
218
+ .SHIFTIN1(0),
219
+ .SHIFTIN2(0),
220
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
221
+ .T1(0),
222
+ .T2(0),
223
+ .T3(0),
224
+ .T4(0),
225
+ .TBYTEIN(0),
226
+ // 1-bit input: Byte group tristate
227
+ .TCE(0)
228
+ // 1-bit input: 3-state clock enable
229
+ );
230
+ // End of OSERDESE2_inst instantiation
231
+
232
+ end
233
+
234
+ if(DUAL_RANK_DIMM) begin // if dual rank enabled, odt_2 and odt_1 will be generated separately
235
+ // OSERDESE2: Output SERial/DESerializer with bitslip
236
+ //7 Series
237
+ // Xilinx HDL Libraries Guide, version 13.4
238
+ `ifndef SIM_MODEL
239
+ OSERDESE2 #(
240
+ `else
241
+ OSERDESE2_model #(
242
+ `endif
243
+ .DATA_RATE_OQ("SDR"), // DDR, SDR
244
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
245
+ .DATA_WIDTH(4), // Parallel data width (2-8,10,14)
246
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
247
+ .TRISTATE_WIDTH(1)
248
+ )
249
+ OSERDESE2_cmd(
250
+ .OFB(), // 1-bit output: Feedback path for data
251
+ .OQ(o_ddr3_odt[1]), // 1-bit output: Data path output
252
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
253
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
254
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
255
+ .D1(i_controller_cmd[cmd_len*0 + CMD_ODT]),
256
+ .D2(i_controller_cmd[cmd_len*1 + CMD_ODT]),
257
+ .D3(i_controller_cmd[cmd_len*2 + CMD_ODT]),
258
+ .D4(i_controller_cmd[cmd_len*3 + CMD_ODT]),
259
+ .OCE(1'b1), // 1-bit input: Output data clock enable
260
+ .RST(sync_rst), // 1-bit input: Reset
261
+ // unused signals but were added here to make vivado happy
262
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
263
+ .SHIFTOUT2(),
264
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
265
+ .TFB(), // 1-bit output: 3-state control
266
+ .TQ(), // 1-bit output: 3-state control
267
+ .D5(),
268
+ .D6(),
269
+ .D7(),
270
+ .D8(),
271
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
272
+ .SHIFTIN1(0),
273
+ .SHIFTIN2(0),
274
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
275
+ .T1(0),
276
+ .T2(0),
277
+ .T3(0),
278
+ .T4(0),
279
+ .TBYTEIN(0),
280
+ // 1-bit input: Byte group tristate
281
+ .TCE(0)
282
+ // 1-bit input: 3-state clock enable
283
+ );
284
+ // End of OSERDESE2_inst instantiation
285
+ end
286
+ endgenerate
287
+
288
+ // cs[1] when DUAL_RANK_DIMM enabled
289
+ generate
290
+ if(DUAL_RANK_DIMM) begin
291
+ assign o_ddr3_cs_n[1] = oserdes_cmd[CMD_CS_N_2];
292
+ assign o_ddr3_cs_n[0] = oserdes_cmd[CMD_CS_N];
293
+ assign o_ddr3_cke[1] = oserdes_cmd[CMD_CKE_2];
294
+ assign o_ddr3_cke[0] = oserdes_cmd[CMD_CKE];
295
+ assign o_ddr3_odt[0] = oserdes_cmd[CMD_ODT];
296
+ // o_ddr3_odt[1] will be generated directly by a separate OSERDES
297
+ // if odt[1] and odt[0] uses same output from oserdes, one of them will be unroutable
298
+ end
299
+ else begin
300
+ assign o_ddr3_cs_n = oserdes_cmd[CMD_CS_N];
301
+ assign o_ddr3_cke = oserdes_cmd[CMD_CKE];
302
+ assign o_ddr3_odt = oserdes_cmd[CMD_ODT];
303
+ end
304
+ endgenerate
305
+ assign o_ddr3_ras_n = oserdes_cmd[CMD_RAS_N],
306
+ o_ddr3_cas_n = oserdes_cmd[CMD_CAS_N],
307
+ o_ddr3_we_n = oserdes_cmd[CMD_WE_N],
308
+ o_ddr3_reset_n = oserdes_cmd[CMD_RESET_N],
309
+ o_ddr3_ba_addr = oserdes_cmd[CMD_BANK_START:CMD_ADDRESS_START+1],
310
+ o_ddr3_addr = oserdes_cmd[CMD_ADDRESS_START:0];
311
+
312
+ if(ODELAY_SUPPORTED) begin
313
+ // OSERDESE2: Output SERial/DESerializer with bitslip
314
+ //7 Series
315
+ // Xilinx HDL Libraries Guide, version 13.4
316
+ `ifndef SIM_MODEL
317
+ OSERDESE2 #(
318
+ `else
319
+ OSERDESE2_model #(
320
+ `endif
321
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
322
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
323
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
324
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
325
+ .TRISTATE_WIDTH(1)
326
+ )
327
+ OSERDESE2_clk(
328
+ .OFB(ddr3_clk), // 1-bit output: Feedback path for data
329
+ .OQ(), // 1-bit output: Data path output
330
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
331
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
332
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
333
+ .D1(1'b1),
334
+ .D2(1'b0),
335
+ .D3(1'b1),
336
+ .D4(1'b0),
337
+ .D5(1'b1),
338
+ .D6(1'b0),
339
+ .D7(1'b1),
340
+ .D8(1'b0),
341
+ .OCE(1'b1), // 1-bit input: Output data clock enable
342
+ .RST(sync_rst), // 1-bit input: Reset
343
+ // unused signals but were added here to make vivado happy
344
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
345
+ .SHIFTOUT2(),
346
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
347
+ .TFB(), // 1-bit output: 3-state control
348
+ .TQ(), // 1-bit output: 3-state control
349
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
350
+ .SHIFTIN1(0),
351
+ .SHIFTIN2(0),
352
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
353
+ .T1(0),
354
+ .T2(0),
355
+ .T3(0),
356
+ .T4(0),
357
+ .TBYTEIN(0),
358
+ // 1-bit input: Byte group tristate
359
+ .TCE(0)
360
+ // 1-bit input: 3-state clock enable
361
+ );
362
+ // End of OSERDESE2_inst instantiation
363
+
364
+ //Delay the DQ
365
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
366
+ (* IODELAY_GROUP="DDR3-GROUP" *)
367
+ `ifndef SIM_MODEL
368
+ ODELAYE2 #(
369
+ `else
370
+ ODELAYE2_model #(
371
+ `endif
372
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
373
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
374
+ .ODELAY_TYPE("FIXED"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
375
+ .ODELAY_VALUE(CMD_ODELAY_TAP), // Output delay tap setting (0-31)
376
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
377
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
378
+ )
379
+ ODELAYE2_clk (
380
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
381
+ .DATAOUT(ddr3_clk_delayed), // 1-bit output: Delayed data/clock output
382
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
383
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
384
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
385
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
386
+ .CNTVALUEIN(5'd0), // 5-bit input: Counter value input
387
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
388
+ .LD(1'b0), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
389
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
390
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
391
+ .ODATAIN(ddr3_clk), // 1-bit input: Output delay data input
392
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
393
+ );
394
+ // if dual rank enabled, then there will be two clk
395
+ if(DUAL_RANK_DIMM) begin
396
+ // OBUFDS: Differential Output Buffer
397
+ // 7 Series
398
+ // Xilinx HDL Libraries Guide, version 13.4
399
+ `ifndef SIM_MODEL
400
+ OBUFDS OBUFDS0_inst (
401
+ `else
402
+ OBUFDS_model OBUFDS0_inst (
403
+ `endif
404
+ .O(o_ddr3_clk_p[0]), // Diff_p output (connect directly to top-level port)
405
+ .OB(o_ddr3_clk_n[0]), // Diff_n output (connect directly to top-level port)
406
+ .I(ddr3_clk_delayed) // Buffer input
407
+ );
408
+ `ifndef SIM_MODEL
409
+ OBUFDS OBUFDS1_inst (
410
+ `else
411
+ OBUFDS_model OBUFDS1_inst (
412
+ `endif
413
+ .O(o_ddr3_clk_p[1]), // Diff_p output (connect directly to top-level port)
414
+ .OB(o_ddr3_clk_n[1]), // Diff_n output (connect directly to top-level port)
415
+ .I(ddr3_clk_delayed) // Buffer input
416
+ );
417
+ // End of OBUFDS_inst instantiation
418
+ end
419
+ else begin
420
+ // OBUFDS: Differential Output Buffer
421
+ // 7 Series
422
+ // Xilinx HDL Libraries Guide, version 13.4
423
+ `ifndef SIM_MODEL
424
+ OBUFDS OBUFDS_inst (
425
+ `else
426
+ OBUFDS_model OBUFDS_inst (
427
+ `endif
428
+ .O(o_ddr3_clk_p), // Diff_p output (connect directly to top-level port)
429
+ .OB(o_ddr3_clk_n), // Diff_n output (connect directly to top-level port)
430
+ .I(ddr3_clk_delayed) // Buffer input
431
+ );
432
+ // End of OBUFDS_inst instantiation
433
+ end
434
+ end
435
+ else begin //ODELAY is not supported
436
+
437
+ // if dual rank enabled, then there will be two clk
438
+ if(DUAL_RANK_DIMM) begin
439
+ // OBUFDS: Differential Output Buffer
440
+ // 7 Series
441
+ // Xilinx HDL Libraries Guide, version 13.4
442
+ `ifndef SIM_MODEL
443
+ OBUFDS OBUFDS0_inst (
444
+ `else
445
+ OBUFDS_model OBUFDS0_inst (
446
+ `endif
447
+ .O(o_ddr3_clk_p[1]), // Diff_p output (connect directly to top-level port)
448
+ .OB(o_ddr3_clk_n[1]), // Diff_n output (connect directly to top-level port)
449
+ .I(!i_ddr3_clk) // Buffer input
450
+ );
451
+ `ifndef SIM_MODEL
452
+ OBUFDS OBUFDS1_inst (
453
+ `else
454
+ OBUFDS_model OBUFDS1_inst (
455
+ `endif
456
+ .O(o_ddr3_clk_p[0]), // Diff_p output (connect directly to top-level port)
457
+ .OB(o_ddr3_clk_n[0]), // Diff_n output (connect directly to top-level port)
458
+ .I(!i_ddr3_clk) // Buffer input
459
+ );
460
+ // End of OBUFDS_inst instantiation
461
+ end
462
+ else begin
463
+ // OBUFDS: Differential Output Buffer
464
+ // 7 Series
465
+ // Xilinx HDL Libraries Guide, version 13.4
466
+ `ifndef SIM_MODEL
467
+ OBUFDS OBUFDS_inst (
468
+ `else
469
+ OBUFDS_model OBUFDS_inst (
470
+ `endif
471
+ .O(o_ddr3_clk_p), // Diff_p output (connect directly to top-level port)
472
+ .OB(o_ddr3_clk_n), // Diff_n output (connect directly to top-level port)
473
+ .I(!i_ddr3_clk) // Buffer input
474
+ );
475
+ end
476
+ end
477
+
478
+
479
+ // PHY data and dm
480
+ generate
481
+ // data: oserdes -> odelay -> iobuf
482
+ for(gen_index = 0; gen_index < (DQ_BITS*LANES); gen_index = gen_index + 1) begin
483
+
484
+ if (ODELAY_SUPPORTED) begin
485
+ // OSERDESE2: Output SERial/DESerializer with bitslip
486
+ //7 Series
487
+ // Xilinx HDL Libraries Guide, version 13.4
488
+ `ifndef SIM_MODEL
489
+ OSERDESE2 #(
490
+ `else
491
+ OSERDESE2_model #(
492
+ `endif
493
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
494
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
495
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
496
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
497
+ .TRISTATE_WIDTH(1)
498
+ )
499
+ OSERDESE2_data(
500
+ .OFB(oserdes_data[gen_index]), // 1-bit output: Feedback path for data
501
+ .OQ(), // 1-bit output: Data path output
502
+ .TQ(oserdes_dq_tri_control[gen_index]),
503
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
504
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
505
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
506
+ .D1(i_controller_data[gen_index + (DQ_BITS*LANES)*0]),
507
+ .D2(i_controller_data[gen_index + (DQ_BITS*LANES)*1]),
508
+ .D3(i_controller_data[gen_index + (DQ_BITS*LANES)*2]),
509
+ .D4(i_controller_data[gen_index + (DQ_BITS*LANES)*3]),
510
+ .D5(i_controller_data[gen_index + (DQ_BITS*LANES)*4]),
511
+ .D6(i_controller_data[gen_index + (DQ_BITS*LANES)*5]),
512
+ .D7(i_controller_data[gen_index + (DQ_BITS*LANES)*6]),
513
+ .D8(i_controller_data[gen_index + (DQ_BITS*LANES)*7]),
514
+ .T1(i_controller_dq_tri_control),
515
+ .TCE(1'b1),
516
+ .OCE(1'b1), // 1-bit input: Output data clock enable
517
+ .RST(sync_rst), // 1-bit input: Reset
518
+ // unused signals but were added here to make vivado happy
519
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
520
+ .SHIFTOUT2(),
521
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
522
+ .TFB(), // 1-bit output: 3-state control
523
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
524
+ .SHIFTIN1(0),
525
+ .SHIFTIN2(0),
526
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
527
+ .T2(0),
528
+ .T3(0),
529
+ .T4(0),
530
+ .TBYTEIN(0)
531
+ // 1-bit input: Byte group tristate
532
+ );
533
+ // End of OSERDESE2_inst instantiation
534
+
535
+ // ODELAYE2: Output Fixed or Variable Delay Element
536
+ // 7 Series
537
+ // Xilinx HDL Libraries Guide, version 13.4
538
+ //odelay adds an insertion delay of 600ps to the actual delay setting: https://support.xilinx.com/s/article/42133?language=en_US
539
+ //Delay the DQ
540
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
541
+ (* IODELAY_GROUP="DDR3-GROUP" *)
542
+ `ifndef SIM_MODEL
543
+ ODELAYE2 #(
544
+ `else
545
+ ODELAYE2_model #(
546
+ `endif
547
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
548
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
549
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
550
+ .ODELAY_VALUE(DATA_ODELAY_TAP), // Output delay tap setting (0-31)
551
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
552
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
553
+ )
554
+ ODELAYE2_data (
555
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
556
+ .DATAOUT(odelay_data[gen_index]), // 1-bit output: Delayed data/clock output
557
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
558
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
559
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
560
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
561
+ .CNTVALUEIN(i_controller_odelay_data_cntvaluein), // 5-bit input: Counter value input
562
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
563
+ .LD(i_controller_odelay_data_ld[gen_index/8]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
564
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
565
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
566
+ .ODATAIN(oserdes_data[gen_index]), // 1-bit input: Output delay data input
567
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
568
+ );
569
+
570
+ if(USE_IO_TERMINATION) begin
571
+ // IOBUF_DCIEN: Single-ended Bi-directional Buffer with Digital Controlled Impedance (DCI)
572
+ // and Input path enable/disable
573
+ // May only be placed in High Performance (HP) Banks
574
+ // 7 Series
575
+ // Xilinx HDL Libraries Guide, version 13.4
576
+ `ifndef SIM_MODEL
577
+ IOBUF_DCIEN #(
578
+ `else
579
+ IOBUF_DCIEN_model #(
580
+ `endif
581
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
582
+ .SLEW("FAST"), // Specify the output slew rate
583
+ .USE_IBUFDISABLE("FALSE") // Use IBUFDISABLE function, "TRUE" or "FALSE"
584
+ ) IOBUF_DCIEN_data (
585
+ .O(read_dq[gen_index]), // Buffer output
586
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
587
+ .DCITERMDISABLE(1'b0), // DCI Termination enable input
588
+ .I(odelay_data[gen_index]), // Buffer input
589
+ .IBUFDISABLE(1'b0), // Input disable input, low=disable
590
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=input, low=output
591
+ );
592
+ // End of IOBUF_DCIEN_inst instantiation
593
+
594
+ end
595
+ else begin
596
+ // IOBUF: Single-ended Bi-directional Buffer
597
+ //All devices
598
+ // Xilinx HDL Libraries Guide, version 13.4
599
+ `ifndef SIM_MODEL
600
+ IOBUF #(
601
+ `else
602
+ IOBUF_model #(
603
+ `endif
604
+ //.DRIVE(12), // Specify the output drive strength
605
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
606
+ //.IOSTANDARD("SSTL15"), // Specify the I/O standard
607
+ .SLEW("FAST") // Specify the output slew rate
608
+ ) IOBUF_data (
609
+ .O(read_dq[gen_index]),// Buffer output
610
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
611
+ .I(odelay_data[gen_index]), // Buffer input
612
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=read, low=write
613
+ );
614
+ end
615
+ end
616
+ else begin //ODELAY is not supported
617
+ // OSERDESE2: Output SERial/DESerializer with bitslip
618
+ //7 Series
619
+ // Xilinx HDL Libraries Guide, version 13.4
620
+ `ifndef SIM_MODEL
621
+ OSERDESE2 #(
622
+ `else
623
+ OSERDESE2_model #(
624
+ `endif
625
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
626
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
627
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
628
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
629
+ .TRISTATE_WIDTH(1)
630
+ )
631
+ OSERDESE2_data(
632
+ .OFB(), // 1-bit output: Feedback path for data
633
+ .OQ(oserdes_data[gen_index]), // 1-bit output: Data path output
634
+ .TQ(oserdes_dq_tri_control[gen_index]),
635
+ .CLK(i_ddr3_clk_90), // 1-bit input: High speed clock
636
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
637
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
638
+ .D1(i_controller_data[gen_index + (DQ_BITS*LANES)*0]),
639
+ .D2(i_controller_data[gen_index + (DQ_BITS*LANES)*1]),
640
+ .D3(i_controller_data[gen_index + (DQ_BITS*LANES)*2]),
641
+ .D4(i_controller_data[gen_index + (DQ_BITS*LANES)*3]),
642
+ .D5(i_controller_data[gen_index + (DQ_BITS*LANES)*4]),
643
+ .D6(i_controller_data[gen_index + (DQ_BITS*LANES)*5]),
644
+ .D7(i_controller_data[gen_index + (DQ_BITS*LANES)*6]),
645
+ .D8(i_controller_data[gen_index + (DQ_BITS*LANES)*7]),
646
+ .T1(i_controller_dq_tri_control),
647
+ .TCE(1'b1),
648
+ .OCE(1'b1), // 1-bit input: Output data clock enable
649
+ .RST(sync_rst), // 1-bit input: Reset
650
+ // unused signals but were added here to make vivado happy
651
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
652
+ .SHIFTOUT2(),
653
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
654
+ .TFB(), // 1-bit output: 3-state control
655
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
656
+ .SHIFTIN1(0),
657
+ .SHIFTIN2(0),
658
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
659
+ .T2(0),
660
+ .T3(0),
661
+ .T4(0),
662
+ .TBYTEIN(0)
663
+ // 1-bit input: Byte group tristate
664
+ );
665
+ // End of OSERDESE2_inst instantiation
666
+
667
+ // IOBUF: Single-ended Bi-directional Buffer
668
+ //All devices
669
+ // Xilinx HDL Libraries Guide, version 13.4
670
+ `ifndef SIM_MODEL
671
+ IOBUF #(
672
+ `else
673
+ IOBUF_model #(
674
+ `endif
675
+ //.DRIVE(12), // Specify the output drive strength
676
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
677
+ //.IOSTANDARD("SSTL15"), // Specify the I/O standard
678
+ .SLEW("FAST") // Specify the output slew rate
679
+ ) IOBUF_data (
680
+ .O(read_dq[gen_index]),// Buffer output
681
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
682
+ .I(oserdes_data[gen_index]), // Buffer input
683
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=read, low=write
684
+ );
685
+ end
686
+
687
+ // IDELAYE2: Input Fixed or Variable Delay Element
688
+ // 7 Series
689
+ // Xilinx HDL Libraries Guide, version 13.4
690
+ (* IODELAY_GROUP="DDR3-GROUP" *)
691
+ `ifndef SIM_MODEL
692
+ IDELAYE2 #(
693
+ `else
694
+ IDELAYE2_model #(
695
+ `endif
696
+ .DELAY_SRC("IDATAIN"), // Delay input (IDATAIN, DATAIN)
697
+ .HIGH_PERFORMANCE_MODE("TRUE"), //Reduced jitter ("TRUE"), Reduced power ("FALSE")
698
+ .IDELAY_TYPE("VAR_LOAD"), //FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
699
+ .IDELAY_VALUE(DATA_IDELAY_TAP), //Input delay tap setting (0-31)
700
+ .PIPE_SEL("FALSE"), //Select pipelined mode, FALSE, TRUE
701
+ .REFCLK_FREQUENCY(200.0), //IDELAYCTRL clock input frequency in MHz (190.0-210.0).
702
+ .SIGNAL_PATTERN("DATA") //DATA, CLOCK input signal
703
+ )
704
+ IDELAYE2_data (
705
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
706
+ .DATAOUT(idelay_data[gen_index]), // 1-bit output: Delayed data output
707
+ .C(i_controller_clk), // 1-bit input: Clock input
708
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
709
+ .CINVCTRL(1'b0),// 1-bit input: Dynamic clock inversion input
710
+ .CNTVALUEIN(i_controller_idelay_data_cntvaluein), // 5-bit input: Counter value input
711
+ .DATAIN(), //1-bit input: Internal delay data input
712
+ .IDATAIN(read_dq[gen_index]), // 1-bit input: Data input from the I/O
713
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
714
+ .LD(i_controller_idelay_data_ld[gen_index/8]), // 1-bit input: Load IDELAY_VALUE input
715
+ .LDPIPEEN(1'b0), // 1-bit input: Enable PIPELINE register to load data input
716
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
717
+ );
718
+ // End of IDELAYE2_inst instantiation
719
+
720
+ // End of IOBUF_inst instantiation
721
+ // ISERDESE2: Input SERial/DESerializer with bitslip
722
+ //7 Series
723
+ // Xilinx HDL Libraries Guide, version 13.4
724
+ `ifndef SIM_MODEL
725
+ ISERDESE2 #(
726
+ `else
727
+ ISERDESE2_model #(
728
+ `endif
729
+ .DATA_RATE("DDR"), // DDR, SDR
730
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
731
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
732
+ .INIT_Q1(1'b0),
733
+ .INIT_Q2(1'b0),
734
+ .INIT_Q3(1'b0),
735
+ .INIT_Q4(1'b0),
736
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
737
+ .IOBDELAY("IFD"), // NONE, BOTH, IBUF, IFD
738
+ .NUM_CE(1),// Number of clock enables (1,2)
739
+ .OFB_USED("FALSE"), // Select OFB path (FALSE, TRUE)
740
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
741
+ .SRVAL_Q1(1'b0),
742
+ .SRVAL_Q2(1'b0),
743
+ .SRVAL_Q3(1'b0),
744
+ .SRVAL_Q4(1'b0)
745
+ )
746
+ ISERDESE2_data (
747
+ .O(),
748
+ // 1-bit output: Combinatorial output
749
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
750
+ .Q1(o_controller_iserdes_data[(DQ_BITS*LANES)*7 + gen_index]),//56
751
+ .Q2(o_controller_iserdes_data[(DQ_BITS*LANES)*6 + gen_index]), //48
752
+ .Q3(o_controller_iserdes_data[(DQ_BITS*LANES)*5 + gen_index]),
753
+ .Q4(o_controller_iserdes_data[(DQ_BITS*LANES)*4 + gen_index]),
754
+ .Q5(o_controller_iserdes_data[(DQ_BITS*LANES)*3 + gen_index]),
755
+ .Q6(o_controller_iserdes_data[(DQ_BITS*LANES)*2 + gen_index]),
756
+ .Q7(o_controller_iserdes_data[(DQ_BITS*LANES)*1 + gen_index]),
757
+ .Q8(o_controller_iserdes_data[(DQ_BITS*LANES)*0 + gen_index]),
758
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
759
+ .SHIFTOUT1(),
760
+ .SHIFTOUT2(),
761
+ .BITSLIP(i_controller_bitslip[gen_index/8]),
762
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
763
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
764
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
765
+ // position every time Bitslip is invoked (DDR operation is different from
766
+ // SDR).
767
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
768
+ .CE1(1'b1),
769
+ .CE2(1'b1),
770
+ .CLKDIVP(), // 1-bit input: TBD
771
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
772
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
773
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
774
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
775
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
776
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
777
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
778
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
779
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
780
+ .D(), // 1-bit input: Data input
781
+ .DDLY(idelay_data[gen_index]), // 1-bit input: Serial data from IDELAYE2
782
+ .OFB(), // 1-bit input: Data feedback from OSERDESE2
783
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
784
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
785
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
786
+ .SHIFTIN1(),
787
+ .SHIFTIN2()
788
+ );
789
+ // End of ISERDESE2_inst instantiation
790
+
791
+ end
792
+
793
+ // data mask: oserdes -> odelay -> obuf
794
+ for(gen_index = 0; gen_index < LANES; gen_index = gen_index + 1) begin
795
+
796
+
797
+ if(ODELAY_SUPPORTED) begin
798
+ // OSERDESE2: Output SERial/DESerializer with bitslip
799
+ //7 Series
800
+ // Xilinx HDL Libraries Guide, version 13.4
801
+ `ifndef SIM_MODEL
802
+ OSERDESE2 #(
803
+ `else
804
+ OSERDESE2_model #(
805
+ `endif
806
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
807
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
808
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
809
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
810
+ .TRISTATE_WIDTH(1)
811
+ )
812
+ OSERDESE2_dm(
813
+ .OFB(oserdes_dm[gen_index]), // 1-bit output: Feedback path for data
814
+ .OQ(), // 1-bit output: Data path output
815
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
816
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
817
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
818
+ .D1(i_controller_dm[gen_index + LANES*0]),
819
+ .D2(i_controller_dm[gen_index + LANES*1]),
820
+ .D3(i_controller_dm[gen_index + LANES*2]),
821
+ .D4(i_controller_dm[gen_index + LANES*3]),
822
+ .D5(i_controller_dm[gen_index + LANES*4]),
823
+ .D6(i_controller_dm[gen_index + LANES*5]),
824
+ .D7(i_controller_dm[gen_index + LANES*6]),
825
+ .D8(i_controller_dm[gen_index + LANES*7]),
826
+ .TCE(1'b0),
827
+ .OCE(1'b1), // 1-bit input: Output data clock enable
828
+ .RST(sync_rst), // 1-bit input: Reset
829
+ // unused signals but were added here to make vivado happy
830
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
831
+ .SHIFTOUT2(),
832
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
833
+ .TFB(), // 1-bit output: 3-state control
834
+ .TQ(), // 1-bit output: 3-state control
835
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
836
+ .SHIFTIN1(0),
837
+ .SHIFTIN2(0),
838
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
839
+ .T1(0),
840
+ .T2(0),
841
+ .T3(0),
842
+ .T4(0),
843
+ .TBYTEIN(0)
844
+ // 1-bit input: Byte group tristate
845
+ );
846
+ // End of OSERDESE2_inst instantiation
847
+
848
+ // ODELAYE2: Output Fixed or Variable Delay Element
849
+ // 7 Series
850
+ // Xilinx HDL Libraries Guide, version 13.4
851
+ //odelay adds an insertion delay of 600ps to the actual delay setting: https://support.xilinx.com/s/article/42133?language=en_US
852
+ //Delay the DQ
853
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
854
+ (* IODELAY_GROUP="DDR3-GROUP" *)
855
+ `ifndef SIM_MODEL
856
+ ODELAYE2 #(
857
+ `else
858
+ ODELAYE2_model #(
859
+ `endif
860
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
861
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
862
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
863
+ .ODELAY_VALUE(DATA_ODELAY_TAP), // Output delay tap setting (0-31)
864
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
865
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
866
+ )
867
+ ODELAYE2_dm (
868
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
869
+ .DATAOUT(odelay_dm[gen_index]), // 1-bit output: Delayed data/clock output
870
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
871
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
872
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
873
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
874
+ .CNTVALUEIN(i_controller_odelay_data_cntvaluein), // 5-bit input: Counter value input
875
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
876
+ .LD(i_controller_odelay_data_ld[gen_index]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
877
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
878
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
879
+ .ODATAIN(oserdes_dm[gen_index]), // 1-bit input: Output delay data input
880
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
881
+ );
882
+
883
+ // OBUF: Single-ended Output Buffer
884
+ // 7 Series
885
+ // Xilinx HDL Libraries Guide, version 13.4
886
+ `ifndef SIM_MODEL
887
+ OBUF #(
888
+ `else
889
+ OBUF_model #(
890
+ `endif
891
+ //.IOSTANDARD("SSTL_15"), // Specify the output I/O standard
892
+ .SLEW("FAST") // Specify the output slew rate
893
+ ) OBUF_dm (
894
+ .O(o_ddr3_dm[gen_index]), // Buffer output (connect directly to top-level port)
895
+ .I(odelay_dm[gen_index]) // Buffer input
896
+ );
897
+ // End of OBUF_inst instantiation
898
+ end
899
+ else begin
900
+ // OSERDESE2: Output SERial/DESerializer with bitslip
901
+ //7 Series
902
+ // Xilinx HDL Libraries Guide, version 13.4
903
+ `ifndef SIM_MODEL
904
+ OSERDESE2 #(
905
+ `else
906
+ OSERDESE2_model #(
907
+ `endif
908
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
909
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
910
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
911
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
912
+ .TRISTATE_WIDTH(1)
913
+ )
914
+ OSERDESE2_dm(
915
+ .OFB(), // 1-bit output: Feedback path for data
916
+ .OQ(oserdes_dm[gen_index]), // 1-bit output: Data path output
917
+ .CLK(i_ddr3_clk_90), // 1-bit input: High speed clock
918
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
919
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
920
+ .D1(i_controller_dm[gen_index + LANES*0]),
921
+ .D2(i_controller_dm[gen_index + LANES*1]),
922
+ .D3(i_controller_dm[gen_index + LANES*2]),
923
+ .D4(i_controller_dm[gen_index + LANES*3]),
924
+ .D5(i_controller_dm[gen_index + LANES*4]),
925
+ .D6(i_controller_dm[gen_index + LANES*5]),
926
+ .D7(i_controller_dm[gen_index + LANES*6]),
927
+ .D8(i_controller_dm[gen_index + LANES*7]),
928
+ .TCE(1'b0),
929
+ .OCE(1'b1), // 1-bit input: Output data clock enable
930
+ .RST(sync_rst), // 1-bit input: Reset
931
+ // unused signals but were added here to make vivado happy
932
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
933
+ .SHIFTOUT2(),
934
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
935
+ .TFB(), // 1-bit output: 3-state control
936
+ .TQ(), // 1-bit output: 3-state control
937
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
938
+ .SHIFTIN1(0),
939
+ .SHIFTIN2(0),
940
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
941
+ .T1(0),
942
+ .T2(0),
943
+ .T3(0),
944
+ .T4(0),
945
+ .TBYTEIN(0)
946
+ // 1-bit input: Byte group tristate
947
+ );
948
+ // End of OSERDESE2_inst instantiation
949
+
950
+ // OBUF: Single-ended Output Buffer
951
+ // 7 Series
952
+ // Xilinx HDL Libraries Guide, version 13.4
953
+ `ifndef SIM_MODEL
954
+ OBUF #(
955
+ `else
956
+ OBUF_model #(
957
+ `endif
958
+ //.IOSTANDARD("SSTL_15"), // Specify the output I/O standard
959
+ .SLEW("FAST") // Specify the output slew rate
960
+ ) OBUF_dm (
961
+ .O(o_ddr3_dm[gen_index]), // Buffer output (connect directly to top-level port)
962
+ .I(oserdes_dm[gen_index]) // Buffer input
963
+ );
964
+ // End of OBUF_inst instantiation
965
+
966
+ end
967
+ end
968
+
969
+ // dqs: odelay -> iobuf
970
+ for(gen_index = 0; gen_index < LANES; gen_index = gen_index + 1) begin
971
+ `ifndef DEBUG_DQS //remove the logic for dqs if needs to be debugged (directed to output instead)
972
+ if(ODELAY_SUPPORTED) begin
973
+ // OSERDESE2: Output SERial/DESerializer with bitslip
974
+ //7 Series
975
+ // Xilinx HDL Libraries Guide, version 13.4
976
+ `ifndef SIM_MODEL
977
+ OSERDESE2 #(
978
+ `else
979
+ OSERDESE2_model #(
980
+ `endif
981
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
982
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
983
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
984
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
985
+ .TRISTATE_WIDTH(1)
986
+ )
987
+ OSERDESE2_dqs(
988
+ .OFB(oserdes_dqs[gen_index]), // 1-bit output: Feedback path for data
989
+ .OQ(), // 1-bit output: Data path output
990
+ .TQ(oserdes_dqs_tri_control[gen_index]),
991
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
992
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
993
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
994
+ .D1(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q)), //the last part will still have half dqs series
995
+ .D2(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
996
+ .D3(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q) && !i_controller_write_leveling_calib),
997
+ .D4(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
998
+ .D5(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
999
+ .D6(1'b0 && i_controller_toggle_dqs),
1000
+ .D7(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1001
+ .D8(1'b0 && i_controller_toggle_dqs),
1002
+ .T1(i_controller_dqs_tri_control),
1003
+ .TCE(1'b1),
1004
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1005
+ .RST(sync_rst), // 1-bit input: Reset
1006
+ // unused signals but were added here to make vivado happy
1007
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1008
+ .SHIFTOUT2(),
1009
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1010
+ .TFB(), // 1-bit output: 3-state control
1011
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1012
+ .SHIFTIN1(0),
1013
+ .SHIFTIN2(0),
1014
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1015
+ .T2(0),
1016
+ .T3(0),
1017
+ .T4(0),
1018
+ .TBYTEIN(0)
1019
+ // 1-bit input: Byte group tristate
1020
+ );
1021
+ // End of OSERDESE2_inst instantiation
1022
+
1023
+
1024
+ // ODELAYE2: Output Fixed or Variable Delay Element
1025
+ // 7 Series
1026
+ // Xilinx HDL Libraries Guide, version 13.4
1027
+ //Delay the DQ
1028
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1029
+ `ifndef SIM_MODEL
1030
+ ODELAYE2 #(
1031
+ `else
1032
+ ODELAYE2_model #(
1033
+ `endif
1034
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
1035
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter ("TRUE"), Reduced power ("FALSE")
1036
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
1037
+ .ODELAY_VALUE(DQS_ODELAY_TAP), // delay to align odelay_dqs to oserdes_dqs due to 600ps insertion delay: (1/800MHz - 600ps)/78.125ps = 8.32 taps
1038
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
1039
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
1040
+ )
1041
+ ODELAYE2_dqs (
1042
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
1043
+ .DATAOUT(odelay_dqs[gen_index]), // 1-bit output: Delayed data/clock output
1044
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
1045
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
1046
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
1047
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
1048
+ .CNTVALUEIN(i_controller_odelay_dqs_cntvaluein), // 5-bit input: Counter value input
1049
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
1050
+ .LD(i_controller_odelay_dqs_ld[gen_index]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
1051
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
1052
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
1053
+ .ODATAIN(oserdes_dqs[gen_index]), // 1-bit input: Output delay data input
1054
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
1055
+ );
1056
+
1057
+ if(USE_IO_TERMINATION) begin
1058
+ // IOBUFDS_DCIEN: Differential Bi-directional Buffer with Digital Controlled Impedance (DCI)
1059
+ // and Input path enable/disable
1060
+ // May only be placed in High Performance (HP) Banks
1061
+ // 7 Series
1062
+ // Xilinx HDL Libraries Guide, version 13.4
1063
+ `ifndef SIM_MODEL
1064
+ IOBUFDS_DCIEN #(
1065
+ `else
1066
+ IOBUFDS_DCIEN_model #(
1067
+ `endif
1068
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
1069
+ .SLEW("FAST"), // Specify the output slew rate
1070
+ .USE_IBUFDISABLE("FALSE") // Use IBUFDISABLE function, "TRUE" or "FALSE"
1071
+ ) IOBUFDS_DCIEN_inst (
1072
+ .O(read_dqs[gen_index]), // Buffer output
1073
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1074
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1075
+ .DCITERMDISABLE(1'b0), // DCI Termination enable input
1076
+ .I(odelay_dqs[gen_index]), // Buffer input
1077
+ .IBUFDISABLE(1'b0), // Input disable input, low=disable
1078
+ .T(oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1079
+ );
1080
+ // End of IOBUFDS_DCIEN_inst instantiation
1081
+
1082
+ end
1083
+ else begin
1084
+ // IOBUFDS: Differential Bi-directional Buffer
1085
+ //7 Series
1086
+ // Xilinx HDL Libraries Guide, version 13.4
1087
+ `ifndef SIM_MODEL
1088
+ IOBUFDS #(
1089
+ `else
1090
+ IOBUFDS_model #(
1091
+ `endif
1092
+ //.DIFF_TERM("FALSE"), // Differential Termination ("TRUE"/"FALSE")
1093
+ .IBUF_LOW_PWR("FALSE") // Low Power - "TRUE", High Performance = "FALSE"
1094
+ //.IOSTANDARD("DIFF_SSTL15") // Specify the I/O standard. CONSULT WITH DATASHEET
1095
+ //.SLEW("FAST") // Specify the output slew rate
1096
+ ) IOBUFDS_dqs (
1097
+ .O(read_dqs[gen_index]), // Buffer output
1098
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1099
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1100
+ .I(odelay_dqs[gen_index]), // Buffer input
1101
+ .T(/*!dqs_tri_control[gen_index]*/oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1102
+ ); // End of IOBUFDS_inst instantiation
1103
+ end
1104
+
1105
+ end
1106
+
1107
+ else begin //ODELAY not supported
1108
+ // OSERDESE2: Output SERial/DESerializer with bitslip
1109
+ //7 Series
1110
+ // Xilinx HDL Libraries Guide, version 13.4
1111
+ `ifndef SIM_MODEL
1112
+ OSERDESE2 #(
1113
+ `else
1114
+ OSERDESE2_model #(
1115
+ `endif
1116
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
1117
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
1118
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
1119
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
1120
+ .TRISTATE_WIDTH(1)
1121
+ )
1122
+ OSERDESE2_dqs(
1123
+ .OFB(), // 1-bit output: Feedback path for data
1124
+ .OQ(oserdes_dqs[gen_index]), // 1-bit output: Data path output
1125
+ .TQ(oserdes_dqs_tri_control[gen_index]),
1126
+ .CLK(!i_ddr3_clk), // 1-bit input: High speed clock
1127
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1128
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
1129
+ .D1(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q)), //the last part will still have half dqs series
1130
+ .D2(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
1131
+ .D3(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q) && !i_controller_write_leveling_calib),
1132
+ .D4(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
1133
+ .D5(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1134
+ .D6(1'b0 && i_controller_toggle_dqs),
1135
+ .D7(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1136
+ .D8(1'b0 && i_controller_toggle_dqs),
1137
+ .T1(i_controller_dqs_tri_control),
1138
+ .TCE(1'b1),
1139
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1140
+ .RST(sync_rst), // 1-bit input: Reset
1141
+ // unused signals but were added here to make vivado happy
1142
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1143
+ .SHIFTOUT2(),
1144
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1145
+ .TFB(), // 1-bit output: 3-state control
1146
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1147
+ .SHIFTIN1(0),
1148
+ .SHIFTIN2(0),
1149
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1150
+ .T2(0),
1151
+ .T3(0),
1152
+ .T4(0),
1153
+ .TBYTEIN(0)
1154
+ // 1-bit input: Byte group tristate
1155
+ );
1156
+ // End of OSERDESE2_inst instantiation
1157
+
1158
+ // IOBUFDS: Differential Bi-directional Buffer
1159
+ //7 Series
1160
+ // Xilinx HDL Libraries Guide, version 13.4
1161
+ `ifndef SIM_MODEL
1162
+ IOBUFDS #(
1163
+ `else
1164
+ IOBUFDS_model #(
1165
+ `endif
1166
+ //.DIFF_TERM("FALSE"), // Differential Termination ("TRUE"/"FALSE")
1167
+ .IBUF_LOW_PWR("FALSE") // Low Power - "TRUE", High Performance = "FALSE"
1168
+ //.IOSTANDARD("DIFF_SSTL15") // Specify the I/O standard. CONSULT WITH DATASHEET
1169
+ //.SLEW("FAST") // Specify the output slew rate
1170
+ ) IOBUFDS_dqs (
1171
+ .O(read_dqs[gen_index]), // Buffer output
1172
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1173
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1174
+ .I(oserdes_dqs[gen_index]), // Buffer input
1175
+ .T(/*!dqs_tri_control[gen_index]*/oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1176
+ ); // End of IOBUFDS_inst instantiation
1177
+
1178
+ end
1179
+
1180
+ // IDELAYE2: Input Fixed or Variable Delay Element
1181
+ // 7 Series
1182
+ // Xilinx HDL Libraries Guide, version 13.4
1183
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1184
+ `ifndef SIM_MODEL
1185
+ IDELAYE2 #(
1186
+ `else
1187
+ IDELAYE2_model #(
1188
+ `endif
1189
+ .DELAY_SRC("IDATAIN"), // Delay input (IDATAIN, DATAIN)
1190
+ .HIGH_PERFORMANCE_MODE("TRUE"), //Reduced jitter ("TRUE"), Reduced power ("FALSE")
1191
+ .IDELAY_TYPE("VAR_LOAD"), //FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
1192
+ .IDELAY_VALUE(DQS_IDELAY_TAP), //Input delay tap setting (0-31)
1193
+ .PIPE_SEL("FALSE"), //Select pipelined mode, FALSE, TRUE
1194
+ .REFCLK_FREQUENCY(200.0), //IDELAYCTRL clock input frequency in MHz (190.0-210.0).
1195
+ .SIGNAL_PATTERN("CLOCK") //DATA, CLOCK input signal
1196
+ )
1197
+ IDELAYE2_dqs (
1198
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
1199
+ .DATAOUT(idelay_dqs[gen_index]), // 1-bit output: Delayed data output
1200
+ .C(i_controller_clk), // 1-bit input: Clock input
1201
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
1202
+ .CINVCTRL(1'b0),// 1-bit input: Dynamic clock inversion input
1203
+ .CNTVALUEIN(i_controller_idelay_dqs_cntvaluein), // 5-bit input: Counter value input
1204
+ .DATAIN(), //1-bit input: Internal delay data input
1205
+ .IDATAIN(read_dqs[gen_index]), // 1-bit input: Data input from the I/O
1206
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
1207
+ .LD(i_controller_idelay_dqs_ld[gen_index]), // 1-bit input: Load IDELAY_VALUE input
1208
+ .LDPIPEEN(1'b0), // 1-bit input: Enable PIPELINE register to load data input
1209
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
1210
+ );
1211
+ // End of IDELAYE2_inst instantiation
1212
+
1213
+
1214
+ // End of IOBUF_inst instantiation
1215
+ // ISERDESE2: Input SERial/DESerializer with bitslip
1216
+ //7 Series
1217
+ // Xilinx HDL Libraries Guide, version 13.4
1218
+ `ifndef SIM_MODEL
1219
+ ISERDESE2 #(
1220
+ `else
1221
+ ISERDESE2_model #(
1222
+ `endif
1223
+ .DATA_RATE("DDR"), // DDR, SDR
1224
+ .DATA_WIDTH(serdes_ratio*2), // Parallel data width (2-8,10,14)
1225
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
1226
+ .INIT_Q1(1'b0),
1227
+ .INIT_Q2(1'b0),
1228
+ .INIT_Q3(1'b0),
1229
+ .INIT_Q4(1'b0),
1230
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
1231
+ .IOBDELAY("IFD"), // NONE, BOTH, IBUF, IFD
1232
+ .NUM_CE(1),// Number of clock enables (1,2)
1233
+ .OFB_USED("FALSE"), // Select OFB path (FALSE, TRUE)
1234
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
1235
+ .SRVAL_Q1(1'b0),
1236
+ .SRVAL_Q2(1'b0),
1237
+ .SRVAL_Q3(1'b0),
1238
+ .SRVAL_Q4(1'b0)
1239
+ )
1240
+ ISERDESE2_dqs (
1241
+ .O(),
1242
+ // 1-bit output: Combinatorial output
1243
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
1244
+ .Q1(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 7]),
1245
+ .Q2(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 6]),
1246
+ .Q3(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 5]),
1247
+ .Q4(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 4]),
1248
+ .Q5(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 3]),
1249
+ .Q6(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 2]), //
1250
+ .Q7(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 1]), //3
1251
+ .Q8(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 0]), //2
1252
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
1253
+ .SHIFTOUT1(),
1254
+ .SHIFTOUT2(),
1255
+ .BITSLIP(i_controller_bitslip[gen_index]),
1256
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
1257
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
1258
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
1259
+ // position every time Bitslip is invoked (DDR operation is different from
1260
+ // SDR).
1261
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
1262
+ .CE1(1'b1),
1263
+ .CE2(1'b1),
1264
+ .CLKDIVP(), // 1-bit input: TBD
1265
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
1266
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
1267
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
1268
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1269
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
1270
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
1271
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
1272
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
1273
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
1274
+ .D(), // 1-bit input: Data input
1275
+ .DDLY(idelay_dqs[gen_index]), // 1-bit input: Serial data from IDELAYE2
1276
+ .OFB(), // 1-bit input: Data feedback from OSERDESE2
1277
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
1278
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
1279
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
1280
+ .SHIFTIN1(),
1281
+ .SHIFTIN2()
1282
+ );
1283
+ // End of ISERDESE2_inst instantiation
1284
+ `endif
1285
+
1286
+ // generate IOSERDES loopback or not for bitslip training
1287
+ if(NO_IOSERDES_LOOPBACK) begin
1288
+ // logic that models OSERDES loopback to ISERDES
1289
+ // accdg to IOSELECT (UG471) for 7-series:
1290
+ // " In DDR mode, every Bitslip operation causes the output pattern to alternate between
1291
+ // a shift right by one and shift left by three"
1292
+ always @(posedge i_controller_clk) begin
1293
+ if(!i_rst_n || i_controller_reset) begin
1294
+ o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 0)] <= 8'b0001_1110;
1295
+ shift_bitslip_index[gen_index] <= 0;
1296
+ end
1297
+ else if(i_controller_bitslip[gen_index]) begin
1298
+ // if shift_bitslip_index high, shift right by 3, else shift left by 1 (this is reverse of the IOSelect document for ISERDES since vector o_controller_iserdes_bitslip_reference is reversed)
1299
+ o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 0)] <=
1300
+ shift_bitslip_index[gen_index]? {o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 2) : (serdes_ratio*2*gen_index + 0)], o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 3)]}
1301
+ : {o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 6) : (serdes_ratio*2*gen_index + 0)], o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7)]};
1302
+ shift_bitslip_index[gen_index] <= !shift_bitslip_index[gen_index];
1303
+ end
1304
+ end
1305
+ assign o_controller_iserdes_bitslip_reference = o_controller_iserdes_bitslip_reference_reg;
1306
+ end
1307
+ else begin // OSERDES will loopback to ISERDES for bitslip training
1308
+ //ISERDES train
1309
+ // End of IOBUF_inst instantiation
1310
+ // ISERDESE2: Input SERial/DESerializer with bitslip
1311
+ //7 Series
1312
+ // Xilinx HDL Libraries Guide, version 13.4
1313
+ `ifndef SIM_MODEL
1314
+ ISERDESE2 #(
1315
+ `else
1316
+ ISERDESE2_model #(
1317
+ `endif
1318
+ .DATA_RATE("DDR"), // DDR, SDR
1319
+ .DATA_WIDTH(serdes_ratio*2), // Parallel data width (2-8,10,14)
1320
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
1321
+ .INIT_Q1(1'b0),
1322
+ .INIT_Q2(1'b0),
1323
+ .INIT_Q3(1'b0),
1324
+ .INIT_Q4(1'b0),
1325
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
1326
+ .IOBDELAY("NONE"), // NONE, BOTH, IBUF, IFD
1327
+ .NUM_CE(1),// Number of clock enables (1,2)
1328
+ .OFB_USED("TRUE"), // Select OFB path (FALSE, TRUE)
1329
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
1330
+ .SRVAL_Q1(1'b0),
1331
+ .SRVAL_Q2(1'b0),
1332
+ .SRVAL_Q3(1'b0),
1333
+ .SRVAL_Q4(1'b0)
1334
+ )
1335
+ ISERDESE2_train (
1336
+ .O(),
1337
+ // 1-bit output: Combinatorial output
1338
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
1339
+ .Q1(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 7]),
1340
+ .Q2(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 6]),
1341
+ .Q3(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 5]),
1342
+ .Q4(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 4]),
1343
+ .Q5(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 3]),
1344
+ .Q6(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 2]),
1345
+ .Q7(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 1]),
1346
+ .Q8(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 0]),
1347
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
1348
+ .SHIFTOUT1(),
1349
+ .SHIFTOUT2(),
1350
+ .BITSLIP(i_controller_bitslip[gen_index]),
1351
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
1352
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
1353
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
1354
+ // position every time Bitslip is invoked (DDR operation is different from
1355
+ // SDR).
1356
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
1357
+ .CE1(1'b1),
1358
+ .CE2(1'b1),
1359
+ .CLKDIVP(), // 1-bit input: TBD
1360
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
1361
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
1362
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
1363
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1364
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
1365
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
1366
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
1367
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
1368
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
1369
+ .D(), // 1-bit input: Data input
1370
+ .DDLY(), // 1-bit input: Serial data from IDELAYE2
1371
+ .OFB(oserdes_bitslip_reference[gen_index]), // 1-bit input: Data feedback from OSERDESE2
1372
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
1373
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
1374
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
1375
+ .SHIFTIN1(),
1376
+ .SHIFTIN2()
1377
+ );
1378
+ // End of ISERDESE2_inst instantiation
1379
+
1380
+ // OSERDESE2: Output SERial/DESerializer with bitslip
1381
+ //7 Series
1382
+ // Xilinx HDL Libraries Guide, version 13.4
1383
+ `ifndef SIM_MODEL
1384
+ OSERDESE2 #(
1385
+ `else
1386
+ OSERDESE2_model #(
1387
+ `endif
1388
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
1389
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
1390
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
1391
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
1392
+ .TRISTATE_WIDTH(1)
1393
+ )
1394
+ OSERDESE2_train(
1395
+ .OFB(oserdes_bitslip_reference[gen_index]), // 1-bit output: Feedback path for data
1396
+ .OQ(), // 1-bit output: Data path output
1397
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
1398
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1399
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
1400
+ .D1(1'b0),
1401
+ .D2(1'b0),
1402
+ .D3(1'b0),
1403
+ .D4(1'b0),
1404
+ .D5(1'b1),
1405
+ .D6(1'b1),
1406
+ .D7(1'b1),
1407
+ .D8(1'b1),
1408
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1409
+ .RST(sync_rst), // 1-bit input: Reset
1410
+ // unused signals but were added here to make vivado happy
1411
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1412
+ .SHIFTOUT2(),
1413
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1414
+ .TFB(), // 1-bit output: 3-state control
1415
+ .TQ(), // 1-bit output: 3-state control
1416
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1417
+ .SHIFTIN1(0),
1418
+ .SHIFTIN2(0),
1419
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1420
+ .T1(0),
1421
+ .T2(0),
1422
+ .T3(0),
1423
+ .T4(0),
1424
+ .TBYTEIN(0),
1425
+ // 1-bit input: Byte group tristate
1426
+ .TCE(0)
1427
+ // 1-bit input: 3-state clock enable
1428
+ );
1429
+ // End of OSERDESE2_inst instantiation
1430
+ end
1431
+
1432
+ end
1433
+ endgenerate
1434
+
1435
+
1436
+ // IDELAYCTRL: IDELAYE2/ODELAYE2 Tap Delay Value Control
1437
+ // 7 Series
1438
+ // Xilinx HDL Libraries Guide, version 13.4
1439
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1440
+ `ifndef SIM_MODEL
1441
+ IDELAYCTRL IDELAYCTRL_inst (
1442
+ `else
1443
+ IDELAYCTRL_model IDELAYCTRL_inst (
1444
+ `endif
1445
+ .RDY(idelayctrl_rdy), // 1-bit output: Ready output
1446
+ .REFCLK(i_ref_clk), // 1-bit input: Reference clock input.The frequency of REFCLK must be 200 MHz to guarantee the tap-delay value specified in the applicable data sheet.
1447
+ .RST(sync_rst) // 1-bit input: Active high reset input, To ,Minimum Reset pulse width is 52ns
1448
+ );
1449
+ // End of IDELAYCTRL_inst instantiation
1450
+
1451
+
1452
+ // DCIRESET: Digitially Controlled Impedence Reset Component
1453
+ //7 Series
1454
+ // Xilinx HDL Libraries Guide, version 13.4
1455
+ // DCIRESET DCIRESET_inst (
1456
+ // .LOCKED(dci_locked), // 1-bit output: LOCK status output (When low, DCI I/O impedance is being calibrated and DCI I/Os are unavailable)
1457
+ // .RST(sync_rst) // 1-bit input: Active-high asynchronous reset input
1458
+ // );
1459
+ assign dci_locked = 1;
1460
+ // End of DCIRESET_inst instantiation
1461
+
1462
+ endmodule
AngeloJacobo_UberDDR3/example_demo/arty_s7/ddr3_top.v ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ddr3_top.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: Top module which instantiates the ddr3_controller and ddr3_phy modules
7
+ // Use this as top module for instantiating UberDDR3 with Wishbone Interface.
8
+ //
9
+ // Engineer: Angelo C. Jacobo
10
+ //
11
+ ////////////////////////////////////////////////////////////////////////////////
12
+ //
13
+ // Copyright (C) 2023-2025 Angelo Jacobo
14
+ //
15
+ // This program is free software: you can redistribute it and/or modify
16
+ // it under the terms of the GNU General Public License as published by
17
+ // the Free Software Foundation, either version 3 of the License, or
18
+ // (at your option) any later version.
19
+ //
20
+ // This program is distributed in the hope that it will be useful,
21
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ // GNU General Public License for more details.
24
+ //
25
+ // You should have received a copy of the GNU General Public License
26
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
27
+ //
28
+ ////////////////////////////////////////////////////////////////////////////////
29
+
30
+ `default_nettype none
31
+ `timescale 1ps / 1ps
32
+
33
+ module ddr3_top #(
34
+ parameter CONTROLLER_CLK_PERIOD = 12_000, //ps, clock period of the controller interface
35
+ DDR3_CLK_PERIOD = 3_000, //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
36
+ ROW_BITS = 14, //width of row address
37
+ COL_BITS = 10, //width of column address
38
+ BA_BITS = 3, //width of bank address
39
+ BYTE_LANES = 2, //number of byte lanes of DDR3 RAM
40
+ AUX_WIDTH = 4, //width of aux line (must be >= 4)
41
+ WB2_ADDR_BITS = 7, //width of 2nd wishbone address bus
42
+ WB2_DATA_BITS = 32, //width of 2nd wishbone data bus
43
+ DUAL_RANK_DIMM = 0, // enable dual rank DIMM (1 = enable, 0 = disable)
44
+ // DDR3 timing parameter values
45
+ parameter SPEED_BIN = 3, // 0 = Use top-level parameters , 1 = DDR3-1066 (7-7-7) , 2 = DR3-1333 (9-9-9) , 3 = DDR3-1600 (11-11-11)
46
+ SDRAM_CAPACITY = 5, // 0 = 256Mb, 1 = 512Mb, 2 = 1Gb, 3 = 2Gb, 4 = 4Gb, 5 = 8Gb, 6 = 16Gb
47
+ TRCD = 13_750, // ps Active to Read/Write command time (only used if SPEED_BIN = 0)
48
+ TRP = 13_750, // ps Precharge command period (only used if SPEED_BIN = 0)
49
+ TRAS = 35_000, // ps ACT to PRE command period (only used if SPEED_BIN = 0)
50
+ parameter[0:0] MICRON_SIM = 0, //enable faster simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
51
+ ODELAY_SUPPORTED = 0, //set to 1 when ODELAYE2 is supported
52
+ SECOND_WISHBONE = 0, //set to 1 if 2nd wishbone for debugging is needed
53
+ DLL_OFF = 0, // 1 = DLL off for low frequency ddr3 clock (< 125MHz)
54
+ WB_ERROR = 0, // set to 1 to support Wishbone error (asserts at ECC double bit error)
55
+ parameter[1:0] BIST_MODE = 1, // 0 = No BIST, 1 = run through all address space ONCE , 2 = run through all address space for every test (burst w/r, random w/r, alternating r/w)
56
+ parameter[0:0] BIST_TEST_DATAMASK = 1, // 1 = include per-byte DM writes in BIST, 0 = all-byte writes only
57
+ parameter[1:0] ECC_ENABLE = 0, // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
58
+ parameter[1:0] DIC = 2'b00, //Output Driver Impedance Control (2'b00 = RZQ/6, 2'b01 = RZQ/7, RZQ = 240ohms) (only change when you know what you are doing)
59
+ parameter[2:0] RTT_NOM = 3'b011, //RTT Nominal (3'b000 = disabled, 3'b001 = RZQ/4, 3'b010 = RZQ/2 , 3'b011 = RZQ/6, RZQ = 240ohms) (only change when you know what you are doing)
60
+ parameter[1:0] SELF_REFRESH = 2'b00, // 0 = use i_user_self_refresh input, 1 = Self-refresh mode is enabled after 64 controller clock cycles of no requests, 2 = 128 cycles, 3 = 256 cycles
61
+ parameter // The next parameters act more like a localparam (since user does not have to set this manually) but was added here to simplify port declaration
62
+ DQ_BITS = 8, //device width (fixed to 8, if DDR3 is x16 then BYTE_LANES will be 2 while )
63
+ serdes_ratio = 4, // this controller is fixed as a 4:1 memory controller (CONTROLLER_CLK_PERIOD/DDR3_CLK_PERIOD = 4)
64
+ wb_addr_bits = ROW_BITS + COL_BITS + BA_BITS - $clog2(serdes_ratio*2) + DUAL_RANK_DIMM,
65
+ wb_data_bits = DQ_BITS*BYTE_LANES*serdes_ratio*2,
66
+ wb_sel_bits = wb_data_bits / 8,
67
+ wb2_sel_bits = WB2_DATA_BITS / 8,
68
+ //4 is the width of a single ddr3 command {cs_n, ras_n, cas_n, we_n} plus 3 (ck_en, odt, reset_n) plus bank bits plus row bits
69
+ cmd_len = 4 + 3 + BA_BITS + ROW_BITS + 2*DUAL_RANK_DIMM
70
+ )
71
+ (
72
+ input wire i_controller_clk, i_ddr3_clk, i_ref_clk, //i_controller_clk = CONTROLLER_CLK_PERIOD, i_ddr3_clk = DDR3_CLK_PERIOD, i_ref_clk = 200MHz
73
+ input wire i_ddr3_clk_90, //required only when ODELAY_SUPPORTED is zero
74
+ input wire i_rst_n,
75
+ //
76
+ // Wishbone inputs
77
+ input wire i_wb_cyc, //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
78
+ input wire i_wb_stb, //request a transfer
79
+ input wire i_wb_we, //write-enable (1 = write, 0 = read)
80
+ input wire[wb_addr_bits - 1:0] i_wb_addr, //burst-addressable {row,bank,col}
81
+ input wire[wb_data_bits - 1:0] i_wb_data, //write data, for a 4:1 controller data width is 8 times the number of pins on the device
82
+ input wire[wb_sel_bits - 1:0] i_wb_sel, //byte strobe for write (1 = write the byte)
83
+ input wire[AUX_WIDTH - 1:0] i_aux, //for AXI-interface compatibility (given upon strobe)
84
+ // Wishbone outputs
85
+ output wire o_wb_stall, //1 = busy, cannot accept requests
86
+ output wire o_wb_ack, //1 = read/write request has completed
87
+ output wire o_wb_err, //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
88
+ output wire[wb_data_bits - 1:0] o_wb_data, //read data, for a 4:1 controller data width is 8 times the number of pins on the device
89
+ output wire[AUX_WIDTH - 1:0] o_aux, //for AXI-interface compatibility (given upon strobe)
90
+ //
91
+ // Wishbone 2 (PHY) inputs
92
+ input wire i_wb2_cyc, //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
93
+ input wire i_wb2_stb, //request a transfer
94
+ input wire i_wb2_we, //write-enable (1 = write, 0 = read)
95
+ input wire[WB2_ADDR_BITS - 1:0] i_wb2_addr, // memory-mapped register to be accessed
96
+ input wire[WB2_DATA_BITS - 1:0] i_wb2_data, //write data
97
+ input wire[wb2_sel_bits - 1:0] i_wb2_sel, //byte strobe for write (1 = write the byte)
98
+ // Wishbone 2 (Controller) outputs
99
+ output wire o_wb2_stall, //1 = busy, cannot accept requests
100
+ output wire o_wb2_ack, //1 = read/write request has completed
101
+ output wire[WB2_DATA_BITS - 1:0] o_wb2_data, //read data
102
+ //
103
+ // DDR3 I/O Interface
104
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_clk_p, o_ddr3_clk_n,
105
+ output wire o_ddr3_reset_n,
106
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cke, // CKE
107
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cs_n, // chip select signal
108
+ output wire o_ddr3_ras_n, // RAS#
109
+ output wire o_ddr3_cas_n, // CAS#
110
+ output wire o_ddr3_we_n, // WE#
111
+ output wire[ROW_BITS-1:0] o_ddr3_addr,
112
+ output wire[BA_BITS-1:0] o_ddr3_ba_addr,
113
+ inout wire[(DQ_BITS*BYTE_LANES)-1:0] io_ddr3_dq,
114
+ inout wire[BYTE_LANES-1:0] io_ddr3_dqs, io_ddr3_dqs_n,
115
+ output wire[BYTE_LANES-1:0] o_ddr3_dm,
116
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_odt, // on-die termination
117
+ //
118
+ // Done Calibration pin
119
+ output wire o_calib_complete,
120
+ // Debug outputs
121
+ output wire[31:0] o_debug1,
122
+ // output wire[31:0] o_debug2,
123
+ // output wire[31:0] o_debug3,
124
+ // output wire[(DQ_BITS*BYTE_LANES)/8-1:0] o_ddr3_debug_read_dqs_p,
125
+ // output wire[(DQ_BITS*BYTE_LANES)/8-1:0] o_ddr3_debug_read_dqs_n
126
+ //
127
+ // User enabled self-refresh
128
+ input wire i_user_self_refresh,
129
+ output wire uart_tx
130
+ );
131
+
132
+ // Instantiation Template (DEFAULT VALUE IS FOR ARTY S7)
133
+ /*
134
+ // DDR3 Controller
135
+ ddr3_top #(
136
+ .CONTROLLER_CLK_PERIOD(12_000), //ps, clock period of the controller interface
137
+ .DDR3_CLK_PERIOD(3_000), //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
138
+ .ROW_BITS(14), //width of row address
139
+ .COL_BITS(10), //width of column address
140
+ .BA_BITS(3), //width of bank address
141
+ .BYTE_LANES(2), //number of byte lanes of DDR3 RAM
142
+ .AUX_WIDTH(4), //width of aux line (must be >= 4)
143
+ .MICRON_SIM(0), //enable faster simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
144
+ .ODELAY_SUPPORTED(0), //set to 1 if ODELAYE2 is supported
145
+ .SECOND_WISHBONE(0), //set to 1 if 2nd wishbone for debugging is needed
146
+ .ECC_ENABLE(0), // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
147
+ .WB_ERROR(0), // set to 1 to support Wishbone error (asserts at ECC double bit error)
148
+ ) ddr3_top
149
+ (
150
+ //clock and reset
151
+ .i_controller_clk(i_controller_clk),
152
+ .i_ddr3_clk(i_ddr3_clk), //i_controller_clk has period of CONTROLLER_CLK_PERIOD, i_ddr3_clk has period of DDR3_CLK_PERIOD
153
+ .i_ref_clk(i_ref_clk), // usually set to 200 MHz
154
+ .i_ddr3_clk_90(i_ddr3_clk_90), //90 degree phase shifted version i_ddr3_clk (required only when ODELAY_SUPPORTED is zero)
155
+ .i_rst_n(!i_rst && clk_locked),
156
+ //
157
+ // Wishbone inputs
158
+ .i_wb_cyc(1), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
159
+ .i_wb_stb(i_wb_stb), //request a transfer
160
+ .i_wb_we(i_wb_we), //write-enable (1 = write, 0 = read)
161
+ .i_wb_addr(i_wb_addr), //burst-addressable {row,bank,col}
162
+ .i_wb_data(i_wb_data), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
163
+ .i_wb_sel(16'hffff), //byte strobe for write (1 = write the byte)
164
+ .i_aux(i_wb_we), //for AXI-interface compatibility (given upon strobe)
165
+ // Wishbone outputs
166
+ .o_wb_stall(o_wb_stall), //1 = busy, cannot accept requests
167
+ .o_wb_ack(o_wb_ack), //1 = read/write request has completed
168
+ .o_wb_err(o_wb_err), //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
169
+ .o_wb_data(o_wb_data), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
170
+ .o_aux(o_aux),
171
+ //
172
+ // Wishbone 2 (PHY) inputs
173
+ .i_wb2_cyc(0), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
174
+ .i_wb2_stb(0), //request a transfer
175
+ .i_wb2_we(0), //write-enable (1 = write, 0 = read)
176
+ .i_wb2_addr(0), //burst-addressable {row,bank,col}
177
+ .i_wb2_data(0), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
178
+ .i_wb2_sel(0), //byte strobe for write (1 = write the byte)
179
+ // Wishbone 2 (Controller) outputs
180
+ .o_wb2_stall(), //1 = busy, cannot accept requests
181
+ .o_wb2_ack(), //1 = read/write request has completed
182
+ .o_wb2_data(), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
183
+ //
184
+ // DDR3 I/O Interface
185
+ .o_ddr3_clk_p(ddr3_clk_p),
186
+ .o_ddr3_clk_n(ddr3_clk_n),
187
+ .o_ddr3_reset_n(ddr3_reset_n),
188
+ .o_ddr3_cke(ddr3_cke),
189
+ .o_ddr3_cs_n(ddr3_cs_n), // width = number of DDR3 ranks
190
+ .o_ddr3_ras_n(ddr3_ras_n),
191
+ .o_ddr3_cas_n(ddr3_cas_n),
192
+ .o_ddr3_we_n(ddr3_we_n),
193
+ .o_ddr3_addr(ddr3_addr), // width = ROW_BITS
194
+ .o_ddr3_ba_addr(ddr3_ba), // width = BA_BITS
195
+ .io_ddr3_dq(ddr3_dq), // width = BYTE_LANES*8
196
+ .io_ddr3_dqs(ddr3_dqs_p), // width = BYTE_LANES
197
+ .io_ddr3_dqs_n(ddr3_dqs_n), // width = BYTE_LANES
198
+ .o_ddr3_dm(ddr3_dm), // width = BYTE_LANES
199
+ .o_ddr3_odt(ddr3_odt),
200
+ // Debug outputs
201
+ .o_debug1(),
202
+ ////////////////////////////////////
203
+ );
204
+ */
205
+
206
+ // Wire connections between controller and phy
207
+ wire[cmd_len*serdes_ratio-1:0] cmd;
208
+ wire dqs_tri_control, dq_tri_control;
209
+ wire toggle_dqs;
210
+ wire[wb_data_bits-1:0] data;
211
+ wire[wb_sel_bits-1:0] dm;
212
+ wire[BYTE_LANES-1:0] bitslip;
213
+ wire[DQ_BITS*BYTE_LANES*8-1:0] iserdes_data;
214
+ wire[BYTE_LANES*8-1:0] iserdes_dqs;
215
+ wire[BYTE_LANES*8-1:0] iserdes_bitslip_reference;
216
+ wire idelayctrl_rdy;
217
+ wire[4:0] odelay_data_cntvaluein, odelay_dqs_cntvaluein;
218
+ wire[4:0] idelay_data_cntvaluein, idelay_dqs_cntvaluein;
219
+ wire[BYTE_LANES-1:0] odelay_data_ld, odelay_dqs_ld;
220
+ wire[BYTE_LANES-1:0] idelay_data_ld, idelay_dqs_ld;
221
+ wire write_leveling_calib;
222
+ wire reset;
223
+
224
+ // logic for self-refresh
225
+ reg[8:0] refresh_counter = 0;
226
+ reg user_self_refresh;
227
+ // refresh counter
228
+ always @(posedge i_controller_clk) begin
229
+ if(i_wb_stb && i_wb_cyc) begin // if there is Wishbone request, then reset counter
230
+ refresh_counter <= 0;
231
+ end
232
+ else if(!o_wb_stall || user_self_refresh) begin // if no request (but not stalled) OR already on self-refresh, then increment counter
233
+ refresh_counter <= refresh_counter + 1;
234
+ end
235
+ end
236
+ // choose self-refresh options
237
+ always @* begin
238
+ case(SELF_REFRESH)
239
+ 2'b00: user_self_refresh = i_user_self_refresh; // use input i_user_self_refresh (high = enter self-refresh, low = exit self-refresh)
240
+ 2'b01: user_self_refresh = refresh_counter[6]; // Self-refresh mode is enabled after 64 controller clock cycles of no requests, then exit Self-refresh after another 64 controller clk cycles
241
+ 2'b10: user_self_refresh = refresh_counter[7]; // Self-refresh mode is enabled after 128 controller clock cycles of no requests, then exit Self-refresh after another 128 controller clk cycles
242
+ 2'b11: user_self_refresh = refresh_counter[8]; // Self-refresh mode is enabled after 256 controller clock cycles of no requests, then exit Self-refresh after another 256 controller clk cycles
243
+ endcase
244
+ end
245
+
246
+
247
+
248
+ //module instantiations
249
+ ddr3_controller #(
250
+ .CONTROLLER_CLK_PERIOD(CONTROLLER_CLK_PERIOD), //ps, clock period of the controller interface
251
+ .DDR3_CLK_PERIOD(DDR3_CLK_PERIOD), //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
252
+ .ROW_BITS(ROW_BITS), //width of row address
253
+ .COL_BITS(COL_BITS), //width of column address
254
+ .BA_BITS(BA_BITS), //width of bank address
255
+ .DQ_BITS(DQ_BITS), //width of DQ
256
+ .LANES(BYTE_LANES), // byte lanes
257
+ .AUX_WIDTH(AUX_WIDTH), //width of aux line (must be >= 4)
258
+ .WB2_ADDR_BITS(WB2_ADDR_BITS), //width of 2nd wishbone address bus
259
+ .WB2_DATA_BITS(WB2_DATA_BITS), //width of 2nd wishbone data bus
260
+ .MICRON_SIM(MICRON_SIM), //simulation for micron ddr3 model (shorten POWER_ON_RESET_HIGH and INITIAL_CKE_LOW)
261
+ .ODELAY_SUPPORTED(ODELAY_SUPPORTED), //set to 1 when ODELAYE2 is supported
262
+ .SECOND_WISHBONE(SECOND_WISHBONE), //set to 1 if 2nd wishbone is needed
263
+ .ECC_ENABLE(ECC_ENABLE), // set to 1 or 2 to add ECC (1 = Side-band ECC per burst, 2 = Side-band ECC per 8 bursts , 3 = Inline ECC )
264
+ .DLL_OFF(DLL_OFF), // 1 = DLL off for low frequency ddr3 clock (< 125MHz)
265
+ .WB_ERROR(WB_ERROR), // set to 1 to support Wishbone error (asserts at ECC double bit error)
266
+ .BIST_MODE(BIST_MODE), // 0 = No BIST, 1 = run through all address space ONCE , 2 = run through all address space for every test (burst w/r, random w/r, alternating r/w)
267
+ .BIST_TEST_DATAMASK(BIST_TEST_DATAMASK), // 1 = include per-byte DM writes in BIST, 0 = all-byte writes only
268
+ .DIC(DIC), //Output Driver Impedance Control (2'b00 = RZQ/6, 2'b01 = RZQ/7, RZQ = 240ohms)
269
+ .RTT_NOM(RTT_NOM), //RTT Nominal (3'b000 = disabled, 3'b001 = RZQ/4, 3'b010 = RZQ/2 , 3'b011 = RZQ/6, RZQ = 240ohms)
270
+ .DUAL_RANK_DIMM(DUAL_RANK_DIMM), // enable dual rank DIMM (1 = enable, 0 = disable)
271
+ .SPEED_BIN(SPEED_BIN), // 0 = Use top-level parameters , 1 = DDR3-1066 (7-7-7) , 2 = DR3-1333 (9-9-9) , 3 = DDR3-1600 (11-11-11)
272
+ .SDRAM_CAPACITY(SDRAM_CAPACITY), // 0 = 256Mb, 1 = 512Mb, 2 = 1Gb, 3 = 2Gb, 4 = 4Gb, 5 = 8Gb, 6 = 16Gb
273
+ .TRCD(TRCD), // ps Active to Read/Write command time (only used if SPEED_BIN = 0)
274
+ .TRP(TRP), // ps Precharge command period (only used if SPEED_BIN = 0)
275
+ .TRAS(TRAS) // ps ACT to PRE command period (only used if SPEED_BIN = 0)
276
+ ) ddr3_controller_inst (
277
+ .i_controller_clk(i_controller_clk), //i_controller_clk has period of CONTROLLER_CLK_PERIOD
278
+ .i_rst_n(i_rst_n), //200MHz input clock
279
+ // Wishbone inputs
280
+ .i_wb_cyc(i_wb_cyc), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
281
+ .i_wb_stb(i_wb_stb), //request a transfer
282
+ .i_wb_we(i_wb_we), //write-enable (1 = write, 0 = read)
283
+ .i_wb_addr(i_wb_addr), //burst-addressable {row,bank,col}
284
+ .i_wb_data(i_wb_data), //write data, for a 4:1 controller data width is 8 times the number of pins on the device
285
+ .i_wb_sel(i_wb_sel), //byte strobe for write (1 = write the byte)
286
+ .i_aux(i_aux), //for AXI-interface compatibility (given upon strobe)
287
+ // Wishbone outputs
288
+ .o_wb_stall(o_wb_stall), //1 = busy, cannot accept requests
289
+ .o_wb_ack(o_wb_ack), //1 = read/write request has completed
290
+ .o_wb_err(o_wb_err), //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
291
+ .o_wb_data(o_wb_data), //read data, for a 4:1 controller data width is 8 times the number of pins on the device
292
+ .o_aux(o_aux), //for AXI-interface compatibility (returned upon ack)
293
+ // Wishbone 2 (PHY) inputs
294
+ .i_wb2_cyc(i_wb2_cyc), //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
295
+ .i_wb2_stb(i_wb2_stb), //request a transfer
296
+ .i_wb2_we(i_wb2_we), //write-enable (1 = write, 0 = read)
297
+ .i_wb2_addr(i_wb2_addr), // memory-mapped register to be accessed
298
+ .i_wb2_data(i_wb2_data), //write data
299
+ .i_wb2_sel(i_wb2_sel), //byte strobe for write (1 = write the byte)
300
+ // Wishbone 2 (Controller) outputs
301
+ .o_wb2_stall(o_wb2_stall), //1 = busy, cannot accept requests
302
+ .o_wb2_ack(o_wb2_ack), //1 = read/write request has completed
303
+ .o_wb2_data(o_wb2_data), //read data
304
+ //
305
+ // PHY interface
306
+ .i_phy_iserdes_data(iserdes_data),
307
+ .i_phy_iserdes_dqs(iserdes_dqs),
308
+ .i_phy_iserdes_bitslip_reference(iserdes_bitslip_reference),
309
+ .i_phy_idelayctrl_rdy(idelayctrl_rdy),
310
+ .o_phy_cmd(cmd),
311
+ .o_phy_dqs_tri_control(dqs_tri_control),
312
+ .o_phy_dq_tri_control(dq_tri_control),
313
+ .o_phy_toggle_dqs(toggle_dqs),
314
+ .o_phy_data(data),
315
+ .o_phy_dm(dm),
316
+ .o_phy_odelay_data_cntvaluein(odelay_data_cntvaluein),
317
+ .o_phy_odelay_dqs_cntvaluein(odelay_dqs_cntvaluein),
318
+ .o_phy_idelay_data_cntvaluein(idelay_data_cntvaluein),
319
+ .o_phy_idelay_dqs_cntvaluein(idelay_dqs_cntvaluein),
320
+ .o_phy_odelay_data_ld(odelay_data_ld),
321
+ .o_phy_odelay_dqs_ld(odelay_dqs_ld),
322
+ .o_phy_idelay_data_ld(idelay_data_ld),
323
+ .o_phy_idelay_dqs_ld(idelay_dqs_ld),
324
+ .o_phy_bitslip(bitslip),
325
+ .o_phy_write_leveling_calib(write_leveling_calib),
326
+ .o_phy_reset(reset),
327
+ // Done Calibration pin
328
+ .o_calib_complete(o_calib_complete),
329
+ // Debug outputs
330
+ .o_debug1(o_debug1),
331
+ // .o_debug2(o_debug2),
332
+ // .o_debug3(o_debug3)
333
+ // User enabled self-refresh
334
+ .i_user_self_refresh(user_self_refresh),
335
+ .uart_tx(uart_tx)
336
+ );
337
+ `ifndef LATTICE_ECP5_PHY // XILINX PHY
338
+ ddr3_phy #(
339
+ .ROW_BITS(ROW_BITS), //width of row address
340
+ .BA_BITS(BA_BITS), //width of bank address
341
+ .DQ_BITS(DQ_BITS), //width of DQ
342
+ .LANES(BYTE_LANES), //8 lanes of DQ
343
+ .CONTROLLER_CLK_PERIOD(CONTROLLER_CLK_PERIOD), //ps, period of clock input to this DDR3 controller module
344
+ .DDR3_CLK_PERIOD(DDR3_CLK_PERIOD), //ps, period of clock input to DDR3 RAM device
345
+ .ODELAY_SUPPORTED(ODELAY_SUPPORTED), //set to 1 when ODELAYE2 is supported
346
+ .DUAL_RANK_DIMM(DUAL_RANK_DIMM) // enable dual rank DIMM (1 = enable, 0 = disable)
347
+ ) ddr3_phy_inst (
348
+ .i_controller_clk(i_controller_clk),
349
+ .i_ddr3_clk(i_ddr3_clk),
350
+ .i_ref_clk(i_ref_clk),
351
+ .i_ddr3_clk_90(i_ddr3_clk_90),
352
+ .i_rst_n(i_rst_n),
353
+ // Controller Interface
354
+ .i_controller_reset(reset),
355
+ .i_controller_cmd(cmd),
356
+ .i_controller_dqs_tri_control(dqs_tri_control),
357
+ .i_controller_dq_tri_control(dq_tri_control),
358
+ .i_controller_toggle_dqs(toggle_dqs),
359
+ .i_controller_data(data),
360
+ .i_controller_dm(dm),
361
+ .i_controller_odelay_data_cntvaluein(odelay_data_cntvaluein),
362
+ .i_controller_odelay_dqs_cntvaluein(odelay_dqs_cntvaluein),
363
+ .i_controller_idelay_data_cntvaluein(idelay_data_cntvaluein),
364
+ .i_controller_idelay_dqs_cntvaluein(idelay_dqs_cntvaluein),
365
+ .i_controller_odelay_data_ld(odelay_data_ld),
366
+ .i_controller_odelay_dqs_ld(odelay_dqs_ld),
367
+ .i_controller_idelay_data_ld(idelay_data_ld),
368
+ .i_controller_idelay_dqs_ld(idelay_dqs_ld),
369
+ .i_controller_bitslip(bitslip),
370
+ .i_controller_write_leveling_calib(write_leveling_calib),
371
+ .o_controller_iserdes_data(iserdes_data),
372
+ .o_controller_iserdes_dqs(iserdes_dqs),
373
+ .o_controller_iserdes_bitslip_reference(iserdes_bitslip_reference),
374
+ .o_controller_idelayctrl_rdy(idelayctrl_rdy),
375
+ // DDR3 I/O Interface
376
+ .o_ddr3_clk_p(o_ddr3_clk_p),
377
+ .o_ddr3_clk_n(o_ddr3_clk_n),
378
+ .o_ddr3_reset_n(o_ddr3_reset_n),
379
+ .o_ddr3_cke(o_ddr3_cke), // CKE
380
+ .o_ddr3_cs_n(o_ddr3_cs_n), // chip select signal
381
+ .o_ddr3_ras_n(o_ddr3_ras_n), // RAS#
382
+ .o_ddr3_cas_n(o_ddr3_cas_n), // CAS#
383
+ .o_ddr3_we_n(o_ddr3_we_n), // WE#
384
+ .o_ddr3_addr(o_ddr3_addr),
385
+ .o_ddr3_ba_addr(o_ddr3_ba_addr),
386
+ .io_ddr3_dq(io_ddr3_dq),
387
+ .io_ddr3_dqs(io_ddr3_dqs),
388
+ .io_ddr3_dqs_n(io_ddr3_dqs_n),
389
+ .o_ddr3_dm(o_ddr3_dm),
390
+ .o_ddr3_odt(o_ddr3_odt), // on-die termination
391
+ .o_ddr3_debug_read_dqs_p(/*o_ddr3_debug_read_dqs_p*/),
392
+ .o_ddr3_debug_read_dqs_n(/*o_ddr3_debug_read_dqs_n*/)
393
+ );
394
+ `else // LATTICE ECP5 PHY
395
+ ddr3_phy_ecp5 #(
396
+ .ROW_BITS(ROW_BITS), //width of row address
397
+ .BA_BITS(BA_BITS), //width of bank address
398
+ .DQ_BITS(DQ_BITS), //width of DQ
399
+ .LANES(BYTE_LANES), //8 lanes of DQ
400
+ .CONTROLLER_CLK_PERIOD(CONTROLLER_CLK_PERIOD) //ps, period of clock input to this DDR3 controller module
401
+ ) ddr3_phy_inst (
402
+ .i_controller_clk(i_controller_clk),
403
+ .i_ddr3_clk(i_ddr3_clk),
404
+ .i_ref_clk(i_ref_clk),
405
+ .i_ddr3_clk_90(i_ddr3_clk_90),
406
+ .i_rst_n(i_rst_n),
407
+ // Controller Interface
408
+ .i_controller_reset(reset),
409
+ .i_controller_cmd(cmd),
410
+ .i_controller_dqs_tri_control(dqs_tri_control),
411
+ .i_controller_dq_tri_control(dq_tri_control),
412
+ .i_controller_toggle_dqs(toggle_dqs),
413
+ .i_controller_data(data),
414
+ .i_controller_dm(dm),
415
+ .i_controller_odelay_data_cntvaluein(odelay_data_cntvaluein),
416
+ .i_controller_odelay_dqs_cntvaluein(odelay_dqs_cntvaluein),
417
+ .i_controller_idelay_data_cntvaluein(idelay_data_cntvaluein),
418
+ .i_controller_idelay_dqs_cntvaluein(idelay_dqs_cntvaluein),
419
+ .i_controller_odelay_data_ld(odelay_data_ld),
420
+ .i_controller_odelay_dqs_ld(odelay_dqs_ld),
421
+ .i_controller_idelay_data_ld(idelay_data_ld),
422
+ .i_controller_idelay_dqs_ld(idelay_dqs_ld),
423
+ .i_controller_bitslip(bitslip),
424
+ .i_controller_write_leveling_calib(write_leveling_calib),
425
+ .o_controller_iserdes_data(iserdes_data),
426
+ .o_controller_iserdes_dqs(iserdes_dqs),
427
+ .o_controller_iserdes_bitslip_reference(iserdes_bitslip_reference),
428
+ .o_controller_idelayctrl_rdy(idelayctrl_rdy),
429
+ // DDR3 I/O Interface
430
+ .o_ddr3_clk_p(o_ddr3_clk_p),
431
+ .o_ddr3_clk_n(o_ddr3_clk_n),
432
+ .o_ddr3_reset_n(o_ddr3_reset_n),
433
+ .o_ddr3_cke(o_ddr3_cke), // CKE
434
+ .o_ddr3_cs_n(o_ddr3_cs_n), // chip select signal
435
+ .o_ddr3_ras_n(o_ddr3_ras_n), // RAS#
436
+ .o_ddr3_cas_n(o_ddr3_cas_n), // CAS#
437
+ .o_ddr3_we_n(o_ddr3_we_n), // WE#
438
+ .o_ddr3_addr(o_ddr3_addr),
439
+ .o_ddr3_ba_addr(o_ddr3_ba_addr),
440
+ .io_ddr3_dq(io_ddr3_dq),
441
+ .io_ddr3_dqs(io_ddr3_dqs),
442
+ .io_ddr3_dqs_n(io_ddr3_dqs_n),
443
+ .o_ddr3_dm(o_ddr3_dm),
444
+ .o_ddr3_odt(o_ddr3_odt), // on-die termination
445
+ .o_ddr3_debug_read_dqs_p(/*o_ddr3_debug_read_dqs_p*/),
446
+ .o_ddr3_debug_read_dqs_n(/*o_ddr3_debug_read_dqs_n*/)
447
+ );
448
+ `endif
449
+
450
+ // // display value of parameters for easy debugging
451
+ // initial begin
452
+ // $display("\nDDR3 TOP PARAMETERS:\n-----------------------------");
453
+ // $display("CONTROLLER_CLK_PERIOD = %0d", CONTROLLER_CLK_PERIOD);
454
+ // $display("DDR3_CLK_PERIOD = %0d", DDR3_CLK_PERIOD);
455
+ // $display("ROW_BITS = %0d", ROW_BITS);
456
+ // $display("COL_BITS = %0d", COL_BITS);
457
+ // $display("BA_BITS = %0d", BA_BITS);
458
+ // $display("BYTE_LANES = %0d", BYTE_LANES);
459
+ // $display("AUX_WIDTH = %0d", AUX_WIDTH);
460
+ // $display("WB2_ADDR_BITS = %0d", WB2_ADDR_BITS);
461
+ // $display("WB2_DATA_BITS = %0d", WB2_DATA_BITS);
462
+ // $display("MICRON_SIM = %0d", MICRON_SIM);
463
+ // $display("ODELAY_SUPPORTED = %0d", ODELAY_SUPPORTED);
464
+ // $display("SECOND_WISHBONE = %0d", SECOND_WISHBONE);
465
+ // $display("WB_ERROR = %0d", WB_ERROR);
466
+ // $display("BIST_MODE = %0d", BIST_MODE);
467
+ // $display("ECC_ENABLE = %0d", ECC_ENABLE);
468
+ // $display("DIC = %0d", DIC);
469
+ // $display("RTT_NOM = %0d", RTT_NOM);
470
+ // $display("SELF_REFRESH = %0d", SELF_REFRESH);
471
+ // $display("DUAL_RANK_DIMM = %0d", DUAL_RANK_DIMM);
472
+ // $display("End of DDR3 TOP PARAMETERS\n-----------------------------");
473
+ // end
474
+
475
+ endmodule
AngeloJacobo_UberDDR3/example_demo/arty_s7/uart_rx.v ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ //
3
+ // Module: uart_rx
4
+ //
5
+ // Notes:
6
+ // - UART reciever module.
7
+ //
8
+
9
+ module uart_rx(
10
+ input wire clk , // Top level system clock input.
11
+ input wire resetn , // Asynchronous active low reset.
12
+ input wire uart_rxd , // UART Recieve pin.
13
+ input wire uart_rx_en , // Recieve enable
14
+ output wire uart_rx_break, // Did we get a BREAK message?
15
+ output wire uart_rx_valid, // Valid data recieved and available.
16
+ output reg [PAYLOAD_BITS-1:0] uart_rx_data // The recieved data.
17
+ );
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // External parameters.
21
+ //
22
+
23
+ //
24
+ // Input bit rate of the UART line.
25
+ parameter BIT_RATE = 9600; // bits / sec
26
+ localparam BIT_P = 1_000_000_000 * 1/BIT_RATE; // nanoseconds
27
+
28
+ //
29
+ // Clock frequency in hertz.
30
+ parameter CLK_HZ = 50_000_000;
31
+ localparam CLK_P = 1_000_000_000 * 1/CLK_HZ; // nanoseconds
32
+
33
+ //
34
+ // Number of data bits recieved per UART packet.
35
+ parameter PAYLOAD_BITS = 8;
36
+
37
+ //
38
+ // Number of stop bits indicating the end of a packet.
39
+ parameter STOP_BITS = 1;
40
+
41
+ // --------------------------------------------------------------------------
42
+ // Internal parameters.
43
+ //
44
+
45
+ //
46
+ // Number of clock cycles per uart bit.
47
+ localparam CYCLES_PER_BIT = BIT_P / CLK_P;
48
+
49
+ //
50
+ // Size of the registers which store sample counts and bit durations.
51
+ localparam COUNT_REG_LEN = 1+$clog2(CYCLES_PER_BIT);
52
+
53
+ // --------------------------------------------------------------------------
54
+ // Internal registers.
55
+ //
56
+
57
+ //
58
+ // Internally latched value of the uart_rxd line. Helps break long timing
59
+ // paths from input pins into the logic.
60
+ reg rxd_reg;
61
+ reg rxd_reg_0;
62
+
63
+ //
64
+ // Storage for the recieved serial data.
65
+ reg [PAYLOAD_BITS-1:0] recieved_data;
66
+
67
+ //
68
+ // Counter for the number of cycles over a packet bit.
69
+ reg [COUNT_REG_LEN-1:0] cycle_counter;
70
+
71
+ //
72
+ // Counter for the number of recieved bits of the packet.
73
+ reg [3:0] bit_counter;
74
+
75
+ //
76
+ // Sample of the UART input line whenever we are in the middle of a bit frame.
77
+ reg bit_sample;
78
+
79
+ //
80
+ // Current and next states of the internal FSM.
81
+ reg [2:0] fsm_state;
82
+ reg [2:0] n_fsm_state;
83
+
84
+ localparam FSM_IDLE = 0;
85
+ localparam FSM_START= 1;
86
+ localparam FSM_RECV = 2;
87
+ localparam FSM_STOP = 3;
88
+
89
+ // ---------------------------------------------------------------------------
90
+ // Output assignment
91
+ //
92
+
93
+ assign uart_rx_break = uart_rx_valid && ~|recieved_data;
94
+ assign uart_rx_valid = fsm_state == FSM_STOP && n_fsm_state == FSM_IDLE;
95
+
96
+ always @(posedge clk) begin
97
+ if(!resetn) begin
98
+ uart_rx_data <= {PAYLOAD_BITS{1'b0}};
99
+ end else if (fsm_state == FSM_STOP) begin
100
+ uart_rx_data <= recieved_data;
101
+ end
102
+ end
103
+
104
+ // ---------------------------------------------------------------------------
105
+ // FSM next state selection.
106
+ //
107
+
108
+ wire next_bit = cycle_counter == CYCLES_PER_BIT ||
109
+ fsm_state == FSM_STOP &&
110
+ cycle_counter == CYCLES_PER_BIT/2;
111
+ wire payload_done = bit_counter == PAYLOAD_BITS ;
112
+
113
+ //
114
+ // Handle picking the next state.
115
+ always @(*) begin : p_n_fsm_state
116
+ case(fsm_state)
117
+ FSM_IDLE : n_fsm_state = rxd_reg ? FSM_IDLE : FSM_START;
118
+ FSM_START: n_fsm_state = next_bit ? FSM_RECV : FSM_START;
119
+ FSM_RECV : n_fsm_state = payload_done ? FSM_STOP : FSM_RECV ;
120
+ FSM_STOP : n_fsm_state = next_bit ? FSM_IDLE : FSM_STOP ;
121
+ default : n_fsm_state = FSM_IDLE;
122
+ endcase
123
+ end
124
+
125
+ // ---------------------------------------------------------------------------
126
+ // Internal register setting and re-setting.
127
+ //
128
+
129
+ //
130
+ // Handle updates to the recieved data register.
131
+ integer i = 0;
132
+ always @(posedge clk) begin : p_recieved_data
133
+ if(!resetn) begin
134
+ recieved_data <= {PAYLOAD_BITS{1'b0}};
135
+ end else if(fsm_state == FSM_IDLE ) begin
136
+ recieved_data <= {PAYLOAD_BITS{1'b0}};
137
+ end else if(fsm_state == FSM_RECV && next_bit ) begin
138
+ recieved_data[PAYLOAD_BITS-1] <= bit_sample;
139
+ for ( i = PAYLOAD_BITS-2; i >= 0; i = i - 1) begin
140
+ recieved_data[i] <= recieved_data[i+1];
141
+ end
142
+ end
143
+ end
144
+
145
+ //
146
+ // Increments the bit counter when recieving.
147
+ always @(posedge clk) begin : p_bit_counter
148
+ if(!resetn) begin
149
+ bit_counter <= 4'b0;
150
+ end else if(fsm_state != FSM_RECV) begin
151
+ bit_counter <= {COUNT_REG_LEN{1'b0}};
152
+ end else if(fsm_state == FSM_RECV && next_bit) begin
153
+ bit_counter <= bit_counter + 1'b1;
154
+ end
155
+ end
156
+
157
+ //
158
+ // Sample the recieved bit when in the middle of a bit frame.
159
+ always @(posedge clk) begin : p_bit_sample
160
+ if(!resetn) begin
161
+ bit_sample <= 1'b0;
162
+ end else if (cycle_counter == CYCLES_PER_BIT/2) begin
163
+ bit_sample <= rxd_reg;
164
+ end
165
+ end
166
+
167
+
168
+ //
169
+ // Increments the cycle counter when recieving.
170
+ always @(posedge clk) begin : p_cycle_counter
171
+ if(!resetn) begin
172
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
173
+ end else if(next_bit) begin
174
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
175
+ end else if(fsm_state == FSM_START ||
176
+ fsm_state == FSM_RECV ||
177
+ fsm_state == FSM_STOP ) begin
178
+ cycle_counter <= cycle_counter + 1'b1;
179
+ end
180
+ end
181
+
182
+
183
+ //
184
+ // Progresses the next FSM state.
185
+ always @(posedge clk) begin : p_fsm_state
186
+ if(!resetn) begin
187
+ fsm_state <= FSM_IDLE;
188
+ end else begin
189
+ fsm_state <= n_fsm_state;
190
+ end
191
+ end
192
+
193
+
194
+ //
195
+ // Responsible for updating the internal value of the rxd_reg.
196
+ always @(posedge clk) begin : p_rxd_reg
197
+ if(!resetn) begin
198
+ rxd_reg <= 1'b1;
199
+ rxd_reg_0 <= 1'b1;
200
+ end else if(uart_rx_en) begin
201
+ rxd_reg <= rxd_reg_0;
202
+ rxd_reg_0 <= uart_rxd;
203
+ end
204
+ end
205
+
206
+
207
+ endmodule
AngeloJacobo_UberDDR3/example_demo/arty_s7/uart_tx.v ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ //
4
+ // Module: uart_tx
5
+ //
6
+ // Notes:
7
+ // - UART transmitter module.
8
+ //
9
+
10
+ module uart_tx(
11
+ input wire clk , // Top level system clock input.
12
+ input wire resetn , // Asynchronous active low reset.
13
+ output wire uart_txd , // UART transmit pin.
14
+ output wire uart_tx_busy, // Module busy sending previous item.
15
+ input wire uart_tx_en , // Send the data on uart_tx_data
16
+ input wire [PAYLOAD_BITS-1:0] uart_tx_data // The data to be sent
17
+ );
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // External parameters.
21
+ //
22
+
23
+ //
24
+ // Input bit rate of the UART line.
25
+ parameter BIT_RATE = 9600; // bits / sec
26
+ localparam BIT_P = 1_000_000_000 * 1/BIT_RATE; // nanoseconds
27
+
28
+ //
29
+ // Clock frequency in hertz.
30
+ parameter CLK_HZ = 50_000_000;
31
+ localparam CLK_P = 1_000_000_000 * 1/CLK_HZ; // nanoseconds
32
+
33
+ //
34
+ // Number of data bits recieved per UART packet.
35
+ parameter PAYLOAD_BITS = 8;
36
+
37
+ //
38
+ // Number of stop bits indicating the end of a packet.
39
+ parameter STOP_BITS = 1;
40
+
41
+ // ---------------------------------------------------------------------------
42
+ // Internal parameters.
43
+ //
44
+
45
+ //
46
+ // Number of clock cycles per uart bit.
47
+ localparam CYCLES_PER_BIT = BIT_P / CLK_P;
48
+
49
+ //
50
+ // Size of the registers which store sample counts and bit durations.
51
+ localparam COUNT_REG_LEN = 1+$clog2(CYCLES_PER_BIT);
52
+
53
+ // ---------------------------------------------------------------------------
54
+ // Internal registers.
55
+ //
56
+
57
+ //
58
+ // Internally latched value of the uart_txd line. Helps break long timing
59
+ // paths from the logic to the output pins.
60
+ reg txd_reg;
61
+
62
+ //
63
+ // Storage for the serial data to be sent.
64
+ reg [PAYLOAD_BITS-1:0] data_to_send;
65
+
66
+ //
67
+ // Counter for the number of cycles over a packet bit.
68
+ reg [COUNT_REG_LEN-1:0] cycle_counter;
69
+
70
+ //
71
+ // Counter for the number of sent bits of the packet.
72
+ reg [3:0] bit_counter;
73
+
74
+ //
75
+ // Current and next states of the internal FSM.
76
+ reg [2:0] fsm_state;
77
+ reg [2:0] n_fsm_state;
78
+
79
+ localparam FSM_IDLE = 0;
80
+ localparam FSM_START= 1;
81
+ localparam FSM_SEND = 2;
82
+ localparam FSM_STOP = 3;
83
+
84
+
85
+ // ---------------------------------------------------------------------------
86
+ // FSM next state selection.
87
+ //
88
+
89
+ assign uart_tx_busy = fsm_state != FSM_IDLE;
90
+ assign uart_txd = txd_reg;
91
+
92
+ wire next_bit = cycle_counter == CYCLES_PER_BIT;
93
+ wire payload_done = bit_counter == PAYLOAD_BITS ;
94
+ wire stop_done = bit_counter == STOP_BITS && fsm_state == FSM_STOP;
95
+
96
+ //
97
+ // Handle picking the next state.
98
+ always @(*) begin : p_n_fsm_state
99
+ case(fsm_state)
100
+ FSM_IDLE : n_fsm_state = uart_tx_en ? FSM_START: FSM_IDLE ;
101
+ FSM_START: n_fsm_state = next_bit ? FSM_SEND : FSM_START;
102
+ FSM_SEND : n_fsm_state = payload_done ? FSM_STOP : FSM_SEND ;
103
+ FSM_STOP : n_fsm_state = stop_done ? FSM_IDLE : FSM_STOP ;
104
+ default : n_fsm_state = FSM_IDLE;
105
+ endcase
106
+ end
107
+
108
+ // ---------------------------------------------------------------------------
109
+ // Internal register setting and re-setting.
110
+ //
111
+
112
+ //
113
+ // Handle updates to the sent data register.
114
+ integer i = 0;
115
+ always @(posedge clk) begin : p_data_to_send
116
+ if(!resetn) begin
117
+ data_to_send <= {PAYLOAD_BITS{1'b0}};
118
+ end else if(fsm_state == FSM_IDLE && uart_tx_en) begin
119
+ data_to_send <= uart_tx_data;
120
+ end else if(fsm_state == FSM_SEND && next_bit ) begin
121
+ for ( i = PAYLOAD_BITS-2; i >= 0; i = i - 1) begin
122
+ data_to_send[i] <= data_to_send[i+1];
123
+ end
124
+ end
125
+ end
126
+
127
+
128
+ //
129
+ // Increments the bit counter each time a new bit frame is sent.
130
+ always @(posedge clk) begin : p_bit_counter
131
+ if(!resetn) begin
132
+ bit_counter <= 4'b0;
133
+ end else if(fsm_state != FSM_SEND && fsm_state != FSM_STOP) begin
134
+ bit_counter <= {COUNT_REG_LEN{1'b0}};
135
+ end else if(fsm_state == FSM_SEND && n_fsm_state == FSM_STOP) begin
136
+ bit_counter <= {COUNT_REG_LEN{1'b0}};
137
+ end else if(fsm_state == FSM_STOP&& next_bit) begin
138
+ bit_counter <= bit_counter + 1'b1;
139
+ end else if(fsm_state == FSM_SEND && next_bit) begin
140
+ bit_counter <= bit_counter + 1'b1;
141
+ end
142
+ end
143
+
144
+
145
+ //
146
+ // Increments the cycle counter when sending.
147
+ always @(posedge clk) begin : p_cycle_counter
148
+ if(!resetn) begin
149
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
150
+ end else if(next_bit) begin
151
+ cycle_counter <= {COUNT_REG_LEN{1'b0}};
152
+ end else if(fsm_state == FSM_START ||
153
+ fsm_state == FSM_SEND ||
154
+ fsm_state == FSM_STOP ) begin
155
+ cycle_counter <= cycle_counter + 1'b1;
156
+ end
157
+ end
158
+
159
+
160
+ //
161
+ // Progresses the next FSM state.
162
+ always @(posedge clk) begin : p_fsm_state
163
+ if(!resetn) begin
164
+ fsm_state <= FSM_IDLE;
165
+ end else begin
166
+ fsm_state <= n_fsm_state;
167
+ end
168
+ end
169
+
170
+
171
+ //
172
+ // Responsible for updating the internal value of the txd_reg.
173
+ always @(posedge clk) begin : p_txd_reg
174
+ if(!resetn) begin
175
+ txd_reg <= 1'b1;
176
+ end else if(fsm_state == FSM_IDLE) begin
177
+ txd_reg <= 1'b1;
178
+ end else if(fsm_state == FSM_START) begin
179
+ txd_reg <= 1'b0;
180
+ end else if(fsm_state == FSM_SEND) begin
181
+ txd_reg <= data_to_send[0];
182
+ end else if(fsm_state == FSM_STOP) begin
183
+ txd_reg <= 1'b1;
184
+ end
185
+ end
186
+
187
+ endmodule
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/Makefile ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FAMILY = kintex7
2
+ PART = xc7k160tffg676-2
3
+ BOARD = qmtechKintex7
4
+ PROJECT = enclustra_ddr3
5
+ CHIPDB = ${KINTEX7_CHIPDB}
6
+ ADDITIONAL_SOURCES = ../../rtl/ddr3_controller.v ../../rtl/ddr3_phy.v ../../rtl/ddr3_top.v uart_rx.v uart_tx.v clk_wiz.v
7
+
8
+ #############################################################################################
9
+ NEXTPNR_XILINX_DIR ?= /snap/openxc7/current/opt/nextpnr-xilinx
10
+ NEXTPNR_XILINX_PYTHON_DIR ?= ${NEXTPNR_XILINX_DIR}/python
11
+ PRJXRAY_DB_DIR ?= ${NEXTPNR_XILINX_DIR}/external/prjxray-db
12
+
13
+ DBPART = $(shell echo ${PART} | sed -e 's/-[0-9]//g')
14
+ SPEEDGRADE = $(shell echo ${PART} | sed -e 's/.*\-\([0-9]\)/\1/g')
15
+
16
+ CHIPDB ?= ./
17
+ ifeq ($(CHIPDB),)
18
+ CHIPDB = ./
19
+ endif
20
+
21
+ PYPY3 ?= pypy3
22
+
23
+ TOP ?= ${PROJECT}
24
+ TOP_MODULE ?= ${TOP}
25
+ TOP_VERILOG ?= ${TOP}.v
26
+
27
+ PNR_DEBUG ?= # --verbose --debug
28
+
29
+ JTAG_LINK ?= -c digilent_hs2
30
+
31
+ XDC ?= ${PROJECT}.xdc
32
+
33
+ .PHONY: openxc7
34
+ openxc7: ${PROJECT}_openxc7.bit
35
+
36
+ .PHONY: program
37
+ program: ${PROJECT}_openxc7.bit
38
+ openFPGALoader ${JTAG_LINK} --bitstream $<
39
+
40
+ ${PROJECT}.json: ${TOP_VERILOG} ${ADDITIONAL_SOURCES}
41
+ yosys -p "synth_xilinx -flatten -abc9 ${SYNTH_OPTS} -arch xc7 -top ${TOP_MODULE}; write_json ${PROJECT}.json" $< ${ADDITIONAL_SOURCES}
42
+
43
+ # The chip database only needs to be generated once
44
+ # that is why we don't clean it with make clean
45
+ ${CHIPDB}/${DBPART}.bin:
46
+ ${PYPY3} ${NEXTPNR_XILINX_PYTHON_DIR}/bbaexport.py --device ${PART} --bba ${DBPART}.bba
47
+ bbasm -l ${DBPART}.bba ${CHIPDB}/${DBPART}.bin
48
+ rm -f ${DBPART}.bba
49
+
50
+ ${PROJECT}.fasm: ${PROJECT}.json ${CHIPDB}/${DBPART}.bin ${XDC}
51
+ nextpnr-xilinx --chipdb ${CHIPDB}/${DBPART}.bin --xdc ${XDC} --json ${PROJECT}.json --fasm $@ ${PNR_ARGS} ${PNR_DEBUG}
52
+
53
+ ${PROJECT}.frames: ${PROJECT}.fasm
54
+ fasm2frames --part ${PART} --db-root ${PRJXRAY_DB_DIR}/${FAMILY} $< > $@
55
+
56
+ ${PROJECT}_openxc7.bit: ${PROJECT}.frames
57
+ xc7frames2bit --part_file ${PRJXRAY_DB_DIR}/${FAMILY}/${PART}/part.yaml --part_name ${PART} --frm_file $< --output_file $@
58
+
59
+
60
+ #############################################################################################
61
+ # SPDX-License-Identifier: MIT
62
+ # Generated from https://github.com/FPGAOL-CE/caas-wizard
63
+ #
64
+ BUILDDIR := ${CURDIR}/build
65
+
66
+ LOGFILE := ${BUILDDIR}/top.log
67
+
68
+ # Build design
69
+ .PHONY: vivado
70
+ vivado: ${BUILDDIR}/${PROJECT}_vivado.bit
71
+
72
+ ${BUILDDIR}:
73
+ mkdir -m 777 -p ${BUILDDIR} && chown -R nobody ${BUILDDIR} | true
74
+
75
+ .ONESHELL:
76
+ ${BUILDDIR}/vivado.tcl: ${BUILDDIR}
77
+ cat << EOF > $@
78
+ # vivado.tcl generated for FPGAOL-CE/caas-wizard
79
+ # can be launched from any directory
80
+ cd ${BUILDDIR}
81
+ create_project -part ${PART} -force v_proj
82
+ set_property target_language Verilog [current_project]
83
+ cd ..
84
+ read_verilog [glob ${PROJECT}.v ${ADDITIONAL_SOURCES}]
85
+ read_xdc [glob $(wildcard ${PROJECT}.xdc) ]
86
+ cd build
87
+ synth_design -top ${PROJECT}
88
+ opt_design
89
+ place_design
90
+ phys_opt_design
91
+ route_design
92
+ write_bitstream -verbose -force ${PROJECT}_vivado.bit
93
+ # report_utilization -file util.rpt
94
+ # report_timing_summary -file timing.rpt
95
+ EOF
96
+
97
+ ${BUILDDIR}/${PROJECT}_vivado.bit: ${BUILDDIR}/vivado.tcl
98
+ cd ${BUILDDIR} && vivado -mode batch -source $< > ${LOGFILE} 2>&1
99
+
100
+ .PHONY: program_vivado
101
+ program_vivado:
102
+ openFPGALoader ${JTAG_LINK} --bitstream ${BUILDDIR}/${PROJECT}_vivado.bit
103
+
104
+ #############################################################################################
105
+
106
+ .PHONY: clean
107
+ clean:
108
+ rm -f *.bit
109
+ rm -f *.frames
110
+ rm -f *.fasm
111
+ rm -f *.json
112
+ rm -f *.bin
113
+ rm -f *.bba
114
+ rm -rf ${BUILDDIR}
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/caas.conf ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ Backend = openxc7
3
+ Part = xc7k160tffg676-2
4
+ Top = enclustra_ddr3
5
+ Constraint = enclustra_ddr3.xdc
6
+ Sources = ./ddr3_top.v,./ddr3_controller.v,./ddr3_phy.v,./enclustra_ddr3.v,./uart_rx.v,./uart_tx.v,./clk_wiz.v
7
+
8
+ [caas]
9
+ Server = https://caas.symbioticeda.com:18888/
10
+
11
+
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/clk_wiz.v ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ `timescale 1ps/1ps
2
+
3
+ module clk_wiz
4
+ (
5
+ input wire clk_in1,
6
+ output wire clk_out1,
7
+ output wire clk_out2,
8
+ output wire clk_out3,
9
+ output wire clk_out4,
10
+ output wire clk_out5,
11
+ input wire reset,
12
+ output wire locked
13
+ );
14
+ wire clk_out1_clk_wiz_0;
15
+ wire clk_out2_clk_wiz_0;
16
+ wire clk_out3_clk_wiz_0;
17
+ // wire clk_out4_clk_wiz_0;
18
+ // wire clk_out5_clk_wiz_0;
19
+
20
+ wire clkfbout;
21
+
22
+ PLLE2_ADV
23
+ #(.BANDWIDTH ("OPTIMIZED"),
24
+ .COMPENSATION ("INTERNAL"),
25
+ .STARTUP_WAIT ("FALSE"),
26
+ .DIVCLK_DIVIDE (1),
27
+ .CLKFBOUT_MULT (5), // 200 MHz * 5 = 1000 MHz
28
+ .CLKFBOUT_PHASE (0.000),
29
+ .CLKOUT0_DIVIDE (12), // 1000 MHz / 12 = 83.333 MHz
30
+ .CLKOUT0_PHASE (0.000),
31
+ .CLKOUT0_DUTY_CYCLE (0.500),
32
+ .CLKOUT1_DIVIDE (3), // 1000 MHz / 3 = 333.333 MHz
33
+ .CLKOUT1_PHASE (0.000),
34
+ .CLKOUT1_DUTY_CYCLE (0.500),
35
+ .CLKOUT2_DIVIDE (5), // 1000 MHz / 5 = 200 MHz
36
+ .CLKOUT2_PHASE (0.000),
37
+ .CLKOUT2_DUTY_CYCLE (0.500),
38
+ // .CLKOUT3_DIVIDE (3), // 1000 MHz / 3 = 333.333 MHz, 90 phase
39
+ // .CLKOUT3_PHASE (90.000),
40
+ // .CLKOUT3_DUTY_CYCLE (0.500),
41
+ // .CLKOUT4_DIVIDE (3), // 1000 MHz / 3 = 333.333 MHz, 180 phase
42
+ // .CLKOUT4_PHASE (180),
43
+ // .CLKOUT4_DUTY_CYCLE (0.500),
44
+ .CLKIN1_PERIOD (5) // 200 MHz input
45
+ )
46
+ plle2_adv_inst
47
+ (
48
+ .CLKFBOUT (clkfbout),
49
+ .CLKOUT0 (clk_out1_clk_wiz_0),
50
+ .CLKOUT1 (clk_out2_clk_wiz_0),
51
+ .CLKOUT2 (clk_out3_clk_wiz_0),
52
+ // .CLKOUT3 (clk_out4_clk_wiz_0),
53
+ // .CLKOUT4 (clk_out5_clk_wiz_0),
54
+ .CLKFBIN (clkfbout),
55
+ .CLKIN1 (clk_in1),
56
+ .LOCKED (locked),
57
+ .RST (reset)
58
+ );
59
+ BUFG clkout1_buf
60
+ (.O (clk_out1),
61
+ .I (clk_out1_clk_wiz_0));
62
+ BUFG clkout2_buf
63
+ (.O (clk_out2),
64
+ .I (clk_out2_clk_wiz_0));
65
+ BUFG clkout3_buf
66
+ (.O (clk_out3),
67
+ .I (clk_out3_clk_wiz_0));
68
+ // BUFG clkout4_buf
69
+ // (.O (clk_out4),
70
+ // .I (clk_out4_clk_wiz_0));
71
+ // BUFG clkout5_buf
72
+ // (.O (clk_out5),
73
+ // .I (clk_out5_clk_wiz_0));
74
+ endmodule
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_controller.v ADDED
The diff for this file is too large to render. See raw diff
 
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_phy.v ADDED
@@ -0,0 +1,1462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ddr3_phy.v
4
+ // Project: UberDDR3 - An Open Source DDR3 Controller
5
+ //
6
+ // Purpose: PHY component for the DDR3 controller. Handles the primitives such
7
+ // as IOSERDES, IODELAY, and IOBUF. These generates the signals connected to
8
+ // the DDR3 RAM.
9
+ //
10
+ // Engineer: Angelo C. Jacobo
11
+ //
12
+ ////////////////////////////////////////////////////////////////////////////////
13
+ //
14
+ // Copyright (C) 2023-2025 Angelo Jacobo
15
+ //
16
+ // This program is free software: you can redistribute it and/or modify
17
+ // it under the terms of the GNU General Public License as published by
18
+ // the Free Software Foundation, either version 3 of the License, or
19
+ // (at your option) any later version.
20
+ //
21
+ // This program is distributed in the hope that it will be useful,
22
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ // GNU General Public License for more details.
25
+ //
26
+ // You should have received a copy of the GNU General Public License
27
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
28
+ //
29
+ ////////////////////////////////////////////////////////////////////////////////
30
+
31
+ `default_nettype none
32
+ `timescale 1ps / 1ps
33
+ //`define DEBUG_DQS // uncomment to route the raw DQS to output port for debugging
34
+
35
+ module ddr3_phy #(
36
+ parameter CONTROLLER_CLK_PERIOD = 10_000, //ps, clock period of the controller interface
37
+ DDR3_CLK_PERIOD = 2_500, //ps, clock period of the DDR3 RAM device (must be 1/4 of the CONTROLLER_CLK_PERIOD)
38
+ ROW_BITS = 14, //width of row address
39
+ BA_BITS = 3,
40
+ DQ_BITS = 8,
41
+ LANES = 8,
42
+ DUAL_RANK_DIMM = 0, // enable dual rank DIMM (1 = enable, 0 = disable)
43
+ parameter[0:0] ODELAY_SUPPORTED = 1, //set to 1 when ODELAYE2 is supported
44
+ USE_IO_TERMINATION = 0, //use IOBUF_DCIEN and IOBUFDS_DCIEN when 1
45
+ NO_IOSERDES_LOOPBACK = 1, // don't use IOSERDES loopback for bitslip training
46
+ // The next parameters act more like a localparam (since user does not have to set this manually) but was added here to simplify port declaration
47
+ parameter serdes_ratio = 4, // this controller is fixed as a 4:1 memory controller (CONTROLLER_CLK_PERIOD/DDR3_CLK_PERIOD = 4)
48
+ wb_data_bits = DQ_BITS*LANES*serdes_ratio*2,
49
+ wb_sel_bits = wb_data_bits / 8,
50
+ //4 is the width of a single ddr3 command {cs_n, ras_n, cas_n, we_n} plus 3 (ck_en, odt, reset_n) plus bank bits plus row bits
51
+ cmd_len = 4 + 3 + BA_BITS + ROW_BITS + 2*DUAL_RANK_DIMM
52
+ )(
53
+ input wire i_controller_clk, i_ddr3_clk, i_ref_clk,
54
+ input wire i_ddr3_clk_90, //required only when ODELAY_SUPPORTED is zero
55
+ input wire i_rst_n,
56
+ // Controller Interface
57
+ input wire i_controller_reset,
58
+ input wire[cmd_len*serdes_ratio-1:0] i_controller_cmd,
59
+ input wire i_controller_dqs_tri_control, i_controller_dq_tri_control,
60
+ input wire i_controller_toggle_dqs,
61
+ input wire[wb_data_bits-1:0] i_controller_data,
62
+ input wire[wb_sel_bits-1:0] i_controller_dm,
63
+ input wire[4:0] i_controller_odelay_data_cntvaluein,i_controller_odelay_dqs_cntvaluein,
64
+ input wire[4:0] i_controller_idelay_data_cntvaluein,i_controller_idelay_dqs_cntvaluein,
65
+ input wire[LANES-1:0] i_controller_odelay_data_ld, i_controller_odelay_dqs_ld,
66
+ input wire[LANES-1:0] i_controller_idelay_data_ld, i_controller_idelay_dqs_ld,
67
+ input wire[LANES-1:0] i_controller_bitslip,
68
+ input wire i_controller_write_leveling_calib,
69
+ output wire[DQ_BITS*LANES*8-1:0] o_controller_iserdes_data,
70
+ output wire[LANES*8-1:0] o_controller_iserdes_dqs,
71
+ output wire[LANES*8-1:0] o_controller_iserdes_bitslip_reference,
72
+ output wire o_controller_idelayctrl_rdy,
73
+ // DDR3 I/O Interface
74
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_clk_p,o_ddr3_clk_n,
75
+ output wire o_ddr3_reset_n,
76
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cke, // CKE
77
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_cs_n, // chip select signal
78
+ output wire o_ddr3_ras_n, // RAS#
79
+ output wire o_ddr3_cas_n, // CAS#
80
+ output wire o_ddr3_we_n, // WE#
81
+ output wire[ROW_BITS-1:0] o_ddr3_addr,
82
+ output wire[BA_BITS-1:0] o_ddr3_ba_addr,
83
+ inout wire[(DQ_BITS*LANES)-1:0] io_ddr3_dq,
84
+ inout wire[(DQ_BITS*LANES)/8-1:0] io_ddr3_dqs, io_ddr3_dqs_n,
85
+ output wire[LANES-1:0] o_ddr3_dm,
86
+ output wire[DUAL_RANK_DIMM:0] o_ddr3_odt, // on-die termination
87
+ // DEBUG PHY
88
+ output wire[(DQ_BITS*LANES)/8-1:0] o_ddr3_debug_read_dqs_p,
89
+ output wire[(DQ_BITS*LANES)/8-1:0] o_ddr3_debug_read_dqs_n
90
+ );
91
+
92
+ // cmd bit assignment
93
+ localparam CMD_CS_N_2 = cmd_len - 1,
94
+ CMD_CS_N = DUAL_RANK_DIMM[0]? cmd_len - 2 : cmd_len - 1,
95
+ CMD_RAS_N = DUAL_RANK_DIMM[0]? cmd_len - 3 : cmd_len - 2,
96
+ CMD_CAS_N = DUAL_RANK_DIMM[0]? cmd_len - 4 : cmd_len - 3,
97
+ CMD_WE_N = DUAL_RANK_DIMM[0]? cmd_len - 5 : cmd_len - 4,
98
+ CMD_ODT = DUAL_RANK_DIMM[0]? cmd_len - 6 : cmd_len - 5,
99
+ CMD_CKE_2 = DUAL_RANK_DIMM[0]? cmd_len - 7 : cmd_len - 6,
100
+ CMD_CKE = DUAL_RANK_DIMM[0]? cmd_len - 8 : cmd_len - 6,
101
+ CMD_RESET_N = DUAL_RANK_DIMM[0]? cmd_len - 9 : cmd_len - 7,
102
+ CMD_BANK_START = BA_BITS + ROW_BITS - 1,
103
+ CMD_ADDRESS_START = ROW_BITS - 1;
104
+ localparam SYNC_RESET_DELAY = $rtoi($ceil(52_000/CONTROLLER_CLK_PERIOD)); //52_000 ps of reset pulse width required for IDELAYCTRL
105
+ //cmd needs to be center-aligned to the positive edge of the
106
+ //ddr3_clk. This means cmd needs to be delayed by half the ddr3
107
+ //clk period. Subtract by 600ps to include the IODELAY insertion
108
+ //delay. Divide by a delay resolution of 78.125ps per tap to get
109
+ //the needed tap value.
110
+ localparam CMD_ODELAY_TAP = ((DDR3_CLK_PERIOD/2) - 600)/78.125;
111
+
112
+ // Data does not have to be delayed (DQS is the on that has to be
113
+ // delayed and center-aligned to the center eye of data)
114
+ localparam DATA_ODELAY_TAP = 0;
115
+
116
+ //DQS needs to be edge-aligned to the center eye of the data.
117
+ //This means DQS needs to be delayed by a quarter of the ddr3
118
+ //clk period relative to the data. Subtract by 600ps to include
119
+ //the IODELAY insertion delay. Divide by a delay resolution of
120
+ //78.125ps per tap to get the needed tap value. Then add the tap
121
+ //value used in data to have the delay relative to the data.
122
+ localparam DQS_ODELAY_TAP = ((DDR3_CLK_PERIOD/4))/78.125 + DATA_ODELAY_TAP;
123
+
124
+ //Incoming DQS should be 90 degree delayed relative to incoming data
125
+ localparam DATA_IDELAY_TAP = 0; //600ps delay
126
+ localparam DQS_IDELAY_TAP = ((DDR3_CLK_PERIOD/4))/78.125 + DATA_IDELAY_TAP;
127
+
128
+ genvar gen_index;
129
+ wire[cmd_len-1:0] oserdes_cmd, //serialized(4:1) i_controller_cmd_slot_x
130
+ cmd;//delayed oserdes_cmd
131
+ wire[(DQ_BITS*LANES)-1:0] oserdes_data, odelay_data, idelay_data, read_dq;
132
+ wire[LANES-1:0] oserdes_dm, odelay_dm;
133
+ wire[LANES-1:0] odelay_dqs, read_dqs, idelay_dqs;
134
+ wire[DQ_BITS*LANES-1:0] oserdes_dq_tri_control;
135
+ wire[LANES-1:0] oserdes_dqs;
136
+ wire[LANES-1:0] oserdes_dqs_tri_control;
137
+ wire[LANES-1:0] oserdes_bitslip_reference;
138
+ reg[$clog2(SYNC_RESET_DELAY):0] delay_before_release_reset;
139
+ reg sync_rst = 0;
140
+ wire ddr3_clk;
141
+ reg toggle_dqs_q; //past value of i_controller_toggle_dqs
142
+ wire ddr3_clk_delayed;
143
+ wire idelayctrl_rdy;
144
+ wire dci_locked;
145
+ reg[LANES*8-1:0] o_controller_iserdes_bitslip_reference_reg;
146
+ reg[LANES - 1 : 0] shift_bitslip_index;
147
+
148
+ // initial value of bitslip reference
149
+ initial begin
150
+ o_controller_iserdes_bitslip_reference_reg = {LANES{8'b0001_1110}};
151
+ shift_bitslip_index = 0;
152
+ end
153
+
154
+ assign o_controller_idelayctrl_rdy = idelayctrl_rdy && dci_locked;
155
+
156
+ `ifdef DEBUG_DQS
157
+ assign o_ddr3_debug_read_dqs_p = io_ddr3_dqs;
158
+ assign o_ddr3_debug_read_dqs_n = io_ddr3_dqs_n;
159
+ `else
160
+ assign o_ddr3_debug_read_dqs_p = 0;
161
+ assign o_ddr3_debug_read_dqs_n = 0;
162
+ `endif
163
+
164
+ //synchronous reset
165
+ always @(posedge i_controller_clk) begin
166
+ if(!i_rst_n || i_controller_reset) begin
167
+ sync_rst <= 1'b1;
168
+ delay_before_release_reset <= SYNC_RESET_DELAY[$clog2(SYNC_RESET_DELAY):0];
169
+ toggle_dqs_q <= 0;
170
+ end
171
+ else begin
172
+ delay_before_release_reset <= (delay_before_release_reset == 0)? 0: delay_before_release_reset - 1;
173
+ sync_rst <= !(delay_before_release_reset == 0);
174
+ toggle_dqs_q <= i_controller_toggle_dqs;
175
+ end
176
+ end
177
+
178
+ //PHY cmd
179
+ generate
180
+ for(gen_index = 0; gen_index < cmd_len; gen_index = gen_index + 1) begin
181
+ // OSERDESE2: Output SERial/DESerializer with bitslip
182
+ //7 Series
183
+ // Xilinx HDL Libraries Guide, version 13.4
184
+ `ifndef SIM_MODEL
185
+ OSERDESE2 #(
186
+ `else
187
+ OSERDESE2_model #(
188
+ `endif
189
+ .DATA_RATE_OQ("SDR"), // DDR, SDR
190
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
191
+ .DATA_WIDTH(4), // Parallel data width (2-8,10,14)
192
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
193
+ .TRISTATE_WIDTH(1)
194
+ )
195
+ OSERDESE2_cmd(
196
+ .OFB(), // 1-bit output: Feedback path for data
197
+ .OQ(oserdes_cmd[gen_index]), // 1-bit output: Data path output
198
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
199
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
200
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
201
+ .D1(i_controller_cmd[cmd_len*0 + gen_index]),
202
+ .D2(i_controller_cmd[cmd_len*1 + gen_index]),
203
+ .D3(i_controller_cmd[cmd_len*2 + gen_index]),
204
+ .D4(i_controller_cmd[cmd_len*3 + gen_index]),
205
+ .OCE(1'b1), // 1-bit input: Output data clock enable
206
+ .RST(sync_rst), // 1-bit input: Reset
207
+ // unused signals but were added here to make vivado happy
208
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
209
+ .SHIFTOUT2(),
210
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
211
+ .TFB(), // 1-bit output: 3-state control
212
+ .TQ(), // 1-bit output: 3-state control
213
+ .D5(),
214
+ .D6(),
215
+ .D7(),
216
+ .D8(),
217
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
218
+ .SHIFTIN1(0),
219
+ .SHIFTIN2(0),
220
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
221
+ .T1(0),
222
+ .T2(0),
223
+ .T3(0),
224
+ .T4(0),
225
+ .TBYTEIN(0),
226
+ // 1-bit input: Byte group tristate
227
+ .TCE(0)
228
+ // 1-bit input: 3-state clock enable
229
+ );
230
+ // End of OSERDESE2_inst instantiation
231
+
232
+ end
233
+
234
+ if(DUAL_RANK_DIMM) begin // if dual rank enabled, odt_2 and odt_1 will be generated separately
235
+ // OSERDESE2: Output SERial/DESerializer with bitslip
236
+ //7 Series
237
+ // Xilinx HDL Libraries Guide, version 13.4
238
+ `ifndef SIM_MODEL
239
+ OSERDESE2 #(
240
+ `else
241
+ OSERDESE2_model #(
242
+ `endif
243
+ .DATA_RATE_OQ("SDR"), // DDR, SDR
244
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
245
+ .DATA_WIDTH(4), // Parallel data width (2-8,10,14)
246
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
247
+ .TRISTATE_WIDTH(1)
248
+ )
249
+ OSERDESE2_cmd(
250
+ .OFB(), // 1-bit output: Feedback path for data
251
+ .OQ(o_ddr3_odt[1]), // 1-bit output: Data path output
252
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
253
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
254
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
255
+ .D1(i_controller_cmd[cmd_len*0 + CMD_ODT]),
256
+ .D2(i_controller_cmd[cmd_len*1 + CMD_ODT]),
257
+ .D3(i_controller_cmd[cmd_len*2 + CMD_ODT]),
258
+ .D4(i_controller_cmd[cmd_len*3 + CMD_ODT]),
259
+ .OCE(1'b1), // 1-bit input: Output data clock enable
260
+ .RST(sync_rst), // 1-bit input: Reset
261
+ // unused signals but were added here to make vivado happy
262
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
263
+ .SHIFTOUT2(),
264
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
265
+ .TFB(), // 1-bit output: 3-state control
266
+ .TQ(), // 1-bit output: 3-state control
267
+ .D5(),
268
+ .D6(),
269
+ .D7(),
270
+ .D8(),
271
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
272
+ .SHIFTIN1(0),
273
+ .SHIFTIN2(0),
274
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
275
+ .T1(0),
276
+ .T2(0),
277
+ .T3(0),
278
+ .T4(0),
279
+ .TBYTEIN(0),
280
+ // 1-bit input: Byte group tristate
281
+ .TCE(0)
282
+ // 1-bit input: 3-state clock enable
283
+ );
284
+ // End of OSERDESE2_inst instantiation
285
+ end
286
+ endgenerate
287
+
288
+ // cs[1] when DUAL_RANK_DIMM enabled
289
+ generate
290
+ if(DUAL_RANK_DIMM) begin
291
+ assign o_ddr3_cs_n[1] = oserdes_cmd[CMD_CS_N_2];
292
+ assign o_ddr3_cs_n[0] = oserdes_cmd[CMD_CS_N];
293
+ assign o_ddr3_cke[1] = oserdes_cmd[CMD_CKE_2];
294
+ assign o_ddr3_cke[0] = oserdes_cmd[CMD_CKE];
295
+ assign o_ddr3_odt[0] = oserdes_cmd[CMD_ODT];
296
+ // o_ddr3_odt[1] will be generated directly by a separate OSERDES
297
+ // if odt[1] and odt[0] uses same output from oserdes, one of them will be unroutable
298
+ end
299
+ else begin
300
+ assign o_ddr3_cs_n = oserdes_cmd[CMD_CS_N];
301
+ assign o_ddr3_cke = oserdes_cmd[CMD_CKE];
302
+ assign o_ddr3_odt = oserdes_cmd[CMD_ODT];
303
+ end
304
+ endgenerate
305
+ assign o_ddr3_ras_n = oserdes_cmd[CMD_RAS_N],
306
+ o_ddr3_cas_n = oserdes_cmd[CMD_CAS_N],
307
+ o_ddr3_we_n = oserdes_cmd[CMD_WE_N],
308
+ o_ddr3_reset_n = oserdes_cmd[CMD_RESET_N],
309
+ o_ddr3_ba_addr = oserdes_cmd[CMD_BANK_START:CMD_ADDRESS_START+1],
310
+ o_ddr3_addr = oserdes_cmd[CMD_ADDRESS_START:0];
311
+
312
+ if(ODELAY_SUPPORTED) begin
313
+ // OSERDESE2: Output SERial/DESerializer with bitslip
314
+ //7 Series
315
+ // Xilinx HDL Libraries Guide, version 13.4
316
+ `ifndef SIM_MODEL
317
+ OSERDESE2 #(
318
+ `else
319
+ OSERDESE2_model #(
320
+ `endif
321
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
322
+ .DATA_RATE_TQ("SDR"), // DDR, SDR
323
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
324
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
325
+ .TRISTATE_WIDTH(1)
326
+ )
327
+ OSERDESE2_clk(
328
+ .OFB(ddr3_clk), // 1-bit output: Feedback path for data
329
+ .OQ(), // 1-bit output: Data path output
330
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
331
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
332
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
333
+ .D1(1'b1),
334
+ .D2(1'b0),
335
+ .D3(1'b1),
336
+ .D4(1'b0),
337
+ .D5(1'b1),
338
+ .D6(1'b0),
339
+ .D7(1'b1),
340
+ .D8(1'b0),
341
+ .OCE(1'b1), // 1-bit input: Output data clock enable
342
+ .RST(sync_rst), // 1-bit input: Reset
343
+ // unused signals but were added here to make vivado happy
344
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
345
+ .SHIFTOUT2(),
346
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
347
+ .TFB(), // 1-bit output: 3-state control
348
+ .TQ(), // 1-bit output: 3-state control
349
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
350
+ .SHIFTIN1(0),
351
+ .SHIFTIN2(0),
352
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
353
+ .T1(0),
354
+ .T2(0),
355
+ .T3(0),
356
+ .T4(0),
357
+ .TBYTEIN(0),
358
+ // 1-bit input: Byte group tristate
359
+ .TCE(0)
360
+ // 1-bit input: 3-state clock enable
361
+ );
362
+ // End of OSERDESE2_inst instantiation
363
+
364
+ //Delay the DQ
365
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
366
+ (* IODELAY_GROUP="DDR3-GROUP" *)
367
+ `ifndef SIM_MODEL
368
+ ODELAYE2 #(
369
+ `else
370
+ ODELAYE2_model #(
371
+ `endif
372
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
373
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
374
+ .ODELAY_TYPE("FIXED"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
375
+ .ODELAY_VALUE(CMD_ODELAY_TAP), // Output delay tap setting (0-31)
376
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
377
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
378
+ )
379
+ ODELAYE2_clk (
380
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
381
+ .DATAOUT(ddr3_clk_delayed), // 1-bit output: Delayed data/clock output
382
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
383
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
384
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
385
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
386
+ .CNTVALUEIN(5'd0), // 5-bit input: Counter value input
387
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
388
+ .LD(1'b0), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
389
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
390
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
391
+ .ODATAIN(ddr3_clk), // 1-bit input: Output delay data input
392
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
393
+ );
394
+ // if dual rank enabled, then there will be two clk
395
+ if(DUAL_RANK_DIMM) begin
396
+ // OBUFDS: Differential Output Buffer
397
+ // 7 Series
398
+ // Xilinx HDL Libraries Guide, version 13.4
399
+ `ifndef SIM_MODEL
400
+ OBUFDS OBUFDS0_inst (
401
+ `else
402
+ OBUFDS_model OBUFDS0_inst (
403
+ `endif
404
+ .O(o_ddr3_clk_p[0]), // Diff_p output (connect directly to top-level port)
405
+ .OB(o_ddr3_clk_n[0]), // Diff_n output (connect directly to top-level port)
406
+ .I(ddr3_clk_delayed) // Buffer input
407
+ );
408
+ `ifndef SIM_MODEL
409
+ OBUFDS OBUFDS1_inst (
410
+ `else
411
+ OBUFDS_model OBUFDS1_inst (
412
+ `endif
413
+ .O(o_ddr3_clk_p[1]), // Diff_p output (connect directly to top-level port)
414
+ .OB(o_ddr3_clk_n[1]), // Diff_n output (connect directly to top-level port)
415
+ .I(ddr3_clk_delayed) // Buffer input
416
+ );
417
+ // End of OBUFDS_inst instantiation
418
+ end
419
+ else begin
420
+ // OBUFDS: Differential Output Buffer
421
+ // 7 Series
422
+ // Xilinx HDL Libraries Guide, version 13.4
423
+ `ifndef SIM_MODEL
424
+ OBUFDS OBUFDS_inst (
425
+ `else
426
+ OBUFDS_model OBUFDS_inst (
427
+ `endif
428
+ .O(o_ddr3_clk_p), // Diff_p output (connect directly to top-level port)
429
+ .OB(o_ddr3_clk_n), // Diff_n output (connect directly to top-level port)
430
+ .I(ddr3_clk_delayed) // Buffer input
431
+ );
432
+ // End of OBUFDS_inst instantiation
433
+ end
434
+ end
435
+ else begin //ODELAY is not supported
436
+
437
+ // if dual rank enabled, then there will be two clk
438
+ if(DUAL_RANK_DIMM) begin
439
+ // OBUFDS: Differential Output Buffer
440
+ // 7 Series
441
+ // Xilinx HDL Libraries Guide, version 13.4
442
+ `ifndef SIM_MODEL
443
+ OBUFDS OBUFDS0_inst (
444
+ `else
445
+ OBUFDS_model OBUFDS0_inst (
446
+ `endif
447
+ .O(o_ddr3_clk_p[1]), // Diff_p output (connect directly to top-level port)
448
+ .OB(o_ddr3_clk_n[1]), // Diff_n output (connect directly to top-level port)
449
+ .I(!i_ddr3_clk) // Buffer input
450
+ );
451
+ `ifndef SIM_MODEL
452
+ OBUFDS OBUFDS1_inst (
453
+ `else
454
+ OBUFDS_model OBUFDS1_inst (
455
+ `endif
456
+ .O(o_ddr3_clk_p[0]), // Diff_p output (connect directly to top-level port)
457
+ .OB(o_ddr3_clk_n[0]), // Diff_n output (connect directly to top-level port)
458
+ .I(!i_ddr3_clk) // Buffer input
459
+ );
460
+ // End of OBUFDS_inst instantiation
461
+ end
462
+ else begin
463
+ // OBUFDS: Differential Output Buffer
464
+ // 7 Series
465
+ // Xilinx HDL Libraries Guide, version 13.4
466
+ `ifndef SIM_MODEL
467
+ OBUFDS OBUFDS_inst (
468
+ `else
469
+ OBUFDS_model OBUFDS_inst (
470
+ `endif
471
+ .O(o_ddr3_clk_p), // Diff_p output (connect directly to top-level port)
472
+ .OB(o_ddr3_clk_n), // Diff_n output (connect directly to top-level port)
473
+ .I(!i_ddr3_clk) // Buffer input
474
+ );
475
+ end
476
+ end
477
+
478
+
479
+ // PHY data and dm
480
+ generate
481
+ // data: oserdes -> odelay -> iobuf
482
+ for(gen_index = 0; gen_index < (DQ_BITS*LANES); gen_index = gen_index + 1) begin
483
+
484
+ if (ODELAY_SUPPORTED) begin
485
+ // OSERDESE2: Output SERial/DESerializer with bitslip
486
+ //7 Series
487
+ // Xilinx HDL Libraries Guide, version 13.4
488
+ `ifndef SIM_MODEL
489
+ OSERDESE2 #(
490
+ `else
491
+ OSERDESE2_model #(
492
+ `endif
493
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
494
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
495
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
496
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
497
+ .TRISTATE_WIDTH(1)
498
+ )
499
+ OSERDESE2_data(
500
+ .OFB(oserdes_data[gen_index]), // 1-bit output: Feedback path for data
501
+ .OQ(), // 1-bit output: Data path output
502
+ .TQ(oserdes_dq_tri_control[gen_index]),
503
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
504
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
505
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
506
+ .D1(i_controller_data[gen_index + (DQ_BITS*LANES)*0]),
507
+ .D2(i_controller_data[gen_index + (DQ_BITS*LANES)*1]),
508
+ .D3(i_controller_data[gen_index + (DQ_BITS*LANES)*2]),
509
+ .D4(i_controller_data[gen_index + (DQ_BITS*LANES)*3]),
510
+ .D5(i_controller_data[gen_index + (DQ_BITS*LANES)*4]),
511
+ .D6(i_controller_data[gen_index + (DQ_BITS*LANES)*5]),
512
+ .D7(i_controller_data[gen_index + (DQ_BITS*LANES)*6]),
513
+ .D8(i_controller_data[gen_index + (DQ_BITS*LANES)*7]),
514
+ .T1(i_controller_dq_tri_control),
515
+ .TCE(1'b1),
516
+ .OCE(1'b1), // 1-bit input: Output data clock enable
517
+ .RST(sync_rst), // 1-bit input: Reset
518
+ // unused signals but were added here to make vivado happy
519
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
520
+ .SHIFTOUT2(),
521
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
522
+ .TFB(), // 1-bit output: 3-state control
523
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
524
+ .SHIFTIN1(0),
525
+ .SHIFTIN2(0),
526
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
527
+ .T2(0),
528
+ .T3(0),
529
+ .T4(0),
530
+ .TBYTEIN(0)
531
+ // 1-bit input: Byte group tristate
532
+ );
533
+ // End of OSERDESE2_inst instantiation
534
+
535
+ // ODELAYE2: Output Fixed or Variable Delay Element
536
+ // 7 Series
537
+ // Xilinx HDL Libraries Guide, version 13.4
538
+ //odelay adds an insertion delay of 600ps to the actual delay setting: https://support.xilinx.com/s/article/42133?language=en_US
539
+ //Delay the DQ
540
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
541
+ (* IODELAY_GROUP="DDR3-GROUP" *)
542
+ `ifndef SIM_MODEL
543
+ ODELAYE2 #(
544
+ `else
545
+ ODELAYE2_model #(
546
+ `endif
547
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
548
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
549
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
550
+ .ODELAY_VALUE(DATA_ODELAY_TAP), // Output delay tap setting (0-31)
551
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
552
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
553
+ )
554
+ ODELAYE2_data (
555
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
556
+ .DATAOUT(odelay_data[gen_index]), // 1-bit output: Delayed data/clock output
557
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
558
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
559
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
560
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
561
+ .CNTVALUEIN(i_controller_odelay_data_cntvaluein), // 5-bit input: Counter value input
562
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
563
+ .LD(i_controller_odelay_data_ld[gen_index/8]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
564
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
565
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
566
+ .ODATAIN(oserdes_data[gen_index]), // 1-bit input: Output delay data input
567
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
568
+ );
569
+
570
+ if(USE_IO_TERMINATION) begin
571
+ // IOBUF_DCIEN: Single-ended Bi-directional Buffer with Digital Controlled Impedance (DCI)
572
+ // and Input path enable/disable
573
+ // May only be placed in High Performance (HP) Banks
574
+ // 7 Series
575
+ // Xilinx HDL Libraries Guide, version 13.4
576
+ `ifndef SIM_MODEL
577
+ IOBUF_DCIEN #(
578
+ `else
579
+ IOBUF_DCIEN_model #(
580
+ `endif
581
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
582
+ .SLEW("FAST"), // Specify the output slew rate
583
+ .USE_IBUFDISABLE("FALSE") // Use IBUFDISABLE function, "TRUE" or "FALSE"
584
+ ) IOBUF_DCIEN_data (
585
+ .O(read_dq[gen_index]), // Buffer output
586
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
587
+ .DCITERMDISABLE(1'b0), // DCI Termination enable input
588
+ .I(odelay_data[gen_index]), // Buffer input
589
+ .IBUFDISABLE(1'b0), // Input disable input, low=disable
590
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=input, low=output
591
+ );
592
+ // End of IOBUF_DCIEN_inst instantiation
593
+
594
+ end
595
+ else begin
596
+ // IOBUF: Single-ended Bi-directional Buffer
597
+ //All devices
598
+ // Xilinx HDL Libraries Guide, version 13.4
599
+ `ifndef SIM_MODEL
600
+ IOBUF #(
601
+ `else
602
+ IOBUF_model #(
603
+ `endif
604
+ //.DRIVE(12), // Specify the output drive strength
605
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
606
+ //.IOSTANDARD("SSTL15"), // Specify the I/O standard
607
+ .SLEW("FAST") // Specify the output slew rate
608
+ ) IOBUF_data (
609
+ .O(read_dq[gen_index]),// Buffer output
610
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
611
+ .I(odelay_data[gen_index]), // Buffer input
612
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=read, low=write
613
+ );
614
+ end
615
+ end
616
+ else begin //ODELAY is not supported
617
+ // OSERDESE2: Output SERial/DESerializer with bitslip
618
+ //7 Series
619
+ // Xilinx HDL Libraries Guide, version 13.4
620
+ `ifndef SIM_MODEL
621
+ OSERDESE2 #(
622
+ `else
623
+ OSERDESE2_model #(
624
+ `endif
625
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
626
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
627
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
628
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
629
+ .TRISTATE_WIDTH(1)
630
+ )
631
+ OSERDESE2_data(
632
+ .OFB(), // 1-bit output: Feedback path for data
633
+ .OQ(oserdes_data[gen_index]), // 1-bit output: Data path output
634
+ .TQ(oserdes_dq_tri_control[gen_index]),
635
+ .CLK(i_ddr3_clk_90), // 1-bit input: High speed clock
636
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
637
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
638
+ .D1(i_controller_data[gen_index + (DQ_BITS*LANES)*0]),
639
+ .D2(i_controller_data[gen_index + (DQ_BITS*LANES)*1]),
640
+ .D3(i_controller_data[gen_index + (DQ_BITS*LANES)*2]),
641
+ .D4(i_controller_data[gen_index + (DQ_BITS*LANES)*3]),
642
+ .D5(i_controller_data[gen_index + (DQ_BITS*LANES)*4]),
643
+ .D6(i_controller_data[gen_index + (DQ_BITS*LANES)*5]),
644
+ .D7(i_controller_data[gen_index + (DQ_BITS*LANES)*6]),
645
+ .D8(i_controller_data[gen_index + (DQ_BITS*LANES)*7]),
646
+ .T1(i_controller_dq_tri_control),
647
+ .TCE(1'b1),
648
+ .OCE(1'b1), // 1-bit input: Output data clock enable
649
+ .RST(sync_rst), // 1-bit input: Reset
650
+ // unused signals but were added here to make vivado happy
651
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
652
+ .SHIFTOUT2(),
653
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
654
+ .TFB(), // 1-bit output: 3-state control
655
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
656
+ .SHIFTIN1(0),
657
+ .SHIFTIN2(0),
658
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
659
+ .T2(0),
660
+ .T3(0),
661
+ .T4(0),
662
+ .TBYTEIN(0)
663
+ // 1-bit input: Byte group tristate
664
+ );
665
+ // End of OSERDESE2_inst instantiation
666
+
667
+ // IOBUF: Single-ended Bi-directional Buffer
668
+ //All devices
669
+ // Xilinx HDL Libraries Guide, version 13.4
670
+ `ifndef SIM_MODEL
671
+ IOBUF #(
672
+ `else
673
+ IOBUF_model #(
674
+ `endif
675
+ //.DRIVE(12), // Specify the output drive strength
676
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
677
+ //.IOSTANDARD("SSTL15"), // Specify the I/O standard
678
+ .SLEW("FAST") // Specify the output slew rate
679
+ ) IOBUF_data (
680
+ .O(read_dq[gen_index]),// Buffer output
681
+ .IO(io_ddr3_dq[gen_index]), // Buffer inout port (connect directly to top-level port)
682
+ .I(oserdes_data[gen_index]), // Buffer input
683
+ .T(oserdes_dq_tri_control[gen_index]) // 3-state enable input, high=read, low=write
684
+ );
685
+ end
686
+
687
+ // IDELAYE2: Input Fixed or Variable Delay Element
688
+ // 7 Series
689
+ // Xilinx HDL Libraries Guide, version 13.4
690
+ (* IODELAY_GROUP="DDR3-GROUP" *)
691
+ `ifndef SIM_MODEL
692
+ IDELAYE2 #(
693
+ `else
694
+ IDELAYE2_model #(
695
+ `endif
696
+ .DELAY_SRC("IDATAIN"), // Delay input (IDATAIN, DATAIN)
697
+ .HIGH_PERFORMANCE_MODE("TRUE"), //Reduced jitter ("TRUE"), Reduced power ("FALSE")
698
+ .IDELAY_TYPE("VAR_LOAD"), //FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
699
+ .IDELAY_VALUE(DATA_IDELAY_TAP), //Input delay tap setting (0-31)
700
+ .PIPE_SEL("FALSE"), //Select pipelined mode, FALSE, TRUE
701
+ .REFCLK_FREQUENCY(200.0), //IDELAYCTRL clock input frequency in MHz (190.0-210.0).
702
+ .SIGNAL_PATTERN("DATA") //DATA, CLOCK input signal
703
+ )
704
+ IDELAYE2_data (
705
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
706
+ .DATAOUT(idelay_data[gen_index]), // 1-bit output: Delayed data output
707
+ .C(i_controller_clk), // 1-bit input: Clock input
708
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
709
+ .CINVCTRL(1'b0),// 1-bit input: Dynamic clock inversion input
710
+ .CNTVALUEIN(i_controller_idelay_data_cntvaluein), // 5-bit input: Counter value input
711
+ .DATAIN(), //1-bit input: Internal delay data input
712
+ .IDATAIN(read_dq[gen_index]), // 1-bit input: Data input from the I/O
713
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
714
+ .LD(i_controller_idelay_data_ld[gen_index/8]), // 1-bit input: Load IDELAY_VALUE input
715
+ .LDPIPEEN(1'b0), // 1-bit input: Enable PIPELINE register to load data input
716
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
717
+ );
718
+ // End of IDELAYE2_inst instantiation
719
+
720
+ // End of IOBUF_inst instantiation
721
+ // ISERDESE2: Input SERial/DESerializer with bitslip
722
+ //7 Series
723
+ // Xilinx HDL Libraries Guide, version 13.4
724
+ `ifndef SIM_MODEL
725
+ ISERDESE2 #(
726
+ `else
727
+ ISERDESE2_model #(
728
+ `endif
729
+ .DATA_RATE("DDR"), // DDR, SDR
730
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
731
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
732
+ .INIT_Q1(1'b0),
733
+ .INIT_Q2(1'b0),
734
+ .INIT_Q3(1'b0),
735
+ .INIT_Q4(1'b0),
736
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
737
+ .IOBDELAY("IFD"), // NONE, BOTH, IBUF, IFD
738
+ .NUM_CE(1),// Number of clock enables (1,2)
739
+ .OFB_USED("FALSE"), // Select OFB path (FALSE, TRUE)
740
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
741
+ .SRVAL_Q1(1'b0),
742
+ .SRVAL_Q2(1'b0),
743
+ .SRVAL_Q3(1'b0),
744
+ .SRVAL_Q4(1'b0)
745
+ )
746
+ ISERDESE2_data (
747
+ .O(),
748
+ // 1-bit output: Combinatorial output
749
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
750
+ .Q1(o_controller_iserdes_data[(DQ_BITS*LANES)*7 + gen_index]),//56
751
+ .Q2(o_controller_iserdes_data[(DQ_BITS*LANES)*6 + gen_index]), //48
752
+ .Q3(o_controller_iserdes_data[(DQ_BITS*LANES)*5 + gen_index]),
753
+ .Q4(o_controller_iserdes_data[(DQ_BITS*LANES)*4 + gen_index]),
754
+ .Q5(o_controller_iserdes_data[(DQ_BITS*LANES)*3 + gen_index]),
755
+ .Q6(o_controller_iserdes_data[(DQ_BITS*LANES)*2 + gen_index]),
756
+ .Q7(o_controller_iserdes_data[(DQ_BITS*LANES)*1 + gen_index]),
757
+ .Q8(o_controller_iserdes_data[(DQ_BITS*LANES)*0 + gen_index]),
758
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
759
+ .SHIFTOUT1(),
760
+ .SHIFTOUT2(),
761
+ .BITSLIP(i_controller_bitslip[gen_index/8]),
762
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
763
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
764
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
765
+ // position every time Bitslip is invoked (DDR operation is different from
766
+ // SDR).
767
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
768
+ .CE1(1'b1),
769
+ .CE2(1'b1),
770
+ .CLKDIVP(), // 1-bit input: TBD
771
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
772
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
773
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
774
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
775
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
776
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
777
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
778
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
779
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
780
+ .D(), // 1-bit input: Data input
781
+ .DDLY(idelay_data[gen_index]), // 1-bit input: Serial data from IDELAYE2
782
+ .OFB(), // 1-bit input: Data feedback from OSERDESE2
783
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
784
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
785
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
786
+ .SHIFTIN1(),
787
+ .SHIFTIN2()
788
+ );
789
+ // End of ISERDESE2_inst instantiation
790
+
791
+ end
792
+
793
+ // data mask: oserdes -> odelay -> obuf
794
+ for(gen_index = 0; gen_index < LANES; gen_index = gen_index + 1) begin
795
+
796
+
797
+ if(ODELAY_SUPPORTED) begin
798
+ // OSERDESE2: Output SERial/DESerializer with bitslip
799
+ //7 Series
800
+ // Xilinx HDL Libraries Guide, version 13.4
801
+ `ifndef SIM_MODEL
802
+ OSERDESE2 #(
803
+ `else
804
+ OSERDESE2_model #(
805
+ `endif
806
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
807
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
808
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
809
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
810
+ .TRISTATE_WIDTH(1)
811
+ )
812
+ OSERDESE2_dm(
813
+ .OFB(oserdes_dm[gen_index]), // 1-bit output: Feedback path for data
814
+ .OQ(), // 1-bit output: Data path output
815
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
816
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
817
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
818
+ .D1(i_controller_dm[gen_index + LANES*0]),
819
+ .D2(i_controller_dm[gen_index + LANES*1]),
820
+ .D3(i_controller_dm[gen_index + LANES*2]),
821
+ .D4(i_controller_dm[gen_index + LANES*3]),
822
+ .D5(i_controller_dm[gen_index + LANES*4]),
823
+ .D6(i_controller_dm[gen_index + LANES*5]),
824
+ .D7(i_controller_dm[gen_index + LANES*6]),
825
+ .D8(i_controller_dm[gen_index + LANES*7]),
826
+ .TCE(1'b0),
827
+ .OCE(1'b1), // 1-bit input: Output data clock enable
828
+ .RST(sync_rst), // 1-bit input: Reset
829
+ // unused signals but were added here to make vivado happy
830
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
831
+ .SHIFTOUT2(),
832
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
833
+ .TFB(), // 1-bit output: 3-state control
834
+ .TQ(), // 1-bit output: 3-state control
835
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
836
+ .SHIFTIN1(0),
837
+ .SHIFTIN2(0),
838
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
839
+ .T1(0),
840
+ .T2(0),
841
+ .T3(0),
842
+ .T4(0),
843
+ .TBYTEIN(0)
844
+ // 1-bit input: Byte group tristate
845
+ );
846
+ // End of OSERDESE2_inst instantiation
847
+
848
+ // ODELAYE2: Output Fixed or Variable Delay Element
849
+ // 7 Series
850
+ // Xilinx HDL Libraries Guide, version 13.4
851
+ //odelay adds an insertion delay of 600ps to the actual delay setting: https://support.xilinx.com/s/article/42133?language=en_US
852
+ //Delay the DQ
853
+ // Delay resolution: 1/(32 x 2 x F REF ) = 78.125ps
854
+ (* IODELAY_GROUP="DDR3-GROUP" *)
855
+ `ifndef SIM_MODEL
856
+ ODELAYE2 #(
857
+ `else
858
+ ODELAYE2_model #(
859
+ `endif
860
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
861
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter to 5ps ("TRUE"), Reduced power but high jitter 9ns ("FALSE")
862
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
863
+ .ODELAY_VALUE(DATA_ODELAY_TAP), // Output delay tap setting (0-31)
864
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
865
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
866
+ )
867
+ ODELAYE2_dm (
868
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
869
+ .DATAOUT(odelay_dm[gen_index]), // 1-bit output: Delayed data/clock output
870
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
871
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
872
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
873
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
874
+ .CNTVALUEIN(i_controller_odelay_data_cntvaluein), // 5-bit input: Counter value input
875
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
876
+ .LD(i_controller_odelay_data_ld[gen_index]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
877
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
878
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
879
+ .ODATAIN(oserdes_dm[gen_index]), // 1-bit input: Output delay data input
880
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
881
+ );
882
+
883
+ // OBUF: Single-ended Output Buffer
884
+ // 7 Series
885
+ // Xilinx HDL Libraries Guide, version 13.4
886
+ `ifndef SIM_MODEL
887
+ OBUF #(
888
+ `else
889
+ OBUF_model #(
890
+ `endif
891
+ //.IOSTANDARD("SSTL_15"), // Specify the output I/O standard
892
+ .SLEW("FAST") // Specify the output slew rate
893
+ ) OBUF_dm (
894
+ .O(o_ddr3_dm[gen_index]), // Buffer output (connect directly to top-level port)
895
+ .I(odelay_dm[gen_index]) // Buffer input
896
+ );
897
+ // End of OBUF_inst instantiation
898
+ end
899
+ else begin
900
+ // OSERDESE2: Output SERial/DESerializer with bitslip
901
+ //7 Series
902
+ // Xilinx HDL Libraries Guide, version 13.4
903
+ `ifndef SIM_MODEL
904
+ OSERDESE2 #(
905
+ `else
906
+ OSERDESE2_model #(
907
+ `endif
908
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
909
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
910
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
911
+ .INIT_OQ(1'b0), // Initial value of OQ output (1'b0,1'b1)
912
+ .TRISTATE_WIDTH(1)
913
+ )
914
+ OSERDESE2_dm(
915
+ .OFB(), // 1-bit output: Feedback path for data
916
+ .OQ(oserdes_dm[gen_index]), // 1-bit output: Data path output
917
+ .CLK(i_ddr3_clk_90), // 1-bit input: High speed clock
918
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
919
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
920
+ .D1(i_controller_dm[gen_index + LANES*0]),
921
+ .D2(i_controller_dm[gen_index + LANES*1]),
922
+ .D3(i_controller_dm[gen_index + LANES*2]),
923
+ .D4(i_controller_dm[gen_index + LANES*3]),
924
+ .D5(i_controller_dm[gen_index + LANES*4]),
925
+ .D6(i_controller_dm[gen_index + LANES*5]),
926
+ .D7(i_controller_dm[gen_index + LANES*6]),
927
+ .D8(i_controller_dm[gen_index + LANES*7]),
928
+ .TCE(1'b0),
929
+ .OCE(1'b1), // 1-bit input: Output data clock enable
930
+ .RST(sync_rst), // 1-bit input: Reset
931
+ // unused signals but were added here to make vivado happy
932
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
933
+ .SHIFTOUT2(),
934
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
935
+ .TFB(), // 1-bit output: 3-state control
936
+ .TQ(), // 1-bit output: 3-state control
937
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
938
+ .SHIFTIN1(0),
939
+ .SHIFTIN2(0),
940
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
941
+ .T1(0),
942
+ .T2(0),
943
+ .T3(0),
944
+ .T4(0),
945
+ .TBYTEIN(0)
946
+ // 1-bit input: Byte group tristate
947
+ );
948
+ // End of OSERDESE2_inst instantiation
949
+
950
+ // OBUF: Single-ended Output Buffer
951
+ // 7 Series
952
+ // Xilinx HDL Libraries Guide, version 13.4
953
+ `ifndef SIM_MODEL
954
+ OBUF #(
955
+ `else
956
+ OBUF_model #(
957
+ `endif
958
+ //.IOSTANDARD("SSTL_15"), // Specify the output I/O standard
959
+ .SLEW("FAST") // Specify the output slew rate
960
+ ) OBUF_dm (
961
+ .O(o_ddr3_dm[gen_index]), // Buffer output (connect directly to top-level port)
962
+ .I(oserdes_dm[gen_index]) // Buffer input
963
+ );
964
+ // End of OBUF_inst instantiation
965
+
966
+ end
967
+ end
968
+
969
+ // dqs: odelay -> iobuf
970
+ for(gen_index = 0; gen_index < LANES; gen_index = gen_index + 1) begin
971
+ `ifndef DEBUG_DQS //remove the logic for dqs if needs to be debugged (directed to output instead)
972
+ if(ODELAY_SUPPORTED) begin
973
+ // OSERDESE2: Output SERial/DESerializer with bitslip
974
+ //7 Series
975
+ // Xilinx HDL Libraries Guide, version 13.4
976
+ `ifndef SIM_MODEL
977
+ OSERDESE2 #(
978
+ `else
979
+ OSERDESE2_model #(
980
+ `endif
981
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
982
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
983
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
984
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
985
+ .TRISTATE_WIDTH(1)
986
+ )
987
+ OSERDESE2_dqs(
988
+ .OFB(oserdes_dqs[gen_index]), // 1-bit output: Feedback path for data
989
+ .OQ(), // 1-bit output: Data path output
990
+ .TQ(oserdes_dqs_tri_control[gen_index]),
991
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
992
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
993
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
994
+ .D1(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q)), //the last part will still have half dqs series
995
+ .D2(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
996
+ .D3(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q) && !i_controller_write_leveling_calib),
997
+ .D4(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
998
+ .D5(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
999
+ .D6(1'b0 && i_controller_toggle_dqs),
1000
+ .D7(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1001
+ .D8(1'b0 && i_controller_toggle_dqs),
1002
+ .T1(i_controller_dqs_tri_control),
1003
+ .TCE(1'b1),
1004
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1005
+ .RST(sync_rst), // 1-bit input: Reset
1006
+ // unused signals but were added here to make vivado happy
1007
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1008
+ .SHIFTOUT2(),
1009
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1010
+ .TFB(), // 1-bit output: 3-state control
1011
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1012
+ .SHIFTIN1(0),
1013
+ .SHIFTIN2(0),
1014
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1015
+ .T2(0),
1016
+ .T3(0),
1017
+ .T4(0),
1018
+ .TBYTEIN(0)
1019
+ // 1-bit input: Byte group tristate
1020
+ );
1021
+ // End of OSERDESE2_inst instantiation
1022
+
1023
+
1024
+ // ODELAYE2: Output Fixed or Variable Delay Element
1025
+ // 7 Series
1026
+ // Xilinx HDL Libraries Guide, version 13.4
1027
+ //Delay the DQ
1028
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1029
+ `ifndef SIM_MODEL
1030
+ ODELAYE2 #(
1031
+ `else
1032
+ ODELAYE2_model #(
1033
+ `endif
1034
+ .DELAY_SRC("ODATAIN"), // Delay input (ODATAIN, CLKIN)
1035
+ .HIGH_PERFORMANCE_MODE("TRUE"), // Reduced jitter ("TRUE"), Reduced power ("FALSE")
1036
+ .ODELAY_TYPE("VAR_LOAD"), // FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
1037
+ .ODELAY_VALUE(DQS_ODELAY_TAP), // delay to align odelay_dqs to oserdes_dqs due to 600ps insertion delay: (1/800MHz - 600ps)/78.125ps = 8.32 taps
1038
+ .REFCLK_FREQUENCY(200.0), // IDELAYCTRL clock input frequency in MHz (190.0-210.0).
1039
+ .SIGNAL_PATTERN("DATA") // DATA, CLOCK input signal
1040
+ )
1041
+ ODELAYE2_dqs (
1042
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
1043
+ .DATAOUT(odelay_dqs[gen_index]), // 1-bit output: Delayed data/clock output
1044
+ .C(i_controller_clk), // 1-bit input: Clock input, when using OSERDESE2, C is connected to CLKDIV
1045
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
1046
+ .CINVCTRL(1'b0), // 1-bit input: Dynamic clock inversion input
1047
+ .CLKIN(1'b0), // 1-bit input: Clock delay input
1048
+ .CNTVALUEIN(i_controller_odelay_dqs_cntvaluein), // 5-bit input: Counter value input
1049
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
1050
+ .LD(i_controller_odelay_dqs_ld[gen_index]), // 1-bit input: Loads ODELAY_VALUE tap delay in VARIABLE mode, in VAR_LOAD or
1051
+ // VAR_LOAD_PIPE mode, loads the value of CNTVALUEIN
1052
+ .LDPIPEEN(1'b0), // 1-bit input: Enables the pipeline register to load data
1053
+ .ODATAIN(oserdes_dqs[gen_index]), // 1-bit input: Output delay data input
1054
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
1055
+ );
1056
+
1057
+ if(USE_IO_TERMINATION) begin
1058
+ // IOBUFDS_DCIEN: Differential Bi-directional Buffer with Digital Controlled Impedance (DCI)
1059
+ // and Input path enable/disable
1060
+ // May only be placed in High Performance (HP) Banks
1061
+ // 7 Series
1062
+ // Xilinx HDL Libraries Guide, version 13.4
1063
+ `ifndef SIM_MODEL
1064
+ IOBUFDS_DCIEN #(
1065
+ `else
1066
+ IOBUFDS_DCIEN_model #(
1067
+ `endif
1068
+ .IBUF_LOW_PWR("FALSE"), // Low Power - "TRUE", High Performance = "FALSE"
1069
+ .SLEW("FAST"), // Specify the output slew rate
1070
+ .USE_IBUFDISABLE("FALSE") // Use IBUFDISABLE function, "TRUE" or "FALSE"
1071
+ ) IOBUFDS_DCIEN_inst (
1072
+ .O(read_dqs[gen_index]), // Buffer output
1073
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1074
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1075
+ .DCITERMDISABLE(1'b0), // DCI Termination enable input
1076
+ .I(odelay_dqs[gen_index]), // Buffer input
1077
+ .IBUFDISABLE(1'b0), // Input disable input, low=disable
1078
+ .T(oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1079
+ );
1080
+ // End of IOBUFDS_DCIEN_inst instantiation
1081
+
1082
+ end
1083
+ else begin
1084
+ // IOBUFDS: Differential Bi-directional Buffer
1085
+ //7 Series
1086
+ // Xilinx HDL Libraries Guide, version 13.4
1087
+ `ifndef SIM_MODEL
1088
+ IOBUFDS #(
1089
+ `else
1090
+ IOBUFDS_model #(
1091
+ `endif
1092
+ //.DIFF_TERM("FALSE"), // Differential Termination ("TRUE"/"FALSE")
1093
+ .IBUF_LOW_PWR("FALSE") // Low Power - "TRUE", High Performance = "FALSE"
1094
+ //.IOSTANDARD("DIFF_SSTL15") // Specify the I/O standard. CONSULT WITH DATASHEET
1095
+ //.SLEW("FAST") // Specify the output slew rate
1096
+ ) IOBUFDS_dqs (
1097
+ .O(read_dqs[gen_index]), // Buffer output
1098
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1099
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1100
+ .I(odelay_dqs[gen_index]), // Buffer input
1101
+ .T(/*!dqs_tri_control[gen_index]*/oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1102
+ ); // End of IOBUFDS_inst instantiation
1103
+ end
1104
+
1105
+ end
1106
+
1107
+ else begin //ODELAY not supported
1108
+ // OSERDESE2: Output SERial/DESerializer with bitslip
1109
+ //7 Series
1110
+ // Xilinx HDL Libraries Guide, version 13.4
1111
+ `ifndef SIM_MODEL
1112
+ OSERDESE2 #(
1113
+ `else
1114
+ OSERDESE2_model #(
1115
+ `endif
1116
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
1117
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
1118
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
1119
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
1120
+ .TRISTATE_WIDTH(1)
1121
+ )
1122
+ OSERDESE2_dqs(
1123
+ .OFB(), // 1-bit output: Feedback path for data
1124
+ .OQ(oserdes_dqs[gen_index]), // 1-bit output: Data path output
1125
+ .TQ(oserdes_dqs_tri_control[gen_index]),
1126
+ .CLK(!i_ddr3_clk), // 1-bit input: High speed clock
1127
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1128
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
1129
+ .D1(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q)), //the last part will still have half dqs series
1130
+ .D2(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
1131
+ .D3(1'b1 && (i_controller_toggle_dqs || toggle_dqs_q) && !i_controller_write_leveling_calib),
1132
+ .D4(1'b0 && (i_controller_toggle_dqs || toggle_dqs_q)),
1133
+ .D5(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1134
+ .D6(1'b0 && i_controller_toggle_dqs),
1135
+ .D7(1'b1 && i_controller_toggle_dqs && !i_controller_write_leveling_calib),
1136
+ .D8(1'b0 && i_controller_toggle_dqs),
1137
+ .T1(i_controller_dqs_tri_control),
1138
+ .TCE(1'b1),
1139
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1140
+ .RST(sync_rst), // 1-bit input: Reset
1141
+ // unused signals but were added here to make vivado happy
1142
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1143
+ .SHIFTOUT2(),
1144
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1145
+ .TFB(), // 1-bit output: 3-state control
1146
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1147
+ .SHIFTIN1(0),
1148
+ .SHIFTIN2(0),
1149
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1150
+ .T2(0),
1151
+ .T3(0),
1152
+ .T4(0),
1153
+ .TBYTEIN(0)
1154
+ // 1-bit input: Byte group tristate
1155
+ );
1156
+ // End of OSERDESE2_inst instantiation
1157
+
1158
+ // IOBUFDS: Differential Bi-directional Buffer
1159
+ //7 Series
1160
+ // Xilinx HDL Libraries Guide, version 13.4
1161
+ `ifndef SIM_MODEL
1162
+ IOBUFDS #(
1163
+ `else
1164
+ IOBUFDS_model #(
1165
+ `endif
1166
+ //.DIFF_TERM("FALSE"), // Differential Termination ("TRUE"/"FALSE")
1167
+ .IBUF_LOW_PWR("FALSE") // Low Power - "TRUE", High Performance = "FALSE"
1168
+ //.IOSTANDARD("DIFF_SSTL15") // Specify the I/O standard. CONSULT WITH DATASHEET
1169
+ //.SLEW("FAST") // Specify the output slew rate
1170
+ ) IOBUFDS_dqs (
1171
+ .O(read_dqs[gen_index]), // Buffer output
1172
+ .IO(io_ddr3_dqs[gen_index]), // Diff_p inout (connect directly to top-level port)
1173
+ .IOB(io_ddr3_dqs_n[gen_index]), // Diff_n inout (connect directly to top-level port)
1174
+ .I(oserdes_dqs[gen_index]), // Buffer input
1175
+ .T(/*!dqs_tri_control[gen_index]*/oserdes_dqs_tri_control[gen_index]) // 3-state enable input, high=input, low=output
1176
+ ); // End of IOBUFDS_inst instantiation
1177
+
1178
+ end
1179
+
1180
+ // IDELAYE2: Input Fixed or Variable Delay Element
1181
+ // 7 Series
1182
+ // Xilinx HDL Libraries Guide, version 13.4
1183
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1184
+ `ifndef SIM_MODEL
1185
+ IDELAYE2 #(
1186
+ `else
1187
+ IDELAYE2_model #(
1188
+ `endif
1189
+ .DELAY_SRC("IDATAIN"), // Delay input (IDATAIN, DATAIN)
1190
+ .HIGH_PERFORMANCE_MODE("TRUE"), //Reduced jitter ("TRUE"), Reduced power ("FALSE")
1191
+ .IDELAY_TYPE("VAR_LOAD"), //FIXED, VARIABLE, VAR_LOAD, VAR_LOAD_PIPE
1192
+ .IDELAY_VALUE(DQS_IDELAY_TAP), //Input delay tap setting (0-31)
1193
+ .PIPE_SEL("FALSE"), //Select pipelined mode, FALSE, TRUE
1194
+ .REFCLK_FREQUENCY(200.0), //IDELAYCTRL clock input frequency in MHz (190.0-210.0).
1195
+ .SIGNAL_PATTERN("CLOCK") //DATA, CLOCK input signal
1196
+ )
1197
+ IDELAYE2_dqs (
1198
+ .CNTVALUEOUT(), // 5-bit output: Counter value output
1199
+ .DATAOUT(idelay_dqs[gen_index]), // 1-bit output: Delayed data output
1200
+ .C(i_controller_clk), // 1-bit input: Clock input
1201
+ .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
1202
+ .CINVCTRL(1'b0),// 1-bit input: Dynamic clock inversion input
1203
+ .CNTVALUEIN(i_controller_idelay_dqs_cntvaluein), // 5-bit input: Counter value input
1204
+ .DATAIN(), //1-bit input: Internal delay data input
1205
+ .IDATAIN(read_dqs[gen_index]), // 1-bit input: Data input from the I/O
1206
+ .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
1207
+ .LD(i_controller_idelay_dqs_ld[gen_index]), // 1-bit input: Load IDELAY_VALUE input
1208
+ .LDPIPEEN(1'b0), // 1-bit input: Enable PIPELINE register to load data input
1209
+ .REGRST(1'b0) // 1-bit input: Active-high reset tap-delay input
1210
+ );
1211
+ // End of IDELAYE2_inst instantiation
1212
+
1213
+
1214
+ // End of IOBUF_inst instantiation
1215
+ // ISERDESE2: Input SERial/DESerializer with bitslip
1216
+ //7 Series
1217
+ // Xilinx HDL Libraries Guide, version 13.4
1218
+ `ifndef SIM_MODEL
1219
+ ISERDESE2 #(
1220
+ `else
1221
+ ISERDESE2_model #(
1222
+ `endif
1223
+ .DATA_RATE("DDR"), // DDR, SDR
1224
+ .DATA_WIDTH(serdes_ratio*2), // Parallel data width (2-8,10,14)
1225
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
1226
+ .INIT_Q1(1'b0),
1227
+ .INIT_Q2(1'b0),
1228
+ .INIT_Q3(1'b0),
1229
+ .INIT_Q4(1'b0),
1230
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
1231
+ .IOBDELAY("IFD"), // NONE, BOTH, IBUF, IFD
1232
+ .NUM_CE(1),// Number of clock enables (1,2)
1233
+ .OFB_USED("FALSE"), // Select OFB path (FALSE, TRUE)
1234
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
1235
+ .SRVAL_Q1(1'b0),
1236
+ .SRVAL_Q2(1'b0),
1237
+ .SRVAL_Q3(1'b0),
1238
+ .SRVAL_Q4(1'b0)
1239
+ )
1240
+ ISERDESE2_dqs (
1241
+ .O(),
1242
+ // 1-bit output: Combinatorial output
1243
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
1244
+ .Q1(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 7]),
1245
+ .Q2(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 6]),
1246
+ .Q3(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 5]),
1247
+ .Q4(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 4]),
1248
+ .Q5(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 3]),
1249
+ .Q6(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 2]), //
1250
+ .Q7(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 1]), //3
1251
+ .Q8(o_controller_iserdes_dqs[serdes_ratio*2*gen_index + 0]), //2
1252
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
1253
+ .SHIFTOUT1(),
1254
+ .SHIFTOUT2(),
1255
+ .BITSLIP(i_controller_bitslip[gen_index]),
1256
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
1257
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
1258
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
1259
+ // position every time Bitslip is invoked (DDR operation is different from
1260
+ // SDR).
1261
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
1262
+ .CE1(1'b1),
1263
+ .CE2(1'b1),
1264
+ .CLKDIVP(), // 1-bit input: TBD
1265
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
1266
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
1267
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
1268
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1269
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
1270
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
1271
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
1272
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
1273
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
1274
+ .D(), // 1-bit input: Data input
1275
+ .DDLY(idelay_dqs[gen_index]), // 1-bit input: Serial data from IDELAYE2
1276
+ .OFB(), // 1-bit input: Data feedback from OSERDESE2
1277
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
1278
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
1279
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
1280
+ .SHIFTIN1(),
1281
+ .SHIFTIN2()
1282
+ );
1283
+ // End of ISERDESE2_inst instantiation
1284
+ `endif
1285
+
1286
+ // generate IOSERDES loopback or not for bitslip training
1287
+ if(NO_IOSERDES_LOOPBACK) begin
1288
+ // logic that models OSERDES loopback to ISERDES
1289
+ // accdg to IOSELECT (UG471) for 7-series:
1290
+ // " In DDR mode, every Bitslip operation causes the output pattern to alternate between
1291
+ // a shift right by one and shift left by three"
1292
+ always @(posedge i_controller_clk) begin
1293
+ if(!i_rst_n || i_controller_reset) begin
1294
+ o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 0)] <= 8'b0001_1110;
1295
+ shift_bitslip_index[gen_index] <= 0;
1296
+ end
1297
+ else if(i_controller_bitslip[gen_index]) begin
1298
+ // if shift_bitslip_index high, shift right by 3, else shift left by 1 (this is reverse of the IOSelect document for ISERDES since vector o_controller_iserdes_bitslip_reference is reversed)
1299
+ o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 0)] <=
1300
+ shift_bitslip_index[gen_index]? {o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 2) : (serdes_ratio*2*gen_index + 0)], o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7) : (serdes_ratio*2*gen_index + 3)]}
1301
+ : {o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 6) : (serdes_ratio*2*gen_index + 0)], o_controller_iserdes_bitslip_reference_reg[(serdes_ratio*2*gen_index + 7)]};
1302
+ shift_bitslip_index[gen_index] <= !shift_bitslip_index[gen_index];
1303
+ end
1304
+ end
1305
+ assign o_controller_iserdes_bitslip_reference = o_controller_iserdes_bitslip_reference_reg;
1306
+ end
1307
+ else begin // OSERDES will loopback to ISERDES for bitslip training
1308
+ //ISERDES train
1309
+ // End of IOBUF_inst instantiation
1310
+ // ISERDESE2: Input SERial/DESerializer with bitslip
1311
+ //7 Series
1312
+ // Xilinx HDL Libraries Guide, version 13.4
1313
+ `ifndef SIM_MODEL
1314
+ ISERDESE2 #(
1315
+ `else
1316
+ ISERDESE2_model #(
1317
+ `endif
1318
+ .DATA_RATE("DDR"), // DDR, SDR
1319
+ .DATA_WIDTH(serdes_ratio*2), // Parallel data width (2-8,10,14)
1320
+ // INIT_Q1 - INIT_Q4: Initial value on the Q outputs (0/1)
1321
+ .INIT_Q1(1'b0),
1322
+ .INIT_Q2(1'b0),
1323
+ .INIT_Q3(1'b0),
1324
+ .INIT_Q4(1'b0),
1325
+ .INTERFACE_TYPE("NETWORKING"), // MEMORY, MEMORY_DDR3, MEMORY_QDR, NETWORKING, OVERSAMPLE
1326
+ .IOBDELAY("NONE"), // NONE, BOTH, IBUF, IFD
1327
+ .NUM_CE(1),// Number of clock enables (1,2)
1328
+ .OFB_USED("TRUE"), // Select OFB path (FALSE, TRUE)
1329
+ // SRVAL_Q1 - SRVAL_Q4: Q output values when SR is used (0/1)
1330
+ .SRVAL_Q1(1'b0),
1331
+ .SRVAL_Q2(1'b0),
1332
+ .SRVAL_Q3(1'b0),
1333
+ .SRVAL_Q4(1'b0)
1334
+ )
1335
+ ISERDESE2_train (
1336
+ .O(),
1337
+ // 1-bit output: Combinatorial output
1338
+ // Q1 - Q8: 1-bit (each) output: Registered data outputs
1339
+ .Q1(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 7]),
1340
+ .Q2(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 6]),
1341
+ .Q3(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 5]),
1342
+ .Q4(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 4]),
1343
+ .Q5(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 3]),
1344
+ .Q6(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 2]),
1345
+ .Q7(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 1]),
1346
+ .Q8(o_controller_iserdes_bitslip_reference[gen_index*serdes_ratio*2 + 0]),
1347
+ // SHIFTOUT1-SHIFTOUT2: 1-bit (each) output: Data width expansion output ports
1348
+ .SHIFTOUT1(),
1349
+ .SHIFTOUT2(),
1350
+ .BITSLIP(i_controller_bitslip[gen_index]),
1351
+ // 1-bit input: The BITSLIP pin performs a Bitslip operation synchronous to
1352
+ // CLKDIV when asserted (active High). Subsequently, the data seen on the Q1
1353
+ // to Q8 output ports will shift, as in a barrel-shifter operation, one
1354
+ // position every time Bitslip is invoked (DDR operation is different from
1355
+ // SDR).
1356
+ // CE1, CE2: 1-bit (each) input: Data register clock enable inputs
1357
+ .CE1(1'b1),
1358
+ .CE2(1'b1),
1359
+ .CLKDIVP(), // 1-bit input: TBD
1360
+ // Clocks: 1-bit (each) input: ISERDESE2 clock input ports
1361
+ .CLK(i_ddr3_clk), // 1-bit input: High-speed clock
1362
+ .CLKB(!i_ddr3_clk), // 1-bit input: High-speed secondary clock
1363
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1364
+ .OCLK(), // 1-bit input: High speed output clock used when INTERFACE_TYPE="MEMORY"
1365
+ // Dynamic Clock Inversions: 1-bit (each) input: Dynamic clock inversion pins to switch clock polarity
1366
+ .DYNCLKDIVSEL(), // 1-bit input: Dynamic CLKDIV inversion
1367
+ .DYNCLKSEL(), // 1-bit input: Dynamic CLK/CLKB inversion
1368
+ // Input Data: 1-bit (each) input: ISERDESE2 data input ports
1369
+ .D(), // 1-bit input: Data input
1370
+ .DDLY(), // 1-bit input: Serial data from IDELAYE2
1371
+ .OFB(oserdes_bitslip_reference[gen_index]), // 1-bit input: Data feedback from OSERDESE2
1372
+ .OCLKB(), // 1-bit input: High speed negative edge output clock
1373
+ .RST(sync_rst), // 1-bit input: Active high asynchronous reset
1374
+ // SHIFTIN1-SHIFTIN2: 1-bit (each) input: Data width expansion input ports
1375
+ .SHIFTIN1(),
1376
+ .SHIFTIN2()
1377
+ );
1378
+ // End of ISERDESE2_inst instantiation
1379
+
1380
+ // OSERDESE2: Output SERial/DESerializer with bitslip
1381
+ //7 Series
1382
+ // Xilinx HDL Libraries Guide, version 13.4
1383
+ `ifndef SIM_MODEL
1384
+ OSERDESE2 #(
1385
+ `else
1386
+ OSERDESE2_model #(
1387
+ `endif
1388
+ .DATA_RATE_OQ("DDR"), // DDR, SDR
1389
+ .DATA_RATE_TQ("BUF"), // DDR, SDR
1390
+ .DATA_WIDTH(8), // Parallel data width (2-8,10,14)
1391
+ .INIT_OQ(1'b1), // Initial value of OQ output (1'b0,1'b1)
1392
+ .TRISTATE_WIDTH(1)
1393
+ )
1394
+ OSERDESE2_train(
1395
+ .OFB(oserdes_bitslip_reference[gen_index]), // 1-bit output: Feedback path for data
1396
+ .OQ(), // 1-bit output: Data path output
1397
+ .CLK(i_ddr3_clk), // 1-bit input: High speed clock
1398
+ .CLKDIV(i_controller_clk), // 1-bit input: Divided clock
1399
+ // D1 - D8: 1-bit (each) input: Parallel data inputs (1-bit each)
1400
+ .D1(1'b0),
1401
+ .D2(1'b0),
1402
+ .D3(1'b0),
1403
+ .D4(1'b0),
1404
+ .D5(1'b1),
1405
+ .D6(1'b1),
1406
+ .D7(1'b1),
1407
+ .D8(1'b1),
1408
+ .OCE(1'b1), // 1-bit input: Output data clock enable
1409
+ .RST(sync_rst), // 1-bit input: Reset
1410
+ // unused signals but were added here to make vivado happy
1411
+ .SHIFTOUT1(), // SHIFTOUT1 / SHIFTOUT2: 1-bit (each) output: Data output expansion (1-bit each)
1412
+ .SHIFTOUT2(),
1413
+ .TBYTEOUT(), // 1-bit output: Byte group tristate
1414
+ .TFB(), // 1-bit output: 3-state control
1415
+ .TQ(), // 1-bit output: 3-state control
1416
+ // SHIFTIN1 / SHIFTIN2: 1-bit (each) input: Data input expansion (1-bit each)
1417
+ .SHIFTIN1(0),
1418
+ .SHIFTIN2(0),
1419
+ // T1 - T4: 1-bit (each) input: Parallel 3-state inputs
1420
+ .T1(0),
1421
+ .T2(0),
1422
+ .T3(0),
1423
+ .T4(0),
1424
+ .TBYTEIN(0),
1425
+ // 1-bit input: Byte group tristate
1426
+ .TCE(0)
1427
+ // 1-bit input: 3-state clock enable
1428
+ );
1429
+ // End of OSERDESE2_inst instantiation
1430
+ end
1431
+
1432
+ end
1433
+ endgenerate
1434
+
1435
+
1436
+ // IDELAYCTRL: IDELAYE2/ODELAYE2 Tap Delay Value Control
1437
+ // 7 Series
1438
+ // Xilinx HDL Libraries Guide, version 13.4
1439
+ (* IODELAY_GROUP="DDR3-GROUP" *)
1440
+ `ifndef SIM_MODEL
1441
+ IDELAYCTRL IDELAYCTRL_inst (
1442
+ `else
1443
+ IDELAYCTRL_model IDELAYCTRL_inst (
1444
+ `endif
1445
+ .RDY(idelayctrl_rdy), // 1-bit output: Ready output
1446
+ .REFCLK(i_ref_clk), // 1-bit input: Reference clock input.The frequency of REFCLK must be 200 MHz to guarantee the tap-delay value specified in the applicable data sheet.
1447
+ .RST(sync_rst) // 1-bit input: Active high reset input, To ,Minimum Reset pulse width is 52ns
1448
+ );
1449
+ // End of IDELAYCTRL_inst instantiation
1450
+
1451
+
1452
+ // DCIRESET: Digitially Controlled Impedence Reset Component
1453
+ //7 Series
1454
+ // Xilinx HDL Libraries Guide, version 13.4
1455
+ // DCIRESET DCIRESET_inst (
1456
+ // .LOCKED(dci_locked), // 1-bit output: LOCK status output (When low, DCI I/O impedance is being calibrated and DCI I/Os are unavailable)
1457
+ // .RST(sync_rst) // 1-bit input: Active-high asynchronous reset input
1458
+ // );
1459
+ assign dci_locked = 1;
1460
+ // End of DCIRESET_inst instantiation
1461
+
1462
+ endmodule
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test.c ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******************************************************************************
2
+ *
3
+ * Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved.
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in
13
+ * all copies or substantial portions of the Software.
14
+ *
15
+ * Use of the Software is limited solely to applications:
16
+ * (a) running on a Xilinx device, or
17
+ * (b) that interact with a Xilinx device through a bus or interconnect.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22
+ * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ *
27
+ * Except as contained in this notice, the name of the Xilinx shall not be used
28
+ * in advertising or otherwise to promote the sale, use or other dealings in
29
+ * this Software without prior written authorization from Xilinx.
30
+ *
31
+ ******************************************************************************/
32
+
33
+ /*
34
+ * helloworld.c: simple test application
35
+ *
36
+ * This application configures UART 16550 to baud rate 9600.
37
+ * PS7 UART (Zynq) is not initialized by this application, since
38
+ * bootrom/bsp configures it to baud rate 115200
39
+ *
40
+ * ------------------------------------------------
41
+ * | UART TYPE BAUD RATE |
42
+ * ------------------------------------------------
43
+ * uartns550 9600
44
+ * uartlite Configurable only in HW design
45
+ * ps7_uart 115200 (configured by bootrom/bsp)
46
+ */
47
+ #include <stdio.h>
48
+ #include <stdint.h>
49
+ #include "xparameters.h"
50
+ #include "platform.h"
51
+ #include "xil_printf.h"
52
+ #include "xil_io.h"
53
+ #include "sleep.h"
54
+
55
+ #define DDR3_MONITOR_BASE 0x00010000
56
+
57
+ #define REG_MATCH_LOW 0x00
58
+ #define REG_MATCH_HIGH 0x04
59
+ #define REG_MISMATCH_LOW 0x08
60
+ #define REG_MISMATCH_HIGH 0x0C
61
+ #define REG_TIMER_LOW 0x10
62
+ #define REG_TIMER_HIGH 0x14
63
+ #define REG_FAULTS 0x18
64
+
65
+ #define TIMER_FREQ_HZ 100000000 // Adjust based on actual hardware clock
66
+
67
+ int main()
68
+ {
69
+ init_platform();
70
+ print("Hello World\n\r");
71
+ print("Successfully ran Hello World application\n\r");
72
+
73
+ while (1) // Infinite loop
74
+ {
75
+ // Read 64-bit counters
76
+ uint32_t correct_lower_32 = *(volatile uint32_t *)(DDR3_MONITOR_BASE + REG_MATCH_LOW);
77
+ uint32_t correct_upper_32 = *(volatile uint32_t *)(DDR3_MONITOR_BASE + REG_MATCH_HIGH);
78
+ uint32_t wrong_lower_32 = *(volatile uint32_t *)(DDR3_MONITOR_BASE + REG_MISMATCH_LOW);
79
+ uint32_t wrong_upper_32 = *(volatile uint32_t *)(DDR3_MONITOR_BASE + REG_MISMATCH_HIGH);
80
+ uint32_t timer_lower_32 = *(volatile uint32_t *)(DDR3_MONITOR_BASE + REG_TIMER_LOW);
81
+ uint32_t timer_upper_32 = *(volatile uint32_t *)(DDR3_MONITOR_BASE + REG_TIMER_HIGH);
82
+ uint32_t injected_faults = *(volatile uint32_t *)(DDR3_MONITOR_BASE + REG_FAULTS);
83
+
84
+ // Combine into 64-bit values
85
+ long long match_count = ((long long) correct_upper_32 << 32) | correct_lower_32;
86
+ long long mismatch_count = ((long long) wrong_upper_32 << 32) | wrong_lower_32;
87
+ long long timer_count = ((long long) timer_upper_32 << 32) | timer_lower_32;
88
+
89
+ // Convert timer count to time in days, hours, and minutes
90
+ long long elapsed_seconds = timer_count / TIMER_FREQ_HZ;
91
+ uint32_t days = elapsed_seconds / (24 * 3600);
92
+ uint32_t hours = (elapsed_seconds % (24 * 3600)) / 3600;
93
+ uint32_t minutes = (elapsed_seconds % 3600) / 60;
94
+
95
+ // Print results
96
+ xil_printf("\n=============================\n\r");
97
+ xil_printf(" SYSTEM STATUS \n\r");
98
+ xil_printf("=============================\n\r");
99
+ xil_printf(" Matched Reads : %u M\n\r", match_count / 1000000);
100
+ xil_printf(" Mismatched Reads: %u \n\r", mismatch_count);
101
+ xil_printf(" Injected Faults : %u\n\r", injected_faults);
102
+ xil_printf("-----------------------------\n\r");
103
+ xil_printf(" Elapsed Time : %u days, %u hours, %u minutes\n\r", days, hours, minutes);
104
+ xil_printf("=============================\n\r\n");
105
+
106
+
107
+
108
+ // Wait 1 second
109
+ usleep(1000000);
110
+ }
111
+
112
+ cleanup_platform();
113
+ return 0; // (Will never reach here due to infinite loop)
114
+ }
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test.v ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Filename: ddr3_test.v
4
+ // Project: Test the UberDDR3 by sending traffic via the Wishbone interface
5
+ //
6
+ // Purpose: Sends traffic over Wishbone interface of UberDDR3. This has 3 tests:
7
+ // - burst write/read
8
+ // - random write/read
9
+ // - alternating write/read
10
+ // Uses MicroBlaze to report via UART the number of read matches, mismatches, and
11
+ // total time elapsed. Report summary is sent every second.
12
+ //
13
+ // Engineer: Angelo C. Jacobo
14
+ //
15
+ ////////////////////////////////////////////////////////////////////////////////
16
+ //
17
+ // Copyright (C) 2023-2025 Angelo Jacobo
18
+ //
19
+ // This program is free software: you can redistribute it and/or modify
20
+ // it under the terms of the GNU General Public License as published by
21
+ // the Free Software Foundation, either version 3 of the License, or
22
+ // (at your option) any later version.
23
+ //
24
+ // This program is distributed in the hope that it will be useful,
25
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ // GNU General Public License for more details.
28
+ //
29
+ // You should have received a copy of the GNU General Public License
30
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
31
+ //
32
+ ////////////////////////////////////////////////////////////////////////////////
33
+
34
+ // `default_nettype none
35
+ `timescale 1ps / 1ps
36
+
37
+ module ddr3_test #(
38
+ parameter WB_ADDR_BITS = 25,
39
+ WB_DATA_BITS = 512,
40
+ WB_SEL_BITS = WB_DATA_BITS / 8,
41
+ AUX_WIDTH = 4,
42
+ DATA_MASK = 1,
43
+ parameter[0:0] MICRON_SIM = 0
44
+ )
45
+ (
46
+ input wire i_clk, // ddr3 test clock
47
+ input wire i_clk100, // microblaze clock
48
+ input wire i_rst_n,
49
+ //
50
+ // Wishbone inputs
51
+ output reg o_wb_cyc, //bus cycle active (1 = normal operation, 0 = all ongoing transaction are to be cancelled)
52
+ output reg o_wb_stb, //request a transfer
53
+ output reg o_wb_we, //write-enable (1 = write, 0 = read)
54
+ output reg[WB_ADDR_BITS - 1:0] o_wb_addr, //burst-addressable {row,bank,col}
55
+ output reg[WB_DATA_BITS - 1:0] o_wb_data, //write data, for a 4:1 controller data width is 8 times the number of pins on the device
56
+ output reg[WB_SEL_BITS - 1:0] o_wb_sel, //byte strobe for write (1 = write the byte)
57
+ output reg[AUX_WIDTH - 1:0] o_aux, //for AXI-interface compatibility (given upon strobe)
58
+ //
59
+ // Wishbone outputs
60
+ input wire i_wb_stall, //1 = busy, cannot accept requests
61
+ input wire i_wb_ack, //1 = read/write request has completed
62
+ input wire i_wb_err, //1 = Error due to ECC double bit error (fixed to 0 if WB_ERROR = 0)
63
+ input wire[WB_DATA_BITS - 1:0] i_wb_data, //read data, for a 4:1 controller data width is 8 times the number of pins on the device
64
+ input wire[AUX_WIDTH - 1:0] i_aux, //for AXI-interface compatibility (given upon strobe)
65
+ //
66
+ // Done Calibration pin
67
+ input wire i_calib_complete,
68
+ //
69
+ // UART line
70
+ input wire rx,
71
+ output wire tx,
72
+ // Button for fault-injection
73
+ input wire btn,
74
+ //
75
+ // Debug
76
+ output wire timer_pulse,
77
+ output wire wrong_data_counter_non_zero
78
+ );
79
+ localparam IDLE=0,
80
+ BURST_WRITE=1,
81
+ BURST_READ=2,
82
+ RANDOM_WRITE=3,
83
+ RANDOM_READ=4,
84
+ ALTERNATE_WRITE_READ=5,
85
+ DONE_TEST=6;
86
+ localparam SIM_ADDRESS_INCR_LOG2 = WB_ADDR_BITS-2-6; // 2^(WB_ADDR_BITS-2)/64
87
+ localparam HALF_ADDRESS = 13;
88
+ localparam SIM_ADDRESS_START = {(WB_ADDR_BITS){1'b1}} - 99; // minus odd number so result is even (similar to default address start of zero)
89
+ (* mark_debug = "true" *) reg[3:0] state=IDLE;
90
+ reg[3:0] rest_counter=0;
91
+ wire[WB_DATA_BITS-1:0] correct_data;
92
+ wire[WB_DATA_BITS-1:0] wb_data_randomized;
93
+ reg[WB_ADDR_BITS-1:0] write_test_address_counter = 0, read_test_address_counter = 0;
94
+ reg[WB_ADDR_BITS-1:0] check_test_address_counter = 0;
95
+ reg[$clog2(WB_SEL_BITS)-1:0] write_by_byte_counter = 0;
96
+ (* mark_debug = "true" *) reg[63:0] correct_read_data_counter = 0, wrong_read_data_counter = 0; // 64-bit counter for correct and wrong read data, this make sure the counter will not overflow when several day's worth of DDR3 test is done on hardware
97
+ reg increment_wrong_read_data_counter = 0;
98
+ reg increment_correct_read_data_counter = 0;
99
+ (* mark_debug = "true" *) reg[WB_DATA_BITS-1:0] wrong_data, expected_data;
100
+ reg[63:0] time_counter = 0;
101
+ (* mark_debug = "true" *) reg[31:0] injected_faults_counter = 0;
102
+ assign timer_pulse = time_counter[27]; // 1.34 sec
103
+ assign wrong_data_counter_non_zero = wrong_read_data_counter != 0; // pulse when there is wrong data
104
+
105
+ always @(posedge i_clk, negedge i_rst_n) begin
106
+ if(!i_rst_n) begin
107
+ state <= IDLE;
108
+ rest_counter <= 0;
109
+ o_wb_cyc <= 0;
110
+ o_wb_stb <= 0;
111
+ o_wb_we <= 0;
112
+ o_wb_addr <= 0;
113
+ o_wb_data <= 0;
114
+ o_wb_sel <= 0;
115
+ o_aux <= 0;
116
+ write_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
117
+ rest_counter <= 0;
118
+ read_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
119
+ write_by_byte_counter <= 0;
120
+ injected_faults_counter <= 0;
121
+ end
122
+ else begin
123
+ case(state)
124
+ IDLE: if(i_calib_complete) begin // wait until DDR3 is done calibrating
125
+ rest_counter = rest_counter + 1;
126
+ if(rest_counter == 4'hf) begin // rest for 16 cycles before starting test
127
+ state <= BURST_WRITE;
128
+ o_wb_cyc <= 1'b1;
129
+ end
130
+ end
131
+ else begin
132
+ o_wb_cyc <= 0;
133
+ o_wb_stb <= 0;
134
+ o_wb_we <= 0;
135
+ o_wb_addr <= 0;
136
+ o_wb_data <= 0;
137
+ o_wb_sel <= 0;
138
+ o_aux <= 0;
139
+ write_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
140
+ rest_counter <= 0;
141
+ read_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
142
+ write_by_byte_counter <= 0;
143
+ injected_faults_counter <= 0;
144
+ end
145
+
146
+ BURST_WRITE: if(!i_wb_stall) begin // Test 1: Burst write (per byte write to test datamask feature), then burst read
147
+ o_wb_stb <= 1'b1;
148
+ o_aux <= 2; // write
149
+ o_wb_we <= 1;
150
+ if(DATA_MASK) begin // If datamasking is available, test datamask by writing 8 bytes at a time
151
+ o_wb_sel <= {{WB_SEL_BITS-8{1'b0}}, 8'hff} << write_by_byte_counter; // write_by_byte_counter increments by 8 from 0 to (WB_SEL_BITS-8)
152
+ o_wb_addr <= write_test_address_counter;
153
+ o_wb_data <= {WB_SEL_BITS{8'haa}}; // fill data initially by 8'haa
154
+ o_wb_data[8*write_by_byte_counter +: 64] <= btn_pulse? {64{1'b0}} : wb_data_randomized[8*write_by_byte_counter +: 64]; // place the real data at the datamasked bytes
155
+ injected_faults_counter <= btn_pulse? injected_faults_counter + 1 : injected_faults_counter;
156
+ if(write_by_byte_counter == (WB_SEL_BITS-8)) begin // once every 64bytes of data is written, go to next address
157
+ write_test_address_counter <= write_test_address_counter + 1;
158
+ /* verilator lint_off WIDTHEXPAND */
159
+ if( write_test_address_counter == {(WB_ADDR_BITS){1'b1}} ) begin // wait until all address space is writtten
160
+ /* verilator lint_on WIDTHEXPAND */
161
+ write_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
162
+ state <= BURST_READ;
163
+ end
164
+ end
165
+ write_by_byte_counter <= write_by_byte_counter + 8;
166
+ end
167
+ else begin // Burst write to all bytes (all datamask on)
168
+ o_wb_sel <= {WB_SEL_BITS{1'b1}};
169
+ o_wb_addr <= write_test_address_counter;
170
+ o_wb_data <= btn_pulse? {WB_DATA_BITS{1'b0}} : wb_data_randomized;
171
+ injected_faults_counter <= btn_pulse? injected_faults_counter + 1 : injected_faults_counter;
172
+ write_test_address_counter <= write_test_address_counter + 1;
173
+ /* verilator lint_off WIDTHEXPAND */
174
+ if( write_test_address_counter == {WB_ADDR_BITS{1'b1}} ) begin // wait until all address space is writtten
175
+ /* verilator lint_on WIDTHEXPAND */
176
+ write_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
177
+ state <= BURST_READ;
178
+ end
179
+ end
180
+ end
181
+
182
+ BURST_READ: if(!i_wb_stall) begin
183
+ o_wb_stb <= 1'b1;
184
+ o_aux <= 3; // read
185
+ o_wb_we <= 0;
186
+ o_wb_addr <= read_test_address_counter;
187
+ read_test_address_counter <= read_test_address_counter + 1;
188
+ /* verilator lint_off WIDTHEXPAND */
189
+ if( read_test_address_counter == {(WB_ADDR_BITS){1'b1}} ) begin // wait until all address space is read
190
+ /* verilator lint_on WIDTHEXPAND */
191
+ read_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
192
+ state <= RANDOM_WRITE;
193
+ end
194
+ end
195
+
196
+ RANDOM_WRITE: if(!i_wb_stall) begin // Test 2: Random write (increments row address to force precharge-act-r/w) then random read
197
+ o_wb_stb <= 1'b1;
198
+ o_aux <= 2; // write
199
+ o_wb_sel <= {WB_SEL_BITS{1'b1}};
200
+ o_wb_we <= 1;
201
+ // swap the halves of address counter, since address mapping is {row,bank,col} then every increment of address counter will now increment the {row, bank} preventing burst operation and forcing precharge-activate before write/read
202
+ o_wb_addr[WB_ADDR_BITS-1:HALF_ADDRESS] <= write_test_address_counter[HALF_ADDRESS-1:0]; // [25:13] <= [12:0]
203
+ o_wb_addr[HALF_ADDRESS-1:0] <= write_test_address_counter[WB_ADDR_BITS-1:HALF_ADDRESS]; // [12:0] <= [25:13]
204
+ o_wb_data <= btn_pulse? {WB_DATA_BITS{1'b0}} : wb_data_randomized;
205
+ injected_faults_counter <= btn_pulse? injected_faults_counter + 1 : injected_faults_counter;
206
+ write_test_address_counter <= write_test_address_counter + 1;
207
+ /* verilator lint_off WIDTHEXPAND */
208
+ if( write_test_address_counter == {(WB_ADDR_BITS){1'b1}} ) begin // wait until all address space is writtten
209
+ /* verilator lint_on WIDTHEXPAND */
210
+ write_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
211
+ state <= RANDOM_READ;
212
+ end
213
+ end
214
+
215
+ RANDOM_READ: if(!i_wb_stall) begin
216
+ o_wb_stb <= 1'b1;
217
+ o_aux <= 3; // read
218
+ o_wb_we <= 0;
219
+ // swap the halves of address counter, since address mapping is {row,bank,col} then every increment of address counter will now increment the {row, bank} preventing burst operation and forcing precharge-activate before write/read
220
+ o_wb_addr[WB_ADDR_BITS-1:HALF_ADDRESS] <= read_test_address_counter[HALF_ADDRESS-1:0]; // [25:13] <= [12:0]
221
+ o_wb_addr[HALF_ADDRESS-1:0] <= read_test_address_counter[WB_ADDR_BITS-1:HALF_ADDRESS]; // [12:0] <= [25:13]
222
+ read_test_address_counter <= read_test_address_counter + 1;
223
+ /* verilator lint_off WIDTHEXPAND */
224
+ if( read_test_address_counter == {(WB_ADDR_BITS){1'b1}} ) begin // wait until all address space is read
225
+ /* verilator lint_on WIDTHEXPAND */
226
+ read_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
227
+ state <= ALTERNATE_WRITE_READ;
228
+ end
229
+ end
230
+
231
+ ALTERNATE_WRITE_READ: if(!i_wb_stall) begin
232
+ o_wb_stb <= 1'b1;
233
+ o_aux <= 2 + (o_wb_we? 1:0); //2 (write), 3 (read)
234
+ o_wb_sel <= {WB_SEL_BITS{1'b1}};
235
+ o_wb_we <= !o_wb_we; // alternating write-read
236
+ o_wb_addr <= write_test_address_counter;
237
+ o_wb_data <= btn_pulse? {WB_DATA_BITS{1'b0}} : wb_data_randomized;
238
+ injected_faults_counter <= btn_pulse? injected_faults_counter + 1 : injected_faults_counter;
239
+ // if current operation is write, then dont increment address since we wil read the same address next
240
+ if(o_wb_we) begin // current operation is read thus increment address
241
+ write_test_address_counter <= write_test_address_counter + 1;
242
+ end
243
+ /* verilator lint_off WIDTHEXPAND */
244
+ if( (o_wb_addr == {(WB_ADDR_BITS){1'b1}}) && !o_wb_we ) begin // only
245
+ /* verilator lint_on WIDTHEXPAND */
246
+ write_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
247
+ state <= DONE_TEST;
248
+ rest_counter <= 0;
249
+ end
250
+ end
251
+ DONE_TEST: begin
252
+ o_wb_stb <= 0;
253
+ rest_counter <= rest_counter + 1;
254
+ if(rest_counter == 4'hf) begin // rest for 16 cycles before repeating test
255
+ state <= BURST_WRITE;
256
+ end
257
+ end
258
+ endcase
259
+ end
260
+ end
261
+ // Uses different operations (XOR, addition, subtraction, bit rotation) to generate different values per byte.
262
+ assign wb_data_randomized = {
263
+ {(WB_SEL_BITS/8){write_test_address_counter[0 +: 8] ^ 8'hA5, // Byte 7
264
+ write_test_address_counter[0 +: 8] | 8'h1A, // Byte 6
265
+ write_test_address_counter[0 +: 8] & 8'h33, // Byte 5
266
+ write_test_address_counter[0 +: 8] ^ 8'h5A, // Byte 4
267
+ write_test_address_counter[0 +: 8] & 8'h21, // Byte 3
268
+ write_test_address_counter[0 +: 8] | 8'hC7, // Byte 2
269
+ write_test_address_counter[0 +: 8] ^ 8'h7E, // Byte 1
270
+ write_test_address_counter[0 +: 8] ^ 8'h3C}} // Byte 0
271
+ };
272
+
273
+ /******************************************************* Test Receiver *******************************************************/
274
+ assign correct_data = {
275
+ {(WB_SEL_BITS/8){check_test_address_counter[0 +: 8] ^ 8'hA5, // Byte 7
276
+ check_test_address_counter[0 +: 8] | 8'h1A, // Byte 6
277
+ check_test_address_counter[0 +: 8] & 8'h33, // Byte 5
278
+ check_test_address_counter[0 +: 8] ^ 8'h5A, // Byte 4
279
+ check_test_address_counter[0 +: 8] & 8'h21, // Byte 3
280
+ check_test_address_counter[0 +: 8] | 8'hC7, // Byte 2
281
+ check_test_address_counter[0 +: 8] ^ 8'h7E, // Byte 1
282
+ check_test_address_counter[0 +: 8] ^ 8'h3C }} // Byte 0
283
+ };
284
+
285
+ always @(posedge i_clk, negedge i_rst_n) begin
286
+ if(!i_rst_n) begin
287
+ check_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
288
+ correct_read_data_counter <= 64'd0;
289
+ wrong_read_data_counter <= 64'd0;
290
+ wrong_data <= 512'd0;
291
+ expected_data <= 512'd0;
292
+ increment_wrong_read_data_counter <= 0;
293
+ end
294
+ else begin
295
+ if(i_calib_complete) begin
296
+ increment_wrong_read_data_counter <= 1'b0;
297
+ increment_correct_read_data_counter <= 1'b0;
298
+ if ( i_wb_ack && i_aux[2:0] == 3'd3 ) begin //o_aux = 3 is for read requests from DDR3 test
299
+ if(i_wb_data == correct_data) begin // if read data matches the expected, increment correct_read_data_counter
300
+ increment_correct_read_data_counter <= 1'b1;
301
+ end
302
+ else begin
303
+ increment_wrong_read_data_counter <= 1'b1;
304
+ wrong_data <= i_wb_data;
305
+ expected_data <= correct_data;
306
+ end
307
+ /* verilator lint_off WIDTHEXPAND */
308
+ check_test_address_counter <= check_test_address_counter + 1;
309
+ if(check_test_address_counter+1'b1 == {(WB_ADDR_BITS){1'b0}}) begin // if next address returns to zero, then if in MICRON_SIM jump to SIM_ADDRESS_START
310
+ check_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : {(WB_ADDR_BITS){1'b0}};
311
+ end
312
+ /* verilator lint_on WIDTHEXPAND */
313
+ end
314
+ end
315
+ else begin
316
+ check_test_address_counter <= MICRON_SIM? SIM_ADDRESS_START : 0;
317
+ correct_read_data_counter <= 64'd0;
318
+ wrong_read_data_counter <= 64'd0;
319
+ wrong_data <= 512'd0;
320
+ expected_data <= 512'd0;
321
+ end
322
+ if(increment_wrong_read_data_counter) begin
323
+ wrong_read_data_counter <= wrong_read_data_counter + 64'd1;
324
+ end
325
+ if(increment_correct_read_data_counter) begin
326
+ correct_read_data_counter <= correct_read_data_counter + 64'd1;
327
+ end
328
+ end
329
+
330
+ end
331
+ /*********************************************************************************************************************************************/
332
+ // 64-bit counter to know how much time had passed and also debounce of btn for fault-injection
333
+ (* mark_debug = "true" *) reg[27:0] btn_debounce_delay;
334
+ (* mark_debug = "true" *) reg btn_pulse_long, btn_pulse_long_prev;
335
+ (* mark_debug = "true" *) wire btn_pulse;
336
+ assign btn_pulse = btn_pulse_long && !btn_pulse_long_prev; // if current btn_pulse is high but previously low (posedge) then make pulse
337
+
338
+ always @(posedge i_clk, negedge i_rst_n) begin
339
+ if(!i_rst_n) begin
340
+ btn_pulse_long_prev <= 1'b0;
341
+ btn_debounce_delay <= 0;
342
+ btn_pulse_long <= 0;
343
+ end
344
+ else begin
345
+ btn_pulse_long_prev <= btn_pulse_long;
346
+ if(btn && !btn_pulse_long) begin // when btn asserts and btn_pulse_long is still low
347
+ btn_pulse_long <= 1'b1;
348
+ end
349
+ if(btn_debounce_delay[27]) begin // if ~1.3s had passed, set btn_pulse_long low and reset delay
350
+ btn_pulse_long <= 0;
351
+ btn_debounce_delay <= 0;
352
+ end
353
+ else begin
354
+ btn_debounce_delay <= btn_pulse_long? btn_debounce_delay + 1 : 0;
355
+ end
356
+ end
357
+ end
358
+
359
+ always @(posedge i_clk100, negedge i_rst_n) begin
360
+ if(!i_rst_n) begin
361
+ time_counter <= 64'd0;
362
+ end
363
+ else begin
364
+ time_counter <= time_counter + 1;
365
+ end
366
+ end
367
+
368
+ design_1_wrapper microblaze_inst
369
+ ( .clk_in1_0(i_clk100),
370
+ .correct_read_data_counter_0(correct_read_data_counter),
371
+ .reset_rtl_0(i_rst_n),
372
+ .time_counter_0(time_counter),
373
+ .injected_faults_counter_0(injected_faults_counter),
374
+ .uart_rtl_0_rxd(rx),
375
+ .uart_rtl_0_txd(tx),
376
+ .wrong_read_data_counter_0(wrong_read_data_counter)
377
+ );
378
+ endmodule
379
+
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/bd/bd.tcl ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ proc init { cellpath otherInfo } {
3
+
4
+ set cell_handle [get_bd_cells $cellpath]
5
+ set all_busif [get_bd_intf_pins $cellpath/*]
6
+ set axi_standard_param_list [list ID_WIDTH AWUSER_WIDTH ARUSER_WIDTH WUSER_WIDTH RUSER_WIDTH BUSER_WIDTH]
7
+ set full_sbusif_list [list ]
8
+
9
+ foreach busif $all_busif {
10
+ if { [string equal -nocase [get_property MODE $busif] "slave"] == 1 } {
11
+ set busif_param_list [list]
12
+ set busif_name [get_property NAME $busif]
13
+ if { [lsearch -exact -nocase $full_sbusif_list $busif_name ] == -1 } {
14
+ continue
15
+ }
16
+ foreach tparam $axi_standard_param_list {
17
+ lappend busif_param_list "C_${busif_name}_${tparam}"
18
+ }
19
+ bd::mark_propagate_only $cell_handle $busif_param_list
20
+ }
21
+ }
22
+ }
23
+
24
+
25
+ proc pre_propagate {cellpath otherInfo } {
26
+
27
+ set cell_handle [get_bd_cells $cellpath]
28
+ set all_busif [get_bd_intf_pins $cellpath/*]
29
+ set axi_standard_param_list [list ID_WIDTH AWUSER_WIDTH ARUSER_WIDTH WUSER_WIDTH RUSER_WIDTH BUSER_WIDTH]
30
+
31
+ foreach busif $all_busif {
32
+ if { [string equal -nocase [get_property CONFIG.PROTOCOL $busif] "AXI4"] != 1 } {
33
+ continue
34
+ }
35
+ if { [string equal -nocase [get_property MODE $busif] "master"] != 1 } {
36
+ continue
37
+ }
38
+
39
+ set busif_name [get_property NAME $busif]
40
+ foreach tparam $axi_standard_param_list {
41
+ set busif_param_name "C_${busif_name}_${tparam}"
42
+
43
+ set val_on_cell_intf_pin [get_property CONFIG.${tparam} $busif]
44
+ set val_on_cell [get_property CONFIG.${busif_param_name} $cell_handle]
45
+
46
+ if { [string equal -nocase $val_on_cell_intf_pin $val_on_cell] != 1 } {
47
+ if { $val_on_cell != "" } {
48
+ set_property CONFIG.${tparam} $val_on_cell $busif
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+
56
+ proc propagate {cellpath otherInfo } {
57
+
58
+ set cell_handle [get_bd_cells $cellpath]
59
+ set all_busif [get_bd_intf_pins $cellpath/*]
60
+ set axi_standard_param_list [list ID_WIDTH AWUSER_WIDTH ARUSER_WIDTH WUSER_WIDTH RUSER_WIDTH BUSER_WIDTH]
61
+
62
+ foreach busif $all_busif {
63
+ if { [string equal -nocase [get_property CONFIG.PROTOCOL $busif] "AXI4"] != 1 } {
64
+ continue
65
+ }
66
+ if { [string equal -nocase [get_property MODE $busif] "slave"] != 1 } {
67
+ continue
68
+ }
69
+
70
+ set busif_name [get_property NAME $busif]
71
+ foreach tparam $axi_standard_param_list {
72
+ set busif_param_name "C_${busif_name}_${tparam}"
73
+
74
+ set val_on_cell_intf_pin [get_property CONFIG.${tparam} $busif]
75
+ set val_on_cell [get_property CONFIG.${busif_param_name} $cell_handle]
76
+
77
+ if { [string equal -nocase $val_on_cell_intf_pin $val_on_cell] != 1 } {
78
+ #override property of bd_interface_net to bd_cell -- only for slaves. May check for supported values..
79
+ if { $val_on_cell_intf_pin != "" } {
80
+ set_property CONFIG.${busif_param_name} $val_on_cell_intf_pin $cell_handle
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/component.xml ADDED
@@ -0,0 +1,900 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <spirit:component xmlns:xilinx="http://www.xilinx.com" xmlns:spirit="http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
+ <spirit:vendor>user.org</spirit:vendor>
4
+ <spirit:library>user</spirit:library>
5
+ <spirit:name>ddr3_test_monitor_axi</spirit:name>
6
+ <spirit:version>1.0</spirit:version>
7
+ <spirit:busInterfaces>
8
+ <spirit:busInterface>
9
+ <spirit:name>s00_axi</spirit:name>
10
+ <spirit:busType spirit:vendor="xilinx.com" spirit:library="interface" spirit:name="aximm" spirit:version="1.0"/>
11
+ <spirit:abstractionType spirit:vendor="xilinx.com" spirit:library="interface" spirit:name="aximm_rtl" spirit:version="1.0"/>
12
+ <spirit:slave>
13
+ <spirit:memoryMapRef spirit:memoryMapRef="s00_axi"/>
14
+ </spirit:slave>
15
+ <spirit:portMaps>
16
+ <spirit:portMap>
17
+ <spirit:logicalPort>
18
+ <spirit:name>AWADDR</spirit:name>
19
+ </spirit:logicalPort>
20
+ <spirit:physicalPort>
21
+ <spirit:name>s00_axi_awaddr</spirit:name>
22
+ </spirit:physicalPort>
23
+ </spirit:portMap>
24
+ <spirit:portMap>
25
+ <spirit:logicalPort>
26
+ <spirit:name>AWPROT</spirit:name>
27
+ </spirit:logicalPort>
28
+ <spirit:physicalPort>
29
+ <spirit:name>s00_axi_awprot</spirit:name>
30
+ </spirit:physicalPort>
31
+ </spirit:portMap>
32
+ <spirit:portMap>
33
+ <spirit:logicalPort>
34
+ <spirit:name>AWVALID</spirit:name>
35
+ </spirit:logicalPort>
36
+ <spirit:physicalPort>
37
+ <spirit:name>s00_axi_awvalid</spirit:name>
38
+ </spirit:physicalPort>
39
+ </spirit:portMap>
40
+ <spirit:portMap>
41
+ <spirit:logicalPort>
42
+ <spirit:name>AWREADY</spirit:name>
43
+ </spirit:logicalPort>
44
+ <spirit:physicalPort>
45
+ <spirit:name>s00_axi_awready</spirit:name>
46
+ </spirit:physicalPort>
47
+ </spirit:portMap>
48
+ <spirit:portMap>
49
+ <spirit:logicalPort>
50
+ <spirit:name>WDATA</spirit:name>
51
+ </spirit:logicalPort>
52
+ <spirit:physicalPort>
53
+ <spirit:name>s00_axi_wdata</spirit:name>
54
+ </spirit:physicalPort>
55
+ </spirit:portMap>
56
+ <spirit:portMap>
57
+ <spirit:logicalPort>
58
+ <spirit:name>WSTRB</spirit:name>
59
+ </spirit:logicalPort>
60
+ <spirit:physicalPort>
61
+ <spirit:name>s00_axi_wstrb</spirit:name>
62
+ </spirit:physicalPort>
63
+ </spirit:portMap>
64
+ <spirit:portMap>
65
+ <spirit:logicalPort>
66
+ <spirit:name>WVALID</spirit:name>
67
+ </spirit:logicalPort>
68
+ <spirit:physicalPort>
69
+ <spirit:name>s00_axi_wvalid</spirit:name>
70
+ </spirit:physicalPort>
71
+ </spirit:portMap>
72
+ <spirit:portMap>
73
+ <spirit:logicalPort>
74
+ <spirit:name>WREADY</spirit:name>
75
+ </spirit:logicalPort>
76
+ <spirit:physicalPort>
77
+ <spirit:name>s00_axi_wready</spirit:name>
78
+ </spirit:physicalPort>
79
+ </spirit:portMap>
80
+ <spirit:portMap>
81
+ <spirit:logicalPort>
82
+ <spirit:name>BRESP</spirit:name>
83
+ </spirit:logicalPort>
84
+ <spirit:physicalPort>
85
+ <spirit:name>s00_axi_bresp</spirit:name>
86
+ </spirit:physicalPort>
87
+ </spirit:portMap>
88
+ <spirit:portMap>
89
+ <spirit:logicalPort>
90
+ <spirit:name>BVALID</spirit:name>
91
+ </spirit:logicalPort>
92
+ <spirit:physicalPort>
93
+ <spirit:name>s00_axi_bvalid</spirit:name>
94
+ </spirit:physicalPort>
95
+ </spirit:portMap>
96
+ <spirit:portMap>
97
+ <spirit:logicalPort>
98
+ <spirit:name>BREADY</spirit:name>
99
+ </spirit:logicalPort>
100
+ <spirit:physicalPort>
101
+ <spirit:name>s00_axi_bready</spirit:name>
102
+ </spirit:physicalPort>
103
+ </spirit:portMap>
104
+ <spirit:portMap>
105
+ <spirit:logicalPort>
106
+ <spirit:name>ARADDR</spirit:name>
107
+ </spirit:logicalPort>
108
+ <spirit:physicalPort>
109
+ <spirit:name>s00_axi_araddr</spirit:name>
110
+ </spirit:physicalPort>
111
+ </spirit:portMap>
112
+ <spirit:portMap>
113
+ <spirit:logicalPort>
114
+ <spirit:name>ARPROT</spirit:name>
115
+ </spirit:logicalPort>
116
+ <spirit:physicalPort>
117
+ <spirit:name>s00_axi_arprot</spirit:name>
118
+ </spirit:physicalPort>
119
+ </spirit:portMap>
120
+ <spirit:portMap>
121
+ <spirit:logicalPort>
122
+ <spirit:name>ARVALID</spirit:name>
123
+ </spirit:logicalPort>
124
+ <spirit:physicalPort>
125
+ <spirit:name>s00_axi_arvalid</spirit:name>
126
+ </spirit:physicalPort>
127
+ </spirit:portMap>
128
+ <spirit:portMap>
129
+ <spirit:logicalPort>
130
+ <spirit:name>ARREADY</spirit:name>
131
+ </spirit:logicalPort>
132
+ <spirit:physicalPort>
133
+ <spirit:name>s00_axi_arready</spirit:name>
134
+ </spirit:physicalPort>
135
+ </spirit:portMap>
136
+ <spirit:portMap>
137
+ <spirit:logicalPort>
138
+ <spirit:name>RDATA</spirit:name>
139
+ </spirit:logicalPort>
140
+ <spirit:physicalPort>
141
+ <spirit:name>s00_axi_rdata</spirit:name>
142
+ </spirit:physicalPort>
143
+ </spirit:portMap>
144
+ <spirit:portMap>
145
+ <spirit:logicalPort>
146
+ <spirit:name>RRESP</spirit:name>
147
+ </spirit:logicalPort>
148
+ <spirit:physicalPort>
149
+ <spirit:name>s00_axi_rresp</spirit:name>
150
+ </spirit:physicalPort>
151
+ </spirit:portMap>
152
+ <spirit:portMap>
153
+ <spirit:logicalPort>
154
+ <spirit:name>RVALID</spirit:name>
155
+ </spirit:logicalPort>
156
+ <spirit:physicalPort>
157
+ <spirit:name>s00_axi_rvalid</spirit:name>
158
+ </spirit:physicalPort>
159
+ </spirit:portMap>
160
+ <spirit:portMap>
161
+ <spirit:logicalPort>
162
+ <spirit:name>RREADY</spirit:name>
163
+ </spirit:logicalPort>
164
+ <spirit:physicalPort>
165
+ <spirit:name>s00_axi_rready</spirit:name>
166
+ </spirit:physicalPort>
167
+ </spirit:portMap>
168
+ </spirit:portMaps>
169
+ </spirit:busInterface>
170
+ <spirit:busInterface>
171
+ <spirit:name>s00_axi_aclk</spirit:name>
172
+ <spirit:busType spirit:vendor="xilinx.com" spirit:library="signal" spirit:name="clock" spirit:version="1.0"/>
173
+ <spirit:abstractionType spirit:vendor="xilinx.com" spirit:library="signal" spirit:name="clock_rtl" spirit:version="1.0"/>
174
+ <spirit:slave/>
175
+ <spirit:portMaps>
176
+ <spirit:portMap>
177
+ <spirit:logicalPort>
178
+ <spirit:name>CLK</spirit:name>
179
+ </spirit:logicalPort>
180
+ <spirit:physicalPort>
181
+ <spirit:name>s00_axi_aclk</spirit:name>
182
+ </spirit:physicalPort>
183
+ </spirit:portMap>
184
+ </spirit:portMaps>
185
+ <spirit:parameters>
186
+ <spirit:parameter>
187
+ <spirit:name>ASSOCIATED_BUSIF</spirit:name>
188
+ <spirit:value spirit:id="BUSIFPARAM_VALUE.S00_AXI_ACLK.ASSOCIATED_BUSIF">s00_axi</spirit:value>
189
+ </spirit:parameter>
190
+ <spirit:parameter>
191
+ <spirit:name>ASSOCIATED_RESET</spirit:name>
192
+ <spirit:value spirit:id="BUSIFPARAM_VALUE.S00_AXI_ACLK.ASSOCIATED_RESET">s00_axi_aresetn</spirit:value>
193
+ </spirit:parameter>
194
+ </spirit:parameters>
195
+ </spirit:busInterface>
196
+ <spirit:busInterface>
197
+ <spirit:name>s00_axi_aresetn</spirit:name>
198
+ <spirit:busType spirit:vendor="xilinx.com" spirit:library="signal" spirit:name="reset" spirit:version="1.0"/>
199
+ <spirit:abstractionType spirit:vendor="xilinx.com" spirit:library="signal" spirit:name="reset_rtl" spirit:version="1.0"/>
200
+ <spirit:slave/>
201
+ <spirit:portMaps>
202
+ <spirit:portMap>
203
+ <spirit:logicalPort>
204
+ <spirit:name>RST</spirit:name>
205
+ </spirit:logicalPort>
206
+ <spirit:physicalPort>
207
+ <spirit:name>s00_axi_aresetn</spirit:name>
208
+ </spirit:physicalPort>
209
+ </spirit:portMap>
210
+ </spirit:portMaps>
211
+ <spirit:parameters>
212
+ <spirit:parameter>
213
+ <spirit:name>POLARITY</spirit:name>
214
+ <spirit:value spirit:id="BUSIFPARAM_VALUE.S00_AXI_ARESETN.POLARITY" spirit:choiceRef="choice_list_74b5137e">ACTIVE_LOW</spirit:value>
215
+ </spirit:parameter>
216
+ </spirit:parameters>
217
+ </spirit:busInterface>
218
+ </spirit:busInterfaces>
219
+ <spirit:memoryMaps>
220
+ <spirit:memoryMap>
221
+ <spirit:name>s00_axi</spirit:name>
222
+ <spirit:displayName>s00_axi</spirit:displayName>
223
+ <spirit:addressBlock>
224
+ <spirit:name>reg0</spirit:name>
225
+ <spirit:displayName>reg0</spirit:displayName>
226
+ <spirit:baseAddress spirit:format="bitString" spirit:bitStringLength="1">0x0</spirit:baseAddress>
227
+ <spirit:range spirit:format="long" spirit:resolve="dependent" spirit:dependency="pow(2,(spirit:decode(id(&apos;MODELPARAM_VALUE.C_S00_AXI_ADDR_WIDTH&apos;)) - 1) - 0 + 1)" spirit:minimum="4096" spirit:rangeType="long">4096</spirit:range>
228
+ <spirit:width spirit:format="long" spirit:resolve="dependent" spirit:dependency="(spirit:decode(id(&apos;MODELPARAM_VALUE.C_S00_AXI_DATA_WIDTH&apos;)) - 1) - 0 + 1">32</spirit:width>
229
+ <spirit:usage>register</spirit:usage>
230
+ </spirit:addressBlock>
231
+ </spirit:memoryMap>
232
+ </spirit:memoryMaps>
233
+ <spirit:model>
234
+ <spirit:views>
235
+ <spirit:view>
236
+ <spirit:name>xilinx_verilogsynthesis</spirit:name>
237
+ <spirit:displayName>Verilog Synthesis</spirit:displayName>
238
+ <spirit:envIdentifier>verilogSource:vivado.xilinx.com:synthesis</spirit:envIdentifier>
239
+ <spirit:language>verilog</spirit:language>
240
+ <spirit:modelName>ddr3_test_monitor_axi_v1_0</spirit:modelName>
241
+ <spirit:fileSetRef>
242
+ <spirit:localName>xilinx_verilogsynthesis_view_fileset</spirit:localName>
243
+ </spirit:fileSetRef>
244
+ <spirit:parameters>
245
+ <spirit:parameter>
246
+ <spirit:name>viewChecksum</spirit:name>
247
+ <spirit:value>02a2ca45</spirit:value>
248
+ </spirit:parameter>
249
+ </spirit:parameters>
250
+ </spirit:view>
251
+ <spirit:view>
252
+ <spirit:name>xilinx_verilogbehavioralsimulation</spirit:name>
253
+ <spirit:displayName>Verilog Simulation</spirit:displayName>
254
+ <spirit:envIdentifier>verilogSource:vivado.xilinx.com:simulation</spirit:envIdentifier>
255
+ <spirit:language>verilog</spirit:language>
256
+ <spirit:modelName>ddr3_test_monitor_axi_v1_0</spirit:modelName>
257
+ <spirit:fileSetRef>
258
+ <spirit:localName>xilinx_verilogbehavioralsimulation_view_fileset</spirit:localName>
259
+ </spirit:fileSetRef>
260
+ <spirit:parameters>
261
+ <spirit:parameter>
262
+ <spirit:name>viewChecksum</spirit:name>
263
+ <spirit:value>02a2ca45</spirit:value>
264
+ </spirit:parameter>
265
+ </spirit:parameters>
266
+ </spirit:view>
267
+ <spirit:view>
268
+ <spirit:name>xilinx_softwaredriver</spirit:name>
269
+ <spirit:displayName>Software Driver</spirit:displayName>
270
+ <spirit:envIdentifier>:vivado.xilinx.com:sw.driver</spirit:envIdentifier>
271
+ <spirit:fileSetRef>
272
+ <spirit:localName>xilinx_softwaredriver_view_fileset</spirit:localName>
273
+ </spirit:fileSetRef>
274
+ <spirit:parameters>
275
+ <spirit:parameter>
276
+ <spirit:name>viewChecksum</spirit:name>
277
+ <spirit:value>533b7796</spirit:value>
278
+ </spirit:parameter>
279
+ </spirit:parameters>
280
+ </spirit:view>
281
+ <spirit:view>
282
+ <spirit:name>xilinx_xpgui</spirit:name>
283
+ <spirit:displayName>UI Layout</spirit:displayName>
284
+ <spirit:envIdentifier>:vivado.xilinx.com:xgui.ui</spirit:envIdentifier>
285
+ <spirit:fileSetRef>
286
+ <spirit:localName>xilinx_xpgui_view_fileset</spirit:localName>
287
+ </spirit:fileSetRef>
288
+ <spirit:parameters>
289
+ <spirit:parameter>
290
+ <spirit:name>viewChecksum</spirit:name>
291
+ <spirit:value>080b65eb</spirit:value>
292
+ </spirit:parameter>
293
+ </spirit:parameters>
294
+ </spirit:view>
295
+ <spirit:view>
296
+ <spirit:name>bd_tcl</spirit:name>
297
+ <spirit:displayName>Block Diagram</spirit:displayName>
298
+ <spirit:envIdentifier>:vivado.xilinx.com:block.diagram</spirit:envIdentifier>
299
+ <spirit:fileSetRef>
300
+ <spirit:localName>bd_tcl_view_fileset</spirit:localName>
301
+ </spirit:fileSetRef>
302
+ <spirit:parameters>
303
+ <spirit:parameter>
304
+ <spirit:name>viewChecksum</spirit:name>
305
+ <spirit:value>45a2f450</spirit:value>
306
+ </spirit:parameter>
307
+ </spirit:parameters>
308
+ </spirit:view>
309
+ </spirit:views>
310
+ <spirit:ports>
311
+ <spirit:port>
312
+ <spirit:name>correct_read_data_counter</spirit:name>
313
+ <spirit:wire>
314
+ <spirit:direction>in</spirit:direction>
315
+ <spirit:vector>
316
+ <spirit:left spirit:format="long">63</spirit:left>
317
+ <spirit:right spirit:format="long">0</spirit:right>
318
+ </spirit:vector>
319
+ <spirit:wireTypeDefs>
320
+ <spirit:wireTypeDef>
321
+ <spirit:typeName>wire</spirit:typeName>
322
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
323
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
324
+ </spirit:wireTypeDef>
325
+ </spirit:wireTypeDefs>
326
+ </spirit:wire>
327
+ </spirit:port>
328
+ <spirit:port>
329
+ <spirit:name>wrong_read_data_counter</spirit:name>
330
+ <spirit:wire>
331
+ <spirit:direction>in</spirit:direction>
332
+ <spirit:vector>
333
+ <spirit:left spirit:format="long">63</spirit:left>
334
+ <spirit:right spirit:format="long">0</spirit:right>
335
+ </spirit:vector>
336
+ <spirit:wireTypeDefs>
337
+ <spirit:wireTypeDef>
338
+ <spirit:typeName>wire</spirit:typeName>
339
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
340
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
341
+ </spirit:wireTypeDef>
342
+ </spirit:wireTypeDefs>
343
+ </spirit:wire>
344
+ </spirit:port>
345
+ <spirit:port>
346
+ <spirit:name>time_counter</spirit:name>
347
+ <spirit:wire>
348
+ <spirit:direction>in</spirit:direction>
349
+ <spirit:vector>
350
+ <spirit:left spirit:format="long">63</spirit:left>
351
+ <spirit:right spirit:format="long">0</spirit:right>
352
+ </spirit:vector>
353
+ <spirit:wireTypeDefs>
354
+ <spirit:wireTypeDef>
355
+ <spirit:typeName>wire</spirit:typeName>
356
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
357
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
358
+ </spirit:wireTypeDef>
359
+ </spirit:wireTypeDefs>
360
+ </spirit:wire>
361
+ </spirit:port>
362
+ <spirit:port>
363
+ <spirit:name>injected_faults_counter</spirit:name>
364
+ <spirit:wire>
365
+ <spirit:direction>in</spirit:direction>
366
+ <spirit:vector>
367
+ <spirit:left spirit:format="long">31</spirit:left>
368
+ <spirit:right spirit:format="long">0</spirit:right>
369
+ </spirit:vector>
370
+ <spirit:wireTypeDefs>
371
+ <spirit:wireTypeDef>
372
+ <spirit:typeName>wire</spirit:typeName>
373
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
374
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
375
+ </spirit:wireTypeDef>
376
+ </spirit:wireTypeDefs>
377
+ </spirit:wire>
378
+ </spirit:port>
379
+ <spirit:port>
380
+ <spirit:name>s00_axi_aclk</spirit:name>
381
+ <spirit:wire>
382
+ <spirit:direction>in</spirit:direction>
383
+ <spirit:wireTypeDefs>
384
+ <spirit:wireTypeDef>
385
+ <spirit:typeName>wire</spirit:typeName>
386
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
387
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
388
+ </spirit:wireTypeDef>
389
+ </spirit:wireTypeDefs>
390
+ </spirit:wire>
391
+ </spirit:port>
392
+ <spirit:port>
393
+ <spirit:name>s00_axi_aresetn</spirit:name>
394
+ <spirit:wire>
395
+ <spirit:direction>in</spirit:direction>
396
+ <spirit:wireTypeDefs>
397
+ <spirit:wireTypeDef>
398
+ <spirit:typeName>wire</spirit:typeName>
399
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
400
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
401
+ </spirit:wireTypeDef>
402
+ </spirit:wireTypeDefs>
403
+ </spirit:wire>
404
+ </spirit:port>
405
+ <spirit:port>
406
+ <spirit:name>s00_axi_awaddr</spirit:name>
407
+ <spirit:wire>
408
+ <spirit:direction>in</spirit:direction>
409
+ <spirit:vector>
410
+ <spirit:left spirit:format="long" spirit:resolve="dependent" spirit:dependency="(spirit:decode(id(&apos;MODELPARAM_VALUE.C_S00_AXI_ADDR_WIDTH&apos;)) - 1)">6</spirit:left>
411
+ <spirit:right spirit:format="long">0</spirit:right>
412
+ </spirit:vector>
413
+ <spirit:wireTypeDefs>
414
+ <spirit:wireTypeDef>
415
+ <spirit:typeName>wire</spirit:typeName>
416
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
417
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
418
+ </spirit:wireTypeDef>
419
+ </spirit:wireTypeDefs>
420
+ <spirit:driver>
421
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
422
+ </spirit:driver>
423
+ </spirit:wire>
424
+ </spirit:port>
425
+ <spirit:port>
426
+ <spirit:name>s00_axi_awprot</spirit:name>
427
+ <spirit:wire>
428
+ <spirit:direction>in</spirit:direction>
429
+ <spirit:vector>
430
+ <spirit:left spirit:format="long">2</spirit:left>
431
+ <spirit:right spirit:format="long">0</spirit:right>
432
+ </spirit:vector>
433
+ <spirit:wireTypeDefs>
434
+ <spirit:wireTypeDef>
435
+ <spirit:typeName>wire</spirit:typeName>
436
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
437
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
438
+ </spirit:wireTypeDef>
439
+ </spirit:wireTypeDefs>
440
+ <spirit:driver>
441
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
442
+ </spirit:driver>
443
+ </spirit:wire>
444
+ </spirit:port>
445
+ <spirit:port>
446
+ <spirit:name>s00_axi_awvalid</spirit:name>
447
+ <spirit:wire>
448
+ <spirit:direction>in</spirit:direction>
449
+ <spirit:wireTypeDefs>
450
+ <spirit:wireTypeDef>
451
+ <spirit:typeName>wire</spirit:typeName>
452
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
453
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
454
+ </spirit:wireTypeDef>
455
+ </spirit:wireTypeDefs>
456
+ <spirit:driver>
457
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
458
+ </spirit:driver>
459
+ </spirit:wire>
460
+ </spirit:port>
461
+ <spirit:port>
462
+ <spirit:name>s00_axi_awready</spirit:name>
463
+ <spirit:wire>
464
+ <spirit:direction>out</spirit:direction>
465
+ <spirit:wireTypeDefs>
466
+ <spirit:wireTypeDef>
467
+ <spirit:typeName>wire</spirit:typeName>
468
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
469
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
470
+ </spirit:wireTypeDef>
471
+ </spirit:wireTypeDefs>
472
+ </spirit:wire>
473
+ </spirit:port>
474
+ <spirit:port>
475
+ <spirit:name>s00_axi_wdata</spirit:name>
476
+ <spirit:wire>
477
+ <spirit:direction>in</spirit:direction>
478
+ <spirit:vector>
479
+ <spirit:left spirit:format="long" spirit:resolve="dependent" spirit:dependency="(spirit:decode(id(&apos;MODELPARAM_VALUE.C_S00_AXI_DATA_WIDTH&apos;)) - 1)">31</spirit:left>
480
+ <spirit:right spirit:format="long">0</spirit:right>
481
+ </spirit:vector>
482
+ <spirit:wireTypeDefs>
483
+ <spirit:wireTypeDef>
484
+ <spirit:typeName>wire</spirit:typeName>
485
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
486
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
487
+ </spirit:wireTypeDef>
488
+ </spirit:wireTypeDefs>
489
+ <spirit:driver>
490
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
491
+ </spirit:driver>
492
+ </spirit:wire>
493
+ </spirit:port>
494
+ <spirit:port>
495
+ <spirit:name>s00_axi_wstrb</spirit:name>
496
+ <spirit:wire>
497
+ <spirit:direction>in</spirit:direction>
498
+ <spirit:vector>
499
+ <spirit:left spirit:format="long" spirit:resolve="dependent" spirit:dependency="((spirit:decode(id(&apos;MODELPARAM_VALUE.C_S00_AXI_DATA_WIDTH&apos;)) / 8) - 1)">3</spirit:left>
500
+ <spirit:right spirit:format="long">0</spirit:right>
501
+ </spirit:vector>
502
+ <spirit:wireTypeDefs>
503
+ <spirit:wireTypeDef>
504
+ <spirit:typeName>wire</spirit:typeName>
505
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
506
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
507
+ </spirit:wireTypeDef>
508
+ </spirit:wireTypeDefs>
509
+ <spirit:driver>
510
+ <spirit:defaultValue spirit:format="long">1</spirit:defaultValue>
511
+ </spirit:driver>
512
+ </spirit:wire>
513
+ </spirit:port>
514
+ <spirit:port>
515
+ <spirit:name>s00_axi_wvalid</spirit:name>
516
+ <spirit:wire>
517
+ <spirit:direction>in</spirit:direction>
518
+ <spirit:wireTypeDefs>
519
+ <spirit:wireTypeDef>
520
+ <spirit:typeName>wire</spirit:typeName>
521
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
522
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
523
+ </spirit:wireTypeDef>
524
+ </spirit:wireTypeDefs>
525
+ <spirit:driver>
526
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
527
+ </spirit:driver>
528
+ </spirit:wire>
529
+ </spirit:port>
530
+ <spirit:port>
531
+ <spirit:name>s00_axi_wready</spirit:name>
532
+ <spirit:wire>
533
+ <spirit:direction>out</spirit:direction>
534
+ <spirit:wireTypeDefs>
535
+ <spirit:wireTypeDef>
536
+ <spirit:typeName>wire</spirit:typeName>
537
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
538
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
539
+ </spirit:wireTypeDef>
540
+ </spirit:wireTypeDefs>
541
+ </spirit:wire>
542
+ </spirit:port>
543
+ <spirit:port>
544
+ <spirit:name>s00_axi_bresp</spirit:name>
545
+ <spirit:wire>
546
+ <spirit:direction>out</spirit:direction>
547
+ <spirit:vector>
548
+ <spirit:left spirit:format="long">1</spirit:left>
549
+ <spirit:right spirit:format="long">0</spirit:right>
550
+ </spirit:vector>
551
+ <spirit:wireTypeDefs>
552
+ <spirit:wireTypeDef>
553
+ <spirit:typeName>wire</spirit:typeName>
554
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
555
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
556
+ </spirit:wireTypeDef>
557
+ </spirit:wireTypeDefs>
558
+ </spirit:wire>
559
+ </spirit:port>
560
+ <spirit:port>
561
+ <spirit:name>s00_axi_bvalid</spirit:name>
562
+ <spirit:wire>
563
+ <spirit:direction>out</spirit:direction>
564
+ <spirit:wireTypeDefs>
565
+ <spirit:wireTypeDef>
566
+ <spirit:typeName>wire</spirit:typeName>
567
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
568
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
569
+ </spirit:wireTypeDef>
570
+ </spirit:wireTypeDefs>
571
+ </spirit:wire>
572
+ </spirit:port>
573
+ <spirit:port>
574
+ <spirit:name>s00_axi_bready</spirit:name>
575
+ <spirit:wire>
576
+ <spirit:direction>in</spirit:direction>
577
+ <spirit:wireTypeDefs>
578
+ <spirit:wireTypeDef>
579
+ <spirit:typeName>wire</spirit:typeName>
580
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
581
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
582
+ </spirit:wireTypeDef>
583
+ </spirit:wireTypeDefs>
584
+ <spirit:driver>
585
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
586
+ </spirit:driver>
587
+ </spirit:wire>
588
+ </spirit:port>
589
+ <spirit:port>
590
+ <spirit:name>s00_axi_araddr</spirit:name>
591
+ <spirit:wire>
592
+ <spirit:direction>in</spirit:direction>
593
+ <spirit:vector>
594
+ <spirit:left spirit:format="long" spirit:resolve="dependent" spirit:dependency="(spirit:decode(id(&apos;MODELPARAM_VALUE.C_S00_AXI_ADDR_WIDTH&apos;)) - 1)">6</spirit:left>
595
+ <spirit:right spirit:format="long">0</spirit:right>
596
+ </spirit:vector>
597
+ <spirit:wireTypeDefs>
598
+ <spirit:wireTypeDef>
599
+ <spirit:typeName>wire</spirit:typeName>
600
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
601
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
602
+ </spirit:wireTypeDef>
603
+ </spirit:wireTypeDefs>
604
+ <spirit:driver>
605
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
606
+ </spirit:driver>
607
+ </spirit:wire>
608
+ </spirit:port>
609
+ <spirit:port>
610
+ <spirit:name>s00_axi_arprot</spirit:name>
611
+ <spirit:wire>
612
+ <spirit:direction>in</spirit:direction>
613
+ <spirit:vector>
614
+ <spirit:left spirit:format="long">2</spirit:left>
615
+ <spirit:right spirit:format="long">0</spirit:right>
616
+ </spirit:vector>
617
+ <spirit:wireTypeDefs>
618
+ <spirit:wireTypeDef>
619
+ <spirit:typeName>wire</spirit:typeName>
620
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
621
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
622
+ </spirit:wireTypeDef>
623
+ </spirit:wireTypeDefs>
624
+ <spirit:driver>
625
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
626
+ </spirit:driver>
627
+ </spirit:wire>
628
+ </spirit:port>
629
+ <spirit:port>
630
+ <spirit:name>s00_axi_arvalid</spirit:name>
631
+ <spirit:wire>
632
+ <spirit:direction>in</spirit:direction>
633
+ <spirit:wireTypeDefs>
634
+ <spirit:wireTypeDef>
635
+ <spirit:typeName>wire</spirit:typeName>
636
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
637
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
638
+ </spirit:wireTypeDef>
639
+ </spirit:wireTypeDefs>
640
+ <spirit:driver>
641
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
642
+ </spirit:driver>
643
+ </spirit:wire>
644
+ </spirit:port>
645
+ <spirit:port>
646
+ <spirit:name>s00_axi_arready</spirit:name>
647
+ <spirit:wire>
648
+ <spirit:direction>out</spirit:direction>
649
+ <spirit:wireTypeDefs>
650
+ <spirit:wireTypeDef>
651
+ <spirit:typeName>wire</spirit:typeName>
652
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
653
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
654
+ </spirit:wireTypeDef>
655
+ </spirit:wireTypeDefs>
656
+ </spirit:wire>
657
+ </spirit:port>
658
+ <spirit:port>
659
+ <spirit:name>s00_axi_rdata</spirit:name>
660
+ <spirit:wire>
661
+ <spirit:direction>out</spirit:direction>
662
+ <spirit:vector>
663
+ <spirit:left spirit:format="long" spirit:resolve="dependent" spirit:dependency="(spirit:decode(id(&apos;MODELPARAM_VALUE.C_S00_AXI_DATA_WIDTH&apos;)) - 1)">31</spirit:left>
664
+ <spirit:right spirit:format="long">0</spirit:right>
665
+ </spirit:vector>
666
+ <spirit:wireTypeDefs>
667
+ <spirit:wireTypeDef>
668
+ <spirit:typeName>wire</spirit:typeName>
669
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
670
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
671
+ </spirit:wireTypeDef>
672
+ </spirit:wireTypeDefs>
673
+ </spirit:wire>
674
+ </spirit:port>
675
+ <spirit:port>
676
+ <spirit:name>s00_axi_rresp</spirit:name>
677
+ <spirit:wire>
678
+ <spirit:direction>out</spirit:direction>
679
+ <spirit:vector>
680
+ <spirit:left spirit:format="long">1</spirit:left>
681
+ <spirit:right spirit:format="long">0</spirit:right>
682
+ </spirit:vector>
683
+ <spirit:wireTypeDefs>
684
+ <spirit:wireTypeDef>
685
+ <spirit:typeName>wire</spirit:typeName>
686
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
687
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
688
+ </spirit:wireTypeDef>
689
+ </spirit:wireTypeDefs>
690
+ </spirit:wire>
691
+ </spirit:port>
692
+ <spirit:port>
693
+ <spirit:name>s00_axi_rvalid</spirit:name>
694
+ <spirit:wire>
695
+ <spirit:direction>out</spirit:direction>
696
+ <spirit:wireTypeDefs>
697
+ <spirit:wireTypeDef>
698
+ <spirit:typeName>wire</spirit:typeName>
699
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
700
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
701
+ </spirit:wireTypeDef>
702
+ </spirit:wireTypeDefs>
703
+ </spirit:wire>
704
+ </spirit:port>
705
+ <spirit:port>
706
+ <spirit:name>s00_axi_rready</spirit:name>
707
+ <spirit:wire>
708
+ <spirit:direction>in</spirit:direction>
709
+ <spirit:wireTypeDefs>
710
+ <spirit:wireTypeDef>
711
+ <spirit:typeName>wire</spirit:typeName>
712
+ <spirit:viewNameRef>xilinx_verilogsynthesis</spirit:viewNameRef>
713
+ <spirit:viewNameRef>xilinx_verilogbehavioralsimulation</spirit:viewNameRef>
714
+ </spirit:wireTypeDef>
715
+ </spirit:wireTypeDefs>
716
+ <spirit:driver>
717
+ <spirit:defaultValue spirit:format="long">0</spirit:defaultValue>
718
+ </spirit:driver>
719
+ </spirit:wire>
720
+ </spirit:port>
721
+ </spirit:ports>
722
+ <spirit:modelParameters>
723
+ <spirit:modelParameter xsi:type="spirit:nameValueTypeType" spirit:dataType="integer">
724
+ <spirit:name>C_S00_AXI_DATA_WIDTH</spirit:name>
725
+ <spirit:displayName>C S00 AXI DATA WIDTH</spirit:displayName>
726
+ <spirit:description>Width of S_AXI data bus</spirit:description>
727
+ <spirit:value spirit:format="long" spirit:resolve="generated" spirit:id="MODELPARAM_VALUE.C_S00_AXI_DATA_WIDTH" spirit:order="3" spirit:rangeType="long">32</spirit:value>
728
+ </spirit:modelParameter>
729
+ <spirit:modelParameter spirit:dataType="integer">
730
+ <spirit:name>C_S00_AXI_ADDR_WIDTH</spirit:name>
731
+ <spirit:displayName>C S00 AXI ADDR WIDTH</spirit:displayName>
732
+ <spirit:description>Width of S_AXI address bus</spirit:description>
733
+ <spirit:value spirit:format="long" spirit:resolve="generated" spirit:id="MODELPARAM_VALUE.C_S00_AXI_ADDR_WIDTH" spirit:order="4" spirit:rangeType="long">7</spirit:value>
734
+ </spirit:modelParameter>
735
+ </spirit:modelParameters>
736
+ </spirit:model>
737
+ <spirit:choices>
738
+ <spirit:choice>
739
+ <spirit:name>choice_list_6fc15197</spirit:name>
740
+ <spirit:enumeration>32</spirit:enumeration>
741
+ </spirit:choice>
742
+ <spirit:choice>
743
+ <spirit:name>choice_list_74b5137e</spirit:name>
744
+ <spirit:enumeration>ACTIVE_HIGH</spirit:enumeration>
745
+ <spirit:enumeration>ACTIVE_LOW</spirit:enumeration>
746
+ </spirit:choice>
747
+ </spirit:choices>
748
+ <spirit:fileSets>
749
+ <spirit:fileSet>
750
+ <spirit:name>xilinx_verilogsynthesis_view_fileset</spirit:name>
751
+ <spirit:file>
752
+ <spirit:name>hdl/ddr3_test_monitor_axi_v1_0_S00_AXI.v</spirit:name>
753
+ <spirit:fileType>verilogSource</spirit:fileType>
754
+ </spirit:file>
755
+ <spirit:file>
756
+ <spirit:name>hdl/ddr3_test_monitor_axi_v1_0.v</spirit:name>
757
+ <spirit:fileType>verilogSource</spirit:fileType>
758
+ <spirit:userFileType>CHECKSUM_e4de66a6</spirit:userFileType>
759
+ </spirit:file>
760
+ </spirit:fileSet>
761
+ <spirit:fileSet>
762
+ <spirit:name>xilinx_verilogbehavioralsimulation_view_fileset</spirit:name>
763
+ <spirit:file>
764
+ <spirit:name>hdl/ddr3_test_monitor_axi_v1_0_S00_AXI.v</spirit:name>
765
+ <spirit:fileType>verilogSource</spirit:fileType>
766
+ </spirit:file>
767
+ <spirit:file>
768
+ <spirit:name>hdl/ddr3_test_monitor_axi_v1_0.v</spirit:name>
769
+ <spirit:fileType>verilogSource</spirit:fileType>
770
+ </spirit:file>
771
+ </spirit:fileSet>
772
+ <spirit:fileSet>
773
+ <spirit:name>xilinx_softwaredriver_view_fileset</spirit:name>
774
+ <spirit:file>
775
+ <spirit:name>drivers/ddr3_test_monitor_axi_v1_0/data/ddr3_test_monitor_axi.mdd</spirit:name>
776
+ <spirit:userFileType>mdd</spirit:userFileType>
777
+ <spirit:userFileType>driver_mdd</spirit:userFileType>
778
+ </spirit:file>
779
+ <spirit:file>
780
+ <spirit:name>drivers/ddr3_test_monitor_axi_v1_0/data/ddr3_test_monitor_axi.tcl</spirit:name>
781
+ <spirit:fileType>tclSource</spirit:fileType>
782
+ <spirit:userFileType>driver_tcl</spirit:userFileType>
783
+ </spirit:file>
784
+ <spirit:file>
785
+ <spirit:name>drivers/ddr3_test_monitor_axi_v1_0/src/Makefile</spirit:name>
786
+ <spirit:userFileType>driver_src</spirit:userFileType>
787
+ </spirit:file>
788
+ <spirit:file>
789
+ <spirit:name>drivers/ddr3_test_monitor_axi_v1_0/src/ddr3_test_monitor_axi.h</spirit:name>
790
+ <spirit:fileType>cSource</spirit:fileType>
791
+ <spirit:userFileType>driver_src</spirit:userFileType>
792
+ </spirit:file>
793
+ <spirit:file>
794
+ <spirit:name>drivers/ddr3_test_monitor_axi_v1_0/src/ddr3_test_monitor_axi.c</spirit:name>
795
+ <spirit:fileType>cSource</spirit:fileType>
796
+ <spirit:userFileType>driver_src</spirit:userFileType>
797
+ </spirit:file>
798
+ <spirit:file>
799
+ <spirit:name>drivers/ddr3_test_monitor_axi_v1_0/src/ddr3_test_monitor_axi_selftest.c</spirit:name>
800
+ <spirit:fileType>cSource</spirit:fileType>
801
+ <spirit:userFileType>driver_src</spirit:userFileType>
802
+ </spirit:file>
803
+ </spirit:fileSet>
804
+ <spirit:fileSet>
805
+ <spirit:name>xilinx_xpgui_view_fileset</spirit:name>
806
+ <spirit:file>
807
+ <spirit:name>xgui/ddr3_test_monitor_axi_v1_0.tcl</spirit:name>
808
+ <spirit:fileType>tclSource</spirit:fileType>
809
+ <spirit:userFileType>CHECKSUM_080b65eb</spirit:userFileType>
810
+ <spirit:userFileType>XGUI_VERSION_2</spirit:userFileType>
811
+ </spirit:file>
812
+ </spirit:fileSet>
813
+ <spirit:fileSet>
814
+ <spirit:name>bd_tcl_view_fileset</spirit:name>
815
+ <spirit:file>
816
+ <spirit:name>bd/bd.tcl</spirit:name>
817
+ <spirit:fileType>tclSource</spirit:fileType>
818
+ </spirit:file>
819
+ </spirit:fileSet>
820
+ </spirit:fileSets>
821
+ <spirit:description>monitors ddr3 test results</spirit:description>
822
+ <spirit:parameters>
823
+ <spirit:parameter>
824
+ <spirit:name>C_S00_AXI_DATA_WIDTH</spirit:name>
825
+ <spirit:displayName>C S00 AXI DATA WIDTH</spirit:displayName>
826
+ <spirit:description>Width of S_AXI data bus</spirit:description>
827
+ <spirit:value spirit:format="long" spirit:resolve="user" spirit:id="PARAM_VALUE.C_S00_AXI_DATA_WIDTH" spirit:choiceRef="choice_list_6fc15197" spirit:order="3">32</spirit:value>
828
+ <spirit:vendorExtensions>
829
+ <xilinx:parameterInfo>
830
+ <xilinx:enablement>
831
+ <xilinx:isEnabled xilinx:id="PARAM_ENABLEMENT.C_S00_AXI_DATA_WIDTH">false</xilinx:isEnabled>
832
+ </xilinx:enablement>
833
+ </xilinx:parameterInfo>
834
+ </spirit:vendorExtensions>
835
+ </spirit:parameter>
836
+ <spirit:parameter>
837
+ <spirit:name>C_S00_AXI_ADDR_WIDTH</spirit:name>
838
+ <spirit:displayName>C S00 AXI ADDR WIDTH</spirit:displayName>
839
+ <spirit:description>Width of S_AXI address bus</spirit:description>
840
+ <spirit:value spirit:format="long" spirit:resolve="user" spirit:id="PARAM_VALUE.C_S00_AXI_ADDR_WIDTH" spirit:order="4" spirit:rangeType="long">7</spirit:value>
841
+ <spirit:vendorExtensions>
842
+ <xilinx:parameterInfo>
843
+ <xilinx:enablement>
844
+ <xilinx:isEnabled xilinx:id="PARAM_ENABLEMENT.C_S00_AXI_ADDR_WIDTH">false</xilinx:isEnabled>
845
+ </xilinx:enablement>
846
+ </xilinx:parameterInfo>
847
+ </spirit:vendorExtensions>
848
+ </spirit:parameter>
849
+ <spirit:parameter>
850
+ <spirit:name>C_S00_AXI_BASEADDR</spirit:name>
851
+ <spirit:displayName>C S00 AXI BASEADDR</spirit:displayName>
852
+ <spirit:value spirit:format="bitString" spirit:resolve="user" spirit:id="PARAM_VALUE.C_S00_AXI_BASEADDR" spirit:order="5" spirit:bitStringLength="32">0xFFFFFFFF</spirit:value>
853
+ <spirit:vendorExtensions>
854
+ <xilinx:parameterInfo>
855
+ <xilinx:enablement>
856
+ <xilinx:isEnabled xilinx:id="PARAM_ENABLEMENT.C_S00_AXI_BASEADDR">false</xilinx:isEnabled>
857
+ </xilinx:enablement>
858
+ </xilinx:parameterInfo>
859
+ </spirit:vendorExtensions>
860
+ </spirit:parameter>
861
+ <spirit:parameter>
862
+ <spirit:name>C_S00_AXI_HIGHADDR</spirit:name>
863
+ <spirit:displayName>C S00 AXI HIGHADDR</spirit:displayName>
864
+ <spirit:value spirit:format="bitString" spirit:resolve="user" spirit:id="PARAM_VALUE.C_S00_AXI_HIGHADDR" spirit:order="6" spirit:bitStringLength="32">0x00000000</spirit:value>
865
+ <spirit:vendorExtensions>
866
+ <xilinx:parameterInfo>
867
+ <xilinx:enablement>
868
+ <xilinx:isEnabled xilinx:id="PARAM_ENABLEMENT.C_S00_AXI_HIGHADDR">false</xilinx:isEnabled>
869
+ </xilinx:enablement>
870
+ </xilinx:parameterInfo>
871
+ </spirit:vendorExtensions>
872
+ </spirit:parameter>
873
+ <spirit:parameter>
874
+ <spirit:name>Component_Name</spirit:name>
875
+ <spirit:value spirit:resolve="user" spirit:id="PARAM_VALUE.Component_Name" spirit:order="1">ddr3_test_monitor_axi_v1_0</spirit:value>
876
+ </spirit:parameter>
877
+ </spirit:parameters>
878
+ <spirit:vendorExtensions>
879
+ <xilinx:coreExtensions>
880
+ <xilinx:supportedFamilies>
881
+ <xilinx:family xilinx:lifeCycle="Pre-Production">kintex7</xilinx:family>
882
+ </xilinx:supportedFamilies>
883
+ <xilinx:taxonomies>
884
+ <xilinx:taxonomy>AXI_Peripheral</xilinx:taxonomy>
885
+ </xilinx:taxonomies>
886
+ <xilinx:displayName>ddr3_test_monitor_axi_v1.0</xilinx:displayName>
887
+ <xilinx:coreRevision>9</xilinx:coreRevision>
888
+ <xilinx:coreCreationDateTime>2025-02-09T12:59:49Z</xilinx:coreCreationDateTime>
889
+ </xilinx:coreExtensions>
890
+ <xilinx:packagingInfo>
891
+ <xilinx:xilinxVersion>2022.1</xilinx:xilinxVersion>
892
+ <xilinx:checksum xilinx:scope="busInterfaces" xilinx:value="2149db2e"/>
893
+ <xilinx:checksum xilinx:scope="memoryMaps" xilinx:value="0c04c4c2"/>
894
+ <xilinx:checksum xilinx:scope="fileGroups" xilinx:value="f7195f90"/>
895
+ <xilinx:checksum xilinx:scope="ports" xilinx:value="9e6f557d"/>
896
+ <xilinx:checksum xilinx:scope="hdlParameters" xilinx:value="a0a6f17f"/>
897
+ <xilinx:checksum xilinx:scope="parameters" xilinx:value="07777575"/>
898
+ </xilinx:packagingInfo>
899
+ </spirit:vendorExtensions>
900
+ </spirit:component>
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/data/ddr3_test_monitor_axi.mdd ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ OPTION psf_version = 2.1;
4
+
5
+ BEGIN DRIVER ddr3_test_monitor_axi
6
+ OPTION supported_peripherals = (ddr3_test_monitor_axi);
7
+ OPTION copyfiles = all;
8
+ OPTION VERSION = 1.0;
9
+ OPTION NAME = ddr3_test_monitor_axi;
10
+ END DRIVER
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/data/ddr3_test_monitor_axi.tcl ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+
2
+
3
+ proc generate {drv_handle} {
4
+ xdefine_include_file $drv_handle "xparameters.h" "ddr3_test_monitor_axi" "NUM_INSTANCES" "DEVICE_ID" "C_S00_AXI_BASEADDR" "C_S00_AXI_HIGHADDR"
5
+ }
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/src/Makefile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ COMPILER=
2
+ ARCHIVER=
3
+ CP=cp
4
+ COMPILER_FLAGS=
5
+ EXTRA_COMPILER_FLAGS=
6
+ LIB=libxil.a
7
+
8
+ RELEASEDIR=../../../lib
9
+ INCLUDEDIR=../../../include
10
+ INCLUDES=-I./. -I${INCLUDEDIR}
11
+
12
+ INCLUDEFILES=*.h
13
+ LIBSOURCES=*.c
14
+ OUTS = *.o
15
+
16
+ libs:
17
+ echo "Compiling ddr3_test_monitor_axi..."
18
+ $(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $(LIBSOURCES)
19
+ $(ARCHIVER) -r ${RELEASEDIR}/${LIB} ${OUTS}
20
+ make clean
21
+
22
+ include:
23
+ ${CP} $(INCLUDEFILES) $(INCLUDEDIR)
24
+
25
+ clean:
26
+ rm -rf ${OUTS}
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/src/ddr3_test_monitor_axi.c ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+
2
+
3
+ /***************************** Include Files *******************************/
4
+ #include "ddr3_test_monitor_axi.h"
5
+
6
+ /************************** Function Definitions ***************************/
AngeloJacobo_UberDDR3/example_demo/enclustra_kx2_st1/ddr3_test_monitor_axi_1.0/drivers/ddr3_test_monitor_axi_v1_0/src/ddr3_test_monitor_axi.h ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #ifndef DDR3_TEST_MONITOR_AXI_H
3
+ #define DDR3_TEST_MONITOR_AXI_H
4
+
5
+
6
+ /****************** Include Files ********************/
7
+ #include "xil_types.h"
8
+ #include "xstatus.h"
9
+
10
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG0_OFFSET 0
11
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG1_OFFSET 4
12
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG2_OFFSET 8
13
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG3_OFFSET 12
14
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG4_OFFSET 16
15
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG5_OFFSET 20
16
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG6_OFFSET 24
17
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG7_OFFSET 28
18
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG8_OFFSET 32
19
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG9_OFFSET 36
20
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG10_OFFSET 40
21
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG11_OFFSET 44
22
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG12_OFFSET 48
23
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG13_OFFSET 52
24
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG14_OFFSET 56
25
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG15_OFFSET 60
26
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG16_OFFSET 64
27
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG17_OFFSET 68
28
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG18_OFFSET 72
29
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG19_OFFSET 76
30
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG20_OFFSET 80
31
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG21_OFFSET 84
32
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG22_OFFSET 88
33
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG23_OFFSET 92
34
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG24_OFFSET 96
35
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG25_OFFSET 100
36
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG26_OFFSET 104
37
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG27_OFFSET 108
38
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG28_OFFSET 112
39
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG29_OFFSET 116
40
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG30_OFFSET 120
41
+ #define DDR3_TEST_MONITOR_AXI_S00_AXI_SLV_REG31_OFFSET 124
42
+
43
+
44
+ /**************************** Type Definitions *****************************/
45
+ /**
46
+ *
47
+ * Write a value to a DDR3_TEST_MONITOR_AXI register. A 32 bit write is performed.
48
+ * If the component is implemented in a smaller width, only the least
49
+ * significant data is written.
50
+ *
51
+ * @param BaseAddress is the base address of the DDR3_TEST_MONITOR_AXIdevice.
52
+ * @param RegOffset is the register offset from the base to write to.
53
+ * @param Data is the data written to the register.
54
+ *
55
+ * @return None.
56
+ *
57
+ * @note
58
+ * C-style signature:
59
+ * void DDR3_TEST_MONITOR_AXI_mWriteReg(u32 BaseAddress, unsigned RegOffset, u32 Data)
60
+ *
61
+ */
62
+ #define DDR3_TEST_MONITOR_AXI_mWriteReg(BaseAddress, RegOffset, Data) \
63
+ Xil_Out32((BaseAddress) + (RegOffset), (u32)(Data))
64
+
65
+ /**
66
+ *
67
+ * Read a value from a DDR3_TEST_MONITOR_AXI register. A 32 bit read is performed.
68
+ * If the component is implemented in a smaller width, only the least
69
+ * significant data is read from the register. The most significant data
70
+ * will be read as 0.
71
+ *
72
+ * @param BaseAddress is the base address of the DDR3_TEST_MONITOR_AXI device.
73
+ * @param RegOffset is the register offset from the base to write to.
74
+ *
75
+ * @return Data is the data from the register.
76
+ *
77
+ * @note
78
+ * C-style signature:
79
+ * u32 DDR3_TEST_MONITOR_AXI_mReadReg(u32 BaseAddress, unsigned RegOffset)
80
+ *
81
+ */
82
+ #define DDR3_TEST_MONITOR_AXI_mReadReg(BaseAddress, RegOffset) \
83
+ Xil_In32((BaseAddress) + (RegOffset))
84
+
85
+ /************************** Function Prototypes ****************************/
86
+ /**
87
+ *
88
+ * Run a self-test on the driver/device. Note this may be a destructive test if
89
+ * resets of the device are performed.
90
+ *
91
+ * If the hardware system is not built correctly, this function may never
92
+ * return to the caller.
93
+ *
94
+ * @param baseaddr_p is the base address of the DDR3_TEST_MONITOR_AXI instance to be worked on.
95
+ *
96
+ * @return
97
+ *
98
+ * - XST_SUCCESS if all self-test code passed
99
+ * - XST_FAILURE if any self-test code failed
100
+ *
101
+ * @note Caching must be turned off for this function to work.
102
+ * @note Self test may fail if data memory and device are not on the same bus.
103
+ *
104
+ */
105
+ XStatus DDR3_TEST_MONITOR_AXI_Reg_SelfTest(void * baseaddr_p);
106
+
107
+ #endif // DDR3_TEST_MONITOR_AXI_H