# SPDX-License-Identifier: MIT
#
# Copyright (c) 2025-2026 FPGA Ninja, LLC
#
# Authors:
# - Alex Forencich
#

# XDC constraints for the Cisco Nexus K3P-Q / ExaNIC X100
# part: xcku3p-ffvb676-2-e

# DDR4
# 9x MT40A1G8SA-075
set_property -dict {LOC W24  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[0]}]
set_property -dict {LOC U24  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[1]}]
set_property -dict {LOC AA24 IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[2]}]
set_property -dict {LOC T24  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[3]}]
set_property -dict {LOC Y22  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[4]}]
set_property -dict {LOC V23  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[5]}]
set_property -dict {LOC Y25  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[6]}]
set_property -dict {LOC V24  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[7]}]
set_property -dict {LOC W23  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[8]}]
set_property -dict {LOC Y26  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[9]}]
set_property -dict {LOC V21  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[10]}]
set_property -dict {LOC W25  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[11]}]
set_property -dict {LOC AA23 IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[12]}]
set_property -dict {LOC W26  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[13]}]
set_property -dict {LOC U21  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[14]}]
set_property -dict {LOC T22  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[15]}]
set_property -dict {LOC T20  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_adr[16]}]
set_property -dict {LOC V22  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_ba[0]}]
set_property -dict {LOC T23  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_ba[1]}]
set_property -dict {LOC Y23  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_bg[0]}]
set_property -dict {LOC P24  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_bg[1]}]
set_property -dict {LOC U19  IOSTANDARD DIFF_SSTL12_DCI} [get_ports {ddr4_ck_t}]
set_property -dict {LOC V19  IOSTANDARD DIFF_SSTL12_DCI} [get_ports {ddr4_ck_c}]
set_property -dict {LOC W19  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_cke}]
set_property -dict {LOC N24  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_cs_n}]
set_property -dict {LOC W20  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_act_n}]
set_property -dict {LOC U20  IOSTANDARD SSTL12_DCI     } [get_ports {ddr4_odt}]
set_property -dict {LOC R25  IOSTANDARD LVCMOS12       } [get_ports {ddr4_reset_n}]

set_property -dict {LOC L20  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[0]}]
set_property -dict {LOC M20  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[1]}]
set_property -dict {LOC J21  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[2]}]
set_property -dict {LOC M21  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[3]}]
set_property -dict {LOC K21  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[4]}]
set_property -dict {LOC J19  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[5]}]
set_property -dict {LOC K20  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[6]}]
set_property -dict {LOC J20  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[7]}]
set_property -dict {LOC K23  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[8]}]
set_property -dict {LOC J24  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[9]}]
set_property -dict {LOC M25  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[10]}]
set_property -dict {LOC K26  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[11]}]
set_property -dict {LOC J23  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[12]}]
set_property -dict {LOC K22  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[13]}]
set_property -dict {LOC M26  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[14]}]
set_property -dict {LOC K25  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[15]}]
set_property -dict {LOC H23  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[16]}]
set_property -dict {LOC G26  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[17]}]
set_property -dict {LOC J26  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[18]}]
set_property -dict {LOC H24  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[19]}]
set_property -dict {LOC H21  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[20]}]
set_property -dict {LOC H22  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[21]}]
set_property -dict {LOC J25  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[22]}]
set_property -dict {LOC H26  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[23]}]
set_property -dict {LOC E23  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[24]}]
set_property -dict {LOC D24  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[25]}]
set_property -dict {LOC D25  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[26]}]
set_property -dict {LOC B25  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[27]}]
set_property -dict {LOC D26  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[28]}]
set_property -dict {LOC F23  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[29]}]
set_property -dict {LOC C26  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[30]}]
set_property -dict {LOC B26  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[31]}]
set_property -dict {LOC AF25 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[32]}]
set_property -dict {LOC AC24 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[33]}]
set_property -dict {LOC AD25 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[34]}]
set_property -dict {LOC AD24 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[35]}]
set_property -dict {LOC AF24 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[36]}]
set_property -dict {LOC AB25 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[37]}]
set_property -dict {LOC AB24 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[38]}]
set_property -dict {LOC AB26 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[39]}]
set_property -dict {LOC AD21 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[40]}]
set_property -dict {LOC AD23 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[41]}]
set_property -dict {LOC AC21 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[42]}]
set_property -dict {LOC AC23 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[43]}]
set_property -dict {LOC AE21 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[44]}]
set_property -dict {LOC AB21 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[45]}]
set_property -dict {LOC AC22 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[46]}]
set_property -dict {LOC AE23 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[47]}]
set_property -dict {LOC AD16 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[48]}]
set_property -dict {LOC AD19 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[49]}]
set_property -dict {LOC AF17 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[50]}]
set_property -dict {LOC AF19 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[51]}]
set_property -dict {LOC AE16 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[52]}]
set_property -dict {LOC AC19 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[53]}]
set_property -dict {LOC AE17 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[54]}]
set_property -dict {LOC AF18 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[55]}]
set_property -dict {LOC AA19 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[56]}]
set_property -dict {LOC Y17  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[57]}]
set_property -dict {LOC AA20 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[58]}]
set_property -dict {LOC AA17 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[59]}]
set_property -dict {LOC AB19 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[60]}]
set_property -dict {LOC Y18  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[61]}]
set_property -dict {LOC AB20 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[62]}]
set_property -dict {LOC AA18 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[63]}]
set_property -dict {LOC H16  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[64]}]
set_property -dict {LOC E15  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[65]}]
set_property -dict {LOC C16  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[66]}]
set_property -dict {LOC D16  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[67]}]
set_property -dict {LOC H17  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[68]}]
set_property -dict {LOC G16  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[69]}]
set_property -dict {LOC G17  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[70]}]
set_property -dict {LOC D15  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dq[71]}]
set_property -dict {LOC M19  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_t[0]}]
set_property -dict {LOC L19  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_c[0]}]
set_property -dict {LOC L24  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_t[1]}]
set_property -dict {LOC L25  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_c[1]}]
set_property -dict {LOC F24  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_t[2]}]
set_property -dict {LOC F25  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_c[2]}]
set_property -dict {LOC D23  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_t[3]}]
set_property -dict {LOC C24  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_c[3]}]
set_property -dict {LOC AC26 IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_t[4]}]
set_property -dict {LOC AD26 IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_c[4]}]
set_property -dict {LOC AA22 IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_t[5]}]
set_property -dict {LOC AB22 IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_c[5]}]
set_property -dict {LOC AC18 IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_t[6]}]
set_property -dict {LOC AD18 IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_c[6]}]
set_property -dict {LOC AB17 IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_t[7]}]
set_property -dict {LOC AC17 IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_c[7]}]
set_property -dict {LOC E16  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_t[8]}]
set_property -dict {LOC E17  IOSTANDARD DIFF_POD12_DCI } [get_ports {ddr4_dqs_c[8]}]
set_property -dict {LOC L18  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dm_dbi_n[0]}]
set_property -dict {LOC L22  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dm_dbi_n[1]}]
set_property -dict {LOC G24  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dm_dbi_n[2]}]
set_property -dict {LOC E25  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dm_dbi_n[3]}]
set_property -dict {LOC AE25 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dm_dbi_n[4]}]
set_property -dict {LOC AE22 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dm_dbi_n[5]}]
set_property -dict {LOC AD20 IOSTANDARD POD12_DCI      } [get_ports {ddr4_dm_dbi_n[6]}]
set_property -dict {LOC Y20  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dm_dbi_n[7]}]
set_property -dict {LOC G15  IOSTANDARD POD12_DCI      } [get_ports {ddr4_dm_dbi_n[8]}]

# 161.1328125 MHz DDR4 clock
set_property -dict {LOC T25 IOSTANDARD DIFF_SSTL12_DCI} [get_ports clk_ddr4_p]
set_property -dict {LOC U25 IOSTANDARD DIFF_SSTL12_DCI} [get_ports clk_ddr4_n]
create_clock -period 6.206 -name clk_ddr4 [get_ports clk_ddr4_p]
