From 0dbec7f50dddf637a3885f1ab8ae090da8884813 Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Tue, 10 Jun 2014 06:57:31 +0000
Subject: [PATCH] Instantiate ip_stratixiv/ip_stratixiv_gxb_reconfig_*.vhd in
 one ip_stratixiv_gxb_reconfig.vhd with g_nof_gx s parameter.

---
 libraries/technology/ip_stratixiv/hdllib.cfg  |  1 +
 .../ip_stratixiv_gxb_reconfig.vhd             | 88 +++++++++++++++++++
 .../tech_transceiver_gx_stratixiv.vhd         | 53 +++--------
 3 files changed, 102 insertions(+), 40 deletions(-)
 create mode 100644 libraries/technology/ip_stratixiv/ip_stratixiv_gxb_reconfig.vhd

diff --git a/libraries/technology/ip_stratixiv/hdllib.cfg b/libraries/technology/ip_stratixiv/hdllib.cfg
index f800935f8d..a5d324b4ec 100644
--- a/libraries/technology/ip_stratixiv/hdllib.cfg
+++ b/libraries/technology/ip_stratixiv/hdllib.cfg
@@ -26,6 +26,7 @@ synth_files =
     ip_stratixiv_gxb_reconfig_4.vhd
     ip_stratixiv_gxb_reconfig_8.vhd
     ip_stratixiv_gxb_reconfig_12.vhd
+    ip_stratixiv_gxb_reconfig.vhd
     
     ip_stratixiv_hssi_gx_generic.vhd
     ip_stratixiv_hssi_tx_generic.vhd
diff --git a/libraries/technology/ip_stratixiv/ip_stratixiv_gxb_reconfig.vhd b/libraries/technology/ip_stratixiv/ip_stratixiv_gxb_reconfig.vhd
new file mode 100644
index 0000000000..0f1f22840d
--- /dev/null
+++ b/libraries/technology/ip_stratixiv/ip_stratixiv_gxb_reconfig.vhd
@@ -0,0 +1,88 @@
+-------------------------------------------------------------------------------
+--
+-- Copyright (C) 2014
+-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
+-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
+--
+-------------------------------------------------------------------------------
+
+
+-- Purpose : Create one reconfig module for all ALTGX instances.
+   
+
+LIBRARY ieee;
+USE ieee.std_logic_1164.all;
+
+ENTITY ip_stratixiv_gxb_reconfig IS
+  GENERIC (
+    g_nof_gx        : NATURAL;
+    g_fromgxb_bus_w : NATURAL := 17;
+    g_togxb_bus_w   : NATURAL := 4
+  );
+  PORT (
+    reconfig_clk     : IN STD_LOGIC;
+    reconfig_fromgxb : IN STD_LOGIC_VECTOR(g_nof_gx*g_fromgxb_bus_w-1 DOWNTO 0);
+    busy             : OUT STD_LOGIC;
+    reconfig_togxb   : OUT STD_LOGIC_VECTOR(g_togxb_bus_w-1 DOWNTO 0)
+  );
+END ip_stratixiv_gxb_reconfig;
+
+
+ARCHITECTURE str OF ip_stratixiv_gxb_reconfig IS
+BEGIN
+
+  gen_gxb_reconfig_2 : IF g_nof_gx = 2 GENERATE
+    u_gxb_reconfig_2 : ENTITY ip_stratixiv_lib.ip_stratixiv_gxb_reconfig_2
+    PORT MAP (
+      reconfig_clk        => cal_rec_clk,
+      reconfig_fromgxb    => reconfig_fromgxb,
+      busy                => rec_busy,
+      reconfig_togxb      => reconfig_togxb
+    );
+  END GENERATE;
+  
+  gen_gxb_reconfig_4 : IF g_nof_gx = 4 GENERATE  
+    u_gxb_reconfig_4 : ENTITY ip_stratixiv_lib.ip_stratixiv_gxb_reconfig_4
+    PORT MAP (
+      reconfig_clk        => cal_rec_clk,
+      reconfig_fromgxb    => reconfig_fromgxb,
+      busy                => rec_busy,
+      reconfig_togxb      => reconfig_togxb
+    );
+  END GENERATE;
+        
+  gen_gxb_reconfig_8 : IF g_nof_gx = 8 GENERATE  
+    u_gxb_reconfig_8 : ENTITY ip_stratixiv_lib.ip_stratixiv_gxb_reconfig_8
+    PORT MAP (
+      reconfig_clk        => cal_rec_clk,
+      reconfig_fromgxb    => reconfig_fromgxb,
+      busy                => rec_busy,
+      reconfig_togxb      => reconfig_togxb
+    );
+  END GENERATE;
+
+  gen_gxb_reconfig_12 : IF g_nof_gx = 12 GENERATE  
+    u_gxb_reconfig_12 : ENTITY ip_stratixiv_lib.ip_stratixiv_gxb_reconfig_12
+    PORT MAP (
+      reconfig_clk        => cal_rec_clk,
+      reconfig_fromgxb    => reconfig_fromgxb,
+      busy                => rec_busy,
+      reconfig_togxb      => reconfig_togxb
+    );
+  END GENERATE;
+
+END str;
+
diff --git a/libraries/technology/transceiver/tech_transceiver_gx_stratixiv.vhd b/libraries/technology/transceiver/tech_transceiver_gx_stratixiv.vhd
index b69ea408b9..d9e28c3e16 100644
--- a/libraries/technology/transceiver/tech_transceiver_gx_stratixiv.vhd
+++ b/libraries/technology/transceiver/tech_transceiver_gx_stratixiv.vhd
@@ -486,45 +486,18 @@ BEGIN
   -- ALTGX_RECONFIG Megafunction
   ------------------------------------------------------------------------------
     
-  gen_cond_reconfig : IF g_nof_gx = 12 GENERATE  
-    u_reconfig : ENTITY ip_stratixiv_lib.ip_stratixiv_gxb_reconfig_12 --Create one reconfig module for all ALTGX instances
-    PORT MAP (
-      reconfig_clk        => cal_rec_clk,
-      reconfig_fromgxb    => reconfig_fromgxb,
-      busy                => rec_busy,
-      reconfig_togxb      => reconfig_togxb
-    );
-  END GENERATE;
-
-  gen_cond_reconfig_8 : IF g_nof_gx = 8 GENERATE  
-    u_reconfig : ENTITY ip_stratixiv_lib.ip_stratixiv_gxb_reconfig_8 --Create one reconfig module for all ALTGX instances
-    PORT MAP (
-      reconfig_clk        => cal_rec_clk,
-      reconfig_fromgxb    => reconfig_fromgxb,
-      busy                => rec_busy,
-      reconfig_togxb      => reconfig_togxb
-    );
-  END GENERATE;
-
-  gen_cond_reconfig_4 : IF g_nof_gx = 4 GENERATE  
-    u_reconfig : ENTITY ip_stratixiv_lib.ip_stratixiv_gxb_reconfig_4 --Create one reconfig module for all ALTGX instances
-    PORT MAP (
-      reconfig_clk        => cal_rec_clk,
-      reconfig_fromgxb    => reconfig_fromgxb,
-      busy                => rec_busy,
-      reconfig_togxb      => reconfig_togxb
-    );
-  END GENERATE;
-        
-  gen_cond_reconfig_sim : IF g_nof_gx = 2 GENERATE
-    u_reconfig_sim : ENTITY ip_stratixiv_lib.ip_stratixiv_gxb_reconfig_2 -- The sim version is meant for 2 transceivers
-    PORT MAP (
-      reconfig_clk        => cal_rec_clk,
-      reconfig_fromgxb    => reconfig_fromgxb,
-      busy                => rec_busy,
-      reconfig_togxb      => reconfig_togxb
-    );
-  END GENERATE;
-
+  u_gxb_reconfig : ENTITY ip_stratixiv_lib.ip_stratixiv_gxb_reconfig  -- Create one gxb_reconfig module for all ALTGX instances
+  GENERIC MAP (
+    g_nof_gx        => g_nof_gx,
+    g_fromgxb_bus_w => c_reconf_fromgxb_bus_w,  -- = 17
+    g_togxb_bus_w   => c_reconf_togxb_bus_w     -- = 4
+  )
+  PORT MAP (
+    reconfig_clk      => cal_rec_clk,
+    reconfig_fromgxb  => reconfig_fromgxb,
+    busy              => rec_busy,
+    reconfig_togxb    => reconfig_togxb
+  );
+  
 END str;
 
-- 
GitLab