1+ #
2+ # This file is part of LiteX-Boards.
3+ #
4+ # Copyright (c) 2023 Hans Baier <hansfbaier@gmail.com>
5+ # SPDX-License-Identifier: BSD-2-Clause
6+
7+ from litex .build .generic_platform import *
8+ from litex .build .xilinx import Xilinx7SeriesPlatform
9+ from litex .build .openocd import OpenOCD
10+
11+ # IOs ----------------------------------------------------------------------------------------------
12+
13+ _io = [
14+ # Clk / Rst
15+ ("clk66" , 0 , Pins ("B26" ), IOStandard ("LVCMOS18" )),
16+
17+ ("clk200" , 0 ,
18+ Subsignal ("p" , Pins ("AC9" ), IOStandard ("DIFF_SSTL15" )),
19+ Subsignal ("n" , Pins ("AD9" ), IOStandard ("DIFF_SSTL15" ))
20+ ),
21+ ("clk_si" , 0 ,
22+ Subsignal ("p" , Pins ("K6" ), IOStandard ("DIFF_HSTL_I_10" )),
23+ Subsignal ("n" , Pins ("K5" ), IOStandard ("DIFF_HSTL_I_10" ))
24+ ),
25+ ("clk_sata_150" , 0 ,
26+ Subsignal ("p" , Pins ("F6" ), IOStandard ("DIFF_HSTL_I_10" )),
27+ Subsignal ("n" , Pins ("F5" ), IOStandard ("DIFF_HSTL_I_10" ))
28+ ),
29+ ("clk_net_156" , 0 ,
30+ Subsignal ("p" , Pins ("H6" ), IOStandard ("DIFF_HSTL_I_10" )),
31+ Subsignal ("n" , Pins ("H5" ), IOStandard ("DIFF_HSTL_I_10" ))
32+ ),
33+
34+ ("cpu_reset_n" , 0 , Pins ("A20" ), IOStandard ("LVCMOS18" )),
35+ ("pi_reset_n" , 0 , Pins ("A18" ), IOStandard ("LVCMOS33" )),
36+
37+ # Leds
38+ ("user_led" , 0 , Pins ("F23" ), IOStandard ("LVCMOS18" ), Misc ("SLEW=SLOW" )),
39+ ("user_led" , 1 , Pins ("J26" ), IOStandard ("LVCMOS18" ), Misc ("SLEW=SLOW" )),
40+ ("user_led" , 2 , Pins ("G26" ), IOStandard ("LVCMOS18" ), Misc ("SLEW=SLOW" )),
41+ ("user_led" , 3 , Pins ("H26" ), IOStandard ("LVCMOS18" ), Misc ("SLEW=SLOW" )),
42+ ("user_led" , 4 , Pins ("G25" ), IOStandard ("LVCMOS18" ), Misc ("SLEW=SLOW" )),
43+ ("user_led" , 5 , Pins ("F24" ), IOStandard ("LVCMOS18" ), Misc ("SLEW=SLOW" )),
44+ ("user_led" , 6 , Pins ("F25" ), IOStandard ("LVCMOS18" ), Misc ("SLEW=SLOW" )),
45+ ("user_led" , 7 , Pins ("G24" ), IOStandard ("LVCMOS18" ), Misc ("SLEW=SLOW" )),
46+
47+ # Buttons
48+ ("user_btn" , 0 , Pins ("J24" ), IOStandard ("LVCMOS18" )),
49+ ("user_btn" , 1 , Pins ("H22" ), IOStandard ("LVCMOS18" )),
50+ ("user_btn" , 2 , Pins ("H23" ), IOStandard ("LVCMOS18" )),
51+ ("user_btn" , 3 , Pins ("H24" ), IOStandard ("LVCMOS18" )),
52+ ("user_btn" , 4 , Pins ("G22" ), IOStandard ("LVCMOS18" )),
53+
54+ # Switches
55+ ("user_sw" , 0 , Pins ("E25" ), IOStandard ("LVCMOS18" )),
56+ ("user_sw" , 1 , Pins ("E26" ), IOStandard ("LVCMOS18" )),
57+ ("user_sw" , 2 , Pins ("D25" ), IOStandard ("LVCMOS18" )),
58+ ("user_sw" , 3 , Pins ("F22" ), IOStandard ("LVCMOS18" )),
59+ ("user_sw" , 4 , Pins ("D24" ), IOStandard ("LVCMOS18" )),
60+ ("user_sw" , 5 , Pins ("D23" ), IOStandard ("LVCMOS18" )),
61+ ("user_sw" , 6 , Pins ("E23" ), IOStandard ("LVCMOS18" )),
62+ ("user_sw" , 7 , Pins ("E22" ), IOStandard ("LVCMOS18" )),
63+ ("user_sw" , 8 , Pins ("J25" ), IOStandard ("LVCMOS18" )),
64+
65+ # Testpoints
66+ ("tp" , 0 , Pins ("M17" ), IOStandard ("LVCMOS33" )),
67+ ("tp" , 1 , Pins ("L18" ), IOStandard ("LVCMOS33" )),
68+ ("tp" , 2 , Pins ("L17" ), IOStandard ("LVCMOS33" )),
69+ ("tp" , 3 , Pins ("K18" ), IOStandard ("LVCMOS33" )),
70+
71+ # Fan control
72+ ("fan" , 0 ,
73+ Subsignal ("tach" , Pins ("B19" )),
74+ Subsignal ("pwm" , Pins ("C17" )),
75+ Subsignal ("sys" , Pins ("C19" )),
76+ IOStandard ("LVCMOS33" )),
77+
78+ # The Serial which connects to the second UART
79+ # of the FTDI on the base board (first FTDI port is JTAG)
80+ ("serial" , 0 ,
81+ Subsignal ("tx" , Pins ("A17" )),
82+ Subsignal ("rx" , Pins ("K15" )),
83+ Subsignal ("rts" , Pins ("B17" )),
84+ Subsignal ("cts" , Pins ("F18" )),
85+ IOStandard ("LVCMOS15" )
86+ ),
87+
88+ # I2C
89+ ("i2c_mxrst_n" , Pins ("W21" ), IOStandard ("LVCMOS18" )),
90+
91+ # IO
92+ ("i2c" , 0 ,
93+ Subsignal ("scl" , Pins ("V21" )),
94+ Subsignal ("sda" , Pins ("AE22" )),
95+ IOStandard ("LVCMOS18" ),
96+ ),
97+ # temperature
98+ ("i2c" , 1 ,
99+ Subsignal ("scl" , Pins ("AE26" )),
100+ Subsignal ("sda" , Pins ("AD26" )),
101+ IOStandard ("LVCMOS18" ),
102+ ),
103+
104+ ("si5324" , 0 ,
105+ Subsignal ("int" , Pins ("V22" )),
106+ Subsignal ("rst" , Pins ("V24" )),
107+ IOStandard ("LVCMOS18" ),
108+ ),
109+
110+ ("smi" , 0 ,
111+ Subsignal ("sa" , Pins ("AB26 V26 U24 U26 AB25 V23" ), IOStandard ("LVCMOS33" )),
112+ Subsignal ("sd" , Pins ("W24 Y26 Y25 AA25 U22 AC26 U25 AB24"
113+ "Y22 W25 Y23 AC23 Y21 W20 W26 AA23"
114+ "AA24 AA22" ), IOStandard ("LVCMOS33" )),
115+ Subsignal ("soe_n" , Pins ("AC24" ), IOStandard ("LVCMOS33" )),
116+ Subsignal ("swe_n" , Pins ("W23" ), IOStandard ("LVCMOS33" )),
117+ ),
118+
119+ # SD Card
120+ ("sdcard" , 0 ,
121+ Subsignal ("data" , Pins ("AD24 AC21 AD23 AB21" ), Misc ("PULLUP True" )),
122+ Subsignal ("cmd" , Pins ("AB22" ), Misc ("PULLUP True" )),
123+ Subsignal ("clk" , Pins ("AD21" )),
124+ Subsignal ("cd" , Pins ("AC22" )),
125+ Misc ("SLEW=FAST" ),
126+ IOStandard ("LVCMOS18" ),
127+ ),
128+
129+ # PCIe
130+ ("pcie_x1" , 0 ,
131+ Subsignal ("rst_n" , Pins ("B16" ), IOStandard ("LVCMOS33" ), Misc ("PULLUP=TRUE" )),
132+ Subsignal ("clk_p" , Pins ("D6" )),
133+ Subsignal ("clk_n" , Pins ("D5" )),
134+ Subsignal ("rx_p" , Pins ("B6" )),
135+ Subsignal ("rx_n" , Pins ("B5" )),
136+ Subsignal ("tx_p" , Pins ("A4" )),
137+ Subsignal ("tx_n" , Pins ("A3" ))
138+ ),
139+
140+ ("sata" , 0 ,
141+ Subsignal ("rx_p" , Pins ("C4" )),
142+ Subsignal ("rx_n" , Pins ("C3" )),
143+ Subsignal ("tx_p" , Pins ("B2" )),
144+ Subsignal ("tx_n" , Pins ("B1" )),
145+ ),
146+
147+ # DDR3 SDRAM
148+ ("ddram" , 0 ,
149+ Subsignal ("a" , Pins (
150+ "AF7 AD8 AB10 AC8 W11 AA12 AC12 AD13" ,
151+ "AB12 AD11 AE7 Y11 AA13 AB7 Y13 Y12" ),
152+ IOStandard ("SSTL15" )),
153+ Subsignal ("ba" , Pins ("AC7 V8 AC13" ), IOStandard ("SSTL15" )),
154+ Subsignal ("ras_n" , Pins ("AA10" ), IOStandard ("SSTL15" )),
155+ Subsignal ("cas_n" , Pins ("AA7" ), IOStandard ("SSTL15" )),
156+ Subsignal ("we_n" , Pins ("Y7" ), IOStandard ("SSTL15" )),
157+ Subsignal ("cs_n" , Pins ("Y8 V7" ), IOStandard ("SSTL15" )),
158+ Subsignal ("dm" , Pins (
159+ "AC19 V17 AF17 AA14 AC4 AF2 U7 Y1" ),
160+ IOStandard ("SSTL15" )),
161+ Subsignal ("dq" , Pins (
162+ "AB17 AC18 AC17 AD19 AA19 AA20 AD18 AC16" ,
163+ "V16 V18 AB20 AB19 W15 V19 W16 Y17" ,
164+ "AF19 AE17 AE15 AF15 AF20 AD16 AD15 AF14" ,
165+ "AA15 AB16 AD14 AB14 AA18 AA17 AB15 AC14" ,
166+ "AD6 AC6 AC3 AB4 AB6 Y6 Y5 AA4" ,
167+ "AF3 AE3 AE2 AE1 AE6 AE5 AD4 AD1" ,
168+ "W3 V4 U2 U5 V6 V3 U1 U6" ,
169+ "AB2 AA3 W1 V2 AC2 Y3 Y2 V1 " ),
170+ IOStandard ("SSTL15_T_DCI" )),
171+ Subsignal ("dqs_p" , Pins ("AD20 W18 AE18 Y15 AA5 AF5 W6 AB1" ),
172+ IOStandard ("DIFF_SSTL15_T_DCI" )),
173+ Subsignal ("dqs_n" , Pins ("AE20 W19 AF18 Y16 AB5 AF4 W5 AC1" ),
174+ IOStandard ("DIFF_SSTL15_T_DCI" )),
175+ Subsignal ("clk_p" , Pins ("AB11 AA9" ), IOStandard ("DIFF_SSTL15" )),
176+ Subsignal ("clk_n" , Pins ("AC11 AB9" ), IOStandard ("DIFF_SSTL15" )),
177+ Subsignal ("cke" , Pins ("Y10 W9" ), IOStandard ("SSTL15" )),
178+ Subsignal ("odt" , Pins ("AA8 V9" ), IOStandard ("SSTL15" )),
179+ Subsignal ("reset_n" , Pins ("V11" ), IOStandard ("SSTL15" ), Misc ("SLEW=SLOW" )),
180+ Misc ("SLEW=FAST" ),
181+ Misc ("VCCAUX_IO=HIGH" ),
182+ ),
183+
184+ # HDMI In
185+ ("hdmi_in" , 0 ,
186+ Subsignal ("clk_p" , Pins ("M24" ), IOStandard ("TMDS_33" )),
187+ Subsignal ("clk_n" , Pins ("L24" ), IOStandard ("TMDS_33" )),
188+ Subsignal ("data0_p" , Pins ("P24" ), IOStandard ("TMDS_33" )),
189+ Subsignal ("data0_n" , Pins ("N24" ), IOStandard ("TMDS_33" )),
190+ Subsignal ("data1_p" , Pins ("R26" ), IOStandard ("TMDS_33" )),
191+ Subsignal ("data1_n" , Pins ("P26" ), IOStandard ("TMDS_33" )),
192+ Subsignal ("data2_p" , Pins ("R25" ), IOStandard ("TMDS_33" )),
193+ Subsignal ("data2_n" , Pins ("P25" ), IOStandard ("TMDS_33" )),
194+ Subsignal ("scl" , Pins ("P23" ), IOStandard ("LVCMOS33" )),
195+ Subsignal ("sda" , Pins ("M21" ), IOStandard ("LVCMOS33" )),
196+ Subsignal ("hpd_en" , Pins ("M22" ), IOStandard ("LVCMOS25" )),
197+ Subsignal ("cec" , Pins ("N23" ), IOStandard ("LVCMOS33" )),
198+ # Subsignal("txen", Pins(""), IOStandard("LVCMOS33")),
199+ ),
200+
201+ # HDMI Out
202+ ("hdmi_out" , 0 ,
203+ Subsignal ("clk_p" , Pins ("N19" ), IOStandard ("TMDS_33" )),
204+ Subsignal ("clk_n" , Pins ("M20" ), IOStandard ("TMDS_33" )),
205+ Subsignal ("data0_p" , Pins ("P19" ), IOStandard ("TMDS_33" )),
206+ Subsignal ("data0_n" , Pins ("P20" ), IOStandard ("TMDS_33" )),
207+ Subsignal ("data1_p" , Pins ("K25" ), IOStandard ("TMDS_33" )),
208+ Subsignal ("data1_n" , Pins ("K26" ), IOStandard ("TMDS_33" )),
209+ Subsignal ("data2_p" , Pins ("M25" ), IOStandard ("TMDS_33" )),
210+ Subsignal ("data2_n" , Pins ("L25" ), IOStandard ("TMDS_33" )),
211+ # Subsignal("scl", Pins(""), IOStandard("LVCMOS33")),
212+ # Subsignal("sda", Pins(""), IOStandard("LVCMOS33")),
213+ Subsignal ("cec" , Pins ("N26" ), IOStandard ("LVCMOS33" )),
214+ Subsignal ("hdp" , Pins ("M26" ), IOStandard ("LVCMOS25" )),
215+ ),
216+
217+ # SFP0
218+ ("sfp_tx" , 0 ,
219+ Subsignal ("p" , Pins ("P2" )),
220+ Subsignal ("n" , Pins ("P1" ))
221+ ),
222+ ("sfp_rx" , 0 ,
223+ Subsignal ("p" , Pins ("R4" )),
224+ Subsignal ("n" , Pins ("R3" ))
225+ ),
226+ ("sfp_tx_disable_n" , 0 , Pins ("R18" ), IOStandard ("LVCMOS33" )),
227+ ("sfp_rx_los" , 0 , Pins ("T19" ), IOStandard ("LVCMOS33" )),
228+ ("sfp_link" , 0 , Pins ("T24" ), IOStandard ("LVCMOS33" )),
229+ ("sfp_act" , 0 , Pins ("T25" ), IOStandard ("LVCMOS33" )),
230+
231+ # SFP1
232+ ("sfp_tx" , 1 ,
233+ Subsignal ("p" , Pins ("M2" )),
234+ Subsignal ("n" , Pins ("M1" )),
235+ ),
236+ ("sfp_rx" , 1 ,
237+ Subsignal ("p" , Pins ("N4" )),
238+ Subsignal ("n" , Pins ("N3" )),
239+ ),
240+ ("sfp_tx_disable_n" , 1 , Pins ("N18" ), IOStandard ("LVCMOS33" )),
241+ ("sfp_rx_los" , 1 , Pins ("M19" ), IOStandard ("LVCMOS33" )),
242+ ("sfp_link" , 1 , Pins ("T22" ), IOStandard ("LVCMOS33" )),
243+ ("sfp_act" , 1 , Pins ("R23" ), IOStandard ("LVCMOS33" )),
244+
245+ # SFP2
246+ ("sfp_tx" , 2 ,
247+ Subsignal ("p" , Pins ("K2" )),
248+ Subsignal ("n" , Pins ("K1" )),
249+ ),
250+ ("sfp_rx" , 2 ,
251+ Subsignal ("p" , Pins ("L4" )),
252+ Subsignal ("n" , Pins ("L3" )),
253+ ),
254+ ("sfp_tx_disable_n" , 2 , Pins ("N17" ), IOStandard ("LVCMOS33" )),
255+ ("sfp_rx_los" , 2 , Pins ("R17" ), IOStandard ("LVCMOS33" )),
256+ ("sfp_link" , 2 , Pins ("N22" ), IOStandard ("LVCMOS33" )),
257+ ("sfp_act" , 2 , Pins ("N21" ), IOStandard ("LVCMOS33" )),
258+
259+ # SFP3
260+ ("sfp_tx" , 3 ,
261+ Subsignal ("p" , Pins ("H2" )),
262+ Subsignal ("n" , Pins ("H1" )),
263+ ),
264+ ("sfp_rx" , 3 ,
265+ Subsignal ("p" , Pins ("J4" )),
266+ Subsignal ("n" , Pins ("J3" )),
267+ ),
268+ ("sfp_tx_disable_n" , 3 , Pins ("P16" ), IOStandard ("LVCMOS33" )),
269+ ("sfp_rx_los" , 3 , Pins ("R16" ), IOStandard ("LVCMOS33" )),
270+ ("sfp_link" , 3 , Pins ("R20" ), IOStandard ("LVCMOS33" )),
271+ ("sfp_act" , 3 , Pins ("R22" ), IOStandard ("LVCMOS33" )),
272+ ]
273+
274+ _connectors = [
275+ ("cruvi_a" , {
276+ "0_p" : "F14" ,
277+ "0_n" : "F13" ,
278+ "1_p" : "A13" ,
279+ "1_n" : "A12" ,
280+ "2_p" : "D9" ,
281+ "2_n" : "D8" ,
282+ "3_p" : "C9" ,
283+ "3_n" : "B9" ,
284+ "4_p" : "B10" ,
285+ "4_n" : "A10" ,
286+ "5_p" : "B12" ,
287+ "5_n" : "B11" ,
288+ "6_p" : "C12" ,
289+ "6_n" : "C11" ,
290+ "7_p" : "B14" ,
291+ "7_n" : "A14" ,
292+ "8_p" : "B15" ,
293+ "8_n" : "A15" ,
294+ "9_p" : "C14" ,
295+ "9_n" : "C13" ,
296+ "10_p" : "H14" ,
297+ "10_n" : "G14" ,
298+ "11_p" : "D14" ,
299+ "11_n" : "D13" ,
300+ "di" : "G19" ,
301+ "do" : "D20" ,
302+ "hsi" : "F17" ,
303+ "hso" : "H17" ,
304+ "hsio" : "H18" ,
305+ "mode" : "F20" ,
306+ "refclk" : "E17" ,
307+ "reset" : "H16" ,
308+ "sck" : "G20" ,
309+ "sel" : "E20" ,
310+ "smb_alert" : "H19" ,
311+ "smb_scl" : "G17" ,
312+ "smb_sda" : "F19" ,
313+ }),
314+
315+ ("cruvi_b" , {
316+ "0_p" : "J10" ,
317+ "0_n" : "J11" ,
318+ "1_p" : "H8" ,
319+ "1_n" : "H9" ,
320+ "2_p" : "G9" ,
321+ "2_n" : "G10" ,
322+ "3_p" : "F8" ,
323+ "3_n" : "F9" ,
324+ "4_p" : "F10" ,
325+ "4_n" : "G11" ,
326+ "5_p" : "D10" ,
327+ "5_n" : "E10" ,
328+ "6_p" : "A8" ,
329+ "6_n" : "A9" ,
330+ "7_p" : "D11" ,
331+ "7_n" : "E11" ,
332+ "8_p" : "F12" ,
333+ "8_n" : "G12" ,
334+ "9_p" : "E12" ,
335+ "9_n" : "E13" ,
336+ "10_p" : "H11" ,
337+ "10_n" : "H12" ,
338+ "11_p" : "H13" ,
339+ "11_n" : "J13" ,
340+ "di" : "J15" ,
341+ "do" : "C18" ,
342+ "hsi" : "G16" ,
343+ "hso" : "D16" ,
344+ "hsio" : "F15" ,
345+ "mode" : "E18" ,
346+ "refclk" : "E16" ,
347+ "reset" : "D15" ,
348+ "sck" : "D19" ,
349+ "sel" : "D18" ,
350+ "smb_alert" : "G15" ,
351+ "smb_scl" : "E15" ,
352+ "smb_sda" : "J16" ,
353+ }),
354+ ]
355+
356+ # Platform -----------------------------------------------------------------------------------------
357+
358+ class Platform (Xilinx7SeriesPlatform ):
359+ default_clk_name = "clk200"
360+ default_clk_period = 1e9 / 200e6
361+
362+ def __init__ (self , toolchain = "vivado" ):
363+ Xilinx7SeriesPlatform .__init__ (self , "xc7k160tffg676-2" , _io , _connectors , toolchain = toolchain )
364+ self .add_platform_command ("set_property CONFIG_VOLTAGE 1.8 [current_design]" )
365+ self .add_platform_command ("set_property CFGBVS GND [current_design]" )
366+ # DDR3 is connected to banks 32, 33 and 34
367+ self .add_platform_command ("set_property INTERNAL_VREF 0.750 [get_iobanks 32]" )
368+ self .add_platform_command ("set_property INTERNAL_VREF 0.750 [get_iobanks 33]" )
369+ self .add_platform_command ("set_property INTERNAL_VREF 0.750 [get_iobanks 34]" )
370+ # The VRP/VRN resistors are connected to bank 34.
371+ # Banks 32 and 33 have LEDs in the places, so we have to use the reference from bank 34
372+ # Bank 33 has no _T_DCI signals connected
373+ self .add_platform_command ("set_property DCI_CASCADE {{32}} [get_iobanks 34]" )
374+ self .add_platform_command ("set_property BITSTREAM.CONFIG.CONFIGRATE 22 [current_design]" )
375+ self .add_platform_command ("set_property BITSTREAM.CONFIG.OVERTEMPPOWERDOWN ENABLE [current_design]" )
376+
377+ # Important! Do not remove this constraint!
378+ # This property ensures that all unused pins are set to high impedance.
379+ # If the constraint is removed, all unused pins have to be set to HiZ in the top level file
380+ # This causes DDR3 to use 1.5V by default
381+ self .add_platform_command ("set_property BITSTREAM.CONFIG.UNUSEDPIN PULLNONE [current_design]" )
382+
383+ def add_baseboard (self , bb ):
384+ self .add_connector (bb .connectors )
385+ self .add_extension (bb .io )
386+
387+ def create_programmer (self ):
388+ return OpenOCD ("openocd_xc7_ft232.cfg" , "bscan_spi_xc7k160t.bit" )
389+
390+ def do_finalize (self , fragment ):
391+ Xilinx7SeriesPlatform .do_finalize (self , fragment )
392+ self .add_period_constraint (self .lookup_request ("clk200" , loose = True ), 1e9 / 200e6 )
0 commit comments