From 31de7140809c9a0687594c3678a2cf3474d24024 Mon Sep 17 00:00:00 2001 From: hadeshyp Date: Wed, 15 Sep 2010 14:19:06 +0000 Subject: [PATCH] *** empty log message *** --- constraints.lpf | 9 +++++++ design2/data_handler.vhd | 8 +++--- design2/mdc_control.vhd | 3 +++ design2/trigger_handler.vhd | 4 +++ mdc_oepb.prj | 2 +- mdc_oepb.vhd | 50 ++++++++++++++++++++++--------------- 6 files changed, 52 insertions(+), 24 deletions(-) diff --git a/constraints.lpf b/constraints.lpf index 8f6f726..9592385 100644 --- a/constraints.lpf +++ b/constraints.lpf @@ -7,6 +7,15 @@ FREQUENCY NET THE_MED_INTERFACE_ff_txfullclk 25 MHz; FREQUENCY NET THE_MED_INTERFACE/ff_rxfullclk 25 MHz; FREQUENCY NET THE_MED_INTERFACE_ff_rxfullclk 25 MHz; + FREQUENCY NET THE_MED_INTERFACE/ff_txfullclk_c 25 MHz; + FREQUENCY NET THE_MED_INTERFACE_ff_txfullclk_c 25 MHz; + FREQUENCY NET THE_MED_INTERFACE/ff_rxfullclk_c 25 MHz; + FREQUENCY NET THE_MED_INTERFACE_ff_rxfullclk_c 25 MHz; + + BLOCK NET "reset" ; + + GSR_NET NET "gsr_n"; + GSR_NET NET "pll_locked"; # MULTICYCLE FROM CELL reset 2.0 x; \ No newline at end of file diff --git a/design2/data_handler.vhd b/design2/data_handler.vhd index fd0ae00..d7d41a3 100644 --- a/design2/data_handler.vhd +++ b/design2/data_handler.vhd @@ -336,7 +336,7 @@ begin when STATUS_WRITE => data_i <= word_status; data_write_buf := '1'; - statram_din <= stat_data_diff_i; + statram_din <= STAT_DATA_IN; statram_write <= '1'; if stat_addr_i = unsigned(NUMBER_OF_STAT_WORDS) - to_unsigned(1,1) then current_state <= STATUS_FINISHED; @@ -347,11 +347,13 @@ begin when STATUS_FINISHED => stat_addr_i <= (others => '1'); data_finished_i <= '1'; - current_state <= IDLE; + current_state <= FINISH; when FINISH => data_finished_i <= '1'; - current_state <= IDLE; + if FINISHED_CYCLE_IN = '1' then + current_state <= IDLE; + end if; when others => current_state <= IDLE; diff --git a/design2/mdc_control.vhd b/design2/mdc_control.vhd index 78bef65..512b65f 100644 --- a/design2/mdc_control.vhd +++ b/design2/mdc_control.vhd @@ -452,6 +452,9 @@ begin end if; end process; +counter_retransmit_received_i <= (others => '0'); +counter_retransmit_sent_i <= (others => '0'); + -- ------------------------------------------------------------------------------- -- -- Readback FiFo -- ------------------------------------------------------------------------------- diff --git a/design2/trigger_handler.vhd b/design2/trigger_handler.vhd index 19eaf6f..eea9c58 100644 --- a/design2/trigger_handler.vhd +++ b/design2/trigger_handler.vhd @@ -128,6 +128,7 @@ begin current_state <= TIMING_TRIGGER; timer_clear <= '1'; start_trigger_i <= '1'; + inc_trigger_counter <= '1'; elsif LVL1_VALID_NOTIMING_TRG_IN = '1' and LVL1_TRG_TYPE_IN = x"9" then current_state <= CALIB_TRIGGER; start_calib_i <= '1'; @@ -135,6 +136,7 @@ begin current_state <= WAIT_FOR_FINISHED_STORING; start_send_data_i <= '1'; elsif LVL1_VALID_NOTIMING_TRG_IN = '1' then + start_readout_i <= '1'; --dummy to get trigger released current_state <= RELEASE_LVL1; end if; elsif LVL1_VALID_NOTIMING_TRG_IN = '1' or LVL1_VALID_TIMING_TRG_IN = '1' then @@ -169,6 +171,7 @@ begin when CALIB_TRIGGER => if CAL1_LOADED_IN = '1' then current_state <= DO_READOUT; + inc_calib_counter <= '1'; start_readout_i <= '1'; end if; @@ -198,6 +201,7 @@ begin when RELEASE_LVL1 => lvl1_release_i <= '1'; + finished_readout_i <= '1'; if LVL1_TRG_DATA_VALID_IN = '0' then current_state <= IDLE; finished_cycle_i <= '1'; diff --git a/mdc_oepb.prj b/mdc_oepb.prj index d5539ca..603491b 100644 --- a/mdc_oepb.prj +++ b/mdc_oepb.prj @@ -47,7 +47,7 @@ add_file -vhdl -lib work "../trbnet/lattice/ecp2m/lattice_ecp2m_fifo_18x1k.vhd" add_file -vhdl -lib work "../trbnet/lattice/ecp2m/trb_net16_fifo_arch.vhd" add_file -vhdl -lib work "../trbnet/lattice/ecp2m/lattice_ecp2m_fifo_16bit_dualport.vhd" add_file -vhdl -lib work "../trbnet/lattice/ecp2m/trb_net_fifo_16bit_bram_dualport.vhd" -add_file -vhdl -lib work "../trbnet/media_interfaces/trb_net16_med_ecp_fot_old.vhd" +add_file -vhdl -lib work "../trbnet/media_interfaces/trb_net16_med_ecp_fot.vhd" add_file -vhdl -lib work "../trbnet/media_interfaces/trb_net16_lsm_sfp.vhd" add_file -vhdl -lib work "../trbnet/media_interfaces/ecp2m_fot/serdes_fot_0.vhd" add_file -vhdl -lib work "../trbnet/media_interfaces/trb_net16_tx_control.vhd" diff --git a/mdc_oepb.vhd b/mdc_oepb.vhd index c13d606..cb64139 100644 --- a/mdc_oepb.vhd +++ b/mdc_oepb.vhd @@ -101,6 +101,7 @@ architecture mdc_oepb_arch of mdc_oepb is signal reset_sync : std_logic; signal reset_async : std_logic; signal reset_counter : unsigned(23 downto 0); + signal gsr_n : std_logic; --Media Interface to internal logic signal med_data_in : std_logic_vector(16-1 downto 0); @@ -280,7 +281,8 @@ begin LOCK => pll_locked ); - reset_async <= not pll_locked; + reset_async <= not gsr_n; + gsr_n <= pll_locked; --------------------------------------------------------------------- -- Reset handler @@ -837,14 +839,14 @@ begin CLK => clk_100, RESET => reset_internal, - A_ADD => TAD, - A_AOD => TAOD, - A_DST => TDST, - A_RDM => RDYI, - A_GDE => GDE, + A_ADD => open,--TAD, + A_AOD => open,--TAOD, + A_DST => open,--TDST, + A_RDM => open,--RDYI, + A_GDE => open,--GDE, A_RDO => TRDYO, - A_MOD => MODD, - A_RES => RES, + A_MOD => open,--MODD, + A_RES => open,--RES, A_TOK => TOK, A_WRM => WRM, A_RESERVE => TRSV, @@ -901,10 +903,12 @@ begin ------------------------------------------------------------------------------- -- LED ------------------------------------------------------------------------------- - D(4) <= not buf_restart_led; -- toggle with restart - D(3) <= not buf_request_led; -- toggle with request - D(2) <= not buf_reset_led; -- toggle with network reset - D(1) <= med_stat_debug(51); -- not comma locked +-- D(4) <= not buf_restart_led; -- toggle with restart +-- D(3) <= not buf_request_led; -- toggle with request +-- D(2) <= not buf_reset_led; -- toggle with network reset +-- D(1) <= med_stat_debug(51); -- not comma locked + +D <= not MED_STAT_OP(7 downto 4); process(clk_100) @@ -930,14 +934,20 @@ begin buf_request_led <= not buf_request_led; end if; --- TAD <= MED_STAT_DEBUG(26 downto 18); --rx data & k --- TAOD<= MED_STAT_DEBUG(52); --c_reset --- TDST<= MED_STAT_DEBUG(53); --cnt(4) --- GDE <= reset_internal; --- RDYI <= reset_startup; --- MODD <= MED_STAT_OP(14); --- RES <= MED_STAT_OP(15); --- TOK <= MED_STAT_OP(13); + + +TAD(3 downto 0) <= MED_STAT_OP(7 downto 4); +TAD(4) <= reset_internal; +TAD(5) <= reset_startup; +TAD(6) <= reset_async; +TAD(7) <= MED_STAT_DEBUG(49); +TAD(8) <= MED_STAT_DEBUG(50); +TAOD <= MED_STAT_DEBUG(51); +TDST <= MED_STAT_DEBUG(52); +RDYI <= MED_STAT_DEBUG(53); +GDE <= MED_STAT_DEBUG(54); +MODD <= MED_STAT_DEBUG(55); +RES <= MED_STAT_DEBUG(63); end if; end process; -- 2.43.0