From ff1987cdc02682a60b850a0d0f85562e539e249a Mon Sep 17 00:00:00 2001
From: Peter Lemmens
Date: Wed, 30 Oct 2013 08:57:46 +0100
Subject: [PATCH] About to rebuild the tx_control FSM. Major reconstruction.
---
soda_client.lpf | 2 +-
soda_source.ldf | 8 ++++----
soda_source.lpf | 2 +-
source/med_ecp3_sfp_sync_down.vhd | 23 ++++++++++++++---------
source/med_ecp3_sfp_sync_up.vhd | 21 +++++++++++++--------
source/soda_cmd_window_generator.vhd | 4 ++--
source/soda_components.vhd | 6 ------
source/soda_packet_builder.vhd | 19 +++++++++++++++++--
source/soda_source.vhd | 10 ++--------
source/soda_superburst_gen.vhd | 2 --
source/trb3_periph_sodaclient.vhd | 12 ++++++++----
source/trb3_periph_sodasource.vhd | 14 ++++++++------
12 files changed, 70 insertions(+), 53 deletions(-)
diff --git a/soda_client.lpf b/soda_client.lpf
index 8a14f16..48babc7 100644
--- a/soda_client.lpf
+++ b/soda_client.lpf
@@ -1,4 +1,4 @@
-rvl_alias "clk_raw_internal" "clk_raw_internal";
+rvl_alias "reveal_ist_282" "the_sync_link/the_serdes/rx_full_clk_ch0";
BLOCK RESETPATHS ;
BLOCK ASYNCPATHS ;
BLOCK RD_DURING_WR_PATHS ;
diff --git a/soda_source.ldf b/soda_source.ldf
index fbf8ae4..514b9fe 100644
--- a/soda_source.ldf
+++ b/soda_source.ldf
@@ -4,7 +4,7 @@
-
+
@@ -20,6 +20,9 @@
+
+
+
@@ -314,9 +317,6 @@
-
-
-
diff --git a/soda_source.lpf b/soda_source.lpf
index ecba527..d63a6c5 100644
--- a/soda_source.lpf
+++ b/soda_source.lpf
@@ -1,4 +1,4 @@
-rvl_alias "reveal_ist_222" "the_sync_link/the_serdes/rx_full_clk_ch0";
+rvl_alias "reveal_ist_129" "the_sync_link/the_serdes/rx_full_clk_ch0";
BLOCK RESETPATHS ;
BLOCK ASYNCPATHS ;
BLOCK RD_DURING_WR_PATHS ;
diff --git a/source/med_ecp3_sfp_sync_down.vhd b/source/med_ecp3_sfp_sync_down.vhd
index 4875f2b..93bb871 100644
--- a/source/med_ecp3_sfp_sync_down.vhd
+++ b/source/med_ecp3_sfp_sync_down.vhd
@@ -325,7 +325,7 @@ THE_TX : soda_tx_control
START_POSITION_IN => request_retr_position_i, --TODO
TX_DLM_INIT => TX_DLM_INIT,
- SEND_DLM => '0', --TX_DLM,
+ SEND_DLM => TX_DLM,
SEND_DLM_WORD => TX_DLM_WORD,
SEND_LINK_RESET_IN => CTRL_OP(15),
@@ -493,14 +493,19 @@ STAT_DEBUG <= debug_reg;
internal_make_link_reset_out <= make_link_reset_i when IS_SYNC_SLAVE = c_YES else '0';
sd_los_i <= SD_LOS_IN when rising_edge(SYSCLK); -- PL!
-STAT_OP(15) <= send_link_reset_i when rising_edge(SYSCLK);
-STAT_OP(14) <= '0';
-STAT_OP(13) <= internal_make_link_reset_out when rising_edge(SYSCLK); --make trbnet reset
-STAT_OP(12) <= '0';
-STAT_OP(11) <= '0';
-STAT_OP(10) <= rx_allow;
-STAT_OP(9) <= tx_allow;
-STAT_OP(8 downto 4) <= (others => '0');
+STAT_OP(15) <= send_link_reset_i when rising_edge(SYSCLK);
+STAT_OP(14) <= '0';
+STAT_OP(13) <= internal_make_link_reset_out when rising_edge(SYSCLK); --make trbnet reset
+STAT_OP(12) <= '0';
+STAT_OP(11) <= '0';
+STAT_OP(10) <= rx_allow;
+STAT_OP(9) <= tx_allow;
+--STAT_OP(8 downto 4) <= (others => '0');
+STAT_OP(8) <= got_link_ready_i;
+STAT_OP(7) <= send_link_reset_i;
+STAT_OP(6) <= make_link_reset_i;
+STAT_OP(5) <= request_retr_i;
+STAT_OP(4) <= start_retr_i;
STAT_OP(3 downto 0) <= x"0" when rx_allow_q = '1' and tx_allow_q = '1' else x"7";
end med_ecp3_sfp_sync_down_arch;
diff --git a/source/med_ecp3_sfp_sync_up.vhd b/source/med_ecp3_sfp_sync_up.vhd
index 369cd54..8d4c56d 100644
--- a/source/med_ecp3_sfp_sync_up.vhd
+++ b/source/med_ecp3_sfp_sync_up.vhd
@@ -495,14 +495,19 @@ internal_make_link_reset_out <= make_link_reset_i when IS_SYNC_SLAVE = c_YES els
sd_los_i <= SD_LOS_IN when rising_edge(SYSCLK); -- PL!
-STAT_OP(15) <= send_link_reset_i when rising_edge(SYSCLK);
-STAT_OP(14) <= '0';
-STAT_OP(13) <= internal_make_link_reset_out when rising_edge(SYSCLK); --make trbnet reset
-STAT_OP(12) <= '0';
-STAT_OP(11) <= '0';
-STAT_OP(10) <= rx_allow;
-STAT_OP(9) <= tx_allow;
-STAT_OP(8 downto 4) <= (others => '0');
+STAT_OP(15) <= send_link_reset_i when rising_edge(SYSCLK);
+STAT_OP(14) <= '0';
+STAT_OP(13) <= internal_make_link_reset_out when rising_edge(SYSCLK); --make trbnet reset
+STAT_OP(12) <= '0';
+STAT_OP(11) <= '0';
+STAT_OP(10) <= rx_allow;
+STAT_OP(9) <= tx_allow;
+--STAT_OP(8 downto 4) <= (others => '0');
+STAT_OP(8) <= got_link_ready_i;
+STAT_OP(7) <= send_link_reset_i;
+STAT_OP(6) <= make_link_reset_i;
+STAT_OP(5) <= request_retr_i;
+STAT_OP(4) <= start_retr_i;
STAT_OP(3 downto 0) <= x"0" when rx_allow_q = '1' and tx_allow_q = '1' else x"7";
end med_ecp3_sfp_sync_up_arch;
diff --git a/source/soda_cmd_window_generator.vhd b/source/soda_cmd_window_generator.vhd
index fca0ea4..7eb7bb8 100644
--- a/source/soda_cmd_window_generator.vhd
+++ b/source/soda_cmd_window_generator.vhd
@@ -11,8 +11,8 @@ use work.trb_net16_hub_func.all;
use work.soda_components.all;
entity soda_cmd_window_generator is
- generic( CLOCK_PERIOD : natural range 1 to 20 := cSODA_CLOCK_PERIOD; -- clock-period in ns
- COMMAND_WINDOS_SIZE : natural range 1 to 256 := cSODA_COMMAND_WINDOS_SIZE -- command window size in ns
+ generic( CLOCK_PERIOD : natural range 1 to 20 := cSODA_CLOCK_PERIOD; -- clock-period in ns
+ COMMAND_WINDOS_SIZE : natural range 1 to 65335 := cSODA_COMMAND_WINDOS_SIZE -- command window size in ns
);
port(
SODACLK : in std_logic; -- fabric clock
diff --git a/source/soda_components.vhd b/source/soda_components.vhd
index fa081a8..125b04b 100644
--- a/source/soda_components.vhd
+++ b/source/soda_components.vhd
@@ -33,8 +33,6 @@ package soda_components is
port(
SODACLK : in std_logic; -- fabric clock
RESET : in std_logic; -- synchronous reset
- CLEAR : in std_logic; -- asynchronous reset
- CLK_EN : in std_logic;
--Internal Connection
SODA_BURST_PULSE_IN : in std_logic := '0'; --
START_OF_SUPERBURST_OUT : out std_logic := '0';
@@ -46,8 +44,6 @@ package soda_components is
port(
SODACLK : in std_logic; -- fabric clock
RESET : in std_logic; -- synchronous reset
- CLEAR : in std_logic; -- asynchronous reset
- CLK_EN : in std_logic;
--Internal Connection
LINK_PHASE_IN : in std_logic := '0';
SODA_CMD_STROBE_IN : in std_logic := '0'; --
@@ -98,8 +94,6 @@ package soda_components is
SYSCLK : in std_logic; -- fabric clock
SODACLK : in std_logic; -- clock for data to serdes
RESET : in std_logic; -- synchronous reset
- CLEAR : in std_logic; -- asynchronous reset
- CLK_EN : in std_logic;
--Internal Connection
SODA_BURST_PULSE_IN : in std_logic := '0'; --
diff --git a/source/soda_packet_builder.vhd b/source/soda_packet_builder.vhd
index 6e463d9..d33d2b3 100644
--- a/source/soda_packet_builder.vhd
+++ b/source/soda_packet_builder.vhd
@@ -13,8 +13,6 @@ entity soda_packet_builder is
port(
SODACLK : in std_logic; -- fabric clock
RESET : in std_logic; -- synchronous reset
- CLEAR : in std_logic; -- asynchronous reset
- CLK_EN : in std_logic;
--Internal Connection
LINK_PHASE_IN : in std_logic := '0'; --_vector(1 downto 0) := (others => '0');
SODA_CMD_STROBE_IN : in std_logic := '0'; --
@@ -51,6 +49,8 @@ architecture Behavioral of soda_packet_builder is
);
signal packet_state_S : packet_state_type := c_IDLE;
+ signal soda_cmd_reg_full_S : std_logic;
+ signal soda_cmd_reg_S : std_logic_vector(31 downto 0) := (others => '0'); -- from super-burst-nr-generator
begin
@@ -189,6 +189,21 @@ begin
end if;
end process;
+ soda_cmd_reg_proc : process(SODACLK)
+ begin
+ if rising_edge(SODACLK) then
+ if (RESET='1') then
+ soda_cmd_reg_full_S <= '0';
+ soda_cmd_reg_S <= (others => '0');
+ elsif (soda_pkt_valid_S = '1') then
+ soda_cmd_reg_full_S <= '1';
+ soda_cmd_reg_S <= '0' & soda_cmd_word_S;
+
+ end if;
+ end if;
+ end process;
+
+
--soda_packet_fill_proc : process(SODACLK, packet_state_S)
--begin
--if rising_edge(SODACLK) then
diff --git a/source/soda_source.vhd b/source/soda_source.vhd
index 0bc1705..6f2b853 100644
--- a/source/soda_source.vhd
+++ b/source/soda_source.vhd
@@ -14,8 +14,6 @@ entity soda_source is
SYSCLK : in std_logic; -- fabric clock
SODACLK : in std_logic; -- clock for data to serdes
RESET : in std_logic; -- synchronous reset
- CLEAR : in std_logic; -- asynchronous reset
- CLK_EN : in std_logic;
--Internal Connection
SODA_BURST_PULSE_IN : in std_logic := '0'; --
@@ -79,8 +77,6 @@ begin
port map(
SODACLK => SODACLK,
RESET => RESET,
- CLEAR => '0',
- CLK_EN => CLK_EN,
--Internal Connection
SODA_BURST_PULSE_IN => SODA_BURST_PULSE_IN,
START_OF_SUPERBURST_OUT => start_of_superburst_S,
@@ -91,8 +87,6 @@ begin
port map(
SODACLK => SODACLK,
RESET => RESET,
- CLEAR => '0',
- CLK_EN => CLK_EN,
--Internal Connection
LINK_PHASE_IN => LINK_PHASE_IN, --link_phase_S, PL!
SODA_CMD_STROBE_IN => soda_cmd_strobe_sodaclk_S,
@@ -152,10 +146,10 @@ begin
begin
if( RESET = '1' ) then
TX_DLM_INIT_OUT <= '0';
- elsif ((start_of_superburst_S='1' or soda_cmd_strobe_S='1') and LINK_PHASE_IN=c_IN_SYNC) then
+ elsif ((start_of_superburst_S='1' or soda_cmd_strobe_sodaclk_S='1') and LINK_PHASE_IN=c_IN_SYNC) then
TX_DLM_INIT_OUT <= '1';
elsif rising_edge(SODACLK) then
- if (start_of_superburst_S='1' or soda_cmd_strobe_S='1') then
+ if (start_of_superburst_S='1' or soda_cmd_strobe_sodaclk_S='1') then
TX_DLM_INIT_OUT <= '1';
else
TX_DLM_INIT_OUT <= '0';
diff --git a/source/soda_superburst_gen.vhd b/source/soda_superburst_gen.vhd
index 94f2553..518fe60 100644
--- a/source/soda_superburst_gen.vhd
+++ b/source/soda_superburst_gen.vhd
@@ -17,8 +17,6 @@ entity soda_superburst_generator is
port(
SODACLK : in std_logic; -- fabric clock
RESET : in std_logic; -- synchronous reset
- CLEAR : in std_logic; -- asynchronous reset
- CLK_EN : in std_logic;
--Internal Connection
SODA_BURST_PULSE_IN : in std_logic := '0'; --
START_OF_SUPERBURST_OUT : out std_logic := '0';
diff --git a/source/trb3_periph_sodaclient.vhd b/source/trb3_periph_sodaclient.vhd
index 2d3d483..b3350f2 100644
--- a/source/trb3_periph_sodaclient.vhd
+++ b/source/trb3_periph_sodaclient.vhd
@@ -576,10 +576,14 @@ THE_SYNC_LINK : med_ecp3_sfp_sync_up
---------------------------------------------------------------------------
-- LED
---------------------------------------------------------------------------
- LED_ORANGE <= not reset_i when rising_edge(clk_sys_internal);
- LED_YELLOW <= soda_leds(0); --'1';
- LED_GREEN <= not med_stat_op(9);
- LED_RED <= not (med_stat_op(10) or med_stat_op(11));
+ LED_ORANGE <= med_stat_op(8);
+ LED_YELLOW <= med_stat_op(10);
+ LED_GREEN <= med_stat_op(9);
+ LED_RED <= med_stat_op(6);
+-- LED_ORANGE <= not reset_i when rising_edge(clk_sys_internal);
+-- LED_YELLOW <= soda_leds(0); --'1';
+-- LED_GREEN <= not med_stat_op(9);
+-- LED_RED <= not (med_stat_op(10) or med_stat_op(11));
-- LED_ORANGE <= soda_leds(0);
-- LED_YELLOW <= soda_leds(1);
-- LED_GREEN <= soda_leds(2);
diff --git a/source/trb3_periph_sodasource.vhd b/source/trb3_periph_sodasource.vhd
index e5795f5..a98540c 100644
--- a/source/trb3_periph_sodasource.vhd
+++ b/source/trb3_periph_sodasource.vhd
@@ -586,8 +586,6 @@ THE_SODA_SOURCE : soda_source
SYSCLK => clk_sys_i,
SODACLK => clk_raw_internal,
RESET => reset_i,
- CLEAR => clear_i,
- CLK_EN => '1',
--Internal Connection
SODA_BURST_PULSE_IN => SOB_S,
@@ -611,10 +609,14 @@ THE_SODA_SOURCE : soda_source
---------------------------------------------------------------------------
-- LED
---------------------------------------------------------------------------
- LED_ORANGE <= not reset_i when rising_edge(clk_sys_internal);
- LED_YELLOW <= soda_leds(0); --'1';
- LED_GREEN <= not med_stat_op(9);
- LED_RED <= not (med_stat_op(10) or med_stat_op(11));
+ LED_ORANGE <= med_stat_op(16+8);
+ LED_YELLOW <= med_stat_op(16+10);
+ LED_GREEN <= med_stat_op(16+9);
+ LED_RED <= med_stat_op(16+6);
+-- LED_ORANGE <= not reset_i when rising_edge(clk_sys_internal);
+-- LED_YELLOW <= soda_leds(0); --'1';
+-- LED_GREEN <= not med_stat_op(9);
+-- LED_RED <= not (med_stat_op(10) or med_stat_op(11));
-- LED_ORANGE <= soda_leds(0);
-- LED_YELLOW <= soda_leds(1);
-- LED_GREEN <= soda_leds(2);
--
2.43.0