CORE-798 Make EL GIP Library FPGA Vendor Independent.
event_logger_2 V2- FPGA Vendor Independent. Change to Generic Fifos from common/1
This commit is contained in:
parent
0df2255bbd
commit
e1b1c76a74
4 changed files with 715 additions and 0 deletions
385
generic_ip/event_logger/2/doc/event_logger_2.json
Normal file
385
generic_ip/event_logger/2/doc/event_logger_2.json
Normal file
|
|
@ -0,0 +1,385 @@
|
|||
[{
|
||||
"ip_name": "event_logger_2",
|
||||
"bus": "csr",
|
||||
"addr_width" : "4",
|
||||
"description": "Event Logger (Slave)",
|
||||
"registers": {
|
||||
"ip_id" : {
|
||||
"address" : "0",
|
||||
"width" : "32",
|
||||
"description" : "Unique ID for this IP block",
|
||||
"fields": {
|
||||
"ip_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x1B",
|
||||
"description" : "IP identifier number"
|
||||
},
|
||||
"mfr_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0xFF",
|
||||
"description" : "Manufacturer number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ip_ver" : {
|
||||
"address" : "1",
|
||||
"width" : "32",
|
||||
"description" : "IP Version",
|
||||
"fields": {
|
||||
"minor_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x00",
|
||||
"description" : "Minor number"
|
||||
},
|
||||
"major_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x02",
|
||||
"description" : "Major number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"logger_ctrl_w" : {
|
||||
"address" : "2",
|
||||
"width" : "11",
|
||||
"description" : "Logger control register",
|
||||
"fields": {
|
||||
"init" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Logger init"
|
||||
},
|
||||
"Reserved-0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"en_1pps_event" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "enable logging of 1-PPS events"
|
||||
},
|
||||
"Reserved-1" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"irq_en" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "IRQ enable"
|
||||
|
||||
},
|
||||
"irq_clr" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "IRQ clear"
|
||||
|
||||
},
|
||||
"irq_mask" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "IRQ mask"
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"logger_ctrl_r" : {
|
||||
"address" : "3",
|
||||
"width" : "12",
|
||||
"description" : "Logger status register",
|
||||
"fields": {
|
||||
"Reserved-0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "11",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"irq_value" : {
|
||||
"type" : "r",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "IRQ value"
|
||||
}
|
||||
}
|
||||
},
|
||||
"src_sel" : {
|
||||
"address" : "4",
|
||||
"width" : "29",
|
||||
"description" : "Source selection",
|
||||
"fields": {
|
||||
"src0_sel" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "0x0",
|
||||
"description" : "Source-0 selection"
|
||||
},
|
||||
"Reserved-0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"src1_sel" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "0x0",
|
||||
"description" : "Source-1 selection"
|
||||
},
|
||||
"Reserved-1" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"src2_sel" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "0x0",
|
||||
"description" : "Source-2 selection"
|
||||
},
|
||||
"Reserved-2" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"src3_sel" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "0x0",
|
||||
"description" : "Source-3 selection"
|
||||
}
|
||||
}
|
||||
},
|
||||
"src_cfg" : {
|
||||
"address" : "5",
|
||||
"width" : "28",
|
||||
"description" : "Source configuration",
|
||||
"fields": {
|
||||
"ris_en_0" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable rising-edge events on source 0"
|
||||
},
|
||||
"fal_en_0" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable falling-edge events on source 0"
|
||||
},
|
||||
"mask_en_0" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Mask events on source 0"
|
||||
},
|
||||
"sync_en_0" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable clock synchronization on source 0"
|
||||
},
|
||||
"Reserved-0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "4",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"ris_en_1" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable rising-edge events on source 1"
|
||||
},
|
||||
"fal_en_1" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable falling-edge events on source 1"
|
||||
},
|
||||
"mask_en_1" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Mask events on source 1"
|
||||
},
|
||||
"sync_en_1" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable clock synchronization on source 1"
|
||||
},
|
||||
"Reserved-1" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "4",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"ris_en_2" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable rising-edge events on source 2"
|
||||
},
|
||||
"fal_en_2" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable falling-edge events on source 2"
|
||||
},
|
||||
"mask_en_2" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Mask events on source 2"
|
||||
},
|
||||
"sync_en_2" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable clock synchronization on source 2"
|
||||
},
|
||||
"Reserved-2" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "4",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"ris_en_3" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable rising-edge events on source 3"
|
||||
},
|
||||
"fal_en_3" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable falling-edge events on source 3"
|
||||
},
|
||||
"mask_en_3" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Mask events on source 3"
|
||||
},
|
||||
"sync_en_3" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0x0",
|
||||
"description" : "Enable clock synchronization on source 3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"log_fifo_mng_w": {
|
||||
"address": "6",
|
||||
"width": "16",
|
||||
"description": "logger FIFO management",
|
||||
"fields": {
|
||||
"irq_gen_thres": {
|
||||
"type": "w",
|
||||
"bit_len": "15",
|
||||
"reset": "0x0",
|
||||
"description": "FIFO IRQ threshold"
|
||||
},
|
||||
"fifo_read" : {
|
||||
"type" : "wp",
|
||||
"bit_len" : "1",
|
||||
"reset": "0x0",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"log_fifo_mng_r": {
|
||||
"address": "7",
|
||||
"width": "32",
|
||||
"description": "logger FIFO management status",
|
||||
"fields": {
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"fifo_level": {
|
||||
"type": "r",
|
||||
"bit_len": "15",
|
||||
"reset": "0x0",
|
||||
"description": "fifo level"
|
||||
},
|
||||
"fifo_overflow": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "fifo overflow flag"
|
||||
}
|
||||
}
|
||||
},
|
||||
"log_fifo_out_a": {
|
||||
"type": "r",
|
||||
"address": "8",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Logger FIFO output-A (time-tag)"
|
||||
},
|
||||
"log_fifo_out_b": {
|
||||
"type": "r",
|
||||
"address": "9",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"subtype": "signed",
|
||||
"description": "Logger FIFO output-B (position-tag)"
|
||||
},
|
||||
"init_value": {
|
||||
"type": "r",
|
||||
"address": "10",
|
||||
"reset": "0x0",
|
||||
"width": "4",
|
||||
"description": "Initial value when logging starts"
|
||||
},
|
||||
"trigger_mng": {
|
||||
"address": "11",
|
||||
"width": "13",
|
||||
"description": "External trigger management",
|
||||
"fields": {
|
||||
"ext_trig_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "External trigger enable"
|
||||
},
|
||||
"ext_trig_fal": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "External triggers happens on the falling edge"
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "6",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"ext_trig_src": {
|
||||
"type": "w",
|
||||
"bit_len": "5",
|
||||
"reset": "0x0",
|
||||
"description": "Select the source for the external trigger"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
45
generic_ip/event_logger/2/sim/comp_event_logger_2.do
Normal file
45
generic_ip/event_logger/2/sim/comp_event_logger_2.do
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Simulation macro
|
||||
|
||||
#.main clear
|
||||
|
||||
# Cleanup libraries
|
||||
foreach lib [list work OSVVM] {
|
||||
file delete -force -- $lib
|
||||
vlib $lib
|
||||
}
|
||||
|
||||
set OSVVM_PATH ../../../common/0/src/test/OSVVM
|
||||
set COMMON_PATH ../../../common/0/src
|
||||
|
||||
set WORKLIB work
|
||||
|
||||
vlib ./work
|
||||
vmap work ./work
|
||||
|
||||
# Compile the UUT
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd
|
||||
vcom -2008 -work $WORKLIB ./../src/event_logger_2_pkg_auto.vhd
|
||||
vcom -2008 -work $WORKLIB ./../src/event_logger_2_csr_regs_auto.vhd
|
||||
vcom -2008 -work $WORKLIB ./../src/event_logger_2.vhd
|
||||
|
||||
# Compile the constrained random related packages
|
||||
vlib OSVVM
|
||||
vcom -2008 -work OSVVM \
|
||||
$OSVVM_PATH/RandomBasePkg.vhd \
|
||||
$OSVVM_PATH/SortListPkg_int.vhd \
|
||||
$OSVVM_PATH/RandomPkg.vhd \
|
||||
$OSVVM_PATH/NamePkg.vhd \
|
||||
$OSVVM_PATH/MessagePkg.vhd \
|
||||
$OSVVM_PATH/CoveragePkg.vhd
|
||||
|
||||
# Compile support files
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH//test/avalon_verify_pkg.vhd
|
||||
|
||||
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
|
||||
set StdArithNoWarnings 1
|
||||
set NumericStdNoWarnings 1
|
||||
284
generic_ip/event_logger/2/src/event_logger_2.vhd
Normal file
284
generic_ip/event_logger/2/src/event_logger_2.vhd
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : event_logger_2
|
||||
-- Project : EMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : event_logger_2.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-07-19
|
||||
-- Last update: 2021-03-25
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'93
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- The event logger block detects events (rising and/or falling edges) on a
|
||||
-- programmable set of inputs signals, attaches a time and position tag to
|
||||
-- each event, then stores that information on an output FIFO, to be read by the HPS.
|
||||
-- The time-tags use the fine time field of the EMB time counter.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.common_pkg.all;
|
||||
|
||||
entity event_logger_2 is
|
||||
generic(
|
||||
FIFO_SIZE : natural := 1024;
|
||||
DEVICE_FAMILY : string := "Cyclone V");
|
||||
port(
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
data_src : in std_logic_vector(31 downto 0);
|
||||
fine_time : in std_logic_vector(27 downto 0);
|
||||
abs_position : in std_logic_vector(31 downto 0);
|
||||
-- Interrupt Sender
|
||||
ins_irq : out std_logic;
|
||||
-- Avalon MM
|
||||
avs_address : in std_logic_vector( 3 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0));
|
||||
end event_logger_2;
|
||||
|
||||
architecture RTL of event_logger_2 is
|
||||
|
||||
-- constants
|
||||
|
||||
constant LOG_IP_ID : std_logic_vector(31 downto 0) := x"0000FF1B";
|
||||
constant LOG_IP_VER : std_logic_vector(31 downto 0) := x"00000100";
|
||||
|
||||
--
|
||||
signal init, en_1pps_event, pulse_1pps : std_logic;
|
||||
signal mp_0, mp_1, mp_2, mp_3 : std_logic;
|
||||
signal mp_0_i, mp_1_i, mp_2_i, mp_3_i : std_logic;
|
||||
signal mp_0_d, mp_1_d, mp_2_d, mp_3_d : std_logic;
|
||||
signal mp_sync_0, mp_sync_1, mp_sync_2, mp_sync_3 : std_logic;
|
||||
signal mask_mp_0, mask_mp_1, mask_mp_2, mask_mp_3 : std_logic;
|
||||
signal ris_en_0, ris_en_1, ris_en_2, ris_en_3 : std_logic;
|
||||
signal fal_en_0, fal_en_1, fal_en_2, fal_en_3 : std_logic;
|
||||
signal sync_en_0, sync_en_1, sync_en_2, sync_en_3 : std_logic;
|
||||
signal irq_en, irq_clr, irq_mask, irq_val, irq, irq_d : std_logic;
|
||||
signal fifo_rd_en, fifo_wr_en, fifo_full, fifo_error : std_logic;
|
||||
signal time_event, log_event, trigger, trigger_d : std_logic;
|
||||
signal event_detect_0, event_detect_1 : std_logic;
|
||||
signal event_detect_2, event_detect_3 : std_logic;
|
||||
signal ext_trg_en, ext_trg_fal, trigger_set : std_logic;
|
||||
signal init_value : std_logic_vector( 3 downto 0);
|
||||
signal ext_trg_src : std_logic_vector( 4 downto 0);
|
||||
signal src_sel_0, src_sel_1, src_sel_2, src_sel_3 : std_logic_vector( 4 downto 0);
|
||||
signal fifo_usedw, fifo_thres : std_logic_vector(log2(FIFO_SIZE)-1 downto 0);
|
||||
signal fine_time_corrected : std_logic_vector(27 downto 0);
|
||||
signal log_entry, fifo_q_a, fifo_q_b : std_logic_vector(31 downto 0);
|
||||
signal fifo_read_pulse : std_logic;
|
||||
|
||||
begin -- RTL
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Data source selection and event detection
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- input synchronization (in case the input is asynchronous)
|
||||
iSync_0 : entity work.sync_wire
|
||||
generic map (rst_val => '0', sync_stages => 2)
|
||||
port map (rstN => rstN, clk => clk, async_in => mp_0_i, sync_out => mp_sync_0);
|
||||
|
||||
iSync_1 : entity work.sync_wire
|
||||
generic map (rst_val => '0', sync_stages => 2)
|
||||
port map (rstN => rstN, clk => clk, async_in => mp_1_i, sync_out => mp_sync_1);
|
||||
|
||||
iSync_2 : entity work.sync_wire
|
||||
generic map (rst_val => '0', sync_stages => 2)
|
||||
port map (rstN => rstN, clk => clk, async_in => mp_2_i, sync_out => mp_sync_2);
|
||||
|
||||
iSync_3 : entity work.sync_wire
|
||||
generic map (rst_val => '0', sync_stages => 2)
|
||||
port map (rstN => rstN, clk => clk, async_in => mp_3_i, sync_out => mp_sync_3);
|
||||
|
||||
mp_0 <= mp_0_i when sync_en_0 = '0' else mp_sync_0;
|
||||
mp_1 <= mp_1_i when sync_en_1 = '0' else mp_sync_1;
|
||||
mp_2 <= mp_2_i when sync_en_2 = '0' else mp_sync_2;
|
||||
mp_3 <= mp_3_i when sync_en_3 = '0' else mp_sync_3;
|
||||
|
||||
pEventDetect : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
mp_0_i <= data_src(to_integer(unsigned(src_sel_0)));
|
||||
mp_1_i <= data_src(to_integer(unsigned(src_sel_1)));
|
||||
mp_2_i <= data_src(to_integer(unsigned(src_sel_2)));
|
||||
mp_3_i <= data_src(to_integer(unsigned(src_sel_3)));
|
||||
mp_0_d <= mp_0;
|
||||
mp_1_d <= mp_1;
|
||||
mp_2_d <= mp_2;
|
||||
mp_3_d <= mp_3;
|
||||
trigger <= data_src(to_integer(unsigned(ext_trg_src)));
|
||||
trigger_d <= trigger;
|
||||
if(init = '1' or ext_trg_en = '0') then
|
||||
trigger_set <= '0';
|
||||
elsif((ext_trg_fal = '0' and trigger = '1' and trigger_d = '0') or (ext_trg_fal = '1' and trigger = '0' and trigger_d = '1')) then
|
||||
trigger_set <= '1';
|
||||
end if;
|
||||
if(log_event = '1') then
|
||||
log_entry <= event_detect_3 & event_detect_2 & event_detect_1 & event_detect_0 & (time_event & fine_time_corrected(26 downto 0));
|
||||
end if;
|
||||
fifo_wr_en <= log_event and ((ext_trg_en and trigger_set) or not ext_trg_en);
|
||||
if(init = '1') then
|
||||
fifo_error <= '0';
|
||||
elsif(fifo_wr_en = '1' and fifo_full = '1') then
|
||||
fifo_error <= '1';
|
||||
end if;
|
||||
if(unsigned(fine_time) = 0) then
|
||||
pulse_1pps <= '1';
|
||||
else
|
||||
pulse_1pps <= '0';
|
||||
end if;
|
||||
if(init = '1') then
|
||||
init_value <= mp_3 & mp_2 & mp_1 & mp_0;
|
||||
end if;
|
||||
end if;
|
||||
end process pEventDetect;
|
||||
|
||||
event_detect_0 <= not mask_mp_0 and ((ris_en_0 and mp_0 and not mp_0_d) or (fal_en_0 and not mp_0 and mp_0_d));
|
||||
event_detect_1 <= not mask_mp_1 and ((ris_en_1 and mp_1 and not mp_1_d) or (fal_en_1 and not mp_1 and mp_1_d));
|
||||
event_detect_2 <= not mask_mp_2 and ((ris_en_2 and mp_2 and not mp_2_d) or (fal_en_2 and not mp_2 and mp_2_d));
|
||||
event_detect_3 <= not mask_mp_3 and ((ris_en_3 and mp_3 and not mp_3_d) or (fal_en_3 and not mp_3 and mp_3_d));
|
||||
time_event <= en_1pps_event and pulse_1pps;
|
||||
|
||||
log_event <= event_detect_0 or event_detect_1 or event_detect_2 or event_detect_3 or time_event;
|
||||
|
||||
|
||||
-- correct the fine time to take into account of the detection latency
|
||||
fine_time_corrected <= std_logic_vector(unsigned(fine_time)-1);
|
||||
|
||||
-- FIFO_A : Event Source and Time-Tag
|
||||
iFIFO_A : entity work.sync_fifo
|
||||
generic map (
|
||||
DEVICE_FAMILY => DEVICE_FAMILY,
|
||||
DATA_WIDTH => 32,
|
||||
DEPTH => FIFO_SIZE,
|
||||
SHOWAHEAD => "OFF",
|
||||
REGISTER_OUTPUT => "OFF"
|
||||
)
|
||||
port map (
|
||||
clk => clk,
|
||||
wrdata => log_entry,
|
||||
rdreq => fifo_rd_en,
|
||||
sclr => init,
|
||||
wrreq => fifo_wr_en,
|
||||
empty => open,
|
||||
full => fifo_full,
|
||||
rddata => fifo_q_a,
|
||||
usedw => fifo_usedw);
|
||||
|
||||
-- FIFO_B: Position-Tag
|
||||
iFIFO_B : entity work.sync_fifo
|
||||
generic map (
|
||||
DEVICE_FAMILY => DEVICE_FAMILY,
|
||||
DATA_WIDTH => 32,
|
||||
DEPTH => FIFO_SIZE,
|
||||
SHOWAHEAD => "OFF",
|
||||
REGISTER_OUTPUT => "OFF"
|
||||
)
|
||||
port map (
|
||||
clk => clk,
|
||||
wrdata => abs_position,
|
||||
rdreq => fifo_rd_en,
|
||||
sclr => init,
|
||||
wrreq => fifo_wr_en,
|
||||
empty => open,
|
||||
full => open,
|
||||
rddata => fifo_q_b,
|
||||
usedw => open);
|
||||
|
||||
fifo_rd_en <= '1' when fifo_read_pulse = '1' else '0';
|
||||
|
||||
-- IRQ generation and management
|
||||
pIRQ : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
irq <= '0';
|
||||
irq_d <= '0';
|
||||
ins_irq <= '0';
|
||||
elsif(clk = '1' and clk'event) then
|
||||
irq_d <= irq;
|
||||
if(irq_clr = '1') then
|
||||
irq <= '0';
|
||||
elsif(irq_en = '1' and (unsigned(fifo_usedw) >= unsigned(fifo_thres)) and irq_d = '0') then
|
||||
irq <= '1';
|
||||
end if;
|
||||
ins_irq <= irq_val;
|
||||
end if;
|
||||
end process pIRQ;
|
||||
|
||||
irq_val <= irq and not irq_mask;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- C&S registers (Avalon-MM I/F)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
event_logger_csr_regs_i : entity work.event_logger_2_csr_regs
|
||||
generic map (
|
||||
ADDR_DECODE_WIDTH => 4
|
||||
)
|
||||
port map (
|
||||
-- Clock and reset
|
||||
clk => clk,
|
||||
rst_n => rstN,
|
||||
|
||||
-- auto-generated
|
||||
|
||||
-- Internal signal ports
|
||||
logger_ctrl_w_init => init,
|
||||
logger_ctrl_w_en_1pps_event => en_1pps_event,
|
||||
logger_ctrl_w_irq_en => irq_en,
|
||||
logger_ctrl_w_irq_clr => irq_clr,
|
||||
logger_ctrl_w_irq_mask => irq_mask,
|
||||
src_sel_src0_sel => src_sel_0,
|
||||
src_sel_src1_sel => src_sel_1,
|
||||
src_sel_src2_sel => src_sel_2,
|
||||
src_sel_src3_sel => src_sel_3,
|
||||
src_cfg_ris_en_0 => ris_en_0,
|
||||
src_cfg_fal_en_0 => fal_en_0,
|
||||
src_cfg_mask_en_0 => mask_mp_0,
|
||||
src_cfg_sync_en_0 => sync_en_0,
|
||||
src_cfg_ris_en_1 => ris_en_1,
|
||||
src_cfg_fal_en_1 => fal_en_1,
|
||||
src_cfg_mask_en_1 => mask_mp_1,
|
||||
src_cfg_sync_en_1 => sync_en_1,
|
||||
src_cfg_ris_en_2 => ris_en_2,
|
||||
src_cfg_fal_en_2 => fal_en_2,
|
||||
src_cfg_mask_en_2 => mask_mp_2,
|
||||
src_cfg_sync_en_2 => sync_en_2,
|
||||
src_cfg_ris_en_3 => ris_en_3,
|
||||
src_cfg_fal_en_3 => fal_en_3,
|
||||
src_cfg_mask_en_3 => mask_mp_3,
|
||||
src_cfg_sync_en_3 => sync_en_3,
|
||||
log_fifo_mng_w_irq_gen_thres => fifo_thres,
|
||||
trigger_mng_ext_trig_en => ext_trg_en,
|
||||
trigger_mng_ext_trig_fal => ext_trg_fal,
|
||||
trigger_mng_ext_trig_src => ext_trg_src,
|
||||
log_fifo_mng_w_pulse => fifo_read_pulse,
|
||||
log_fifo_mng_w_fifo_read => open,
|
||||
log_fifo_mng_w_fifo_read_in => '0',
|
||||
logger_ctrl_r_irq_value => irq_val,
|
||||
log_fifo_mng_r_fifo_level => fifo_usedw,
|
||||
log_fifo_mng_r_fifo_overflow => fifo_error,
|
||||
log_fifo_out_a => fifo_q_a,
|
||||
log_fifo_out_b => fifo_q_b,
|
||||
init_value => init_value,
|
||||
|
||||
-- end auto-generated
|
||||
|
||||
-- Slave bus port
|
||||
avs_address => avs_address,
|
||||
avs_write => avs_write,
|
||||
avs_writedata => avs_writedata,
|
||||
avs_read => avs_read,
|
||||
avs_readdata => avs_readdata
|
||||
|
||||
);
|
||||
|
||||
end RTL;
|
||||
1
generic_ip/event_logger/versions.txt
Normal file
1
generic_ip/event_logger/versions.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
V2- FPGA Vendor Independent. Change to Generic Fifos from common/1
|
||||
Loading…
Add table
Add a link
Reference in a new issue