From c0a901cf1bfec33e5f8ec80594d6256b1f1b6034 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Fri, 2 Feb 2018 11:54:56 +0100 Subject: [PATCH] update included features with more information --- backplanemaster/config.vhd | 43 +++++++++++++++++++++------ hub/config.vhd | 7 +++-- tdctemplate/config_32_sfp_kel.vhd | 2 +- tdctemplate/config_48_crate_4conn.vhd | 4 +-- template/config.vhd | 5 ++-- 5 files changed, 44 insertions(+), 17 deletions(-) diff --git a/backplanemaster/config.vhd b/backplanemaster/config.vhd index 2aea6ce..eb23b70 100644 --- a/backplanemaster/config.vhd +++ b/backplanemaster/config.vhd @@ -62,7 +62,9 @@ package config is - + type hub_mii_t is array(0 to 1) of integer; + type hub_ct is array(0 to 16) of integer; + type hub_cfg_t is array(0 to 1) of hub_ct; --With GbE: @@ -72,11 +74,26 @@ package config is -- port 10: SCTRL channel on uplink to CTS -- port 11: SCTRL channel from GbE interface - constant INTERFACE_NUM : integer := 10; - constant MII_IS_UPLINK : hub_mii_config_t := (0,0,0,0,0,0,0,0,0, 1,1,1,0,0,0,0,0);--0,0,0,0,0, - constant MII_IS_DOWNLINK : hub_mii_config_t := (1,1,1,1,1,1,1,1,1, 1,0,0,0,0,0,0,0);--1,1,1,1,1, - constant MII_IS_UPLINK_ONLY : hub_mii_config_t := (0,0,0,0,0,0,0,0,0, 0,1,1,0,0,0,0,0);--0,0,0,0,0, - +--Without GbE: +-- for MII_NUMBER=11 +-- port 0-8: downlinks to other FPGA +-- port 9: SFP2 +-- port 10: SFP1 + + constant INTERFACE_NUM_ARR : hub_mii_t := (11,10); + constant IS_UPLINK_ARR : hub_cfg_t := ((0,0,0,0,0,0,0,0,0, 1,1,0,0,0,0,0,0), + (0,0,0,0,0,0,0,0,0, 1,1,1,0,0,0,0,0)); + constant IS_DOWNLINK_ARR : hub_cfg_t := ((1,1,1,1,1,1,1,1,1, 1,1,1,0,0,0,0,0), + (1,1,1,1,1,1,1,1,1, 1,0,0,0,0,0,0,0)); + constant IS_UPLINK_ONLY_ARR : hub_cfg_t := ((0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0), + (0,0,0,0,0,0,0,0,0, 0,1,1,0,0,0,0,0)); + + + constant INTERFACE_NUM : integer; + constant MII_IS_UPLINK : hub_ct; + constant MII_IS_DOWNLINK : hub_ct; + constant MII_IS_UPLINK_ONLY : hub_ct; + ------------------------------------------------------------------------------ --Select settings by configuration ------------------------------------------------------------------------------ @@ -91,7 +108,7 @@ package config is constant HARDWARE_INFO : std_logic_vector(31 downto 0); constant CLOCK_FREQUENCY : integer; constant MEDIA_FREQUENCY : integer; - constant INCLUDED_FEATURES : std_logic_vector(63 downto 0); + constant INCLUDED_FEATURES : std_logic_vector(63 downto 0); end; @@ -103,6 +120,13 @@ package body config is HW_INFO_BASE ); constant CLOCK_FREQUENCY : integer := CLOCK_FREQUENCY_ARR(USE_120_MHZ); constant MEDIA_FREQUENCY : integer := MEDIA_FREQUENCY_ARR(USE_120_MHZ); + + constant CFG_MODE : integer := INCLUDE_GBE; + constant INTERFACE_NUM : integer := INTERFACE_NUM_ARR(CFG_MODE); + constant MII_IS_UPLINK : hub_ct := IS_UPLINK_ARR(CFG_MODE); + constant MII_IS_DOWNLINK : hub_ct := IS_DOWNLINK_ARR(CFG_MODE); + constant MII_IS_UPLINK_ONLY : hub_ct := IS_UPLINK_ONLY_ARR(CFG_MODE); + function generateIncludedFeatures return std_logic_vector is variable t : std_logic_vector(63 downto 0); @@ -110,9 +134,10 @@ function generateIncludedFeatures return std_logic_vector is t := (others => '0'); t(63 downto 56) := std_logic_vector(to_unsigned(1,8)); --table version 1 -- t(16 downto 16) := std_logic_vector(to_unsigned(USE_ETHERNET,1)); - t(17 downto 17) := std_logic_vector(to_unsigned(INCLUDE_GBE,1)); --sctrl via GbE + t(22 downto 17) := "0100111"; --sctrl via GbE t(23 downto 23) := std_logic_vector(to_unsigned(INCLUDE_GBE,1)); - t(26 downto 24) := std_logic_vector(to_unsigned(1,3)); --num SFPs with TrbNet + t(28) := std_logic_vector(to_unsigned(1,1)); + t(27 downto 24) := std_logic_vector(to_unsigned(2-INCLUDE_GBE,4)); --num SFPs with TrbNet t(40 downto 40) := std_logic_vector(to_unsigned(INCLUDE_LCD,1)); t(42 downto 42) := std_logic_vector(to_unsigned(INCLUDE_SPI,1)); t(43 downto 43) := std_logic_vector(to_unsigned(INCLUDE_UART,1)); diff --git a/hub/config.vhd b/hub/config.vhd index 4919f81..b43f22f 100644 --- a/hub/config.vhd +++ b/hub/config.vhd @@ -12,8 +12,8 @@ package config is ------------------------------------------------------------------------------ --design options: backplane or front SFP, with or without GBE - constant USE_BACKPLANE : integer := c_NO; - constant INCLUDE_GBE : integer := c_NO; + constant USE_BACKPLANE : integer := c_YES; + constant INCLUDE_GBE : integer := c_YES; --Runs with 120 MHz instead of 100 MHz constant USE_120_MHZ : integer := c_NO; @@ -140,9 +140,10 @@ function generateIncludedFeatures return std_logic_vector is begin t := (others => '0'); t(63 downto 56) := std_logic_vector(to_unsigned(1,8)); --table version 1 - t(17 downto 17) := std_logic_vector(to_unsigned(INCLUDE_GBE,1)); --sctrl via GbE + t(22 downto 17) := "0100111"; --sctrl via GbE t(23 downto 23) := std_logic_vector(to_unsigned(INCLUDE_GBE,1)); t(27 downto 24) := std_logic_vector(to_unsigned(INTERFACE_NUM-USE_BACKPLANE,4)); --num SFPs with TrbNet + t(28) := std_logic_vector(to_unsigned(USE_BACKPLANE,1)); t(40 downto 40) := std_logic_vector(to_unsigned(INCLUDE_LCD,1)); t(42 downto 42) := std_logic_vector(to_unsigned(INCLUDE_SPI,1)); t(43 downto 43) := std_logic_vector(to_unsigned(INCLUDE_UART,1)); diff --git a/tdctemplate/config_32_sfp_kel.vhd b/tdctemplate/config_32_sfp_kel.vhd index b82207e..06d4558 100644 --- a/tdctemplate/config_32_sfp_kel.vhd +++ b/tdctemplate/config_32_sfp_kel.vhd @@ -125,7 +125,7 @@ function generateIncludedFeatures return std_logic_vector is t(14 downto 12) := std_logic_vector(to_unsigned(RING_BUFFER_SIZE,3)); t(15) := '1'; --TDC t(17 downto 16) := std_logic_vector(to_unsigned(NUM_TDC_MODULES-1,2)); - + t(28) := std_logic_vector(to_unsigned(3-SERDES_NUM,1)); t(40 downto 40) := std_logic_vector(to_unsigned(INCLUDE_LCD,1)); t(42 downto 42) := std_logic_vector(to_unsigned(INCLUDE_SPI,1)); t(43 downto 43) := std_logic_vector(to_unsigned(INCLUDE_UART,1)); diff --git a/tdctemplate/config_48_crate_4conn.vhd b/tdctemplate/config_48_crate_4conn.vhd index 2cb7441..147e599 100644 --- a/tdctemplate/config_48_crate_4conn.vhd +++ b/tdctemplate/config_48_crate_4conn.vhd @@ -49,7 +49,7 @@ package config is constant BROADCAST_SPECIAL_ADDR : std_logic_vector := x"70"; --set to 0 for backplane serdes, set to 3 for front SFP serdes - constant SERDES_NUM : integer := 0; + constant SERDES_NUM : integer := 3; constant INCLUDE_UART : integer := c_NO; constant INCLUDE_SPI : integer := c_YES; @@ -125,7 +125,7 @@ function generateIncludedFeatures return std_logic_vector is t(14 downto 12) := std_logic_vector(to_unsigned(RING_BUFFER_SIZE,3)); t(15) := '1'; --TDC t(17 downto 16) := std_logic_vector(to_unsigned(NUM_TDC_MODULES-1,2)); - + t(28) := std_logic_vector(to_unsigned(3-SERDES_NUM,1)); t(40 downto 40) := std_logic_vector(to_unsigned(INCLUDE_LCD,1)); t(42 downto 42) := std_logic_vector(to_unsigned(INCLUDE_SPI,1)); t(43 downto 43) := std_logic_vector(to_unsigned(INCLUDE_UART,1)); diff --git a/template/config.vhd b/template/config.vhd index 92d55fe..1fa56af 100644 --- a/template/config.vhd +++ b/template/config.vhd @@ -16,6 +16,7 @@ package config is --Runs with 120 MHz instead of 100 MHz constant USE_120_MHZ : integer := c_NO; + constant USE_200MHZOSCILLATOR : integer := c_YES; constant USE_EXTERNAL_CLOCK : integer := c_YES; --'no' not implemented. constant CLOCK_FAST_SELECT : integer := c_NO; --fast clock select (135us) or slow (280ms)? @@ -27,7 +28,7 @@ package config is constant BROADCAST_SPECIAL_ADDR : std_logic_vector := x"60"; --set to 0 for backplane serdes, set to 3 for front SFP serdes - constant SERDES_NUM : integer := 3; + constant SERDES_NUM : integer := 0; constant INCLUDE_UART : integer := c_YES; constant INCLUDE_SPI : integer := c_YES; @@ -94,7 +95,7 @@ function generateIncludedFeatures return std_logic_vector is begin t := (others => '0'); t(63 downto 56) := std_logic_vector(to_unsigned(1,8)); --table version 1 - + t(28) := std_logic_vector(to_unsigned(3-SERDES_NUM,1)); t(40 downto 40) := std_logic_vector(to_unsigned(INCLUDE_LCD,1)); t(42 downto 42) := std_logic_vector(to_unsigned(INCLUDE_SPI,1)); t(43 downto 43) := std_logic_vector(to_unsigned(INCLUDE_UART,1)); -- 2.43.0