Commit 8250f67c authored by penacoba's avatar penacoba

Raw_timestamps version


git-svn-id: http://svn.ohwr.org/fmc-tdc@53 85dfdc96-de2c-444c-878d-45b388be74a9
parent 757b8fff
......@@ -121,8 +121,10 @@ begin
begin
if class_reset ='1' then
class_ack <= '0';
elsif class_stb ='1' and class_cyc ='1' and class_ack ='0' then
class_ack <= '1';
else
class_ack <= class_stb and class_cyc;
class_ack <= '0';
end if;
wait until class_clk ='1';
end process;
......
......@@ -2,12 +2,16 @@
-- CERN-BE-CO-HT
----------------------------------------------------------------------------------------------------
--
-- unit name : data polling engine (data_engine)
-- unit name : data managing engine (data_engine)
-- author : G. Penacoba
-- date : June 2011
-- version : Revision 1
-- description : engine polling data continuouly from the acam interface provided the FIFO is not
-- empty. acts as a wishbone master.
-- description : engine managing the configuration and acquisition modes of operation for the ACAM.
-- in acquisition mode: monitors permanently the Empty Flags of the ACAM iFIFOs
-- and reads timestamps accordingly.
-- when acquisition mode is inactive: allows the configuration and readback of ACAM
-- registers.
-- Acts as a wishbone master.
-- dependencies:
-- references :
-- modified by :
......@@ -15,8 +19,7 @@
----------------------------------------------------------------------------------------------------
-- last changes:
----------------------------------------------------------------------------------------------------
-- to do: REPLACE THE POLLING BY INTERRUPT FROM THE EMPTY SIGNALS. ADD RESET ACAM COMMAND
-- AND GET STATUS COMMAND
-- to do:
----------------------------------------------------------------------------------------------------
library IEEE;
......@@ -334,8 +337,8 @@ begin
end case;
end process;
config_adr: process -- process to generate the valid addresses for the ACAM registers
begin
config_adr: process -- process to generate the valid addresses
begin -- for the ACAM config registers
if reset ='1' then
config_adr_counter <= x"00";
......@@ -356,7 +359,6 @@ begin
wait until clk ='1';
end process;
data_config_decoding: process(acam_adr, engine_st, acam_config, reset_word)
begin
case acam_adr is
......@@ -393,7 +395,23 @@ begin
data_readback_decoding: process
begin
if acam_cyc ='1' and acam_stb ='1' and acam_ack ='1' and acam_we ='0' then
if reset ='1' then
acam_config_rdbk(0) <= (others =>'0');
acam_config_rdbk(1) <= (others =>'0');
acam_config_rdbk(2) <= (others =>'0');
acam_config_rdbk(3) <= (others =>'0');
acam_config_rdbk(4) <= (others =>'0');
acam_config_rdbk(5) <= (others =>'0');
acam_config_rdbk(6) <= (others =>'0');
acam_config_rdbk(7) <= (others =>'0');
acam_config_rdbk(8) <= (others =>'0');
acam_config_rdbk(9) <= (others =>'0');
acam_config_rdbk(10) <= (others =>'0');
acam_ififo1 <= (others =>'0');
acam_ififo2 <= (others =>'0');
acam_start01 <= (others =>'0');
elsif acam_cyc ='1' and acam_stb ='1' and acam_ack ='1' and acam_we ='0' then
if acam_adr= x"00" then
acam_config_rdbk(0) <= acam_data_rd;
end if;
......
This diff is collapsed.
......@@ -48,8 +48,6 @@ entity reg_ctrl is
-- control signals for interface with other internal modules
activate_acq_o : out std_logic;
deactivate_acq_o : out std_logic;
load_utc_o : out std_logic;
load_tdc_config_o : out std_logic;
load_acam_config_o : out std_logic;
read_acam_config_o : out std_logic;
read_acam_status_o : out std_logic;
......@@ -57,6 +55,9 @@ entity reg_ctrl is
read_ififo2_o : out std_logic;
read_start01_o : out std_logic;
reset_acam_o : out std_logic;
load_utc_o : out std_logic;
load_tdc_config_o : out std_logic;
clear_dacapo_flag_o : out std_logic;
-- configuration registers from and for the ACAM and the modules of the TDC core
acam_config_rdbk_i : in config_vector;
......@@ -66,6 +67,8 @@ entity reg_ctrl is
acam_start01_i : in std_logic_vector(g_width-1 downto 0);
current_utc_i : in std_logic_vector(g_width-1 downto 0);
irq_code_i : in std_logic_vector(g_width-1 downto 0);
core_status_i : in std_logic_vector(g_width-1 downto 0);
wr_pointer_i : in std_logic_vector(g_width-1 downto 0);
acam_config_o : out config_vector;
starting_utc_o : out std_logic_vector(g_width-1 downto 0);
......@@ -118,6 +121,8 @@ signal acam_ififo2 : std_logic_vector(g_width-1 downto 0);
signal acam_start01 : std_logic_vector(g_width-1 downto 0);
signal current_utc : std_logic_vector(g_width-1 downto 0);
signal irq_code : std_logic_vector(g_width-1 downto 0);
signal core_status : std_logic_vector(g_width-1 downto 0);
signal wr_pointer : std_logic_vector(g_width-1 downto 0);
signal acam_config : config_vector;
signal starting_utc : std_logic_vector(g_width-1 downto 0);
......@@ -307,6 +312,8 @@ begin
retrig_freq when x"25",
current_utc when x"26",
irq_code when x"27",
core_status when x"28",
wr_pointer when x"29",
x"FFFFFFFF" when others;
-- inputs from other blocks
......@@ -326,6 +333,8 @@ begin
acam_ififo2 <= acam_ififo2_i;
acam_start01 <= acam_start01_i;
irq_code <= irq_code_i;
core_status <= core_status_i;
wr_pointer <= wr_pointer_i;
-- outputs to other blocks
reg_ack_o <= reg_ack;
......@@ -343,6 +352,7 @@ begin
reset_acam_o <= control_register(8);
load_utc_o <= control_register(9);
load_tdc_config_o <= control_register(10);
clear_dacapo_flag_o <= control_register(11);
starting_utc_o <= starting_utc;
clk_freq_o <= clk_freq;
......
......@@ -162,19 +162,32 @@ architecture rtl of top_tdc is
component data_formatting
generic(
g_span : integer :=32;
g_width : integer :=32
);
port(
acam_start01_i : in std_logic_vector(16 downto 0);
acam_timestamp_i : in std_logic_vector(27 downto 0);
acam_timestamp_valid_i : in std_logic;
-- wishbone master signals internal to the chip: interface with the circular buffer
ack_i : in std_logic;
dat_i : in std_logic_vector(4*g_width-1 downto 0);
adr_o : out std_logic_vector(g_span-1 downto 0);
cyc_o : out std_logic;
dat_o : out std_logic_vector(4*g_width-1 downto 0);
stb_o : out std_logic;
we_o : out std_logic;
-- signals internal to the chip: interface with other modules
acam_timestamp1_i : in std_logic_vector(g_width-1 downto 0);
acam_timestamp1_valid_i : in std_logic;
acam_timestamp2_i : in std_logic_vector(g_width-1 downto 0);
acam_timestamp2_valid_i : in std_logic;
clk_i : in std_logic;
clear_dacapo_flag_i : in std_logic;
reset_i : in std_logic;
start_nb_offset_i : in std_logic_vector(g_width-1 downto 0);
utc_current_time_i : in std_logic_vector(g_width-1 downto 0);
full_timestamp_o : out std_logic_vector(3*g_width-1 downto 0);
full_timestamp_valid_o : out std_logic
wr_pointer_o : out std_logic_vector(g_width-1 downto 0)
);
end component;
......@@ -371,15 +384,16 @@ architecture rtl of top_tdc is
-- control signals for interface with other internal modules
activate_acq_o : out std_logic;
deactivate_acq_o : out std_logic;
load_utc_o : out std_logic;
load_tdc_config_o : out std_logic;
load_acam_config_o : out std_logic;
read_acam_config_o : out std_logic;
reset_acam_o : out std_logic;
read_acam_status_o : out std_logic;
read_ififo1_o : out std_logic;
read_ififo2_o : out std_logic;
read_start01_o : out std_logic;
reset_acam_o : out std_logic;
load_utc_o : out std_logic;
load_tdc_config_o : out std_logic;
clear_dacapo_flag_o : out std_logic;
-- configuration registers from and for the ACAM and the modules of the TDC core
acam_config_rdbk_i : in config_vector;
......@@ -387,8 +401,10 @@ architecture rtl of top_tdc is
acam_ififo1_i : in std_logic_vector(g_width-1 downto 0);
acam_ififo2_i : in std_logic_vector(g_width-1 downto 0);
acam_start01_i : in std_logic_vector(g_width-1 downto 0);
current_utc_i : in std_logic_vector(g_width-1 downto 0);
irq_code_i : in std_logic_vector(g_width-1 downto 0);
current_utc_i : in std_logic_vector(g_width-1 downto 0);
irq_code_i : in std_logic_vector(g_width-1 downto 0);
core_status_i : in std_logic_vector(g_width-1 downto 0);
wr_pointer_i : in std_logic_vector(g_width-1 downto 0);
acam_config_o : out config_vector;
starting_utc_o : out std_logic_vector(g_width-1 downto 0);
......@@ -524,14 +540,15 @@ signal acam_timestamp1 : std_logic_vector(g_width-1 downto 0);
signal acam_timestamp1_valid : std_logic;
signal acam_timestamp2 : std_logic_vector(g_width-1 downto 0);
signal acam_timestamp2_valid : std_logic;
signal full_timestamp : std_logic_vector(3*g_width-1 downto 0);
signal full_timestamp_valid : std_logic;
signal clear_dacapo_flag : std_logic;
signal core_status : std_logic_vector(g_width-1 downto 0);
signal general_reset : std_logic;
signal one_hz_p : std_logic;
signal start_nb_offset : std_logic_vector(g_width-1 downto 0);
signal start_trig : std_logic;
signal start_timer_reg : std_logic_vector(7 downto 0);
signal utc_current_time : std_logic_vector(g_width-1 downto 0);
signal wr_pointer : std_logic_vector(g_width-1 downto 0);
signal acm_adr : std_logic_vector(g_span-1 downto 0);
signal acm_cyc : std_logic;
......@@ -653,22 +670,33 @@ begin
start_trig_o => open
);
-- data_formatting_block: data_formatting
-- generic map(
-- g_width => g_width
-- )
-- port map(
-- acam_start01_i => acam_start01,
-- acam_timestamp_i => acam_timestamp,
-- acam_timestamp_valid_i => acam_timestamp_valid,
-- clk_i => clk,
-- reset_i => general_reset,
-- start_nb_offset_i => start_nb_offset,
-- utc_current_time_i => utc_current_time,
--
-- full_timestamp_o => full_timestamp,
-- full_timestamp_valid_o => full_timestamp_valid
-- );
data_formatting_block: data_formatting
generic map(
g_span => g_span,
g_width => g_width
)
port map(
ack_i => mem_class_ack,
dat_i => mem_class_data_rd,
adr_o => mem_class_adr,
cyc_o => mem_class_cyc,
dat_o => mem_class_data_wr,
stb_o => mem_class_stb,
we_o => mem_class_we,
acam_timestamp1_i => acam_timestamp1,
acam_timestamp1_valid_i => acam_timestamp1_valid,
acam_timestamp2_i => acam_timestamp2,
acam_timestamp2_valid_i => acam_timestamp2_valid,
clk_i => clk,
clear_dacapo_flag_i => clear_dacapo_flag,
reset_i => general_reset,
start_nb_offset_i => start_nb_offset,
utc_current_time_i => utc_current_time,
wr_pointer_o => wr_pointer
);
acam_timing_block: acam_timecontrol_interface
generic map(
......@@ -835,8 +863,6 @@ begin
-- control signals for interface with other application internal modules
activate_acq_o => activate_acq,
deactivate_acq_o => deactivate_acq,
load_utc_o => load_utc,
load_tdc_config_o => load_tdc_config,
load_acam_config_o => load_acam_config,
read_acam_config_o => read_acam_config,
read_acam_status_o => read_acam_status,
......@@ -844,8 +870,11 @@ begin
read_ififo2_o => read_ififo2,
read_start01_o => read_start01,
reset_acam_o => reset_acam,
load_utc_o => load_utc,
load_tdc_config_o => load_tdc_config,
clear_dacapo_flag_o => clear_dacapo_flag,
-- configuration registers for the modules of the TDC core
-- configuration registers for the ACAM and the modules of the TDC core
acam_config_rdbk_i => acam_config_rdbk,
acam_status_i => acam_status,
acam_ififo1_i => acam_ififo1,
......@@ -853,6 +882,8 @@ begin
acam_start01_i => acam_start01,
current_utc_i => current_utc,
irq_code_i => irq_code,
core_status_i => core_status,
wr_pointer_i => wr_pointer,
acam_config_o => acam_config,
starting_utc_o => starting_utc,
......@@ -1081,6 +1112,7 @@ begin
tdc_led_trig5_o <= tdc_led_trig5;
-- these will evolve as we implement all the features
irq_p <= dma_irq(0) or dma_irq(1);
pulse_delay <= x"00000001";
window_delay <= x"00000002";
mute_inputs_o <= '1';
......
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