From 83b66b8a0f901845f266bb4b72625bce0ecc1a99 Mon Sep 17 00:00:00 2001
From: vauban353 <vauban353@gmail.com>
Date: Sat, 22 Oct 2022 20:42:47 +0100
Subject: [PATCH] PCIe: Add missing reset connections.

---
 .../CLOCKS_AND_RESETS/ADD_PCIE_CLOCKS_AND_RESETS.tcl |  1 +
 .../components/M2/DEFAULT/ADD_M2_INTERFACE.tcl       |  2 ++
 .../components/M2/DEFAULT/M2_INTERFACE.tcl           | 12 ++++++------
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/script_support/components/CLOCKS_AND_RESETS/ADD_PCIE_CLOCKS_AND_RESETS.tcl b/script_support/components/CLOCKS_AND_RESETS/ADD_PCIE_CLOCKS_AND_RESETS.tcl
index 0261bd8..c92d857 100644
--- a/script_support/components/CLOCKS_AND_RESETS/ADD_PCIE_CLOCKS_AND_RESETS.tcl
+++ b/script_support/components/CLOCKS_AND_RESETS/ADD_PCIE_CLOCKS_AND_RESETS.tcl
@@ -63,6 +63,7 @@ sd_connect_pins -sd_name ${sd_name} -pin_names {"INIT_MONITOR_0:PCIE_INIT_DONE"
 sd_connect_pins -sd_name ${sd_name} -pin_names {"PCIE_REF_CLK_0:REF_CLK" "PCIe_REFERENCE_CLK" "TRANSMIT_PLL_0:REF_CLK" }
 sd_rename_port -sd_name ${sd_name} -current_port_name {REF_CLK_PAD_N} -new_port_name {XCVR_0A_REFCLK_N}
 sd_rename_port -sd_name ${sd_name} -current_port_name {REF_CLK_PAD_P} -new_port_name {XCVR_0A_REFCLK_P}
+sd_connect_pin_to_port -sd_name ${sd_name} -pin_name {INIT_MONITOR_0:PCIE_INIT_DONE} -port_name {}
 
 #-------------------------------------------------------------------------------
 # Save the SmartDesign
diff --git a/script_support/components/M2/DEFAULT/ADD_M2_INTERFACE.tcl b/script_support/components/M2/DEFAULT/ADD_M2_INTERFACE.tcl
index 7245e28..8a96bf6 100644
--- a/script_support/components/M2/DEFAULT/ADD_M2_INTERFACE.tcl
+++ b/script_support/components/M2/DEFAULT/ADD_M2_INTERFACE.tcl
@@ -64,6 +64,8 @@ sd_connect_pins -sd_name ${sd_name} -pin_names {"CLOCKS_AND_RESETS:FIC_0_FABRIC_
 sd_connect_pins -sd_name ${sd_name} -pin_names {"CLOCKS_AND_RESETS:PCIe_REFERENCE_CLK" "M2_INTERFACE_0:PCIE_REF_CLK"} 
 sd_connect_pins -sd_name ${sd_name} -pin_names {"CLOCKS_AND_RESETS:PCIe_CLK_125MHz" "M2_INTERFACE_0:PCIE_0_TL_CLK_125MHz"} 
 
+sd_connect_pins -sd_name ${sd_name} -pin_names {"CLOCKS_AND_RESETS:PCIE_INIT_DONE" "M2_INTERFACE_0:PCIE_INIT_DONE"} 
+
 sd_connect_pins -sd_name ${sd_name} -pin_names {"M2_INTERFACE_0:PCIE_INTERRUPT" "BVF_RISCV_SUBSYSTEM:PCIE_INT_N"} 
 
 sd_connect_pins -sd_name ${sd_name} -pin_names {"M2_INTERFACE_0:M2_PERST0n" "M2_PERST0n"}
diff --git a/script_support/components/M2/DEFAULT/M2_INTERFACE.tcl b/script_support/components/M2/DEFAULT/M2_INTERFACE.tcl
index e955569..f580916 100644
--- a/script_support/components/M2/DEFAULT/M2_INTERFACE.tcl
+++ b/script_support/components/M2/DEFAULT/M2_INTERFACE.tcl
@@ -44,7 +44,6 @@ sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {PCIE:PCIE_0_S_WDERR}
 sd_mark_pins_unused -sd_name ${sd_name} -pin_names {PCIE:PCIE_0_LTSSM}
 sd_mark_pins_unused -sd_name ${sd_name} -pin_names {PCIE:PCIE_0_M_WDERR}
 sd_mark_pins_unused -sd_name ${sd_name} -pin_names {PCIE:PCIE_0_S_RDERR}
-sd_mark_pins_unused -sd_name ${sd_name} -pin_names {PCIE:PCIE_0_PERST_OUT_N}
 sd_mark_pins_unused -sd_name ${sd_name} -pin_names {PCIE:PCIE_0_HOT_RST_EXIT}
 sd_mark_pins_unused -sd_name ${sd_name} -pin_names {PCIE:PCIE_0_DLUP_EXIT}
 
@@ -71,8 +70,6 @@ sd_mark_pins_unused -sd_name ${sd_name} -pin_names {RECONFIGURATION_INTERFACE_0:
 sd_mark_pins_unused -sd_name ${sd_name} -pin_names {RECONFIGURATION_INTERFACE_0:PTIMEOUT}
 sd_mark_pins_unused -sd_name ${sd_name} -pin_names {RECONFIGURATION_INTERFACE_0:BUSERROR}
 
-sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {M2_PERST0n} -value {VCC}
-
 #-------------------------------------------------------------------------------
 # Promote bus and signals to top level
 #-------------------------------------------------------------------------------
@@ -90,6 +87,12 @@ sd_connect_pin_to_port -sd_name ${sd_name} -pin_name {PCIE:AXI_0_SLAVE} -port_na
 sd_rename_port -sd_name ${sd_name} -current_port_name {AXI_0_SLAVE} -new_port_name {AXI_TARGET} 
 sd_mark_pins_unused -sd_name ${sd_name} -pin_names {RECONFIGURATION_INTERFACE_0:PLL0_SW_DRI} 
 
+
+sd_connect_pin_to_port -sd_name ${sd_name} -pin_name {PCIE:INIT_DONE} -port_name {} 
+sd_rename_port -sd_name ${sd_name} -current_port_name {INIT_DONE} -new_port_name {PCIE_INIT_DONE} 
+
+sd_connect_pins -sd_name ${sd_name} -pin_names {"M2_PERST0n" "PCIE:PCIE_0_PERST_OUT_N"}
+
 #-------------------------------------------------------------------------------
 # Temporary - rework once pin assignment confirmed.
 #-------------------------------------------------------------------------------
@@ -102,9 +105,6 @@ sd_connect_pins -sd_name ${sd_name} -pin_names {"M2_I2C_ALTn" "M2_W_DISABLE2n"}
 
 sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {M2_UART_WAKEn} -value {VCC}
 
-# TODO: connect INIT_DONE to clocks and reset block.
-sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {PCIE:INIT_DONE} -value {GND}
-
 #-------------------------------------------------------------------------------
 
 # Re-enable auto promotion of pins of type 'pad'
-- 
GitLab