From 90f2e3e4f4448cdb0252f103324bced97e938af0 Mon Sep 17 00:00:00 2001
From: jhegeman <jeroen.hegeman@cern.ch>
Date: Thu, 14 Mar 2024 13:15:50 +0100
Subject: [PATCH 1/7] Some more improvements for the Vivado IP core creation
 scripts

Mainly:
- Support for user IP repositories. Not relevant for the TCLink,
  but this keeps the scripts in line with some other repos.
- Use of TCL regular expressions to select (on the command line)
  which IP cores to create.
---
 .../tclink_mmcm/vivado_create_ip_mmcme3.tcl   |  4 ++
 .../vivado_create_ip_mmcme3_slave.tcl         |  4 ++
 .../tclink_mmcm/vivado_create_ip_mmcme4.tcl   |  4 ++
 .../vivado_create_ip_mmcme4_slave.tcl         |  4 ++
 ...vado_create_ip_gthe3_master_timing_10g.tcl |  4 ++
 ...ivado_create_ip_gthe3_master_timing_5g.tcl |  4 ++
 ...ivado_create_ip_gthe3_slave_timing_10g.tcl |  4 ++
 ...vivado_create_ip_gthe3_slave_timing_5g.tcl |  4 ++
 ...vado_create_ip_gthe4_master_timing_10g.tcl |  4 ++
 ...ivado_create_ip_gthe4_master_timing_5g.tcl |  4 ++
 ...ivado_create_ip_gthe4_slave_timing_10g.tcl |  4 ++
 ...vivado_create_ip_gthe4_slave_timing_5g.tcl |  4 ++
 ...vado_create_ip_gtye3_master_timing_10g.tcl |  4 ++
 ...ivado_create_ip_gtye3_master_timing_5g.tcl |  4 ++
 ...ivado_create_ip_gtye3_slave_timing_10g.tcl |  4 ++
 ...vivado_create_ip_gtye3_slave_timing_5g.tcl |  4 ++
 ...vado_create_ip_gtye4_master_timing_10g.tcl |  4 ++
 ...ivado_create_ip_gtye4_master_timing_5g.tcl |  4 ++
 ...ivado_create_ip_gtye4_slave_timing_10g.tcl |  4 ++
 ...vivado_create_ip_gtye4_slave_timing_5g.tcl |  4 ++
 .../vivado_create_ip_vio_control_kcu105.tcl   |  4 ++
 .../vivado_create_ip_vio_control_vcu118.tcl   |  4 ++
 scripts/vivado_create_ips.sh                  |  2 +-
 scripts/vivado_create_ips.tcl                 | 15 ++++--
 scripts/vivado_utils.tcl                      | 46 ++++++++++++-------
 25 files changed, 128 insertions(+), 23 deletions(-)

diff --git a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3.tcl b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3.tcl
index 8d90f28..9e3be2b 100644
--- a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3.tcl
+++ b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 6.0
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name mmcme3
 
@@ -44,6 +47,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3_slave.tcl b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3_slave.tcl
index c31f0ef..7538b8e 100644
--- a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3_slave.tcl
+++ b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3_slave.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 6.0
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name mmcme3_slave
 
@@ -54,6 +57,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4.tcl b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4.tcl
index 8645be4..cd49c09 100644
--- a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4.tcl
+++ b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 6.0
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name mmcme4
 
@@ -42,6 +45,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4_slave.tcl b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4_slave.tcl
index de25ac0..85aba02 100644
--- a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4_slave.tcl
+++ b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4_slave.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 6.0
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name mmcme4_slave
 
@@ -61,6 +64,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_10g.tcl
index df71167..982616d 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_10g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gthe3_master_timing_10g
 
@@ -57,6 +60,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_5g.tcl
index 1b9ee8f..ddd8c0e 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_5g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gthe3_master_timing_5g
 
@@ -61,6 +64,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_10g.tcl
index 636f331..80b062d 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_10g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gthe3_slave_timing_10g
 
@@ -60,6 +63,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_5g.tcl
index cfd4131..661a5c0 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_5g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gthe3_slave_timing_5g
 
@@ -60,6 +63,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_10g.tcl
index 5e84325..f6681fd 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_10g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gthe4_master_timing_10g
 
@@ -57,6 +60,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_5g.tcl
index 3724af9..df7d796 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_5g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gthe4_master_timing_5g
 
@@ -61,6 +64,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_10g.tcl
index 1afb5e6..3fdbb44 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_10g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gthe4_slave_timing_10g
 
@@ -56,6 +59,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_5g.tcl
index ec7b6d6..b74b307 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_5g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gthe4_slave_timing_5g
 
@@ -60,6 +63,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_10g.tcl
index 00141db..ef9ed3a 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_10g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gtye3_master_timing_10g
 
@@ -61,6 +64,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_5g.tcl
index 32f28d4..9d2add6 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_5g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gtye3_master_timing_5g
 
@@ -61,6 +64,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_10g.tcl
index bb924e3..3cd5b45 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_10g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gtye3_slave_timing_10g
 
@@ -60,6 +63,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_5g.tcl
index b06b010..2b25167 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_5g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gtye3_slave_timing_5g
 
@@ -60,6 +63,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_10g.tcl
index 08aa346..14a3a38 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_10g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gtye4_master_timing_10g
 
@@ -57,6 +60,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_5g.tcl
index 8888479..625259b 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_5g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gtye4_master_timing_5g
 
@@ -61,6 +64,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_10g.tcl
index 733bb9c..d36139c 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_10g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gtye4_slave_timing_10g
 
@@ -56,6 +59,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_5g.tcl
index 3fdb1f3..50bc1ce 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_5g.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name gtye4_slave_timing_5g
 
@@ -60,6 +63,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/vio_control/vivado_create_ip_vio_control_kcu105.tcl b/firmware/source/vio_control/vivado_create_ip_vio_control_kcu105.tcl
index 76ed134..5708d61 100644
--- a/firmware/source/vio_control/vivado_create_ip_vio_control_kcu105.tcl
+++ b/firmware/source/vio_control/vivado_create_ip_vio_control_kcu105.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 3.0
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name vio_control_kcu105
 
@@ -93,6 +96,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/vio_control/vivado_create_ip_vio_control_vcu118.tcl b/firmware/source/vio_control/vivado_create_ip_vio_control_vcu118.tcl
index 6bfb301..0fffb86 100644
--- a/firmware/source/vio_control/vivado_create_ip_vio_control_vcu118.tcl
+++ b/firmware/source/vio_control/vivado_create_ip_vio_control_vcu118.tcl
@@ -6,6 +6,9 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 3.0
 
+# No special user IP repo path is needed.
+set user_ip_repo_path ""
+
 # This is the name to give to the generated module.
 set module_name vio_control_vcu118
 
@@ -92,6 +95,7 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
+    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/scripts/vivado_create_ips.sh b/scripts/vivado_create_ips.sh
index 6d47852..c3e5775 100755
--- a/scripts/vivado_create_ips.sh
+++ b/scripts/vivado_create_ips.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# Disable wildcard expansion because of the possibility of a '*' as
+# Disable wildcard expansion because of the possibility of a '.*' as
 # ip-name-pattern.
 set -o noglob
 
diff --git a/scripts/vivado_create_ips.tcl b/scripts/vivado_create_ips.tcl
index 1991706..097fa47 100644
--- a/scripts/vivado_create_ips.tcl
+++ b/scripts/vivado_create_ips.tcl
@@ -53,7 +53,7 @@ proc glob_recursive {{dir .} {filespec *} {types {b c f l p s}}} {
 set parameters {
     {target-part.arg "" "The FPGA to target"}
     {target-board.arg "" "The evaluation board to target"}
-    {ip-name-pattern.arg "*" "Pattern describing which IP core(s) to generate"}
+    {ip-name-pattern.arg ".*" "Regular expression describing which IP core(s) to generate"}
 }
 
 set usage "- A script to (re)generate Xilinx IP cores from stored parameters"
@@ -65,18 +65,23 @@ if { [catch {array set options [cmdline::getoptions ::argv $parameters $usage]}]
 
 # Find all the Vivado IP core creation scripts.
 set ip_name_pattern $options(ip-name-pattern)
-set script_name_pattern "${script_name_pattern_base}${ip_name_pattern}.tcl"
-set ip_scripts [glob_recursive . $script_name_pattern]
+set script_name_pattern "${script_name_pattern_base}*.tcl"
+set ip_scripts_tmp [glob_recursive . $script_name_pattern]
+set ip_scripts [lsearch -all -inline -regexp $ip_scripts_tmp $ip_name_pattern]
 set s_or_not ""
 set tmp [llength $ip_scripts]
-if { $tmp > 1 || $tmp == 0} {
+if { $tmp > 1 || $tmp == 0 } {
     set s_or_not "s"
 }
 
-set ip_scripts [lsort $ip_scripts]
+# Sort and remove duplicates (which may arise from symlinks).
+set ip_scripts [lsort -unique $ip_scripts]
 
 puts "$sep_line"
 puts "Found [llength $ip_scripts] matching IP core creation script$s_or_not"
+# foreach item $ip_scripts {
+#     puts $item
+# }
 puts "$sep_line"
 
 # Now process all found scripts.
diff --git a/scripts/vivado_utils.tcl b/scripts/vivado_utils.tcl
index 373982d..f8a74c9 100644
--- a/scripts/vivado_utils.tcl
+++ b/scripts/vivado_utils.tcl
@@ -12,16 +12,19 @@ package require cmdline
 
 proc vivado_utils::run_vivado_create_ip {ip_name \
                                              ip_vendor \
-                                             ip_library ip_version \
+                                             ip_library \
+                                             ip_version \
                                              module_name \
                                              module_properties \
                                              include_example_design \
                                              default_part \
                                              default_board \
+                                             user_ip_repo_path \
                                              argv} {
     set parameters [list \
                         [list target-part.arg $default_part "The FPGA to target"] \
-                        [list target-board.arg $default_board "The development board to target"]
+                        [list target-board.arg $default_board "The development board to target"] \
+                        [list user-ip-repo-path.arg $user_ip_repo_path "The path to an optional user IP repository"]
                    ]
 
     if { [catch {array set options [cmdline::getoptions argv $parameters]}] } {
@@ -35,39 +38,46 @@ proc vivado_utils::run_vivado_create_ip {ip_name \
     # The board to target.
     set board $options(target-board)
 
+    # An optional user IP repository.
+    set user_ip_repo_path $options(user-ip-repo-path)
+
     vivado_utils::vivado_create_ip \
         $ip_name $ip_vendor $ip_library $ip_version \
         $module_name $module_properties \
         $include_example_design \
-        $part $board
+        $part $board \
+        $user_ip_repo_path
 }
 
 ########################################################################
 
 proc vivado_utils::vivado_create_ip {ip_name \
                                          ip_vendor \
-                                         ip_library ip_version \
+                                         ip_library \
+                                         ip_version \
                                          module_name \
                                          module_properties \
                                          {include_example_design false} \
                                          {part ""} \
-                                         {board ""}} {
+                                         {board ""} \
+                                         {user_ip_repo_path ""}} {
     set dir_name_base vivado_create_ip_$module_name
     set dir_name [file join $dir_name_base ${module_name}_ip]
     set project_name ${module_name}_ip
 
-    set list_projs [get_projects -quiet]
-    if { $list_projs eq "" } {
-        create_project -force $project_name $dir_name
-        if { $part ne "" } {
-            set_property PART $part [current_project]
-        }
-        if { $board ne "" } {
-            set_property BOARD_PART $board [current_project]
-        }
-        set_property target_language VHDL [current_project]
-        set_property simulator_language Mixed [current_project]
+    create_project -force $project_name $dir_name
+    if { $part ne "" } {
+        set_property PART $part [current_project]
+    }
+    if { $board ne "" } {
+        set_property BOARD_PART $board [current_project]
     }
+    if { $user_ip_repo_path ne "" } {
+        set_property ip_repo_paths $user_ip_repo_path [current_fileset]
+        update_ip_catalog -rebuild
+    }
+    set_property target_language VHDL [current_project]
+    set_property simulator_language Mixed [current_project]
 
     # Create the IP itself.
     create_ip -name $ip_name \
@@ -77,7 +87,9 @@ proc vivado_utils::vivado_create_ip {ip_name \
         -module_name $module_name
 
     # Apply the IP settings.
-    set_property -dict $module_properties [get_ips $module_name]
+    if { [dict size $module_properties] != 0 } {
+        set_property -dict $module_properties [get_ips $module_name]
+    }
 
     if { $include_example_design == true } {
         # Create the corresponding example design/project.
-- 
GitLab


From e16a85d15719ae271adec749b44f481319c23247 Mon Sep 17 00:00:00 2001
From: jhegeman <jeroen.hegeman@cern.ch>
Date: Mon, 18 Mar 2024 11:49:17 +0100
Subject: [PATCH 2/7] Improve handling of user-IP repositories and IP name
 filtering in IP core creation script

---
 scripts/vivado_create_ips.sh  | 30 +++++++++++++++---
 scripts/vivado_create_ips.tcl | 57 +++++++++++++++++++++++++++++++----
 scripts/vivado_utils.tcl      |  8 ++---
 3 files changed, 81 insertions(+), 14 deletions(-)

diff --git a/scripts/vivado_create_ips.sh b/scripts/vivado_create_ips.sh
index c3e5775..d31be2a 100755
--- a/scripts/vivado_create_ips.sh
+++ b/scripts/vivado_create_ips.sh
@@ -4,14 +4,36 @@
 # ip-name-pattern.
 set -o noglob
 
+args=()
+
+while [ $# -gt 0 ]; do
+    if [[ $1 == "--"*"="* ]]; then
+        t0="${1/--/}"
+        v=$(echo ${t0} | cut -d'=' -f1 | tr "-" "_")
+        w=$(echo ${t0} | cut -d'=' -f2)
+        declare "$v"="$w"
+    elif [[ $1 == "--"* ]]; then
+        v=$(echo ${1/--/} | tr "-" "_")
+        declare "$v"="$2"
+        shift
+    else
+        args+=($1)
+    fi
+    shift
+done
+
 TCL_ARGS=""
 
-if [ ! -z "$1" ]; then
-    TCL_ARGS="-ip-name-pattern $1"
+if [ ! -z "${args[0]}" ]; then
+    TCL_ARGS="-ip-name-pattern ${args[0]}"
+fi
+
+if [ ! -z "${args[1]}" ]; then
+    TCL_ARGS="$TCL_ARGS -target-part ${args[1]}"
 fi
 
-if [ ! -z "$2" ]; then
-    TCL_ARGS="$TCL_ARGS -target-part $2"
+if [ ! -z "${user_ip_repo}" ]; then
+    TCL_ARGS="$TCL_ARGS -user-ip-repo ${user_ip_repo}"
 fi
 
 TCL_ARGS_STR=""
diff --git a/scripts/vivado_create_ips.tcl b/scripts/vivado_create_ips.tcl
index 097fa47..49f3d4e 100644
--- a/scripts/vivado_create_ips.tcl
+++ b/scripts/vivado_create_ips.tcl
@@ -54,6 +54,7 @@ set parameters {
     {target-part.arg "" "The FPGA to target"}
     {target-board.arg "" "The evaluation board to target"}
     {ip-name-pattern.arg ".*" "Regular expression describing which IP core(s) to generate"}
+    {user-ip-repo.arg "" "Path to an optional user-IP repository to include"}
 }
 
 set usage "- A script to (re)generate Xilinx IP cores from stored parameters"
@@ -65,9 +66,23 @@ if { [catch {array set options [cmdline::getoptions ::argv $parameters $usage]}]
 
 # Find all the Vivado IP core creation scripts.
 set ip_name_pattern $options(ip-name-pattern)
-set script_name_pattern "${script_name_pattern_base}*.tcl"
+set script_name_pattern "${script_name_pattern_base}*\.tcl"
 set ip_scripts_tmp [glob_recursive . $script_name_pattern]
-set ip_scripts [lsearch -all -inline -regexp $ip_scripts_tmp $ip_name_pattern]
+# NOTE: There is a bit of fiddling here with the IP name pattern. We
+# want to make sure to apply the filtering only to the IP name part of
+# the file names (while still filtering a list of file names).
+set filter_anchor_lo [string match "\^*" $ip_name_pattern]
+set filter_anchor_hi [string match "*\$" $ip_name_pattern]
+set ip_name_pattern_tmp $ip_name_pattern
+if {$filter_anchor_lo} {
+    set ip_name_pattern_tmp [string range $ip_name_pattern_tmp 1 end]
+}
+if {$filter_anchor_hi} {
+    set ip_name_pattern_tmp [string range $ip_name_pattern_tmp 0 end-1]
+}
+set ip_name_pattern_stripped $ip_name_pattern_tmp
+set filter_pattern "${script_name_pattern_base}${ip_name_pattern_stripped}.tcl"
+set ip_scripts [lsearch -all -inline -regexp $ip_scripts_tmp $filter_pattern]
 set s_or_not ""
 set tmp [llength $ip_scripts]
 if { $tmp > 1 || $tmp == 0 } {
@@ -77,7 +92,25 @@ if { $tmp > 1 || $tmp == 0 } {
 # Sort and remove duplicates (which may arise from symlinks).
 set ip_scripts [lsort -unique $ip_scripts]
 
+# Get the values of all options.
+set target_part $options(target-part)
+set target_board $options(target-board)
+set user_ip_repo [file normalize $options(user-ip-repo)]
+
+# Perform some basic checks on the user-IP repo path.
+if { $user_ip_repo ne "" } {
+    if { ! [file exists $user_ip_repo] } {
+        error "Path '$user_ip_repo' does not exist"
+    }
+    if { ! [file isdirectory $user_ip_repo] } {
+        error "Path '$user_ip_repo' is not a directory"
+    }
+}
+
 puts "$sep_line"
+if { $user_ip_repo ne "" } {
+    puts "Including user-IP repository '$user_ip_repo'"
+}
 puts "Found [llength $ip_scripts] matching IP core creation script$s_or_not"
 # foreach item $ip_scripts {
 #     puts $item
@@ -85,6 +118,7 @@ puts "Found [llength $ip_scripts] matching IP core creation script$s_or_not"
 puts "$sep_line"
 
 # Now process all found scripts.
+set status 0
 foreach {script_name} $ip_scripts {
 
     # Derive the Vivado project name from the script name. (NOTE: This
@@ -94,7 +128,11 @@ foreach {script_name} $ip_scripts {
     # Derive the IP core name from the vivado project name.
     set ip_name [regsub ***=$script_name_pattern_base $vivado_project_name ""]
 
-    puts "Processing [file tail "$ip_name"]"
+    # Derive a descriptive 'parent' name. (Useful in case there are
+    # multiple IP creation scripts with the same (IP) name.
+    set grandparent_name [file tail [file dirname [file dirname [file dirname [file dirname $script_name]]]]]
+    set parent_name [file tail [file dirname [file dirname [file dirname $script_name]]]]
+    puts "Processing \"$grandparent_name:$parent_name:$ip_name\""
     puts "$sep_line"
 
     # Derive the expected Vivado project directory name from the
@@ -106,14 +144,15 @@ foreach {script_name} $ip_scripts {
 
     # Have Vivado run the script and generate the IP core.
     set args ""
-    set target_part $options(target-part)
     if { [string length $target_part] != 0 } {
         set args [concat $args "-target-part \"$target_part\""]
     }
-    set target_board $options(target-board)
     if { [string length $target_board] != 0 } {
         set args [concat $args "-target-board \"$target_board\""]
     }
+    if { [string length $user_ip_repo] != 0 } {
+        set args [concat $args "-user-ip-repo \"$user_ip_repo\""]
+    }
     set full_args ""
     if { [string length $args] != 0 } {
         set full_args "-tclargs $args"
@@ -156,7 +195,13 @@ foreach {script_name} $ip_scripts {
     file delete -force -- $dir_name
 }
 
-puts "Done"
+if { $status == 0 } {
+    puts "Done"
+} else {
+    puts "Failed"
+}
 puts "$sep_line"
 
+exit $status
+
 ########################################################################
diff --git a/scripts/vivado_utils.tcl b/scripts/vivado_utils.tcl
index f8a74c9..230d8b0 100644
--- a/scripts/vivado_utils.tcl
+++ b/scripts/vivado_utils.tcl
@@ -19,12 +19,11 @@ proc vivado_utils::run_vivado_create_ip {ip_name \
                                              include_example_design \
                                              default_part \
                                              default_board \
-                                             user_ip_repo_path \
                                              argv} {
     set parameters [list \
                         [list target-part.arg $default_part "The FPGA to target"] \
                         [list target-board.arg $default_board "The development board to target"] \
-                        [list user-ip-repo-path.arg $user_ip_repo_path "The path to an optional user IP repository"]
+                        [list user-ip-repo.arg "" "Path to an optional user-IP repository"]
                    ]
 
     if { [catch {array set options [cmdline::getoptions argv $parameters]}] } {
@@ -39,7 +38,7 @@ proc vivado_utils::run_vivado_create_ip {ip_name \
     set board $options(target-board)
 
     # An optional user IP repository.
-    set user_ip_repo_path $options(user-ip-repo-path)
+    set user_ip_repo_path $options(user-ip-repo)
 
     vivado_utils::vivado_create_ip \
         $ip_name $ip_vendor $ip_library $ip_version \
@@ -73,7 +72,8 @@ proc vivado_utils::vivado_create_ip {ip_name \
         set_property BOARD_PART $board [current_project]
     }
     if { $user_ip_repo_path ne "" } {
-        set_property ip_repo_paths $user_ip_repo_path [current_fileset]
+        set ip_repo_path_ori [get_property ip_repo_paths [current_fileset]]
+        set_property ip_repo_paths "$ip_repo_path_ori $user_ip_repo_path" [current_fileset]
         update_ip_catalog -rebuild
     }
     set_property target_language VHDL [current_project]
-- 
GitLab


From b2f4cb067f2ccec7335e40394517cb0e2ec2ea59 Mon Sep 17 00:00:00 2001
From: jhegeman <jeroen.hegeman@cern.ch>
Date: Mon, 18 Mar 2024 11:53:06 +0100
Subject: [PATCH 3/7] Update README.md with instructions for latest IP core
 creation script

---
 README.md | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/README.md b/README.md
index 05addca..5bce461 100644
--- a/README.md
+++ b/README.md
@@ -9,8 +9,22 @@ cores are (re)created using Vivado Tcl scripts. After cloning this
 repo, please run the following to generate all IP cores on Linux,
 or use the corresponding .bat file on Windows.
 
+The simplest way is to simply call the IP core creation script from
+inside the cloned repository:
+
 ```
+pushd tclink
 ./scripts/vivado_create_ips.sh
+popd
+```
+
+For the impatient, the above can be sped up (albeit at the cost of
+some loss of efficiency) when GNU parallel is available:
+
+```
+pushd tclink
+parallel ./scripts/vivado_create_ips.sh ::: $(find . -iname '*vivado_create_ip_*.tcl' | sed -s 's/.*vivado_create_ip_\(.*\)\.tcl/\1/g')
+popd
 ```
 
 ## TClink concept
-- 
GitLab


From df6a8a0eb7a3c6d95fb8c56500a677b159e16b02 Mon Sep 17 00:00:00 2001
From: jhegeman <jeroen.hegeman@cern.ch>
Date: Mon, 18 Mar 2024 12:22:32 +0100
Subject: [PATCH 4/7] Update all individual IP core creation scripts to match
 the latest version of the tools

---
 firmware/source/tclink_mmcm/vivado_create_ip_mmcme3.tcl       | 4 ----
 firmware/source/tclink_mmcm/vivado_create_ip_mmcme3_slave.tcl | 4 ----
 firmware/source/tclink_mmcm/vivado_create_ip_mmcme4.tcl       | 4 ----
 firmware/source/tclink_mmcm/vivado_create_ip_mmcme4_slave.tcl | 4 ----
 .../vivado_create_ip_gthe3_master_timing_10g.tcl              | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gthe3_master_timing_5g.tcl | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_10g.tcl | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_5g.tcl  | 4 ----
 .../vivado_create_ip_gthe4_master_timing_10g.tcl              | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gthe4_master_timing_5g.tcl | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_10g.tcl | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_5g.tcl  | 4 ----
 .../vivado_create_ip_gtye3_master_timing_10g.tcl              | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gtye3_master_timing_5g.tcl | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_10g.tcl | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_5g.tcl  | 4 ----
 .../vivado_create_ip_gtye4_master_timing_10g.tcl              | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gtye4_master_timing_5g.tcl | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_10g.tcl | 4 ----
 .../ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_5g.tcl  | 4 ----
 .../vio_control/vivado_create_ip_vio_control_kcu105.tcl       | 4 ----
 .../vio_control/vivado_create_ip_vio_control_vcu118.tcl       | 4 ----
 22 files changed, 88 deletions(-)

diff --git a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3.tcl b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3.tcl
index 9e3be2b..8d90f28 100644
--- a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3.tcl
+++ b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 6.0
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name mmcme3
 
@@ -47,7 +44,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3_slave.tcl b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3_slave.tcl
index 7538b8e..c31f0ef 100644
--- a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3_slave.tcl
+++ b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme3_slave.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 6.0
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name mmcme3_slave
 
@@ -57,7 +54,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4.tcl b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4.tcl
index cd49c09..8645be4 100644
--- a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4.tcl
+++ b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 6.0
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name mmcme4
 
@@ -45,7 +42,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4_slave.tcl b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4_slave.tcl
index 85aba02..de25ac0 100644
--- a/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4_slave.tcl
+++ b/firmware/source/tclink_mmcm/vivado_create_ip_mmcme4_slave.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 6.0
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name mmcme4_slave
 
@@ -64,7 +61,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_10g.tcl
index 982616d..df71167 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_10g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gthe3_master_timing_10g
 
@@ -60,7 +57,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_5g.tcl
index ddd8c0e..1b9ee8f 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_master_timing_5g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gthe3_master_timing_5g
 
@@ -64,7 +61,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_10g.tcl
index 80b062d..636f331 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_10g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gthe3_slave_timing_10g
 
@@ -63,7 +60,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_5g.tcl
index 661a5c0..cfd4131 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe3_slave_timing_5g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gthe3_slave_timing_5g
 
@@ -63,7 +60,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_10g.tcl
index f6681fd..5e84325 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_10g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gthe4_master_timing_10g
 
@@ -60,7 +57,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_5g.tcl
index df7d796..3724af9 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_master_timing_5g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gthe4_master_timing_5g
 
@@ -64,7 +61,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_10g.tcl
index 3fdbb44..1afb5e6 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_10g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gthe4_slave_timing_10g
 
@@ -59,7 +56,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_5g.tcl
index b74b307..ec7b6d6 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gthe4_slave_timing_5g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gthe4_slave_timing_5g
 
@@ -63,7 +60,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_10g.tcl
index ef9ed3a..00141db 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_10g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gtye3_master_timing_10g
 
@@ -64,7 +61,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_5g.tcl
index 9d2add6..32f28d4 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_master_timing_5g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gtye3_master_timing_5g
 
@@ -64,7 +61,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_10g.tcl
index 3cd5b45..bb924e3 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_10g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gtye3_slave_timing_10g
 
@@ -63,7 +60,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_5g.tcl
index 2b25167..b06b010 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye3_slave_timing_5g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gtye3_slave_timing_5g
 
@@ -63,7 +60,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_10g.tcl
index 14a3a38..08aa346 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_10g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gtye4_master_timing_10g
 
@@ -60,7 +57,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_5g.tcl
index 625259b..8888479 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_master_timing_5g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gtye4_master_timing_5g
 
@@ -64,7 +61,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_10g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_10g.tcl
index d36139c..733bb9c 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_10g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_10g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gtye4_slave_timing_10g
 
@@ -59,7 +56,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_5g.tcl b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_5g.tcl
index 50bc1ce..3fdb1f3 100644
--- a/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_5g.tcl
+++ b/firmware/source/transceiver/ip_mgt_timing/vivado_create_ip_gtye4_slave_timing_5g.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 1.7
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name gtye4_slave_timing_5g
 
@@ -63,7 +60,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/vio_control/vivado_create_ip_vio_control_kcu105.tcl b/firmware/source/vio_control/vivado_create_ip_vio_control_kcu105.tcl
index 5708d61..76ed134 100644
--- a/firmware/source/vio_control/vivado_create_ip_vio_control_kcu105.tcl
+++ b/firmware/source/vio_control/vivado_create_ip_vio_control_kcu105.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 3.0
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name vio_control_kcu105
 
@@ -96,7 +93,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
diff --git a/firmware/source/vio_control/vivado_create_ip_vio_control_vcu118.tcl b/firmware/source/vio_control/vivado_create_ip_vio_control_vcu118.tcl
index 0fffb86..6bfb301 100644
--- a/firmware/source/vio_control/vivado_create_ip_vio_control_vcu118.tcl
+++ b/firmware/source/vio_control/vivado_create_ip_vio_control_vcu118.tcl
@@ -6,9 +6,6 @@ set ip_vendor xilinx.com
 set ip_library ip
 set ip_version 3.0
 
-# No special user IP repo path is needed.
-set user_ip_repo_path ""
-
 # This is the name to give to the generated module.
 set module_name vio_control_vcu118
 
@@ -95,7 +92,6 @@ vivado_utils::run_vivado_create_ip \
     $module_name $module_properties \
     $include_example_design \
     $default_part $default_board \
-    $user_ip_repo_path \
     $::argv
 
 ########################################################################
-- 
GitLab


From 7d29d1ad2f5ece3394baf86649fa93a2fd084ffd Mon Sep 17 00:00:00 2001
From: jhegeman <jeroen.hegeman@cern.ch>
Date: Mon, 18 Mar 2024 15:19:30 +0100
Subject: [PATCH 5/7] Make IP core name filtering a bit cleaner (and more
 robust, although less efficient)

---
 scripts/vivado_create_ips.tcl | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/scripts/vivado_create_ips.tcl b/scripts/vivado_create_ips.tcl
index 49f3d4e..f13f7e6 100644
--- a/scripts/vivado_create_ips.tcl
+++ b/scripts/vivado_create_ips.tcl
@@ -70,19 +70,15 @@ set script_name_pattern "${script_name_pattern_base}*\.tcl"
 set ip_scripts_tmp [glob_recursive . $script_name_pattern]
 # NOTE: There is a bit of fiddling here with the IP name pattern. We
 # want to make sure to apply the filtering only to the IP name part of
-# the file names (while still filtering a list of file names).
-set filter_anchor_lo [string match "\^*" $ip_name_pattern]
-set filter_anchor_hi [string match "*\$" $ip_name_pattern]
-set ip_name_pattern_tmp $ip_name_pattern
-if {$filter_anchor_lo} {
-    set ip_name_pattern_tmp [string range $ip_name_pattern_tmp 1 end]
-}
-if {$filter_anchor_hi} {
-    set ip_name_pattern_tmp [string range $ip_name_pattern_tmp 0 end-1]
+# the file names (while still filtering a list of file names). This is
+# not super efficient.
+set ip_scripts {}
+foreach file_name $ip_scripts_tmp {
+    regexp "${script_name_pattern_base}(.*)\.tcl$" $file_name dummy ip_name
+    if {[regexp $ip_name_pattern $ip_name]} {
+        lappend ip_scripts $file_name
+    }
 }
-set ip_name_pattern_stripped $ip_name_pattern_tmp
-set filter_pattern "${script_name_pattern_base}${ip_name_pattern_stripped}.tcl"
-set ip_scripts [lsearch -all -inline -regexp $ip_scripts_tmp $filter_pattern]
 set s_or_not ""
 set tmp [llength $ip_scripts]
 if { $tmp > 1 || $tmp == 0 } {
-- 
GitLab


From 3469436732fa42fc39e38d32d17872c94cc54097 Mon Sep 17 00:00:00 2001
From: jhegeman <jeroen.hegeman@cern.ch>
Date: Tue, 19 Mar 2024 15:50:17 +0100
Subject: [PATCH 6/7] Allow execution of IP core creation script from other
 directories

---
 scripts/vivado_create_ips.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/vivado_create_ips.sh b/scripts/vivado_create_ips.sh
index d31be2a..c55046d 100755
--- a/scripts/vivado_create_ips.sh
+++ b/scripts/vivado_create_ips.sh
@@ -41,4 +41,5 @@ if [ ! -z "${TCL_ARGS}" ]; then
     TCL_ARGS_STR="-tclargs ${TCL_ARGS}"
 fi
 
-vivado -mode batch -notrace -nolog -nojou -quiet -source scripts/vivado_create_ips.tcl ${TCL_ARGS_STR}
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+vivado -mode batch -notrace -nolog -nojou -quiet -source ${SCRIPT_DIR}/vivado_create_ips.tcl ${TCL_ARGS_STR}
-- 
GitLab


From 61a8733670607d6b9801e5d3d992755244065689 Mon Sep 17 00:00:00 2001
From: jhegeman <jeroen.hegeman@cern.ch>
Date: Wed, 3 Apr 2024 14:20:32 +0200
Subject: [PATCH 7/7] Fine-tune things a bit more

---
 scripts/vivado_create_ips.tcl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/vivado_create_ips.tcl b/scripts/vivado_create_ips.tcl
index f13f7e6..dfdcc7c 100644
--- a/scripts/vivado_create_ips.tcl
+++ b/scripts/vivado_create_ips.tcl
@@ -18,7 +18,7 @@
 
 package require cmdline
 
-variable script_dir [file dirname [file normalize [info script]]]
+set script_dir [file dirname [file normalize [info script]]]
 set env(TCLLIBPATH) [list $script_dir]
 lappend ::auto_path $script_dir
 
@@ -79,11 +79,6 @@ foreach file_name $ip_scripts_tmp {
         lappend ip_scripts $file_name
     }
 }
-set s_or_not ""
-set tmp [llength $ip_scripts]
-if { $tmp > 1 || $tmp == 0 } {
-    set s_or_not "s"
-}
 
 # Sort and remove duplicates (which may arise from symlinks).
 set ip_scripts [lsort -unique $ip_scripts]
@@ -107,6 +102,11 @@ puts "$sep_line"
 if { $user_ip_repo ne "" } {
     puts "Including user-IP repository '$user_ip_repo'"
 }
+set s_or_not ""
+set tmp [llength $ip_scripts]
+if { $tmp > 1 || $tmp == 0 } {
+    set s_or_not "s"
+}
 puts "Found [llength $ip_scripts] matching IP core creation script$s_or_not"
 # foreach item $ip_scripts {
 #     puts $item
-- 
GitLab