Skip to content

Commit

Permalink
Move FMC/SFP interfaces to separate package to pass HDL tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glennchid committed May 22, 2024
1 parent 5132910 commit 040f823
Show file tree
Hide file tree
Showing 18 changed files with 127 additions and 99 deletions.
110 changes: 110 additions & 0 deletions common/hdl/defines/interface_types.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
library ieee;
use ieee.std_logic_1164.all;

package interface_types is

-- FMC Block Record declarations

type FMC_interface is
record
FMC_PRSNT : std_logic;
FMC_LA_P : std_logic_vector(33 downto 0);
FMC_LA_N : std_logic_vector(33 downto 0);
FMC_CLK0_M2C_P : std_logic;
FMC_CLK0_M2C_N : std_logic;
FMC_CLK1_M2C_P : std_logic;
FMC_CLK1_M2C_N : std_logic;
end record FMC_interface;

view FMC_Module of FMC_interface is
FMC_PRSNT : in;
FMC_LA_P : inout;
FMC_LA_N : inout;
FMC_CLK0_M2C_P : inout;
FMC_CLK0_M2C_N : inout;
FMC_CLK1_M2C_P : in;
FMC_CLK1_M2C_N : in;
end view FMC_Module;

constant FMC_init : FMC_interface;

type FMC_array is array (natural range <>) of FMC_interface;

type FMC_ARR_REC is record
FMC_ARR : FMC_array;
end record FMC_ARR_REC;

view FMC_MOD_ARR of FMC_ARR_REC is
FMC_ARR: view (FMC_Module);
end view;

-- SFP Block Record declarations

type MGT_interface is
record
SFP_LOS : std_logic;
GTREFCLK : std_logic;
RXN_IN : std_logic;
RXP_IN : std_logic;
TXN_OUT : std_logic;
TXP_OUT : std_logic;
MGT_REC_CLK : std_logic;
LINK_UP : std_logic;
TS_SEC : std_logic_vector(31 downto 0);
TS_TICKS : std_logic_vector(31 downto 0);
MAC_ADDR : std_logic_vector(47 downto 0);
MAC_ADDR_WS : std_logic;
end record MGT_interface;

view MGT_Module of MGT_interface is
SFP_LOS : in;
GTREFCLK : in;
RXN_IN : in;
RXP_IN : in;
TXN_OUT : out;
TXP_OUT : out;
MGT_REC_CLK : out;
LINK_UP : out;
TS_SEC : out;
TS_TICKS : out;
MAC_ADDR : in;
MAC_ADDR_WS : in;
end view MGT_Module;

constant MGT_init : MGT_interface;

type MGT_array is array (natural range <>) of MGT_interface;

type MGT_ARR_REC is record
MGT_ARR : MGT_array;
end record MGT_ARR_REC;

view MGT_MOD_ARR of MGT_ARR_REC is
MGT_ARR: view (MGT_Module);
end view;
end;

package body interface_types is

constant FMC_init : FMC_interface := ( FMC_PRSNT => '0',
FMC_LA_P => (others => 'Z'),
FMC_LA_N => (others => 'Z'),
FMC_CLK0_M2C_P => 'Z',
FMC_CLK0_M2C_N => 'Z',
FMC_CLK1_M2C_P => '0',
FMC_CLK1_M2C_N => '0');

constant MGT_init : MGT_interface := ( SFP_LOS => '0',
GTREFCLK => '0',
RXN_IN => '0',
RXP_IN => '0',
TXN_OUT => 'Z',
TXP_OUT => 'Z',
MGT_REC_CLK => '0',
LINK_UP => '0',
TS_SEC => (others => '0'),
TS_TICKS => (others => '0'),
MAC_ADDR => (others => '0'),
MAC_ADDR_WS => '0');

end;
97 changes: 0 additions & 97 deletions common/hdl/defines/top_defines.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -62,103 +62,6 @@ end record;
--
-- TYPEs :
--

-- FMC Block Record declarations

type FMC_interface is
record
FMC_PRSNT : std_logic;
FMC_LA_P : std_logic_vector(33 downto 0);
FMC_LA_N : std_logic_vector(33 downto 0);
FMC_CLK0_M2C_P : std_logic;
FMC_CLK0_M2C_N : std_logic;
FMC_CLK1_M2C_P : std_logic;
FMC_CLK1_M2C_N : std_logic;
end record FMC_interface;

view FMC_Module of FMC_interface is
FMC_PRSNT : in;
FMC_LA_P : inout;
FMC_LA_N : inout;
FMC_CLK0_M2C_P : inout;
FMC_CLK0_M2C_N : inout;
FMC_CLK1_M2C_P : in;
FMC_CLK1_M2C_N : in;
end view FMC_Module;

constant FMC_init : FMC_interface := ( FMC_PRSNT => '0',
FMC_LA_P => (others => 'Z'),
FMC_LA_N => (others => 'Z'),
FMC_CLK0_M2C_P => 'Z',
FMC_CLK0_M2C_N => 'Z',
FMC_CLK1_M2C_P => '0',
FMC_CLK1_M2C_N => '0');

type FMC_array is array (natural range <>) of FMC_interface;

type FMC_ARR_REC is record
FMC_ARR : FMC_array;
end record FMC_ARR_REC;

view FMC_MOD_ARR of FMC_ARR_REC is
FMC_ARR: view (FMC_Module);
end view;

-- SFP Block Record declarations

type MGT_interface is
record
SFP_LOS : std_logic;
GTREFCLK : std_logic;
RXN_IN : std_logic;
RXP_IN : std_logic;
TXN_OUT : std_logic;
TXP_OUT : std_logic;
MGT_REC_CLK : std_logic;
LINK_UP : std_logic;
TS_SEC : std_logic_vector(31 downto 0);
TS_TICKS : std_logic_vector(31 downto 0);
MAC_ADDR : std_logic_vector(47 downto 0);
MAC_ADDR_WS : std_logic;
end record MGT_interface;

view MGT_Module of MGT_interface is
SFP_LOS : in;
GTREFCLK : in;
RXN_IN : in;
RXP_IN : in;
TXN_OUT : out;
TXP_OUT : out;
MGT_REC_CLK : out;
LINK_UP : out;
TS_SEC : out;
TS_TICKS : out;
MAC_ADDR : in;
MAC_ADDR_WS : in;
end view MGT_Module;

constant MGT_init : MGT_interface := ( SFP_LOS => '0',
GTREFCLK => '0',
RXN_IN => '0',
RXP_IN => '0',
TXN_OUT => 'Z',
TXP_OUT => 'Z',
MGT_REC_CLK => '0',
LINK_UP => '0',
TS_SEC => (others => '0'),
TS_TICKS => (others => '0'),
MAC_ADDR => (others => '0'),
MAC_ADDR_WS => '0');

type MGT_array is array (natural range <>) of MGT_interface;

type MGT_ARR_REC is record
MGT_ARR : MGT_array;
end record MGT_ARR_REC;

view MGT_MOD_ARR of MGT_ARR_REC is
MGT_ARR: view (MGT_Module);
end view;

type seq_t is
record
Expand Down
1 change: 1 addition & 0 deletions common/templates/soft_blocks.vhd.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use ieee.std_logic_1164.all;

use work.addr_defines.all;
use work.top_defines.all;
use work.interface_types.all;

entity soft_blocks is
port (
Expand Down
1 change: 1 addition & 0 deletions modules/fmc_24vio/hdl/fmc_24vio_wrapper.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use unisim.vcomponents.all;
library work;
use work.support.all;
use work.top_defines.all;
use work.interface_types.all;

entity fmc_24vio_wrapper is
port (
Expand Down
1 change: 1 addition & 0 deletions modules/fmc_acq427/hdl/fmc_acq427_wrapper.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use unisim.vcomponents.all;
library work;
use work.support.all;
use work.top_defines.all;
use work.interface_types.all;

entity fmc_acq427_wrapper is
port (
Expand Down
1 change: 1 addition & 0 deletions modules/fmc_acq430/hdl/fmc_acq430_wrapper.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use unisim.vcomponents.all;
library work;
use work.support.all;
use work.top_defines.all;
use work.interface_types.all;

entity fmc_acq430_wrapper is
port (
Expand Down
1 change: 1 addition & 0 deletions modules/fmc_loopback/hdl/fmc_loopback_wrapper.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use unisim.vcomponents.all;
library work;
use work.support.all;
use work.top_defines.all;
use work.interface_types.all;

entity fmc_loopback_wrapper is
port (
Expand Down
1 change: 1 addition & 0 deletions modules/fmc_x4sfp/hdl/fmc_x4sfp_wrapper.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use ieee.std_logic_1164.all;

use work.support.all;
use work.top_defines.all;
use work.interface_types.all;

entity us_system_top is
port (
Expand Down
1 change: 1 addition & 0 deletions modules/sfp_eventr/hdl/sfp_dls_eventr_wrapper.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use ieee.numeric_std.all;
library work;
use work.support.all;
use work.top_defines.all;
use work.interface_types.all;

library unisim;
use unisim.vcomponents.all;
Expand Down
1 change: 1 addition & 0 deletions modules/sfp_loopback/hdl/sfp_loopback_wrapper.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use ieee.numeric_std.all;
library work;
use work.support.all;
use work.top_defines.all;
use work.interface_types.all;

entity sfp_loopback_wrapper is
port (
Expand Down
1 change: 1 addition & 0 deletions modules/sfp_panda_sync/hdl/sfp_panda_sync_wrapper.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use ieee.std_logic_1164.all;

library work;
use work.top_defines.all;
use work.interface_types.all;

library unisim;
use unisim.vcomponents.all;
Expand Down
1 change: 1 addition & 0 deletions modules/sfp_udpontrig/hdl/sfp_udpontrig_wrapper.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ library IEEE;
library work;
use work.support.all;
use work.top_defines.all;
use work.interface_types.all;

library UNISIM;
use UNISIM.vcomponents.all; -- needed for OBUF instance
Expand Down
1 change: 1 addition & 0 deletions targets/PandABox/hdl/PandABox_top.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use unisim.vcomponents.all;

use work.addr_defines.all;
use work.top_defines.all;
use work.interface_types.all;

entity PandABox_top is
generic (
Expand Down
1 change: 1 addition & 0 deletions targets/ZedBoard/hdl/ZedBoard_top.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use unisim.vcomponents.all;

use work.addr_defines.all;
use work.top_defines.all;
use work.interface_types.all;

entity ZedBoard_top is
generic (
Expand Down
1 change: 1 addition & 0 deletions targets/xu5_st1/hdl/xu5_st1_top.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use unisim.vcomponents.all;

use work.addr_defines.all;
use work.top_defines.all;
use work.interface_types.all;

entity xu5_st1_top is
generic (
Expand Down
2 changes: 2 additions & 0 deletions tests/hdl/regression_tests.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ add_files -norecurse \
$TOP_DIR/common/hdl/defines \
$APP_BUILD_DIR/autogen/hdl/top_defines_gen.vhd

set_property FILE_TYPE "VHDL 2008" [get_files $TOP_DIR/common/hdl/defines/top_defines.vhd]

# Loop through all the tests
foreach test [array names tests] {

Expand Down
3 changes: 1 addition & 2 deletions tests/hdl/single_test.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ add_files -norecurse \
$TOP_DIR/common/hdl/defines \
$APP_BUILD_DIR/autogen/hdl/top_defines_gen.vhd



set_property FILE_TYPE "VHDL 2008" [get_files $TOP_DIR/common/hdl/defines/top_defines.vhd]

puts "###############################################################################################";
puts " $test" ;
Expand Down
1 change: 1 addition & 0 deletions tests/python/test_data/app-expected/hdl/soft_blocks.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use ieee.std_logic_1164.all;

use work.addr_defines.all;
use work.top_defines.all;
use work.interface_types.all;

entity soft_blocks is
port (
Expand Down

0 comments on commit 040f823

Please sign in to comment.