Commit cdabc78f authored by egousiou's avatar egousiou

inputs cyc and fd_rxa deleted from pinlist and design

git-svn-id: http://svn.ohwr.org/cern-fip/trunk/hdl/design@59 7f0067c9-7624-46c7-bd39-3fb5400c0213
parent 02c4dba5
...@@ -105,10 +105,10 @@ set_io {c_id_i[3]} \ ...@@ -105,10 +105,10 @@ set_io {c_id_i[3]} \
-DIRECTION Input -DIRECTION Input
set_io cyc_i \ #set_io cyc_i \
-pinname 75 \ # -pinname 75 \
-fixed yes \ # -fixed yes \
-DIRECTION Input # -DIRECTION Input
set_io {dat_i[0]} \ set_io {dat_i[0]} \
...@@ -333,10 +333,10 @@ set_io fd_wdgn_i \ ...@@ -333,10 +333,10 @@ set_io fd_wdgn_i \
-DIRECTION Input -DIRECTION Input
set_io fx_rxa_i \ #set_io fx_rxa_i \
-pinname 121 \ # -pinname 121 \
-fixed yes \ # -fixed yes \
-DIRECTION Input # -DIRECTION Inout
set_io fx_rxd_i \ set_io fx_rxd_i \
...@@ -560,98 +560,3 @@ set_io we_i \ ...@@ -560,98 +560,3 @@ set_io we_i \
# Non IO constraints # Non IO constraints
# #
#
# Old IO constraints, commented out for reference
#
# set_io ack_o -pinname 77 -fixed yes -DIRECTION Output
# set_io {adr_i[0]} -pinname 3 -fixed yes -DIRECTION Input
# set_io {adr_i[1]} -pinname 4 -fixed yes -DIRECTION Input
# set_io {adr_i[2]} -pinname 5 -fixed yes -DIRECTION Input
# set_io {adr_i[3]} -pinname 6 -fixed yes -DIRECTION Input
# set_io {adr_i[4]} -pinname 7 -fixed yes -DIRECTION Input
# set_io {adr_i[5]} -pinname 8 -fixed yes -DIRECTION Input
# set_io {adr_i[6]} -pinname 10 -fixed yes -DIRECTION Input
# set_io {adr_i[7]} -pinname 11 -fixed yes -DIRECTION Input
# set_io {adr_i[8]} -pinname 12 -fixed yes -DIRECTION Input
# set_io {adr_i[9]} -pinname 13 -fixed yes -DIRECTION Input
# set_io {c_id_i[0]} -pinname 179 -fixed yes -DIRECTION Input
# set_io {c_id_i[1]} -pinname 180 -fixed yes -DIRECTION Input
# set_io {c_id_i[2]} -pinname 181 -fixed yes -DIRECTION Input
# set_io {c_id_i[3]} -pinname 182 -fixed yes -DIRECTION Input
# set_io cyc_i -pinname 75 -fixed yes -DIRECTION Input
# set_io {dat_i[0]} -pinname 205 -fixed yes -DIRECTION Input
# set_io {dat_i[1]} -pinname 204 -fixed yes -DIRECTION Input
# set_io {dat_i[2]} -pinname 203 -fixed yes -DIRECTION Input
# set_io {dat_i[3]} -pinname 202 -fixed yes -DIRECTION Input
# set_io {dat_i[4]} -pinname 201 -fixed yes -DIRECTION Input
# set_io {dat_i[5]} -pinname 199 -fixed yes -DIRECTION Input
# set_io {dat_i[6]} -pinname 198 -fixed yes -DIRECTION Input
# set_io {dat_i[7]} -pinname 197 -fixed yes -DIRECTION Input
# set_io {dat_i[8]} -pinname 196 -fixed yes -DIRECTION Input
# set_io {dat_i[9]} -pinname 194 -fixed yes -DIRECTION Input
# set_io {dat_i[10]} -pinname 193 -fixed yes -DIRECTION Input
# set_io {dat_i[11]} -pinname 192 -fixed yes -DIRECTION Input
# set_io {dat_i[12]} -pinname 191 -fixed yes -DIRECTION Input
# set_io {dat_i[13]} -pinname 190 -fixed yes -DIRECTION Input
# set_io {dat_i[14]} -pinname 189 -fixed yes -DIRECTION Input
# set_io {dat_i[15]} -pinname 188 -fixed yes -DIRECTION Input
# set_io {dat_o[0]} -pinname 48 -fixed yes -DIRECTION Output
# set_io {dat_o[1]} -pinname 49 -fixed yes -DIRECTION Output
# set_io {dat_o[2]} -pinname 55 -fixed yes -DIRECTION Output
# set_io {dat_o[3]} -pinname 56 -fixed yes -DIRECTION Output
# set_io {dat_o[4]} -pinname 57 -fixed yes -DIRECTION Output
# set_io {dat_o[5]} -pinname 58 -fixed yes -DIRECTION Output
# set_io {dat_o[6]} -pinname 59 -fixed yes -DIRECTION Output
# set_io {dat_o[7]} -pinname 60 -fixed yes -DIRECTION Output
# set_io {dat_o[8]} -pinname 61 -fixed yes -DIRECTION Output
# set_io {dat_o[9]} -pinname 63 -fixed yes -DIRECTION Output
# set_io {dat_o[10]} -pinname 64 -fixed yes -DIRECTION Output
# set_io {dat_o[11]} -pinname 66 -fixed yes -DIRECTION Output
# set_io {dat_o[12]} -pinname 68 -fixed yes -DIRECTION Output
# set_io {dat_o[13]} -pinname 69 -fixed yes -DIRECTION Output
# set_io {dat_o[14]} -pinname 70 -fixed yes -DIRECTION Output
# set_io {dat_o[15]} -pinname 73 -fixed yes -DIRECTION Output
# set_io fd_rstn_o -pinname 118 -fixed yes -DIRECTION Output
# set_io fd_txck_o -pinname 129 -fixed yes -DIRECTION Output
# set_io fd_txena_o -pinname 119 -fixed yes -DIRECTION Output
# set_io fd_txer_i -pinname 128 -fixed yes -DIRECTION Input
# set_io fd_wdgn_i -pinname 120 -fixed yes -DIRECTION Input
# set_io fx_rxa_i -pinname 121 -fixed yes -DIRECTION Input
# set_io fx_rxd_i -pinname 127 -fixed yes -DIRECTION Input
# set_io fx_txd_o -pinname 131 -fixed yes -DIRECTION Output
# set_io {m_id_i[0]} -pinname 172 -fixed yes -DIRECTION Input
# set_io {m_id_i[1]} -pinname 173 -fixed yes -DIRECTION Input
# set_io {m_id_i[2]} -pinname 174 -fixed yes -DIRECTION Input
# set_io {m_id_i[3]} -pinname 175 -fixed yes -DIRECTION Input
# set_io nostat_i -pinname 185 -fixed yes -DIRECTION Input
# set_io {p3_lgth_i[0]} -pinname 166 -fixed yes -DIRECTION Input
# set_io {p3_lgth_i[1]} -pinname 167 -fixed yes -DIRECTION Input
# set_io {p3_lgth_i[2]} -pinname 168 -fixed yes -DIRECTION Input
# set_io {rate_i[0]} -pinname 111 -fixed yes -DIRECTION Input
# set_io {rate_i[1]} -pinname 112 -fixed yes -DIRECTION Input
# set_io rst_i -pinname 92 -fixed yes -DIRECTION Input
# set_io rstin_i -pinname 93 -fixed yes -DIRECTION Input
# set_io rston_o -pinname 94 -fixed yes -DIRECTION Output
# set_io {s_id_o[0]} -pinname 176 -fixed yes -DIRECTION Output
# set_io {s_id_o[1]} -pinname 177 -fixed yes -DIRECTION Output
# set_io slone_i -pinname 184 -fixed yes -DIRECTION Input
# set_io stb_i -pinname 76 -fixed yes -DIRECTION Input
# set_io {subs_i[0]} -pinname 149 -fixed yes -DIRECTION Input
# set_io {subs_i[1]} -pinname 150 -fixed yes -DIRECTION Input
# set_io {subs_i[2]} -pinname 151 -fixed yes -DIRECTION Input
# set_io {subs_i[3]} -pinname 152 -fixed yes -DIRECTION Input
# set_io {subs_i[4]} -pinname 153 -fixed yes -DIRECTION Input
# set_io {subs_i[5]} -pinname 158 -fixed yes -DIRECTION Input
# set_io {subs_i[6]} -pinname 159 -fixed yes -DIRECTION Input
# set_io {subs_i[7]} -pinname 160 -fixed yes -DIRECTION Input
# set_io uclk_i -pinname 136 -fixed yes -DIRECTION Input
# set_io var1_acc_i -pinname 82 -fixed yes -DIRECTION Input
# set_io var1_rdy_o -pinname 83 -fixed yes -DIRECTION Output
# set_io var2_acc_i -pinname 84 -fixed yes -DIRECTION Input
# set_io var2_rdy_o -pinname 86 -fixed yes -DIRECTION Output
# set_io var3_acc_i -pinname 87 -fixed yes -DIRECTION Input
# set_io var3_rdy_o -pinname 90 -fixed yes -DIRECTION Output
# set_io wclk_i -pinname 28 -fixed yes -DIRECTION Input
# set_io we_i -pinname 74 -fixed yes -DIRECTION Input
-------------------------------------------------------------------------------
--! @file dpblockram.vhd
-------------------------------------------------------------------------------
--! Standard library
library IEEE;
--! Standard packages
use IEEE.STD_LOGIC_1164.all; --! std_logic definitions
use IEEE.NUMERIC_STD.all; --! conversion functions
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- --
-- CERN, BE --
-- --
-------------------------------------------------------------------------------
--
-- unit name: dpblockram.vhd
--
--! @brief The dpblockram implements a template for a true dual port ram clocked on both ports by the same clock.
--!
--! @author <Pablo Alvarez(pablo.alvarez.sanchez@cern.ch)>
--
--! @date 24\01\2009
--
--! @version 1
--
--! @details
--!
--! <b>Dependencies:</b>\n
--!
--!
--! <b>References:</b>\n
--! <reference one> \n
--! <reference two>
--!
--! <b>Modified by:</b>\n
--! Author: <name>
-------------------------------------------------------------------------------
--! \n\n<b>Last changes:</b>\n
--! 24\01\2009 paas header included\n
--! <extended description>
-------------------------------------------------------------------------------
--! @todo Adapt vhdl sintax to ohr standard\n
--! <another thing to do> \n
--
-------------------------------------------------------------------------------
entity dpblockram_clka_rd_clkb_wr is
generic (c_dl : integer := 42; -- Length of the data word
c_al : integer := 10); -- Number of words
-- 'nw' has to be coherent with 'c_al'
port (clka_i : in std_logic; -- Global Clock
aa_i : in std_logic_vector(c_al - 1 downto 0);
da_o : out std_logic_vector(c_dl -1 downto 0);
clkb_i : in std_logic;
ab_i : in std_logic_vector(c_al - 1 downto 0);
db_i : in std_logic_vector(c_dl - 1 downto 0);
web_i : in std_logic);
end dpblockram_clka_rd_clkb_wr;
--library synplify;
--use synplify.attributes.all;
architecture beh of dpblockram_clka_rd_clkb_wr is
type t_ram is array (2**c_al - 1 downto 0) of std_logic_vector (c_dl - 1 downto 0);
shared variable s_ram : t_ram := (others => (others => '0'));
--attribute syn_ramstyle : string;
--attribute syn_ramstyle of s_ram : variable is "block_ram";
--attribute syn_ramstyle of RAM : signal is "select_ram";
--attribute syn_ramstyle of RAM : signal is "area ";
begin
process (clkb_i)
begin
if (clkb_i'event and clkb_i = '1') then
if (web_i = '1') then
s_ram(to_integer(unsigned(ab_i))) := db_i;
end if;
end if;
end process;
process (clka_i)
begin
if (clka_i'event and clka_i = '1') then
da_o <= s_ram(to_integer(unsigned(aa_i)));
end if;
end process;
end beh;
\ No newline at end of file
...@@ -111,19 +111,19 @@ memory_triplication: for I in 0 to 2 generate ...@@ -111,19 +111,19 @@ memory_triplication: for I in 0 to 2 generate
UDualClkRam : DualClkRam UDualClkRam : DualClkRam
port map ( DINA => s_zeros, port map ( DINA => s_zeros,
ADDRA => addr_A_i, ADDRA => addr_A_i,
RWA => one, RWA => one,
CLKA => clk_A_i, CLKA => clk_A_i,
DINB => data_B_i, DINB => data_B_i,
ADDRB => addr_B_i, ADDRB => addr_B_i,
RWB => s_rwB, RWB => s_rwB,
CLKB => clk_B_i, CLKB => clk_B_i,
RESETn => one, RESETn => one,
DOUTA => data_o_A_array(I), DOUTA => data_o_A_array(I),
DOUTB => open) ; DOUTB => open) ;
end generate; end generate;
......
...@@ -147,7 +147,7 @@ entity nanofip is ...@@ -147,7 +147,7 @@ entity nanofip is
fd_txena_o: out std_logic; --! Transmitter enable fd_txena_o: out std_logic; --! Transmitter enable
fd_txck_o : out std_logic; --! Line driver half bit clock fd_txck_o : out std_logic; --! Line driver half bit clock
fx_txd_o : out std_logic; --! Transmitter data fx_txd_o : out std_logic; --! Transmitter data
fx_rxa_i : in std_logic; --! Reception activity detection -- fx_rxa_i : inout std_logic; --! Reception activity detection
fx_rxd_i : in std_logic; --! Receiver data fx_rxd_i : in std_logic; --! Receiver data
...@@ -225,7 +225,7 @@ entity nanofip is ...@@ -225,7 +225,7 @@ entity nanofip is
rst_i : in std_logic; --! Wishbone reset. Does not reset other internal logic. rst_i : in std_logic; --! Wishbone reset. Does not reset other internal logic.
stb_i : in std_logic; --! Strobe stb_i : in std_logic; --! Strobe
ack_o : out std_logic; --! Acknowledge ack_o : out std_logic; --! Acknowledge
cyc_i : in std_logic; -- cyc_i : inout std_logic;
we_i : in std_logic --! Write enable we_i : in std_logic --! Write enable
); );
...@@ -281,8 +281,7 @@ architecture struc of nanofip is ...@@ -281,8 +281,7 @@ architecture struc of nanofip is
signal fss_decoded_p_from_rx : std_logic; signal fss_decoded_p_from_rx : std_logic;
signal s_stat : std_logic_vector(7 downto 0); signal s_stat : std_logic_vector(7 downto 0);
signal s_ack_produced, s_ack_consumed, s_ack_o: std_logic; signal s_ack_produced, s_ack_consumed, s_ack_o: std_logic;
signal s_stat_sent_p, s_sending_stat: std_logic; signal s_reset_status_bytes, s_sending_mps: std_logic;
signal s_mps_sent_p: std_logic;
signal s_code_violation_p : std_logic; signal s_code_violation_p : std_logic;
signal s_crc_bad_p : std_logic; signal s_crc_bad_p : std_logic;
signal s_var1_rdy : std_logic; signal s_var1_rdy : std_logic;
...@@ -291,7 +290,7 @@ architecture struc of nanofip is ...@@ -291,7 +290,7 @@ architecture struc of nanofip is
signal s_mps : std_logic_vector(7 downto 0); signal s_mps : std_logic_vector(7 downto 0);
signal s_wb_d_d : std_logic_vector(15 downto 0); signal s_wb_d_d : std_logic_vector(15 downto 0);
signal s_m_id_dec_o, s_c_id_dec_o : std_logic_vector(7 downto 0); signal s_m_id_dec_o, s_c_id_dec_o : std_logic_vector(7 downto 0);
signal s_stb_d, s_we_d, s_fx_rxa : std_logic; signal s_stb_d, s_we_d : std_logic;
signal s_adr_d : std_logic_vector ( 9 downto 0); signal s_adr_d : std_logic_vector ( 9 downto 0);
begin begin
...@@ -304,7 +303,8 @@ begin ...@@ -304,7 +303,8 @@ begin
rston_o => rston_o, rston_o => rston_o,
var_i => s_var_from_control, var_i => s_var_from_control,
rst_o => s_rst rst_o => s_rst,
fd_rst_o => fd_rstn_o
); );
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
...@@ -398,7 +398,7 @@ begin ...@@ -398,7 +398,7 @@ begin
slone_i => slone_i, slone_i => slone_i,
nostat_i => nostat_i, nostat_i => nostat_i,
subs_i => subs_i, subs_i => subs_i,
sending_stat_o => s_sending_stat, sending_mps_o => s_sending_mps,
stat_i => s_stat, stat_i => s_stat,
mps_i => s_mps, mps_i => s_mps,
var_i => s_var_from_control, var_i => s_var_from_control,
...@@ -429,25 +429,13 @@ begin ...@@ -429,25 +429,13 @@ begin
var1_access_a_i => var1_acc_i, var1_access_a_i => var1_acc_i,
var2_access_a_i => var2_acc_i, var2_access_a_i => var2_acc_i,
var3_access_a_i => var3_acc_i, var3_access_a_i => var3_acc_i,
stat_sent_p_i => s_stat_sent_p, reset_status_bytes_i => s_reset_status_bytes,
mps_sent_p_i => s_mps_sent_p,
stat_o => s_stat, stat_o => s_stat,
mps_o => s_mps mps_o => s_mps
); );
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
ack_o <= (s_ack_produced or s_ack_consumed) and stb_i; Uwf_dec_m_ids : wf_dec_m_ids
s_ack_o <= s_ack_produced or s_ack_consumed;
s_stat_sent_p <= s_sending_stat and s_byte_to_tx_ready_p;
s_mps_sent_p <= s_sending_stat and s_byte_to_tx_ready_p;
--fd_rstn_o <= cyc_i and fx_rxa_i;
--s_fx_rxa <= fx_rxa_i;
-- s_id_o <= "0" & fx_rxa_i; -- I connect fx_rxa_i to s_id_o just to test the pinout
fd_rstn_o <= fd_wdgn_i and cyc_i and fx_rxa_i; -- just to check place+route; as to be changed!!!!!!!
---------------------------------------------------------------------------------------------------
Uwf_dec_m_ids : wf_dec_m_ids
port map( port map(
uclk_i => uclk_i, uclk_i => uclk_i,
rst_i => s_rst, rst_i => s_rst,
...@@ -477,6 +465,20 @@ begin ...@@ -477,6 +465,20 @@ begin
end if; end if;
end process; end process;
---------------------------------------------------------------------------------------------------
ack_o <= (s_ack_produced or s_ack_consumed) and stb_i;
s_ack_o <= s_ack_produced or s_ack_consumed;
s_reset_status_bytes <= s_sending_mps and s_byte_to_tx_ready_p;
-- fx_rxa_i <= 'Z';
-- cyc_i <= 'Z';
-- s_id_o <= "0" & fx_rxa_i; -- I connect fx_rxa_i to s_id_o just to test the pinout
---------------------------------------------------------------------------------------------------
end architecture struc; end architecture struc;
--============================================================================ --============================================================================
--============================================================================ --============================================================================
......
...@@ -59,22 +59,24 @@ use work.wf_package.all; ...@@ -59,22 +59,24 @@ use work.wf_package.all;
--! Entity declaration for reset_logic --! Entity declaration for reset_logic
--============================================================================ --============================================================================
entity reset_logic is entity reset_logic is
generic(c_reset_length : integer := 4); --! Reset counter length. 4==> 16 uclk_i ticks generic(c_reset_length : integer := 4); --! Reset counter length. 4==> 16 uclk_i ticks
port ( port (
uclk_i : in std_logic; --! User Clock uclk_i : in std_logic; --! 40MHz clock
rstin_i : in std_logic; --! Initialisation control, active low
var_i : in t_var; --! Received variable
rstin_i : in std_logic; --! Initialisation control, active low
--! Reset output, active low. Active when the reset variable is received rston_o : out std_logic; --! Reset output, active low.
--! and the second byte contains the station address. -- Active when the reset variable is received
rston_o : out std_logic; --! Reset output, active low -- and the second byte contains the station address.
var_i : in t_var; --! Received variable rst_o : out std_logic; --! Reset ouput active high
rst_o : out std_logic --! Reset ouput active high
fd_rst_o : out std_logic --! fieldrive reset, active low
); -- Active when the reset variable is received
-- and the first byte contains the station address.
);
end entity reset_logic; end entity reset_logic;
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
...@@ -83,35 +85,63 @@ end entity reset_logic; ...@@ -83,35 +85,63 @@ end entity reset_logic;
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
architecture rtl of reset_logic is architecture rtl of reset_logic is
--attribute syn_radhardlevel : string;
--attribute syn_radhardlevel of rtl: architecture is "tmr";
signal s_rstin_d : std_logic_vector(1 downto 0);
signal s_rst_c : unsigned(4 downto 0);
signal s_reload_rst_c : std_logic;
begin
process(s_rstin_d,var_i)
begin
if (var_i = c_var_array(c_reset_var_pos).var) then
s_reload_rst_c <= '1';
else
s_reload_rst_c <= s_rstin_d(s_rstin_d'left);
end if;
end process;
process(uclk_i) signal s_rstin_buff : std_logic_vector(1 downto 0);
begin signal s_rst_c, s_rstin_c : unsigned(4 downto 0);
if rising_edge(uclk_i) then signal s_reload_rst_c, rst_o2, s_rstin_c_start, s_reset : std_logic;
s_rstin_d <= s_rstin_d(0) & (not rstin_i);
if (s_reload_rst_c = '1') then begin
s_rst_c <= to_unsigned(0, s_rst_c'length);
elsif s_rst_c(s_rst_c'left) = '0' then process(s_rstin_buff,var_i)
s_rst_c <= s_rst_c + 1; begin
if (var_i = c_var_array(c_reset_var_pos).var) then
s_reload_rst_c <= '1';
else
s_reload_rst_c <= s_rstin_buff(s_rstin_buff'left);
end if; end if;
rst_o <= not s_rst_c(s_rst_c'left); end process;
rston_o <= s_rst_c(s_rst_c'left);
end if; process(uclk_i)
begin
if rising_edge(uclk_i) then
s_rstin_buff <= s_rstin_buff(0) & (not rstin_i);
if (s_reload_rst_c = '1') then
s_rst_c <= to_unsigned(0, s_rst_c'length);
elsif s_rst_c(s_rst_c'left) = '0' then
s_rst_c <= s_rst_c + 1;
end if;
rst_o <= not s_rst_c(s_rst_c'left);
rston_o <= s_rst_c(s_rst_c'left);
fd_rst_o <= s_rst_c(s_rst_c'left);
---------------------------------------------------------------------------------------------------
-- if (s_rstin_buff(0) = '1') and (s_rstin_buff(1) /= '1') then
-- s_rstin_c_start <= '1';
-- s_rstin_c <= to_unsigned(0, s_rstin_c'length);
-- end if;
-- if s_rstin_c_start = '1' then
-- if rstin_i = '0' then
-- s_rstin_c <= s_rstin_c+1;
-- end if;
-- end if;
-- if s_rstin_c(s_rstin_c'left) = '1' then
-- s_rstin_c_start <='0';
-- s_reset <= rstin_i;
-- else
-- s_reset <= '1';
-- end if;
-- rst_o2 <= not (s_reset);
end if;
end process; end process;
......
...@@ -63,56 +63,25 @@ use work.wf_package.all; ...@@ -63,56 +63,25 @@ use work.wf_package.all;
entity status_gen is entity status_gen is
port ( port (
uclk_i : in std_logic; --! User Clock uclk_i : in std_logic; --! User Clock
rst_i : in std_logic; rst_i : in std_logic;
------------------------------------------------------------------------------- fd_wdgn_i : in std_logic; --! Watchdog on transmitter
-- Connections to wf_tx_rx (WorldFIP received data) fd_txer_i : in std_logic; --! Transmitter error
-------------------------------------------------------------------------------
fd_wdgn_i : in std_logic; --! Watchdog on transmitter
fd_txer_i : in std_logic; --! Transmitter error
code_violation_p_i : in std_logic; code_violation_p_i : in std_logic;
crc_bad_p_i : in std_logic; crc_bad_p_i : in std_logic;
------------------------------------------------------------------------------- var1_rdy_i : in std_logic; --! Variable 1 ready
-- Connections to wf_engine var2_rdy_i : in std_logic; --! Variable 2 ready
------------------------------------------------------------------------------- var3_rdy_i : in std_logic; --! Variable 3 ready
--! Signals new data is received and can safely be read (Consumed var1_access_a_i : in std_logic; --! Variable 1 access
--! variable 05xyh). In stand-alone mode one may sample the data on the var2_access_a_i : in std_logic; --! Variable 2 access
--! first clock edge VAR1_RDY is high. var3_access_a_i : in std_logic; --! Variable 3 access
var1_rdy_i: in std_logic; --! Variable 1 ready reset_status_bytes_i : in std_logic;
--! Signals new data is received and can safely be read (Consumed
--! broadcast variable 04xyh). In stand-alone mode one may sample the
--! data on the first clock edge VAR1_RDY is high.
var2_rdy_i: in std_logic; --! Variable 2 ready
--! Signals that the variable can safely be written (Produced variable
--! 06xyh). In stand-alone mode, data is sampled on the first clock after
--! VAR_RDY is deasserted.
var3_rdy_i: in std_logic; --! Variable 3 ready
var1_access_a_i: in std_logic; --! Variable 1 access
var2_access_a_i: in std_logic; --! Variable 2 access
var3_access_a_i: in std_logic; --! Variable 3 access
-- reset_var1_access_o : out std_logic; --! Reset Variable 1 access flag
-- reset_var2_access_o : out std_logic; --! Reset Variable 2 access flag
-- reset_var3_access_o : out std_logic; --! Reset Variable 2 access flag
stat_sent_p_i : in std_logic;
mps_sent_p_i : in std_logic;
stat_o : out std_logic_vector(7 downto 0);
mps_o : out std_logic_vector(7 downto 0)
-------------------------------------------------------------------------------
-- Connections to data_if
-------------------------------------------------------------------------------
stat_o : out std_logic_vector(7 downto 0);
mps_o : out std_logic_vector(7 downto 0)
); );
...@@ -124,8 +93,7 @@ end entity status_gen; ...@@ -124,8 +93,7 @@ end entity status_gen;
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
architecture rtl of status_gen is architecture rtl of status_gen is
--attribute syn_radhardlevel : string;
--attribute syn_radhardlevel of rtl: architecture is "tmr";
signal s_stat : std_logic_vector(7 downto 0); signal s_stat : std_logic_vector(7 downto 0);
signal s_refreshment : std_logic; signal s_refreshment : std_logic;
signal s_var1_access: std_logic_vector(1 downto 0); --! Variable 1 access signal s_var1_access: std_logic_vector(1 downto 0); --! Variable 1 access
...@@ -135,65 +103,71 @@ signal s_var3_access: std_logic_vector(1 downto 0); --! Variable 3 access ...@@ -135,65 +103,71 @@ signal s_var3_access: std_logic_vector(1 downto 0); --! Variable 3 access
begin begin
process(uclk_i) process(uclk_i)
begin begin
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
s_var1_access(0) <= var1_access_a_i; s_var1_access(0) <= var1_access_a_i;
s_var2_access(0) <= var2_access_a_i; s_var2_access(0) <= var2_access_a_i;
s_var3_access(0) <= var3_access_a_i; s_var3_access(0) <= var3_access_a_i;
s_var1_access(1) <= s_var1_access(0); s_var1_access(1) <= s_var1_access(0);
s_var2_access(1) <= s_var2_access(0); s_var2_access(1) <= s_var2_access(0);
s_var3_access(1) <= s_var3_access(0); s_var3_access(1) <= s_var3_access(0);
end if; end if;
end process; end process;
process(uclk_i) process(uclk_i)
begin begin
if rising_edge(uclk_i) then
if rst_i = '1' or stat_sent_p_i = '1' then if rising_edge(uclk_i) then
s_stat <= (others => '0');
else if rst_i = '1' or reset_status_bytes_i = '1' then
s_stat <= (others => '0');
else -- value of s_var1_access on the previous clock tick should be 0
if (var1_rdy_i = '0' and s_var1_access(1) = '1') or (var2_rdy_i = '0' and s_var2_access(1) = '1') then if (var1_rdy_i = '0' and s_var1_access(1) = '1') or (var2_rdy_i = '0' and s_var2_access(1) = '1') then
s_stat(c_u_cacer_pos) <= '1'; s_stat(c_u_cacer_pos) <= '1';
end if; end if;
if ((var3_rdy_i = '0') and (s_var3_access(1) = '1')) then if ((var3_rdy_i = '0') and (s_var3_access(1) = '1')) then
s_stat(c_u_pacer_pos) <= '1'; s_stat(c_u_pacer_pos) <= '1';
end if; end if;
if code_violation_p_i = '1' then if code_violation_p_i = '1' then
s_stat(c_r_bner_pos) <= '1'; s_stat(c_r_bner_pos) <= '1';
end if; end if;
if crc_bad_p_i = '1' then if crc_bad_p_i = '1' then
s_stat(c_r_fcser_pos) <= '1'; s_stat(c_r_fcser_pos) <= '1';
end if; end if;
if fd_wdgn_i = '1' then if fd_wdgn_i = '1' then
s_stat(c_t_txer_pos) <= '1'; s_stat(c_t_txer_pos) <= '1';
end if; end if;
if fd_txer_i = '1' then if fd_txer_i = '1' then
s_stat(c_t_wder_pos) <= '1'; s_stat(c_t_wder_pos) <= '1';
end if; end if;
end if; end if;
if rst_i = '1' or mps_sent_p_i = '1' then
if rst_i = '1' or reset_status_bytes_i = '1' then
s_refreshment <= '0'; s_refreshment <= '0';
else else
if (var3_access_a_i = '1') then if (var3_access_a_i = '1') then
s_refreshment <= '1'; s_refreshment <= '1';
end if; end if;
end if; end if;
-- reset_var1_access_o <= var1_access_a_i;
-- reset_var2_access_o <= var2_access_a_i;
-- reset_var3_access_o <= var3_access_a_i;
end if; end if;
end process; end process;
process(s_refreshment) process(s_refreshment)
begin begin
mps_o <= (others => '0'); mps_o <= (others => '0');
mps_o(c_refreshment_pos) <= s_refreshment; mps_o(c_refreshment_pos) <= s_refreshment;
mps_o(c_significance_pos) <= s_refreshment; mps_o(c_significance_pos) <= s_refreshment;
end process; end process;
stat_o <= s_stat; stat_o <= s_stat;
end architecture rtl; end architecture rtl;
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
......
...@@ -105,6 +105,7 @@ begin ...@@ -105,6 +105,7 @@ begin
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
if rst_i = '1' then if rst_i = '1' then
s_q <= (others => '1'); s_q <= (others => '1');
else else
if start_p_i = '1' then if start_p_i = '1' then
s_q <= (others => '1'); s_q <= (others => '1');
......
...@@ -66,7 +66,7 @@ use work.wf_package.all; ...@@ -66,7 +66,7 @@ use work.wf_package.all;
--! Entity declaration for wf_engine_control --! Entity declaration for wf_engine_control
--================================================================================================= --=================================================================================================
entity wf_engine_control is entity wf_engine_control is
generic( C_QUARTZ_PERIOD : real := 25.0); generic( C_QUARTZ_PERIOD : real := 24.8);
port ( port (
uclk_i : in std_logic; --! 40MHz clock uclk_i : in std_logic; --! 40MHz clock
...@@ -265,7 +265,7 @@ begin ...@@ -265,7 +265,7 @@ begin
end process; end process;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--!@brief synchronous process Receiver_FSM_Sync: storage of the current state of the FSM --!@brief synchronous process Central_Control_FSM_Comb_Output_Signals:
Central_Control_FSM_Comb_Output_Signals: process (control_st, frame_ok_p_i, s_bytes_c, Central_Control_FSM_Comb_Output_Signals: process (control_st, frame_ok_p_i, s_bytes_c,
s_produce_or_consume, s_start_produce_p_d1, s_produce_or_consume, s_start_produce_p_d1,
...@@ -417,14 +417,15 @@ begin ...@@ -417,14 +417,15 @@ begin
end process; end process;
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
--! The following two processes: id_dat_var_concurrent and ... manage the values of the signals --! The following two processes: id_dat_var_concurrent and id_dat_var_specific_moments manage the
--! s_var_aux_concurr, s_var_aux and s_var. All of them are used to keep the value of the --! signals s_var_aux_concurr, s_var_aux and s_var. All of them are used to keep the value of the
--! ID_DAT.Identifier.Variable byte of the incoming ID_DAT frame, but change their value on --! ID_DAT.Identifier.Variable byte of the incoming ID_DAT frame, but change their value on
--! different moments: --! different moments:
--! s_var_aux_concurr: is constantly following the incoming byte byte_i --! s_var_aux_concurr: is constantly following the incoming byte byte_i
--! s_var_aux: locks to the value of s_var_aux_concurr when the ID_DAT.Identifier.Variable byte --! s_var_aux: locks to the value of s_var_aux_concurr when the ID_DAT.Identifier.Variable byte
--! is received (s_load_temp_var = 1) --! is received (s_load_temp_var = 1)
--! s_var: locks to the value of s_var_aux at the end of the id_dat frame (s_load_var = 1) --! s_var: locks to the value of s_var_aux at the end of the id_dat frame (s_load_var = 1) if the
--! specified station address matches the SUBS configuration.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
id_dat_var_concurrent: process(byte_i) id_dat_var_concurrent: process(byte_i)
...@@ -464,10 +465,13 @@ begin ...@@ -464,10 +465,13 @@ begin
end if; end if;
end process; end process;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
var_o <= s_var; -- var_o takes a value at the end of the id_dat
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
--!@brief: Combinatorial process Identify_Broadcast_Var: signal s_broadcast_var is enabled if the --!@brief: Combinatorial process Var_Characteristics: managment of the signals
--! variable received from the id_dat, s_var_aux, is a variable 2 (04h). --! s_produce_or_consume and s_broadcast_var, accroding to the value of s_var_aux.
Var_Characteristics: process(s_var_aux) Var_Characteristics: process(s_var_aux)
begin begin
...@@ -494,11 +498,13 @@ begin ...@@ -494,11 +498,13 @@ begin
end process; end process;
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
--!@brief: Combinatorial process data_length_calculation: calculation of the total amount of data --!@brief:Combinatorial process data_length_calcul_produce: calculation of the total amount of data
--! bytes that have to be transferreed when an rp_dat (produced variable) has to be sent, --! bytes that have to be transferreed when a variable is produced, including the rp_dat.Control as
--! including the rp_dat.Control as well as the rp_dat.Data.mps and rp_dat.Data.nanoFIPstatus bytes. --! well as the rp_dat.Data.mps and rp_dat.Data.nanoFIPstatus bytes. In the case of presence and
--! identification variables, the data length is predefined in the wf_package.
--! In the case of a var_3 the inputs slone, nostat and p3_lgth[] are accounted for the calculation
data_length_calculation: process(s_var, s_p3_length_decoded, slone_i, nostat_i) data_length_calcul_produce: process(s_var, s_p3_length_decoded, slone_i, nostat_i)
variable v_nostat : std_logic_vector(1 downto 0); variable v_nostat : std_logic_vector(1 downto 0);
begin begin
s_append_status <= not nostat_i; s_append_status <= not nostat_i;
...@@ -507,7 +513,7 @@ begin ...@@ -507,7 +513,7 @@ begin
s_p3_length_decoded'length); s_p3_length_decoded'length);
case s_var is case s_var is
when c_presence_var => -- data_length including rp_dat.control and rp_dat.data fields when c_presence_var =>
s_data_length<=to_unsigned(c_var_array(c_presence_var_pos).array_length-1,s_data_length'length); s_data_length<=to_unsigned(c_var_array(c_presence_var_pos).array_length-1,s_data_length'length);
when c_identif_var => when c_identif_var =>
...@@ -542,8 +548,8 @@ begin ...@@ -542,8 +548,8 @@ begin
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
--!@brief Synchronous process Bytes_Counter:Managing the counter that counts the number of produced --!@brief Synchronous process Bytes_Counter: Managment of the counter that counts the number of
--! or consumed bytes of data. --! produced or consumed bytes of data.
Bytes_Counter: process(uclk_i) Bytes_Counter: process(uclk_i)
begin begin
...@@ -560,8 +566,8 @@ begin ...@@ -560,8 +566,8 @@ begin
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- when s_data_length bytes have been counted, the signal data_length_match is activated -- when s_data_length bytes have been counted, the signal data_length_match is activated
data_length_match <= '1' when s_bytes_c = s_data_length else '0'; data_length_match <= '1' when s_bytes_c = s_data_length else '0';
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
-- retrieval of response and silence times information (in equivalent number of uclk ticks) from -- retrieval of response and silence times information (in equivalent number of uclk ticks) from
-- the c_timeouts_table declared in the wf_package unit. -- the c_timeouts_table declared in the wf_package unit.
...@@ -587,34 +593,9 @@ begin ...@@ -587,34 +593,9 @@ begin
end if; end if;
end process; end process;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- when the response or silence time is reached, the signal s_respon_silen_c_is_zero is activated. -- when the response or silence time is reached, the signal s_respon_silen_c_is_zero is activated
s_respon_silen_c_is_zero <= '1' when s_respon_silen_c = 0 else '0'; s_respon_silen_c_is_zero <= '1' when s_respon_silen_c = 0 else '0';
---------------------------------------------------------------------------------------------------
--!@brief: buffering the output signals last_byte_p_o and byte_ready_p_o and start_produce_p_o
process(uclk_i)
begin
if rising_edge(uclk_i) then
if rst_i = '1' then
last_byte_p_o <= '0';
byte_ready_p_o <= '0';
else
last_byte_p_o <= s_last_byte_p;
byte_ready_p_o <= s_byte_ready_p;
end if;
end if;
end process;
---------------------------------------------------------------------------------------------------
process(uclk_i)
begin
if rising_edge(uclk_i) then
s_start_produce_p_d1 <= s_start_produce_p;
end if;
end process;
start_produce_p_o <= s_start_produce_p_d1;
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
--!@brief:synchronous process VAR_RDY_Generation: managment of the nanoFIP output signals VAR1_RDY, --!@brief:synchronous process VAR_RDY_Generation: managment of the nanoFIP output signals VAR1_RDY,
...@@ -667,7 +648,29 @@ begin ...@@ -667,7 +648,29 @@ begin
end if; end if;
end process; end process;
var_o <= s_var; --var_o takes a value at the end of the id_dat
---------------------------------------------------------------------------------------------------
--!@brief: essential buffering of output signals last_byte_p_o, byte_ready_p_o, start_produce_p_o
process(uclk_i)
begin
if rising_edge(uclk_i) then
if rst_i = '1' then
last_byte_p_o <= '0';
byte_ready_p_o <= '0';
s_start_produce_p_d1 <= '0';
else
last_byte_p_o <= s_last_byte_p;
byte_ready_p_o <= s_byte_ready_p;
s_start_produce_p_d1 <= s_start_produce_p;
end if;
end if;
end process;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
start_produce_p_o <= s_start_produce_p_d1;
---------------------------------------------------------------------------------------------------
end architecture rtl; end architecture rtl;
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
-- E N D O F F I L E -- E N D O F F I L E
......
...@@ -13,7 +13,7 @@ USE ieee.numeric_std.ALL; ...@@ -13,7 +13,7 @@ USE ieee.numeric_std.ALL;
package wf_package is package wf_package is
constant C_QUARTZ_PERIOD : real := 25.0; constant C_QUARTZ_PERIOD : real := 24.8;
...@@ -175,7 +175,7 @@ package wf_package is ...@@ -175,7 +175,7 @@ package wf_package is
slone : std_logic) return std_logic_vector; slone : std_logic) return std_logic_vector;
component wf_rx_osc component wf_rx_osc
generic (C_COUNTER_LENGTH : integer := 7; generic (C_COUNTER_LENGTH : integer := 11;
C_QUARTZ_PERIOD : real := 24.8; C_QUARTZ_PERIOD : real := 24.8;
C_CLKFCDLENTGTH : natural := 3 C_CLKFCDLENTGTH : natural := 3
); );
...@@ -291,8 +291,8 @@ package wf_package is ...@@ -291,8 +291,8 @@ package wf_package is
component dpblockram_clka_rd_clkb_wr component dpblockram_clka_rd_clkb_wr
generic (c_data_length : integer := 42; -- Length of the data word generic (c_data_length : integer := 8; -- Length of the data word
c_addr_length : integer := 10); -- Number of words c_addr_length : integer := 9); -- Number of words
-- 'nw' has to be coherent with 'c_addr_length' -- 'nw' has to be coherent with 'c_addr_length'
port (clk_A_i : in std_logic; -- Global Clock port (clk_A_i : in std_logic; -- Global Clock
...@@ -306,7 +306,7 @@ package wf_package is ...@@ -306,7 +306,7 @@ package wf_package is
end component dpblockram_clka_rd_clkb_wr; end component dpblockram_clka_rd_clkb_wr;
component wf_engine_control component wf_engine_control
generic( C_QUARTZ_PERIOD : real := 25.0); generic( C_QUARTZ_PERIOD : real := 24.8);
port ( port (
uclk_i : in std_logic; --! User Clock uclk_i : in std_logic; --! User Clock
...@@ -467,7 +467,7 @@ package wf_package is ...@@ -467,7 +467,7 @@ package wf_package is
stat_i : in std_logic_vector(7 downto 0); --! NanoFIP status stat_i : in std_logic_vector(7 downto 0); --! NanoFIP status
mps_i : in std_logic_vector(7 downto 0); mps_i : in std_logic_vector(7 downto 0);
sending_stat_o : out std_logic; --! The status register is being adressed sending_mps_o : out std_logic;
-- var3_access_wb_clk_o: out std_logic; --! Variable 2 access flag -- var3_access_wb_clk_o: out std_logic; --! Variable 2 access flag
...@@ -567,8 +567,7 @@ package wf_package is ...@@ -567,8 +567,7 @@ package wf_package is
-- reset_var3_access_o : out std_logic; --! Reset Variable 2 access flag -- reset_var3_access_o : out std_logic; --! Reset Variable 2 access flag
stat_sent_p_i : in std_logic; reset_status_bytes_i : in std_logic;
mps_sent_p_i : in std_logic;
stat_o : out std_logic_vector(7 downto 0); stat_o : out std_logic_vector(7 downto 0);
mps_o : out std_logic_vector(7 downto 0) mps_o : out std_logic_vector(7 downto 0)
...@@ -593,7 +592,8 @@ package wf_package is ...@@ -593,7 +592,8 @@ package wf_package is
rston_o : out std_logic; --! Reset output, active low rston_o : out std_logic; --! Reset output, active low
var_i : in t_var; --! Received variable var_i : in t_var; --! Received variable
rst_o : out std_logic --! Reset ouput active high rst_o : out std_logic; --! Reset ouput active high
fd_rst_o : out std_logic
); );
...@@ -658,7 +658,7 @@ package wf_package is ...@@ -658,7 +658,7 @@ package wf_package is
fd_txena_o: out std_logic; --! Transmitter enable fd_txena_o: out std_logic; --! Transmitter enable
fd_txck_o : out std_logic; --! Line driver half bit clock fd_txck_o : out std_logic; --! Line driver half bit clock
fx_txd_o : out std_logic; --! Transmitter data fx_txd_o : out std_logic; --! Transmitter data
fx_rxa_i : in std_logic; --! Reception activity detection fx_rxa_i : inout std_logic; --! Reception activity detection
fx_rxd_i : in std_logic; --! Receiver data fx_rxd_i : in std_logic; --! Receiver data
......
...@@ -110,10 +110,10 @@ entity wf_produced_vars is ...@@ -110,10 +110,10 @@ entity wf_produced_vars is
-- Outputs -- Outputs
-- signal to status_gen -- signal to status_gen
sending_stat_o : out std_logic; --!indication:nanoFIP status byte being sent sending_mps_o : out std_logic; --!indication: mps byte being sent
-- signal to wf_tx -- signal to wf_tx
byte_o : out std_logic_vector(7 downto 0); --! output byte to be serialized and sent byte_o : out std_logic_vector(7 downto 0);--! output byte to be serialized and sent
-- nanoFIP output -- nanoFIP output
wb_ack_p_o : out std_logic --! wishbone acknowledge wb_ack_p_o : out std_logic --! wishbone acknowledge
...@@ -227,8 +227,8 @@ architecture rtl of wf_produced_vars is ...@@ -227,8 +227,8 @@ architecture rtl of wf_produced_vars is
s_base_addr <= (others => '0'); -- specifies the ram block s_base_addr <= (others => '0'); -- specifies the ram block
-- corresponding to each variable -- corresponding to each variable
sending_stat_o <= '0'; -- indicates that nanoFIP status sending_mps_o <= '0'; -- indicates that mps status byte
-- is being sent -- is being sent
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
...@@ -274,10 +274,11 @@ architecture rtl of wf_produced_vars is ...@@ -274,10 +274,11 @@ architecture rtl of wf_produced_vars is
elsif s_byte_adr = (unsigned(data_length_i) - 1) and nostat_i = '0' then --one but last byte: elsif s_byte_adr = (unsigned(data_length_i) - 1) and nostat_i = '0' then --one but last byte:
s_byte <= stat_i; --nanoFIP status;only sent if nostat negated s_byte <= stat_i; --nanoFIP status;only sent if nostat negated
sending_stat_o <= '1'; -- indication that status byte is being sent
elsif s_byte_adr = (unsigned(data_length_i))then -- last byte: mps status elsif s_byte_adr = (unsigned(data_length_i))then -- last byte: mps status
s_byte <= mps_i; s_byte <= mps_i;
sending_mps_o <= '1'; -- indication that mps byte is being sent
elsif slone_i='0' and s_byte_adr = c_pdu_byte_add then -- in memory mode operation, elsif slone_i='0' and s_byte_adr = c_pdu_byte_add then -- in memory mode operation,
s_byte <= c_var_array(c_var_3_pos).byte_array(s_byte_adr_aux); -- PDU byte is being sent s_byte <= c_var_array(c_var_3_pos).byte_array(s_byte_adr_aux); -- PDU byte is being sent
......
...@@ -13,7 +13,7 @@ use work.wf_package.all; ...@@ -13,7 +13,7 @@ use work.wf_package.all;
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
-- -- -- --
-- wf_rx -- -- wf_rx --
-- -- -- --
-- CERN, BE/CO/HT -- -- CERN, BE/CO/HT --
-- -- -- --
...@@ -27,19 +27,20 @@ use work.wf_package.all; ...@@ -27,19 +27,20 @@ use work.wf_package.all;
--! --!
--! --!
--! @author Pablo Alvarez Sanchez (Pablo.Alvarez.Sanchez@cern.ch) --! @author Pablo Alvarez Sanchez (Pablo.Alvarez.Sanchez@cern.ch)
--! Evangelia Gousiou (Evangelia.Gousiou@cern.ch)
--! --!
--! @date 10/08/2009 --! @date 08/2010
-- --
--! @version v0.01 --! @version v0.02
-- --
--! @details --! @details
--! --!
--! <b>Dependencies:</b>\n --! <b>Dependencies:</b>\n
--! wf_engine \n --! wf_rx_tx_osc\n
--! tx_engine \n --! wf_deglitcher\n
--! clk_gen \n --! wf_tx_rx\n
--! reset_logic \n --!
--! consumed_ram \n --!
--! --!
--! --!
--! <b>References:</b>\n --! <b>References:</b>\n
...@@ -49,10 +50,14 @@ use work.wf_package.all; ...@@ -49,10 +50,14 @@ use work.wf_package.all;
--! <b>Modified by:</b>\n --! <b>Modified by:</b>\n
--! Author: Erik van der Bij --! Author: Erik van der Bij
--! Pablo Alvarez Sanchez --! Pablo Alvarez Sanchez
--! Evangelia Gousiou
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
--! \n\n<b>Last changes:</b>\n --! \n\n<b>Last changes:</b>\n
--! 07/08/2009 v0.02 PAAS Entity Ports added, start of architecture content --! 07/10 state switch_to_deglitched added
--! --! output signal wait_d_first_f_edge_o added
--! signals renamed
--! code cleaned-up + commented
--!
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
--! @todo Define I/O signals \n --! @todo Define I/O signals \n
--! --!
...@@ -68,21 +73,21 @@ entity wf_rx is ...@@ -68,21 +73,21 @@ entity wf_rx is
port ( port (
-- Inputs -- Inputs
-- user interface general signals -- user interface general signals
uclk_i : in std_logic; --! 40MHz clock uclk_i : in std_logic; --! 40MHz clock
rst_i : in std_logic; --! global reset rst_i : in std_logic; --! global reset
-- signals from the wf_rx_tx_osc -- signals from the wf_rx_tx_osc
signif_edge_window_i : in std_logic; --! time window where a significant edge is expected signif_edge_window_i : in std_logic; --! time window where a significant edge is expected
adjac_bits_window_i : in std_logic; --! time window where a transition between adjacent adjac_bits_window_i : in std_logic; --! time window where a transition between adjacent
--! bits is expected --! bits is expected
-- signals from wf_tx_rx -- signals from wf_tx_rx
rx_data_r_edge_i : in std_logic;--!indicates a rising edge on the buffered rxd (rx_data_i) rx_data_r_edge_i : in std_logic; --!indicates a rising edge on the buffered rxd(rx_data_i)
rx_data_f_edge_i : in std_logic; --! indicates a falling edge on the d_1 rx_data_f_edge_i : in std_logic; --! indicates a falling edge on the d_1
-- signal from the wf_deglitcher -- signal from the wf_deglitcher
rx_data_filtered_i : in std_logic; --! deglitched serial input signal rx_data_filtered_i : in std_logic; --! deglitched serial input signal
sample_manch_bit_p_i: in std_logic; --! sample_manch_bit_p_i: in std_logic; --!
sample_bit_p_i : in std_logic; --! sample_bit_p_i : in std_logic; --!
...@@ -91,7 +96,7 @@ entity wf_rx is ...@@ -91,7 +96,7 @@ entity wf_rx is
-- needed by the wf_consumed and wf_engine_control -- needed by the wf_consumed and wf_engine_control
byte_ready_p_o : out std_logic; --! indication of a valid data byte byte_ready_p_o : out std_logic; --! indication of a valid data byte
byte_o : out std_logic_vector(7 downto 0) ; --! retreived data byte byte_o : out std_logic_vector(7 downto 0) ; --! retreived data byte
-- needed by the wf_engine_control -- needed by the wf_engine_control
crc_ok_p_o : out std_logic; crc_ok_p_o : out std_logic;
...@@ -100,11 +105,11 @@ entity wf_rx is ...@@ -100,11 +105,11 @@ entity wf_rx is
last_byte_p_o : out std_logic; last_byte_p_o : out std_logic;
-- needed by the status_gen -- needed by the status_gen
code_violation_p_o : out std_logic; --! indicator of a manchester 2 code violation code_violation_p_o : out std_logic; --! indicator of a manchester 2 code violation
-- needed by the wf_rx_tx_osc -- needed by the wf_rx_tx_osc
wait_d_first_f_edge_o : out std_logic --! indicator of the rx state machine being in idle wait_d_first_f_edge_o : out std_logic --! indicator of the rx state machine being in idle
-- state, expecting for the first falling edge of the preamble --state, expecting for the preamble's 1st falling edge
); );
end entity wf_rx; end entity wf_rx;
...@@ -409,6 +414,7 @@ architecture rtl of wf_rx is ...@@ -409,6 +414,7 @@ architecture rtl of wf_rx is
s_queue_bit <= FRAME_END(to_integer(resize(pointer,4))); s_queue_bit <= FRAME_END(to_integer(resize(pointer,4)));
code_violation_p_o <= '0'; code_violation_p_o <= '0';
s_start_crc_p <= '0'; s_start_crc_p <= '0';
s_calculate_crc <= '1'; s_calculate_crc <= '1';
s_frame_start_bit <= '0'; s_frame_start_bit <= '0';
...@@ -457,6 +463,7 @@ architecture rtl of wf_rx is ...@@ -457,6 +463,7 @@ architecture rtl of wf_rx is
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
if rst_i = '1' then if rst_i = '1' then
s_frame_end_detection <= '1'; s_frame_end_detection <= '1';
elsif s_pointer_is_zero = '1' and sample_manch_bit_p_i = '1' then elsif s_pointer_is_zero = '1' and sample_manch_bit_p_i = '1' then
s_frame_end_detection <= '1'; s_frame_end_detection <= '1';
elsif s_frame_end_wrong_bit = '1' then elsif s_frame_end_wrong_bit = '1' then
...@@ -475,6 +482,7 @@ architecture rtl of wf_rx is ...@@ -475,6 +482,7 @@ architecture rtl of wf_rx is
if rst_i = '1' then if rst_i = '1' then
pointer <= (others => '0'); pointer <= (others => '0');
else else
if s_load_pointer = '1' then if s_load_pointer = '1' then
pointer <= s_start_pointer; pointer <= s_start_pointer;
elsif s_decr_pointer = '1' then elsif s_decr_pointer = '1' then
...@@ -492,9 +500,14 @@ architecture rtl of wf_rx is ...@@ -492,9 +500,14 @@ architecture rtl of wf_rx is
Append_Bit_To_Byte: process (uclk_i) Append_Bit_To_Byte: process (uclk_i)
begin begin
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
if s_write_bit_to_byte = '1' then if rst_i = '1' then
s_byte <= s_byte(6 downto 0) & rx_data_filtered_i; s_byte <= (others => '0');
end if; else
if s_write_bit_to_byte = '1' then
s_byte <= s_byte(6 downto 0) & rx_data_filtered_i;
end if;
end if;
end if; end if;
end process; end process;
...@@ -503,12 +516,15 @@ architecture rtl of wf_rx is ...@@ -503,12 +516,15 @@ architecture rtl of wf_rx is
begin begin
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
if rst_i = '1' then if rst_i = '1' then
s_crc_ok <= '0'; s_crc_ok <= '0';
elsif s_calculate_crc='0' then else
s_crc_ok <= '0';
elsif s_crc_ok_p = '1' and s_calculate_crc='1' then if s_calculate_crc='0' then
s_crc_ok <= '1'; s_crc_ok <= '0';
end if; elsif s_crc_ok_p = '1' and s_calculate_crc='1' then
s_crc_ok <= '1';
end if;
end if;
end if; end if;
end process; end process;
...@@ -521,10 +537,11 @@ architecture rtl of wf_rx is ...@@ -521,10 +537,11 @@ architecture rtl of wf_rx is
Detect_f_edge_rx_data_filtered: process(uclk_i) Detect_f_edge_rx_data_filtered: process(uclk_i)
begin begin
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
-- initializations:
if rst_i = '1' then if rst_i = '1' then
s_rx_data_filtered_buff <= (others => '0'); s_rx_data_filtered_buff <= (others => '0');
s_rx_data_filtered_f_edge <= '0';
else else
-- buffer s_rx_data_filtered_buff keeps the last 2 bits of rx_data_filtered_i -- buffer s_rx_data_filtered_buff keeps the last 2 bits of rx_data_filtered_i
s_rx_data_filtered_buff <= s_rx_data_filtered_buff(0) & rx_data_filtered_i; s_rx_data_filtered_buff <= s_rx_data_filtered_buff(0) & rx_data_filtered_i;
-- falling edge detected if last bit is a 0 and previous was a 1 -- falling edge detected if last bit is a 0 and previous was a 1
......
...@@ -40,9 +40,9 @@ use IEEE.NUMERIC_STD.all; --! conversion functions ...@@ -40,9 +40,9 @@ use IEEE.NUMERIC_STD.all; --! conversion functions
--! @author Pablo Alvarez Sanchez (Pablo.Alvarez.Sanchez@cern.ch) --! @author Pablo Alvarez Sanchez (Pablo.Alvarez.Sanchez@cern.ch)
--! Evangelia Gousiou (Evangelia.Gousiou@cern.ch) --! Evangelia Gousiou (Evangelia.Gousiou@cern.ch)
--! --!
--! @date 06/06/2010 --! @date 07/2010
-- --
--! @version v0.02 --! @version v0.03
-- --
--! @details --! @details
--! --!
...@@ -56,10 +56,13 @@ use IEEE.NUMERIC_STD.all; --! conversion functions ...@@ -56,10 +56,13 @@ use IEEE.NUMERIC_STD.all; --! conversion functions
--! --!
--! <b>Modified by:</b>\n --! <b>Modified by:</b>\n
--! Author: Pablo Alvarez Sanchez --! Author: Pablo Alvarez Sanchez
--! Evangelia Gousiou
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
--! \n\n<b>Last changes:</b>\n --! \n\n<b>Last changes:</b>\n
--! 07/08/2009 v0.02 PAAS Entity Ports added, start of architecture content --! 08/2009 v0.02 PAAS Entity Ports added, start of architecture content
--! --! 07/2010 v0.03 tx, rx counter changed from 20 bits signed, to 11 bits unsigned
--! rx clk generation depends on edges detection
--! code cleaned-up + commented
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
--! @todo Define I/O signals \n --! @todo Define I/O signals \n
--! --!
...@@ -72,11 +75,11 @@ use IEEE.NUMERIC_STD.all; --! conversion functions ...@@ -72,11 +75,11 @@ use IEEE.NUMERIC_STD.all; --! conversion functions
--================================================================================================= --=================================================================================================
entity wf_rx_osc is entity wf_rx_osc is
generic (C_COUNTER_LENGTH : integer := 12; -- in the slowest bit rate (31.25kbps), the period is generic (C_COUNTER_LENGTH : integer := 11; -- in the slowest bit rate (31.25kbps), the period is
-- 32000ns and can be measured after 1280 uclk ticks. -- 32000ns and can be measured after 1280 uclk ticks.
-- Therefore a counter of 12 bits is the max needed -- Therefore a counter of 11 bits is the max needed
-- for counting transmission/reception periods. -- for counting transmission/reception periods.
C_QUARTZ_PERIOD : real := 25.0; -- 40 MHz clock period C_QUARTZ_PERIOD : real := 24.8; -- 40 MHz clock period
C_CLKFCDLENTGTH : natural := 3 C_CLKFCDLENTGTH : natural := 3
); );
...@@ -126,8 +129,8 @@ end entity wf_rx_osc; ...@@ -126,8 +129,8 @@ end entity wf_rx_osc;
architecture rtl of wf_rx_osc is architecture rtl of wf_rx_osc is
-- calculations of the number of uclk ticks equivalent to the reception/ transmission period -- calculations of the number of uclk ticks equivalent to the reception/ transmission period
constant c_uclk_ticks_31_25kbit:unsigned:= constant c_uclk_ticks_31_25kbit:unsigned:=
to_unsigned((32000 / integer(C_QUARTZ_PERIOD)),C_COUNTER_LENGTH); to_unsigned((32000/ integer(C_QUARTZ_PERIOD)),C_COUNTER_LENGTH);
constant c_uclk_ticks_1_mbit:unsigned:= constant c_uclk_ticks_1_mbit:unsigned:=
to_unsigned((1000/ integer(C_QUARTZ_PERIOD)),C_COUNTER_LENGTH); to_unsigned((1000/ integer(C_QUARTZ_PERIOD)),C_COUNTER_LENGTH);
constant c_uclk_ticks_2_5mbit:unsigned:= constant c_uclk_ticks_2_5mbit:unsigned:=
...@@ -144,18 +147,18 @@ architecture rtl of wf_rx_osc is ...@@ -144,18 +147,18 @@ architecture rtl of wf_rx_osc is
-- auxiliary signals declarations -- auxiliary signals declarations
signal s_counter_rx, s_counter_tx, s_period, s_jitter : unsigned (C_COUNTER_LENGTH-1 downto 0); signal s_counter_rx, s_counter_tx, s_period, s_jitter : unsigned (C_COUNTER_LENGTH-1 downto 0);
signal s_counter_full, s_one_forth_period, s_half_period :unsigned (C_COUNTER_LENGTH-1 downto 0); signal s_counter_full, s_one_forth_period, s_half_period :unsigned (C_COUNTER_LENGTH-1 downto 0);
signal s_tx_clk_p_buff : std_logic_vector(C_CLKFCDLENTGTH -1 downto 0); signal s_tx_clk_p_buff : std_logic_vector(C_CLKFCDLENTGTH -1 downto 0);
signal s_tx_clk_d1, s_tx_clk, s_tx_clk_p : std_logic; signal s_tx_clk_d1, s_tx_clk, s_tx_clk_p : std_logic;
signal s_rx_bit_clk, s_rx_bit_clk_d1, s_rx_manch_clk, s_rx_manch_clk_d1 : std_logic; signal s_rx_bit_clk, s_rx_bit_clk_d1, s_rx_manch_clk, s_rx_manch_clk_d1 : std_logic;
signal s_adjac_bits_edge_found, s_signif_edge_found : std_logic; signal s_adjac_bits_edge_found, s_signif_edge_found : std_logic;
signal s_rx_signif_edge_window, s_rx_adjac_bits_window : std_logic; signal s_rx_signif_edge_window, s_rx_adjac_bits_window : std_logic;
begin begin
s_period <= C_UCLK_TICKS(to_integer(unsigned(rate_i))); -- s_period: # uclock ticks for a period s_period <= C_UCLK_TICKS(to_integer(unsigned(rate_i))); -- s_period: # uclock ticks for a period
s_half_period <= (s_period srl 1); -- s_period shifted 1 bit s_half_period <= (s_period srl 1); -- s_period shifted 1 bit
s_one_forth_period <= s_period srl 2; -- s_period shifted 2 bits s_one_forth_period <= s_period srl 2; -- s_period shifted 2 bits
...@@ -178,7 +181,6 @@ begin ...@@ -178,7 +181,6 @@ begin
periods_count: process(uclk_i) periods_count: process(uclk_i)
begin begin
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
-- initializations:
if rst_i = '1' then if rst_i = '1' then
s_counter_tx <= (others => '0'); s_counter_tx <= (others => '0');
s_counter_rx <= (others => '0'); s_counter_rx <= (others => '0');
......
...@@ -398,8 +398,12 @@ begin ...@@ -398,8 +398,12 @@ begin
process(uclk_i) process(uclk_i)
begin begin
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
if byte_ready_p_i = '1' then if rst_i = '1' then
s_byte <= byte_i; s_byte <= (others => '0');
else
if byte_ready_p_i = '1' then
s_byte <= byte_i;
end if;
end if; end if;
end if; end if;
end process; end process;
...@@ -440,10 +444,15 @@ begin ...@@ -440,10 +444,15 @@ begin
Bits_Delivery: process(uclk_i) Bits_Delivery: process(uclk_i)
begin begin
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
if tx_clk_p_buff_i(0) = '1' then if rst_i = '1' then
tx_data_o <= s_data_bit; tx_data_o <= '0';
end if; tx_enable_o <= '0';
else
if tx_clk_p_buff_i(0) = '1' then
tx_data_o <= s_data_bit;
end if;
tx_enable_o <= s_tx_enable; tx_enable_o <= s_tx_enable;
end if;
end if; end if;
end process; end process;
...@@ -454,10 +463,15 @@ begin ...@@ -454,10 +463,15 @@ begin
Outgoing_Bits_Pointer: process(uclk_i) Outgoing_Bits_Pointer: process(uclk_i)
begin begin
if rising_edge(uclk_i) then if rising_edge(uclk_i) then
if s_load_pointer = '1' then if rst_i = '1' then
s_pointer <= s_top_pointer; s_pointer <= (others => '0');
elsif s_decr_pointer = '1' then else
s_pointer <= s_pointer - 1;
if s_load_pointer = '1' then
s_pointer <= s_top_pointer;
elsif s_decr_pointer = '1' then
s_pointer <= s_pointer - 1;
end if;
end if; end if;
end if; end if;
end process; end process;
......
...@@ -116,7 +116,7 @@ architecture rtl of wf_tx_rx is ...@@ -116,7 +116,7 @@ architecture rtl of wf_tx_rx is
signal s_clk_carrier_p : std_logic; signal s_clk_carrier_p : std_logic;
signal s_clk_bit_180_p, s_sample_bit_p, s_sample_manch_bit_p : std_logic; signal s_clk_bit_180_p, s_sample_bit_p, s_sample_manch_bit_p : std_logic;
signal s_edge_window, edge_180_window : std_logic; signal s_edge_window, edge_180_window : std_logic;
signal s_d_edge : std_logic; signal s_d_edge, s_code_violation : std_logic;
signal s_clk_fixed_carrier_p_d : std_logic_vector(C_CLKFCDLENTGTH - 1 downto 0); signal s_clk_fixed_carrier_p_d : std_logic_vector(C_CLKFCDLENTGTH - 1 downto 0);
begin begin
...@@ -167,18 +167,19 @@ begin ...@@ -167,18 +167,19 @@ begin
rx_data_filtered_i => s_d_filtered, rx_data_filtered_i => s_d_filtered,
sample_manch_bit_p_i => s_sample_manch_bit_p, sample_manch_bit_p_i => s_sample_manch_bit_p,
wait_d_first_f_edge_o=> s_first_fe, wait_d_first_f_edge_o=> s_first_fe,
code_violation_p_o => code_violation_p_o,
crc_wrong_p_o => crc_wrong_p_o,
sample_bit_p_i => s_sample_bit_p, sample_bit_p_i => s_sample_bit_p,
signif_edge_window_i => s_edge_window, signif_edge_window_i => s_edge_window,
adjac_bits_window_i => edge_180_window adjac_bits_window_i => edge_180_window
); );
uwf_rx_osc :wf_rx_osc uwf_rx_osc :wf_rx_osc
generic map(C_COUNTER_LENGTH => 7, generic map(C_COUNTER_LENGTH => 11,
C_QUARTZ_PERIOD => 24.8, C_QUARTZ_PERIOD => 24.8,
C_CLKFCDLENTGTH => C_CLKFCDLENTGTH) C_CLKFCDLENTGTH => C_CLKFCDLENTGTH)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment