From b0d60d782e07c8f20907930c1c206bb443a8eb99 Mon Sep 17 00:00:00 2001
From: Peter Lemmens
Date: Wed, 29 Jan 2014 10:11:10 +0100
Subject: [PATCH] New soda_hub project created and populated. Basic code is
there. Reveal files added for convenience
---
soda_client.ldf | 4 +-
soda_client_probe.rvl | 277 ++++++++++++++++++++++++++++++
soda_hub_probe.rvl | 105 +++++++++++
soda_source.ldf | 4 +-
soda_source_probe.rvl | 164 ++++++++++++++++++
source/soda_calibration_timer.vhd | 2 +-
source/soda_components.vhd | 70 ++++----
source/soda_hub.vhd | 242 +++++++++++++++-----------
8 files changed, 736 insertions(+), 132 deletions(-)
create mode 100644 soda_client_probe.rvl
create mode 100644 soda_hub_probe.rvl
create mode 100644 soda_source_probe.rvl
diff --git a/soda_client.ldf b/soda_client.ldf
index 063fc82..26aa3e2 100644
--- a/soda_client.ldf
+++ b/soda_client.ldf
@@ -1,9 +1,9 @@
-
+
-
+
diff --git a/soda_client_probe.rvl b/soda_client_probe.rvl
new file mode 100644
index 0000000..a0d27a9
--- /dev/null
+++ b/soda_client_probe.rvl
@@ -0,0 +1,277 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/soda_hub_probe.rvl b/soda_hub_probe.rvl
new file mode 100644
index 0000000..0397f85
--- /dev/null
+++ b/soda_hub_probe.rvl
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/soda_source.ldf b/soda_source.ldf
index d3f2bf9..76f8658 100644
--- a/soda_source.ldf
+++ b/soda_source.ldf
@@ -1,9 +1,9 @@
-
+
-
+
diff --git a/soda_source_probe.rvl b/soda_source_probe.rvl
new file mode 100644
index 0000000..1d33e9e
--- /dev/null
+++ b/soda_source_probe.rvl
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/soda_calibration_timer.vhd b/source/soda_calibration_timer.vhd
index c4135b2..a8820cc 100644
--- a/source/soda_calibration_timer.vhd
+++ b/source/soda_calibration_timer.vhd
@@ -49,7 +49,7 @@ begin
calibration_running_S <= '0';
CALIB_VALID_OUT <= '1';
CALIB_TIME_OUT <= calibration_timer_S;
- elsif (calibration_timer_S= 65535) then
+ elsif (calibration_timer_S = x"ffff") then
calibration_running_S <= '0';
CALIB_VALID_OUT <= '1';
CALIB_TIME_OUT <= calibration_timer_S;
diff --git a/source/soda_components.vhd b/source/soda_components.vhd
index de28825..c831bee 100644
--- a/source/soda_components.vhd
+++ b/source/soda_components.vhd
@@ -23,12 +23,15 @@ package soda_components is
type t_HUB_DLM is array(c_HUB_CHILDREN-1 downto 0) of std_logic;
- type t_HUB_DLM_WORD is array(c_HUB_CHILDREN-1 downto 0) of std_logic_vector(7 downto 0);
+ type t_HUB_DLM_BYTE is array(c_HUB_CHILDREN-1 downto 0) of std_logic_vector(7 downto 0);
+ type t_HUB_DLM_WORD is array(c_HUB_CHILDREN-1 downto 0) of std_logic_vector(15 downto 0);
+ type t_HUB_DLM_LWORD is array(c_HUB_CHILDREN-1 downto 0) of std_logic_vector(31 downto 0);
type t_PACKET_TYPE_SENT is (c_NO_PACKET, c_CMD_PACKET, c_BST_PACKET);
type t_PACKET_TYPE_ARRAY is array(c_HUB_CHILDREN-1 downto 0) of t_PACKET_TYPE_SENT;
type t_HUB_BIT_ARRAY is array(c_HUB_CHILDREN-1 downto 0) of std_logic;
type t_HUB_BYTE_ARRAY is array(c_HUB_CHILDREN-1 downto 0) of std_logic_vector(7 downto 0);
- type t_HUB_WORD_ARRAY is array(c_HUB_CHILDREN-1 downto 0) of std_logic_vector(31 downto 0);
+ type t_HUB_WORD_ARRAY is array(c_HUB_CHILDREN-1 downto 0) of std_logic_vector(15 downto 0);
+ type t_HUB_LWORD_ARRAY is array(c_HUB_CHILDREN-1 downto 0) of std_logic_vector(31 downto 0);
component soda_superburst_generator
@@ -122,33 +125,40 @@ package soda_components is
end component;
component soda_hub
- port(
- SYSCLK : in std_logic; -- fabric clock
- SODACLK : in std_logic; -- recovered clock
- RESET : in std_logic; -- synchronous reset
- CLEAR : in std_logic; -- asynchronous reset
- CLK_EN : in std_logic;
- -- SINGLE DUBPLEX LINK TO THE TOP
- RXTOP_DLM_IN : in std_logic;
- RXTOP_DLM_WORD_IN : in std_logic_vector(7 downto 0) := (others => '0');
- TXTOP_DLM_OUT : out std_logic;
- TXTOP_DLM_WORD_OUT : out std_logic_vector(7 downto 0) := (others => '0');
- -- MULTIPLE DUPLEX LINKS TO THE BOTTOM
- RXBTM_DLM_IN : in t_HUB_DLM; -- typedef in soda_components.vhd
- RXBTM_DLM_WORD_IN : in t_HUB_DLM_WORD; -- typedef in soda_components.vhd
- TXBTM_DLM_OUT : out t_HUB_DLM; -- typedef in soda_components.vhd
- TXBTM_DLM_WORD_OUT : out t_HUB_DLM_WORD; -- typedef in soda_components.vhd
-
- SODA_DATA_IN : in std_logic_vector(31 downto 0) := (others => '0');
- SODA_DATA_OUT : out std_logic_vector(31 downto 0) := (others => '0');
- SODA_ADDR_IN : in std_logic_vector(3 downto 0) := (others => '0');
- SODA_READ_IN : in std_logic := '0';
- SODA_WRITE_IN : in std_logic := '0';
- SODA_ACK_OUT : out std_logic := '0';
- STAT : out std_logic_vector(31 downto 0) := (others => '0') -- DEBUG
- );
+ port(
+ SYSCLK : in std_logic; -- fabric clock
+ SODACLK : in std_logic; -- recovered clock
+ RESET : in std_logic; -- synchronous reset
+ CLEAR : in std_logic; -- asynchronous reset
+ CLK_EN : in std_logic;
+
+ -- SINGLE DUBPLEX UP-LINK TO THE TOP
+ RXUP_DLM_IN : in std_logic;
+ RXUP_DLM_WORD_IN : in std_logic_vector(7 downto 0) := (others => '0');
+ TXUP_DLM_OUT : out std_logic;
+ TXUP_DLM_WORD_OUT : out std_logic_vector(7 downto 0) := (others => '0');
+ TXUP_DLM_PREVIEW_OUT : out std_logic := '0'; --PL!
+ UPLINK_PHASE_IN : in std_logic := '0'; --PL!
+
+ -- MULTIPLE DUPLEX DOWN-LINKS TO THE BOTTOM
+ RXDN_DLM_IN : in t_HUB_DLM;
+ RXDN_DLM_WORD_IN : in t_HUB_DLM_BYTE;
+ TXDN_DLM_OUT : out t_HUB_DLM;
+ TXDN_DLM_WORD_OUT : out t_HUB_DLM_BYTE;
+ TXDN_DLM_PREVIEW_OUT : out t_HUB_DLM; --PL!
+ DNLINK_PHASE_IN : in t_HUB_DLM; --PL!
+
+ SODA_DATA_IN : in std_logic_vector(31 downto 0) := (others => '0');
+ SODA_DATA_OUT : out std_logic_vector(31 downto 0) := (others => '0');
+ SODA_ADDR_IN : in std_logic_vector(3 downto 0) := (others => '0');
+ SODA_READ_IN : in std_logic := '0';
+ SODA_WRITE_IN : in std_logic := '0';
+ SODA_ACK_OUT : out std_logic := '0';
+ LEDS_OUT : out std_logic_vector(3 downto 0);
+ LINK_DEBUG_IN : in std_logic_vector(31 downto 0) := (others => '0')
+ );
end component;
-
+
component soda_client -- box containing soda_source components
port(
SYSCLK : in std_logic; -- fabric clock
@@ -173,8 +183,8 @@ package soda_components is
LEDS_OUT : out std_logic_vector(3 downto 0);
LINK_DEBUG_IN : in std_logic_vector(31 downto 0) := (others => '0')
);
- end component;
-
+ end component;
+
component soda_reply_pkt_builder
port(
SODACLK : in std_logic; -- fabric clock
diff --git a/source/soda_hub.vhd b/source/soda_hub.vhd
index d42d4d2..461295e 100644
--- a/source/soda_hub.vhd
+++ b/source/soda_hub.vhd
@@ -11,36 +11,42 @@ use work.soda_components.all;
entity soda_hub is
port(
- SYSCLK : in std_logic; -- fabric clock
- SODACLK : in std_logic; -- fabric clock
- RESET : in std_logic; -- synchronous reset
- CLEAR : in std_logic; -- asynchronous reset
- CLK_EN : in std_logic;
- -- SINGLE DUBPLEX LINK TO THE TOP
- RXTOP_DLM_IN : in std_logic;
- RXTOP_DLM_WORD_IN : in std_logic_vector(7 downto 0) := (others => '0');
- TXTOP_DLM_OUT : out std_logic;
- TXTOP_DLM_WORD_OUT : out std_logic_vector(7 downto 0) := (others => '0');
- -- MULTIPLE DUPLEX LINKS TO THE BOTTOM
- RXBTM_DLM_IN : in t_HUB_DLM; -- typedef in soda_components.vhd
- RXBTM_DLM_WORD_IN : in t_HUB_DLM_WORD; -- typedef in soda_components.vhd
- TXBTM_DLM_OUT : out t_HUB_DLM; -- typedef in soda_components.vhd
- TXBTM_DLM_WORD_OUT : out t_HUB_DLM_WORD; -- typedef in soda_components.vhd
+ SYSCLK : in std_logic; -- fabric clock
+ SODACLK : in std_logic; -- recovered clock
+ RESET : in std_logic; -- synchronous reset
+ CLEAR : in std_logic; -- asynchronous reset
+ CLK_EN : in std_logic;
- SODA_DATA_IN : in std_logic_vector(31 downto 0) := (others => '0');
- SODA_DATA_OUT : out std_logic_vector(31 downto 0) := (others => '0');
- SODA_ADDR_IN : in std_logic_vector(3 downto 0) := (others => '0');
- SODA_READ_IN : in std_logic := '0';
- SODA_WRITE_IN : in std_logic := '0';
- SODA_ACK_OUT : out std_logic := '0';
- STAT : out std_logic_vector(31 downto 0) := (others => '0') -- DEBUG
+ -- SINGLE DUBPLEX UP-LINK TO THE TOP
+ RXUP_DLM_IN : in std_logic;
+ RXUP_DLM_WORD_IN : in std_logic_vector(7 downto 0) := (others => '0');
+ TXUP_DLM_OUT : out std_logic;
+ TXUP_DLM_WORD_OUT : out std_logic_vector(7 downto 0) := (others => '0');
+ TXUP_DLM_PREVIEW_OUT : out std_logic := '0'; --PL!
+ UPLINK_PHASE_IN : in std_logic := '0'; --PL!
+
+ -- MULTIPLE DUPLEX DOWN-LINKS TO THE BOTTOM
+ RXDN_DLM_IN : in t_HUB_DLM;
+ RXDN_DLM_WORD_IN : in t_HUB_DLM_BYTE;
+ TXDN_DLM_OUT : out t_HUB_DLM;
+ TXDN_DLM_WORD_OUT : out t_HUB_DLM_BYTE;
+ TXDN_DLM_PREVIEW_OUT : out t_HUB_DLM; --PL!
+ DNLINK_PHASE_IN : in t_HUB_DLM; --PL!
+
+ SODA_DATA_IN : in std_logic_vector(31 downto 0) := (others => '0');
+ SODA_DATA_OUT : out std_logic_vector(31 downto 0) := (others => '0');
+ SODA_ADDR_IN : in std_logic_vector(3 downto 0) := (others => '0');
+ SODA_READ_IN : in std_logic := '0';
+ SODA_WRITE_IN : in std_logic := '0';
+ SODA_ACK_OUT : out std_logic := '0';
+ LEDS_OUT : out std_logic_vector(3 downto 0);
+ LINK_DEBUG_IN : in std_logic_vector(31 downto 0) := (others => '0')
);
end soda_hub;
architecture Behavioral of soda_hub is
--SODA
- signal enable_S : std_logic := '0';
signal soda_cmd_word_S : std_logic_vector(30 downto 0) := (others => '0');
signal soda_cmd_valid_S : std_logic := '0';
signal start_of_superburst_S : std_logic := '0';
@@ -58,23 +64,32 @@ architecture Behavioral of soda_hub is
signal reply_OK_S : t_HUB_BIT_ARRAY;
signal start_calibration_S : std_logic;
signal calibration_valid_S : t_HUB_BIT_ARRAY;
- signal calibration_time_S : t_HUB_BYTE_ARRAY;
-
-
+ signal calibration_time_S : t_HUB_WORD_ARRAY;
+ signal calib_register_s : t_HUB_LWORD_ARRAY;
+
+ signal dead_channels_S : t_HUB_BIT_ARRAY;
+ signal channel_status_S : t_HUB_BIT_ARRAY;
+ signal status_register : std_logic_vector(31 downto 0) := (others => '0');
+
-- slave bus signals
- signal bus_ack_x : std_logic;
- signal bus_ack : std_logic;
- signal store_wr_x : std_logic;
- signal store_wr : std_logic;
- signal store_rd_x : std_logic;
- signal store_rd : std_logic;
- signal buf_bus_data_out : std_logic_vector(31 downto 0);
+ signal bus_ack_x : std_logic;
+ signal bus_ack : std_logic;
+ signal store_wr_x : std_logic;
+ signal store_wr : std_logic;
+ signal store_rd_x : std_logic;
+ signal store_rd : std_logic;
+ signal buf_bus_data_out : std_logic_vector(31 downto 0) := (others => '0');
+ signal ledregister_i : std_logic_vector(31 downto 0) := (others => '0');
+ signal txup_dlm_out_S : std_logic;
+
+-- debug
+ signal debug_status_S : std_logic_vector(31 downto 0) := (others => '0');
+ signal debug_rx_cnt_S : std_logic_vector(31 downto 0) := (others => '0');
+ signal debug_tx_cnt_S : std_logic_vector(31 downto 0) := (others => '0');
+ signal debug_SOS_cnt_S : std_logic_vector(31 downto 0) := (others => '0');
+ signal debug_cmd_cnt_S : std_logic_vector(31 downto 0) := (others => '0');
- signal dead_channels_S : std_logic_vector(31 downto 0) := (others => '0');
- signal channel_status_S : std_logic_vector(31 downto 0) := (others => '0');
- signal calib_register_S : t_HUB_WORD_ARRAY;
-
- begin
+begin
hub_packet_handler : soda_packet_handler
port map(
@@ -87,36 +102,33 @@ architecture Behavioral of soda_hub is
SUPER_BURST_NR_OUT => super_burst_nr_S,
SODA_CMD_VALID_OUT => soda_cmd_valid_S,
SODA_CMD_WORD_OUT => soda_cmd_word_S,
- EXPECTED_REPLY_OUT => expected_reply_S,
- CRC_VALID_OUT => crc_valid_S,
- CRC_DATA_OUT => crc_data_S,
- RX_DLM_IN => RXTOP_DLM_IN,
- RX_DLM_WORD_IN => RXTOP_DLM_WORD_IN
+ RX_DLM_IN => RXUP_DLM_IN,
+ RX_DLM_WORD_IN => RXUP_DLM_WORD_IN
);
- reply_packet_builder : soda_reply_pkt_builder
+ hub_reply_packet_builder : soda_reply_pkt_builder
port map(
SODACLK => SODACLK,
RESET => RESET,
CLEAR => '0',
CLK_EN => CLK_EN,
--Internal Connection
+ LINK_PHASE_IN => UPLINK_PHASE_IN,
START_OF_SUPERBURST => start_of_superburst_S,
SUPER_BURST_NR_IN => super_burst_nr_S,
SODA_CMD_STROBE_IN => soda_cmd_valid_S,
SODA_CMD_WORD_IN => soda_cmd_word_S,
- TX_DLM_OUT => TXTOP_DLM_OUT,
- TX_DLM_WORD_OUT => TXTOP_DLM_WORD_OUT
+ TX_DLM_PREVIEW_OUT => TXUP_DLM_PREVIEW_OUT,
+ TX_DLM_OUT => txup_dlm_out_S, --TX_DLM_OUT,
+ TX_DLM_WORD_OUT => TXUP_DLM_WORD_OUT
);
-
+
channel :for i in c_HUB_CHILDREN-1 downto 0 generate
packet_builder : soda_packet_builder
port map(
SODACLK => SODACLK,
RESET => RESET,
- CLEAR => '0',
- CLK_EN => CLK_EN,
--Internal Connection
SODA_CMD_STROBE_IN => soda_cmd_valid_S,
START_OF_SUPERBURST => start_of_superburst_S,
@@ -124,36 +136,36 @@ architecture Behavioral of soda_hub is
SODA_CMD_WORD_IN => soda_cmd_word_S,
EXPECTED_REPLY_OUT => open,
TIME_CAL_OUT => start_calibration_S,
- TX_DLM_OUT => TXBTM_DLM_OUT(i),
- TX_DLM_WORD_OUT => TXBTM_DLM_WORD_OUT(i)
+ TX_DLM_OUT => TXDN_DLM_OUT(i),
+ TX_DLM_WORD_OUT => TXDN_DLM_WORD_OUT(i)
);
hub_reply_handler : soda_reply_handler
port map(
- SYSCLK => SYSCLK,
+ SODACLK => SODACLK,
RESET => RESET,
CLEAR => '0',
CLK_EN => '1',
--Internal Connection
-- LAST_PACKET => last_packet_sent_S,
EXPECTED_REPLY_IN => expected_reply_S,
- RX_DLM_IN => RXBTM_DLM_IN(i),
- RX_DLM_WORD_IN => RXBTM_DLM_WORD_IN(i),
- REPLY_VALID_OUT => reply_valid_S(i),
+ RX_DLM_IN => RXDN_DLM_IN(i),
+ RX_DLM_WORD_IN => RXDN_DLM_WORD_IN(i),
+ REPLY_VALID_OUT => reply_valid_S(i),
REPLY_OK_OUT => reply_OK_S(i)
);
- hub_calibration_timer : soda_calibration_timer
+ hub_calibration_timer : soda_calibration_timer
port map(
- SYSCLK => SYSCLK,
+ SODACLK => SODACLK,
RESET => RESET,
CLEAR => '0',
CLK_EN => '1',
--Internal Connection
- START_CALIBRATION => start_calibration_S,
- END_CALIBRATION => reply_valid_S(i),
+ START_CALIBRATION => start_calibration_S,
+ END_CALIBRATION => reply_valid_S(i),
CALIB_VALID_OUT => calibration_valid_S(i),
- CALIB_TIME_OUT => calibration_time_S(i)
+ CALIB_TIME_OUT => calibration_time_S(i)
);
hub_store_calib_proc : process(SYSCLK)
@@ -162,7 +174,7 @@ architecture Behavioral of soda_hub is
if( RESET = '1' ) then
calib_register_S(i) <= (others => '0');
else
- calib_register_S(i)(7 downto 0) <= calibration_time_S(i);
+ calib_register_S(i)(15 downto 0) <= calibration_time_S(i);
end if;
end if;
end process;
@@ -180,7 +192,8 @@ architecture Behavioral of soda_hub is
else
channel_status_S(i) <= '0';
end if;
- end if;
+ end if;
+
end process;
end generate;
@@ -188,16 +201,16 @@ architecture Behavioral of soda_hub is
-----------------------------------------------------------
-- Reset the unused bits of channel_status_S --
-----------------------------------------------------------
- other_bits :for j in 31 downto c_HUB_CHILDREN generate
- init_unused_bits_proc : process(SYSCLK)
- begin
- if rising_edge(SYSCLK) then
- if( RESET = '1' ) then
- channel_status_S(j) <= '0'; -- reset status bits
- end if;
- end if;
- end process;
- end generate;
+-- other_bits :for j in 31 downto c_HUB_CHILDREN generate
+-- init_unused_bits_proc : process(SYSCLK)
+-- begin
+-- if rising_edge(SYSCLK) then
+-- if( RESET = '1' ) then
+-- channel_status_S(j) <= '0'; -- reset status bits
+-- end if;
+-- end if;
+-- end process;
+-- end generate;
-----------------------------------------------------------
-- Transmission history for reply-checking --
@@ -223,14 +236,14 @@ architecture Behavioral of soda_hub is
if( rising_edge(SYSCLK) ) then
if( RESET = '1' ) then
CURRENT_STATE <= SLEEP;
- bus_ack <= '0';
- store_wr<= '0';
- store_rd<= '0';
+ bus_ack <= '0';
+ store_wr <= '0';
+ store_rd <= '0';
else
CURRENT_STATE <= NEXT_STATE;
- bus_ack <= bus_ack_x;
- store_wr<= store_wr_x;
- store_rd<= store_rd_x;
+ bus_ack <= bus_ack_x;
+ store_wr <= store_wr_x;
+ store_rd <= store_rd_x;
end if;
end if;
end process STATE_MEM;
@@ -239,7 +252,7 @@ architecture Behavioral of soda_hub is
TRANSFORM: process(CURRENT_STATE, SODA_READ_IN, SODA_WRITE_IN )
begin
NEXT_STATE <= SLEEP;
- bus_ack_x<= '0';
+ bus_ack_x <= '0';
store_wr_x <= '0';
store_rd_x <= '0';
case CURRENT_STATE is
@@ -284,15 +297,15 @@ end process TRANSFORM;
---------------------------------------------------------
-- data handling --
---------------------------------------------------------
--- For sim purposes the HUB gets addresses 01XX
+-- For sim purposes the CLIENT gets addresses 11XX
-- register write
THE_WRITE_REG_PROC: process( SYSCLK )
begin
if( rising_edge(SYSCLK) ) then
if ( RESET = '1' ) then
- -- do NOT reset dead_channels; This is a task for slow-control ONLY
- elsif( (store_wr = '1') and (SODA_ADDR_IN = "0100") ) then --
- dead_channels_S <= SODA_DATA_IN(31 downto 0);
+ LEDregister_i <= (others => '0');
+ elsif( (store_wr = '1') and (SODA_ADDR_IN = B"0000") ) then
+ LEDregister_i <= SODA_DATA_IN;
end if;
end if;
end process THE_WRITE_REG_PROC;
@@ -303,24 +316,59 @@ end process TRANSFORM;
if( rising_edge(SYSCLK) ) then
if ( RESET = '1' ) then
buf_bus_data_out <= (others => '0');
- elsif( (store_rd = '1') and (SODA_ADDR_IN = B"0100") ) then
+ elsif( (store_rd = '1') and (SODA_ADDR_IN = "0000") ) then
buf_bus_data_out <= '0' & soda_cmd_word_S;
- elsif( (store_rd = '1') and (SODA_ADDR_IN = B"0101") ) then
- buf_bus_data_out <= channel_status_S;
- elsif( (store_rd = '1') and (SODA_ADDR_IN = B"0110") ) then
- buf_bus_data_out <= dead_channels_S;
- elsif( (store_rd = '1') and (SODA_ADDR_IN(3 downto 2) = "10") ) then
- for j in 0 to c_HUB_CHILDREN-1 loop
- if (j=conv_integer(SODA_ADDR_IN(1 downto 0))) then
- buf_bus_data_out <= calib_register_S(j);
- end if;
- end loop;
+ elsif( (store_rd = '1') and (SODA_ADDR_IN = "0001") ) then
+ buf_bus_data_out <= '0' & super_burst_nr_S;
+ elsif( (store_rd = '1') and (SODA_ADDR_IN = "0010") ) then
+ buf_bus_data_out <= LEDregister_i;
+ elsif( (store_rd = '1') and (SODA_ADDR_IN = "0011") ) then
+ buf_bus_data_out <= debug_status_S;
+ elsif( (store_rd = '1') and (SODA_ADDR_IN = "0100") ) then
+ buf_bus_data_out <= debug_rx_cnt_S;
+ elsif( (store_rd = '1') and (SODA_ADDR_IN = "0101") ) then
+ buf_bus_data_out <= debug_tx_cnt_S;
+ elsif( (store_rd = '1') and (SODA_ADDR_IN = "0110") ) then
+ buf_bus_data_out <= debug_sos_cnt_S;
+ elsif( (store_rd = '1') and (SODA_ADDR_IN = "0111") ) then
+ buf_bus_data_out <= debug_cmd_cnt_S;
end if;
end if;
end process THE_READ_REG_PROC;
-
+
+-- debug signals
+ DEBUG_HUB : process(SODACLK)
+ begin
+ if( rising_edge(SODACLK) ) then
+ debug_status_S(0) <= RESET;
+ debug_status_S(1) <= CLEAR;
+ debug_status_S(2) <= CLK_EN;
+ if ( RESET = '1' ) then
+ debug_rx_cnt_S <= (others => '0');
+ debug_tx_cnt_S <= (others => '0');
+ else
+ if (txup_dlm_out_S = '1') then
+ debug_tx_cnt_S <= debug_tx_cnt_S + 1;
+ end if;
+ if (RXUP_DLM_IN = '1') then
+ debug_rx_cnt_S <= debug_rx_cnt_S + 1;
+ end if;
+ if (start_of_superburst_S = '1') then
+ debug_sos_cnt_S <= debug_sos_cnt_S + 1;
+ end if;
+ if (soda_cmd_valid_S = '1') then
+ debug_cmd_cnt_S <= debug_cmd_cnt_S + 1;
+ end if;
+ end if;
+ end if;
+ end process;
+
+ debug_status_S(31 downto 3) <= LINK_DEBUG_IN(31 downto 3);
+ TXUP_DLM_OUT <= txup_dlm_out_S;
-- output signals
- SODA_DATA_OUT <= buf_bus_data_out;
- SODA_ACK_OUT <= bus_ack;
+ LEDS_OUT <= LEDregister_i(3 downto 0);
+
+ SODA_DATA_OUT <= buf_bus_data_out;
+ SODA_ACK_OUT <= bus_ack;
end architecture;
\ No newline at end of file
--
2.43.0