From 3534729a6fba4fd5e29ba9e8f2732e04bc477c07 Mon Sep 17 00:00:00 2001 From: gianmarcogirau Date: Tue, 15 Oct 2019 09:02:47 +0100 Subject: [PATCH] HMBXR5601-797 - New testbench for Q&D block, fixed bug when assessing elapsed time. No Fire-Pulse missing after 4 full days of regression tests --- generic_ip/common/0/sim/sim_queue_delay.do | 16 + generic_ip/common/0/sim/wave_queue_delay.do | 65 +- generic_ip/common/0/src/queue_and_delay.vhd | 73 +- generic_ip/common/0/src/test/lfsr_6.vhd | 63 ++ .../common/0/src/test/queue_and_delay_tb.vhd | 809 +++++++----------- .../fire_pulse_manager/3/sim/sim_fpm.do | 4 +- .../1/doc/pulse_generator_1.json | 2 +- .../1/src/altera/sync_fifo_1.vhd | 201 ----- .../1/src/pulse_generator_1.vhd | 12 +- .../2/doc/pulse_generator_2.json | 2 +- .../2/src/pulse_generator_2.vhd | 15 +- 11 files changed, 474 insertions(+), 788 deletions(-) create mode 100644 generic_ip/common/0/src/test/lfsr_6.vhd delete mode 100644 generic_ip/pulse_generator/1/src/altera/sync_fifo_1.vhd diff --git a/generic_ip/common/0/sim/sim_queue_delay.do b/generic_ip/common/0/sim/sim_queue_delay.do index 123c6f7..6102493 100644 --- a/generic_ip/common/0/sim/sim_queue_delay.do +++ b/generic_ip/common/0/sim/sim_queue_delay.do @@ -2,13 +2,28 @@ .main clear +# Cleanup libraries +foreach lib [list work OSVVM] { + file delete -force -- $lib + vlib $lib +} + set SRC_PATH ./../src set TB_PATH ./../src/test +set OSVVM_PATH $TB_PATH/OSVVM vlib ./work vmap work ./work +# Compile the constrained random related packages +vlib OSVVM +vcom -2008 -work OSVVM $OSVVM_PATH/RandomBasePkg.vhd +vcom -2008 -work OSVVM $OSVVM_PATH/SortListPkg_int.vhd +vcom -2008 -work OSVVM $OSVVM_PATH/RandomPkg.vhd +vcom -2008 -work OSVVM $OSVVM_PATH/NamePkg.vhd +vcom -2008 -work OSVVM $OSVVM_PATH/MessagePkg.vhd +vcom -2008 -work OSVVM $OSVVM_PATH/CoveragePkg.vhd # Compile the UUT vcom -work work $SRC_PATH/common_pkg.vhd @@ -18,6 +33,7 @@ vcom -2008 -work work $SRC_PATH/queue_and_delay.vhd # Compile the Testbench and the other components supporting the test vcom -2008 -work work $TB_PATH/common_test_pkg.vhd vcom -2008 -work work $TB_PATH/log_pkg.vhd +vcom -2008 -work work $TB_PATH/lfsr_6.vhd vcom -2008 -work work $TB_PATH/queue_and_delay_tb.vhd # Simulate diff --git a/generic_ip/common/0/sim/wave_queue_delay.do b/generic_ip/common/0/sim/wave_queue_delay.do index 63a6e9a..262a810 100644 --- a/generic_ip/common/0/sim/wave_queue_delay.do +++ b/generic_ip/common/0/sim/wave_queue_delay.do @@ -1,33 +1,40 @@ onerror {resume} quietly WaveActivateNextPane {} 0 -add wave -noupdate /queue_and_delay_tb/rstN +add wave -noupdate /queue_and_delay_tb/reset_n add wave -noupdate /queue_and_delay_tb/clk add wave -noupdate /queue_and_delay_tb/init add wave -noupdate /queue_and_delay_tb/cnt_dir -add wave -noupdate /queue_and_delay_tb/pIO_MNG/loc_cnt -add wave -noupdate -radix unsigned /queue_and_delay_tb/delay -add wave -noupdate -radix decimal /queue_and_delay_tb/ext_time -add wave -noupdate /queue_and_delay_tb/kickstart -add wave -noupdate /queue_and_delay_tb/kickstart_ref +add wave -noupdate /queue_and_delay_tb/delay +add wave -noupdate -radix hexadecimal /queue_and_delay_tb/ext_time add wave -noupdate /queue_and_delay_tb/wave_in -add wave -noupdate /queue_and_delay_tb/wave_delayed add wave -noupdate /queue_and_delay_tb/wave_out add wave -noupdate /queue_and_delay_tb/wave_ref -add wave -noupdate /queue_and_delay_tb/wave_error -add wave -noupdate /queue_and_delay_tb/error_detected -add wave -noupdate -radix decimal /queue_and_delay_tb/init_time -add wave -noupdate /queue_and_delay_tb/offset -add wave -noupdate /queue_and_delay_tb/pulse_width +add wave -noupdate /queue_and_delay_tb/ovf_error add wave -noupdate /queue_and_delay_tb/passed add wave -noupdate /queue_and_delay_tb/failed -add wave -noupdate /queue_and_delay_tb/completed -add wave -noupdate /queue_and_delay_tb/ovf_error +add wave -noupdate /queue_and_delay_tb/test_completed +add wave -noupdate /queue_and_delay_tb/wave_in_rst +add wave -noupdate /queue_and_delay_tb/wave_in_upd +add wave -noupdate /queue_and_delay_tb/wave_ref_rst +add wave -noupdate /queue_and_delay_tb/wave_ref_upd +add wave -noupdate /queue_and_delay_tb/wave_running +add wave -noupdate /queue_and_delay_tb/wave_completed +add wave -noupdate /queue_and_delay_tb/wave_in_completed +add wave -noupdate /queue_and_delay_tb/wave_ref_completed +add wave -noupdate /queue_and_delay_tb/wave_init +add wave -noupdate /queue_and_delay_tb/wave_init_d +add wave -noupdate /queue_and_delay_tb/delay_cnt +add wave -noupdate /queue_and_delay_tb/div_cnt_in +add wave -noupdate /queue_and_delay_tb/wave_in_upd +add wave -noupdate /queue_and_delay_tb/wave_in_cnt +add wave -noupdate /queue_and_delay_tb/div_cnt_ref +add wave -noupdate /queue_and_delay_tb/wave_ref_cnt add wave -noupdate /queue_and_delay_tb/iUUT/rstN add wave -noupdate /queue_and_delay_tb/iUUT/clk add wave -noupdate /queue_and_delay_tb/iUUT/init add wave -noupdate /queue_and_delay_tb/iUUT/cnt_dir -add wave -noupdate -radix unsigned /queue_and_delay_tb/iUUT/delay -add wave -noupdate -radix decimal /queue_and_delay_tb/iUUT/ext_time +add wave -noupdate /queue_and_delay_tb/iUUT/delay +add wave -noupdate -radix hexadecimal /queue_and_delay_tb/iUUT/ext_time add wave -noupdate /queue_and_delay_tb/iUUT/wave_in add wave -noupdate /queue_and_delay_tb/iUUT/wave_out add wave -noupdate /queue_and_delay_tb/iUUT/ovf_error @@ -36,16 +43,30 @@ add wave -noupdate /queue_and_delay_tb/iUUT/toggle_out add wave -noupdate /queue_and_delay_tb/iUUT/time_elapsed add wave -noupdate /queue_and_delay_tb/iUUT/wave_in_d add wave -noupdate /queue_and_delay_tb/iUUT/wave_out_i -add wave -noupdate /queue_and_delay_tb/iUUT/wave_out_i_d -add wave -noupdate /queue_and_delay_tb/iUUT/new_event add wave -noupdate /queue_and_delay_tb/iUUT/pending_trans add wave -noupdate /queue_and_delay_tb/iUUT/fifo_rd_en add wave -noupdate /queue_and_delay_tb/iUUT/fifo_empty add wave -noupdate /queue_and_delay_tb/iUUT/fifo_full -add wave -noupdate -radix unsigned /queue_and_delay_tb/iUUT/int_time -add wave -noupdate -radix decimal /queue_and_delay_tb/iUUT/event_time +add wave -noupdate /queue_and_delay_tb/iUUT/cnt_dir_i +add wave -noupdate /queue_and_delay_tb/iUUT/wave_out_i_d +add wave -noupdate /queue_and_delay_tb/iUUT/new_event +add wave -noupdate /queue_and_delay_tb/iUUT/wave_out_ii +add wave -noupdate /queue_and_delay_tb/iUUT/shf_enable +add wave -noupdate /queue_and_delay_tb/iUUT/delay_line +add wave -noupdate -radix hexadecimal /queue_and_delay_tb/iUUT/int_time +add wave -noupdate /queue_and_delay_tb/iUUT/local_time_d +add wave -noupdate -radix hexadecimal /queue_and_delay_tb/iUUT/event_time +add wave -noupdate /queue_and_delay_tb/iUUT/delayed_event_time +add wave -noupdate -radix hexadecimal /queue_and_delay_tb/iUUT/diff_time +add wave -noupdate /queue_and_delay_tb/iWAVE_IN_GEN/clk +add wave -noupdate /queue_and_delay_tb/iWAVE_IN_GEN/lfsr_rst +add wave -noupdate /queue_and_delay_tb/iWAVE_IN_GEN/lfsr_upd +add wave -noupdate /queue_and_delay_tb/iWAVE_IN_GEN/lfsr_reg +add wave -noupdate /queue_and_delay_tb/iWAVE_IN_GEN/lfsr_out +add wave -noupdate /queue_and_delay_tb/iWAVE_IN_GEN/new_val +add wave -noupdate /queue_and_delay_tb/iWAVE_IN_GEN/shf_reg TreeUpdate [SetDefaultTree] -WaveRestoreCursors {{Cursor 1} {5695000 ps} 0} +WaveRestoreCursors {{Cursor 1} {495000 ps} 0} {{Cursor 2} {635000 ps} 1} quietly wave cursor active 1 configure wave -namecolwidth 343 configure wave -valuecolwidth 100 @@ -61,4 +82,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ps update -WaveRestoreZoom {814844 ps} {2822428 ps} +WaveRestoreZoom {0 ps} {2007584 ps} diff --git a/generic_ip/common/0/src/queue_and_delay.vhd b/generic_ip/common/0/src/queue_and_delay.vhd index ec01c6e..43b89dd 100644 --- a/generic_ip/common/0/src/queue_and_delay.vhd +++ b/generic_ip/common/0/src/queue_and_delay.vhd @@ -6,7 +6,7 @@ -- Author : Gianmarco Girau -- Company : Global Inkjet Systems -- Created : 2016-05-28 --- Last update: 2018-06-28 +-- Last update: 2019-10-10 -- SVN ID : Git -- Standard : VHDL'93 ------------------------------------------------------------------------------- @@ -30,19 +30,21 @@ use work.common_pkg.all; entity queue_and_delay is generic( - use_ext_time : boolean := false; - queue_size : natural range 16 to 8192 := 1024); + DELAY_WIDTH : integer range 8 to 32 := 32; + USE_EXT_TIME : boolean := false; + QUEUE_SIZE : natural range 16 to 8192 := 1024); port ( - rstN : in std_logic; - clk : in std_logic; - init : in std_logic; - cnt_dir : in std_logic; -- specify the direction of the cnt (0 => up, 1 - -- => down), when use_ext_time is set to ture - delay : in std_logic_vector(31 downto 0); - ext_time : in std_logic_vector(31 downto 0); - wave_in : in std_logic; - wave_out : out std_logic; - ovf_error : out std_logic); + rstN : in std_logic; + clk : in std_logic; + init : in std_logic; + cnt_dir : in std_logic; -- specify the direction of the cnt (0 => up, 1 + -- => down), when use_ext_time is set to true + delay : in std_logic_vector(DELAY_WIDTH-1 downto 0); + ext_time : in std_logic_vector(31 downto 0); + wave_in : in std_logic; + wave_out : out std_logic; + no_edge_detect : in std_logic := '0'; + ovf_error : out std_logic); end queue_and_delay; architecture RTL of queue_and_delay is @@ -67,9 +69,10 @@ architecture RTL of queue_and_delay is signal wave_in_d, wave_out_i, pending_trans : std_logic; signal fifo_rd_en, fifo_empty, fifo_full : std_logic; signal cnt_dir_i, wave_out_i_d, new_event : std_logic; - signal wave_out_ii, shf_enable : std_logic; + signal wave_out_ii, shf_enable, ext_msb : std_logic; signal delay_line : std_logic_vector( 7 downto 0); - signal int_time, local_time_d, event_time : std_logic_vector(31 downto 0); + signal int_time, local_time_d, event_time : std_logic_vector(31 downto 0); + signal diff_time, delayed_event_time : std_logic_vector(31 downto 0); begin -- RTL @@ -91,7 +94,7 @@ begin -- RTL iENTRY_QUEUE: sync_fifo generic map( FIFO_WIDTH => 32, - FIFO_DEPTH => queue_size) + FIFO_DEPTH => QUEUE_SIZE) port map ( clock => clk, data => int_time, @@ -118,37 +121,32 @@ begin -- RTL end process pCHECK_OVF; -- Time reference: either use the external one or generate it locally - gTIME_REF0: if use_ext_time = true generate + gTIME_REF0: if USE_EXT_TIME = true generate int_time <= ext_time; shf_enable <= '1' when int_time /= local_time_d else '0'; - - --pTimeElapsed : process(cnt_dir, int_time, event_time, delay) + pTimeElapsed : process(clk) begin if(clk = '1' and clk'event) then local_time_d <= int_time; cnt_dir_i <= cnt_dir; - if(cnt_dir_i = '0') then - if(signed(int_time) >= signed(event_time) + signed(delay)) then - time_elapsed <= '1'; - else - time_elapsed <= '0'; - end if; - else - if(signed(int_time) <= signed(event_time) - signed(delay)) then - time_elapsed <= '1'; - else - time_elapsed <= '0'; - end if; + if(cnt_dir_i = '0') then + time_elapsed <= not diff_time(diff_time'left); + else + time_elapsed <= diff_time(diff_time'left); end if; new_event <= fifo_rd_en; end if; end process pTimeElapsed; + + delayed_event_time <= std_logic_vector(signed(event_time) + signed(delay)) when cnt_dir_i = '0' else std_logic_vector(signed(event_time) - signed(delay) + 1); + diff_time <= std_logic_vector(signed(ext_time)-signed(delayed_event_time)); + end generate gTIME_REF0; - gTIME_REF1: if use_ext_time = false generate + gTIME_REF1: if USE_EXT_TIME = false generate pGEN_LOC_REF : process(rstN, clk) begin @@ -164,7 +162,10 @@ begin -- RTL end process pGEN_LOC_REF; new_event <= fifo_rd_en; - time_elapsed <= '1' when unsigned(int_time) >= unsigned(event_time) + unsigned(delay) else '0'; + + delayed_event_time <= std_logic_vector(unsigned(event_time) + unsigned(delay)); + diff_time <= std_logic_vector(unsigned(int_time)-unsigned(delayed_event_time)); + time_elapsed <= '1' when diff_time(diff_time'left) = '0' else '0'; shf_enable <= '1'; @@ -242,7 +243,11 @@ begin -- RTL begin if(clk = '1' and clk'event) then wave_out_i_d <= wave_out_i; - wave_out <= wave_out_i and not wave_out_i_d; + if(no_edge_detect = '0') then + wave_out <= wave_out_i and not wave_out_i_d; + else + wave_out <= wave_out_i; + end if; end if; end process pOUT_GEN1; diff --git a/generic_ip/common/0/src/test/lfsr_6.vhd b/generic_ip/common/0/src/test/lfsr_6.vhd new file mode 100644 index 0000000..7e3a17a --- /dev/null +++ b/generic_ip/common/0/src/test/lfsr_6.vhd @@ -0,0 +1,63 @@ +------------------------------------------------------------------------------- +-- Title : lfsr_6 +-- Project : generic-ip +------------------------------------------------------------------------------- +-- File : lfsr_6.vhd +-- Author : Gianmarco Girau +-- Company : Global Inkjet Systems +-- Created : 2019-10-08 +-- Last update: 2019-10-08 +-- SVN ID : Git +-- Standard : VHDL'2008 +------------------------------------------------------------------------------- +-- Description: +-- 6-bit, max length LFSR with removed absorbing state +-- Taps are 5,6 +-- For different LFSR lengths please consult: +-- Xilinx XAPP052, 7th July 1996, "Efficient Shift Registers, LFSR Counters, +-- and Long Pseudo-Random Sequence Generators", by Peter Alfke. +------------------------------------------------------------------------------- + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity lfsr_6 is + generic( + SEED : std_logic_vector(5 downto 0) := (others => '1')); + + port( + clk : in std_logic; + lfsr_rst : in std_logic; + lfsr_upd : in std_logic; + lfsr_reg : out std_logic_vector(5 downto 0); + lfsr_out : out std_logic); +end lfsr_6; + +architecture RTL of lfsr_6 is + + signal new_val : std_logic; + signal shf_reg : std_logic_vector(5 downto 0); + +begin + + pLFSR : process(clk) + begin + if(clk = '1' and clk'event) then + if(lfsr_rst = '1') then + shf_reg <= SEED; + elsif(lfsr_upd = '1') then + shf_reg <= shf_reg(shf_reg'left-1 downto 0) & new_val; + end if; + end if; + end process pLFSR; + + new_val <= shf_reg(5) xor shf_reg(4); + + lfsr_reg <= shf_reg; + lfsr_out <= shf_reg(shf_reg'left); + +end RTL; + + + diff --git a/generic_ip/common/0/src/test/queue_and_delay_tb.vhd b/generic_ip/common/0/src/test/queue_and_delay_tb.vhd index c407dc3..9a50b92 100644 --- a/generic_ip/common/0/src/test/queue_and_delay_tb.vhd +++ b/generic_ip/common/0/src/test/queue_and_delay_tb.vhd @@ -6,7 +6,7 @@ -- Author : Gianmarco Girau -- Company : Global Inkjet Systems -- Created : 2016-11-01 --- Last update: 2019-09-24 +-- Last update: 2019-10-10 -- SVN ID : Git -- Standard : VHDL'93 ------------------------------------------------------------------------------- @@ -25,43 +25,37 @@ use ieee.numeric_std.all; library work; use work.log_pkg.all; -entity queue_and_delay_tb is - -- ... +library OSVVM; +use OSVVM.RandomBasePkg.all; +use OSVVM.RandomPkg.all; + +entity queue_and_delay_tb is + generic( + USE_EXT_TIME : boolean := true); +-- ... end queue_and_delay_tb; architecture behav of queue_and_delay_tb is - ----------------------------------------------------------------------------- - -- Component declarations - ----------------------------------------------------------------------------- - - component queue_and_delay - generic ( - use_ext_time : boolean; - queue_size : natural range 16 to 8192); - port ( - rstN : in std_logic; - clk : in std_logic; - init : in std_logic; - cnt_dir : in std_logic; - delay : in std_logic_vector(31 downto 0); - ext_time : in std_logic_vector(31 downto 0); - wave_in : in std_logic; - wave_out : out std_logic; - ovf_error : out std_logic); - end component; - - ----------------------------------------------------------------------------- -- Constant, types and signals ----------------------------------------------------------------------------- - constant clk_period : time := 10.0 ns; -- ems clock + constant clk_period : time := 10.0 ns; -- clock period -- Logging Verbosity Level constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM; - signal rstN : std_logic; + constant WAVE_UPD_PERIOD : natural := 4; + constant EXT_TIME_PERIOD : natural := 3; + constant DELAY_ERROR : natural := 2; + + -- Number of delay values to be tested. For each value the testbench + -- initializes the timing reference with a wide set of values + constant DELAY_TEST_NUM : natural := 10; + + + signal reset_n : std_logic; signal clk : std_logic := '0'; signal init : std_logic; signal cnt_dir : std_logic; @@ -69,22 +63,34 @@ architecture behav of queue_and_delay_tb is signal ext_time : std_logic_vector(31 downto 0); signal wave_in : std_logic; signal wave_out : std_logic; + signal no_edge_detect : std_logic; signal ovf_error : std_logic; -- - signal wave_delayed : std_logic; - signal wave_delayed_d : std_logic; - signal wave_ref : std_logic; - signal wave_error : std_logic; - signal init_time : std_logic_vector(31 downto 0); - signal offset : integer; - signal pulse_width : integer; signal passed : boolean; signal failed : boolean; - signal completed : boolean; signal test_completed : boolean := false; - signal kickstart : std_logic; - signal kickstart_ref : std_logic; - signal error_detected : std_logic; + -- + signal wave_in_rst : std_logic; + signal wave_in_upd : std_logic; + signal wave_ref : std_logic; + signal wave_ref_rst : std_logic; + signal wave_ref_upd : std_logic; + signal wave_running : std_logic; + signal wave_completed : std_logic; + signal wave_in_completed : std_logic; + signal wave_ref_completed : std_logic; + signal wave_init : std_logic; + signal wave_init_d : std_logic; + signal delay_cnt : natural; + signal div_cnt_in : natural; + signal wave_in_cnt : natural; + signal div_cnt_ref : natural; + signal wave_ref_cnt : natural; + signal set_ext_time : std_logic; + signal ext_time_init : std_logic_vector(31 downto 0); + signal ext_time_upd_cnt : natural; + + shared variable error_flag : boolean; begin -- behav @@ -95,539 +101,314 @@ begin -- behav -- UUT ----------------------------------------------------------------------------- - iUUT: queue_and_delay + iUUT : entity work.queue_and_delay generic map ( - use_ext_time => true, + use_ext_time => USE_EXT_TIME, queue_size => 128) port map ( - rstN => rstN, - clk => clk, - init => init, - cnt_dir => cnt_dir, - delay => delay, - ext_time => ext_time, - wave_in => wave_in, - wave_out => wave_out, - ovf_error => ovf_error); + rstN => reset_n, + clk => clk, + init => init, + cnt_dir => cnt_dir, + delay => delay, + ext_time => ext_time, + wave_in => wave_in, + wave_out => wave_out, + no_edge_detect => no_edge_detect, + ovf_error => ovf_error); ----------------------------------------------------------------------------- -- Stimuli generator and output checker ----------------------------------------------------------------------------- - pIO_MNG: process(rstN, init, clk) - variable loc_cnt : integer; - begin - if(rstN = '0') then - loc_cnt := 0; - ext_time <= (others => '0'); - kickstart <= '0'; - kickstart_ref <= '0'; - wave_error <= '0'; - elsif(init = '1') then - loc_cnt := 0; - ext_time <= init_time; - kickstart <= '0'; - kickstart_ref <= '0'; - wave_error <= '0'; - elsif(clk = '1' and clk'event) then - loc_cnt := loc_cnt+1; - if(cnt_dir = '0') then - ext_time <= std_logic_vector(signed(ext_time)+1); - else - ext_time <= std_logic_vector(signed(ext_time)-1); - end if; - if(loc_cnt = offset) then - kickstart <= '1'; - else - kickstart <= '0'; - end if; - --if(loc_cnt = (offset + to_integer(unsigned(delay))+1)) then - -- wave_delayed <= '1'; - --elsif(loc_cnt = offset + pulse_width + to_integer(unsigned(delay)+1)) then - -- wave_delayed <= '0'; - --end if; - if(loc_cnt = (offset + to_integer(unsigned(delay))+3)) then - kickstart_ref <= '1'; - --elsif(loc_cnt = offset + pulse_width + to_integer(unsigned(delay)+2)) then - else - kickstart_ref <= '0'; - end if; - if(wave_out /= wave_ref) then - wave_error <= '1'; - end if; - end if; - end process pIO_MNG; - - pREP : process(clk) + -- Generate the ext_time reference + pEXT_TIME_GEN : process(clk) begin if(clk = '1' and clk'event) then - wave_delayed_d <= wave_delayed; - if(init = '1') then - error_detected <= '0'; - elsif(wave_error = '1') then - error_detected <= '1'; + /* + if(set_ext_time = '1' or ext_time_upd_cnt = EXT_TIME_PERIOD-1) then + ext_time_upd_cnt <= 0; + else + ext_time_upd_cnt <= ext_time_upd_cnt + 1; + end if; + */ + ext_time_upd_cnt <= 0; + if(set_ext_time = '1') then + ext_time <= ext_time_init; + else + if(cnt_dir = '0' and ext_time_upd_cnt = 0) then + if(ext_time_upd_cnt = 0) then + ext_time <= std_logic_vector(unsigned(ext_time)+1); + end if; + else + if(ext_time_upd_cnt = 0) then + ext_time <= std_logic_vector(unsigned(ext_time)-1); + end if; + end if; end if; end if; - end process pREP; + end process pEXT_TIME_GEN; - -- Generate the input wave - pWAVE_IN_GEN : process + -- Use a first lfsr to generate the a random input waveform, to be delayed, + -- and a second lfsr, to be compared against the output of the Q&D block. + -- The second lfsr starts the generation after the programmed delay + + iWAVE_IN_GEN: entity work.lfsr_6 + port map ( + clk => clk, + lfsr_rst => wave_in_rst, + lfsr_upd => wave_in_upd, + lfsr_reg => open, + lfsr_out => wave_in); + + iWAVE_REF_GEN: entity work.lfsr_6 + port map ( + clk => clk, + lfsr_rst => wave_ref_rst, + lfsr_upd => wave_ref_upd, + lfsr_reg => open, + lfsr_out => wave_ref); + + -- The logic down below drive the two LFSRs, and make sure the second one, + -- used as a reference, is delayed of the same amount used in the Q&D block. + -- The full LFSR pattern is automatically generated each time wave_init is asserted + pRUN_WAVES : process(reset_n, clk) begin - wave_in <= '0'; - -- wait for the kickstart - wait until kickstart = '1' and kickstart'event; - -- send pulse #1 - wave_in <= '1'; - for n in 1 to pulse_width loop - wait until clk = '1' and clk'event; - end loop; -- n - wave_in <= '0'; - -- send pulse #2 - for n in 1 to 6 loop - wait until ext_time'event; - end loop; -- n - wave_in <= '1'; - for n in 1 to pulse_width loop - wait until clk = '1' and clk'event; - end loop; -- n - wave_in <= '0'; - /* - -- send pulse #3 - for n in 1 to 3 loop - wait until ext_time'event; - end loop; -- n - wave_in <= '1'; - for n in 1 to pulse_width loop - wait until clk = '1' and clk'event; - end loop; -- n - wave_in <= '0'; - */ - end process pWAVE_IN_GEN; + if(reset_n = '0') then + wave_in_rst <= '0'; + wave_in_upd <= '0'; + wave_ref_rst <= '0'; + wave_ref_upd <= '0'; + wave_running <= '0'; + elsif(clk = '1' and clk'event) then + wave_in_upd <= '0'; + wave_ref_upd <= '0'; + wave_init_d <= wave_init; + if(wave_init = '1') then + wave_in_rst <= '1'; + wave_ref_rst <= '1'; + else + wave_in_rst <= '0'; + wave_ref_rst <= '0'; + end if; + if(wave_init = '1' or wave_completed = '1') then + wave_running <= '0'; + elsif(wave_init_d = '1') then + wave_running <= '1'; + end if; + if(wave_init_d = '1' or div_cnt_in = WAVE_UPD_PERIOD-1) then + div_cnt_in <= 0; + if(wave_running = '1' and wave_in_cnt <= 63) then + wave_in_upd <= '1'; + end if; + else + div_cnt_in <= div_cnt_in + 1; + end if; + if(wave_init = '1') then + wave_in_cnt <= 0; + elsif(wave_in_upd = '1') then + wave_in_cnt <= wave_in_cnt + 1; + end if; + if(wave_init_d = '1') then + if(USE_EXT_TIME = false) then + delay_cnt <= to_integer(unsigned(delay)) + DELAY_ERROR; + else + delay_cnt <= to_integer(unsigned(delay)) + DELAY_ERROR+1; + end if; + elsif(delay_cnt /= 0) then + delay_cnt <= delay_cnt - 1; + end if; + if(wave_init_d = '1' or div_cnt_ref = WAVE_UPD_PERIOD-1) then + div_cnt_ref <= 0; + if(wave_running = '1' and delay_cnt = 0 and wave_ref_cnt <= 63) then + wave_ref_upd <= '1'; + end if; + elsif(delay_cnt = 0) then + div_cnt_ref <= div_cnt_ref + 1; + end if; + if(wave_init = '1') then + wave_ref_cnt <= 0; + elsif(wave_ref_upd = '1') then + wave_ref_cnt <= wave_ref_cnt + 1; + end if; + end if; + end process pRUN_WAVES; - -- Generate the reference wave - pWAVE_REF_GEN : process + wave_in_completed <= '1' when wave_in_cnt = 63 else '0'; + wave_ref_completed <= '1' when wave_ref_cnt = 63 else '0'; + + wave_completed <= wave_ref_completed; + + pERROR_CHECK : process(clk) begin - wave_delayed <= '0'; - -- wait for the kickstart - wait until kickstart_ref = '1' and kickstart_ref'event; - -- send pulse #1 - wave_delayed <= '1'; - for n in 1 to pulse_width loop - wait until clk = '1' and clk'event; - end loop; -- n - wave_delayed <= '0'; - -- send pulse #2 - for n in 1 to 6 loop - wait until ext_time'event; - end loop; -- n - wave_delayed <= '1'; - for n in 1 to pulse_width loop - wait until clk = '1' and clk'event; - end loop; -- n - wave_delayed <= '0'; - /* - -- send pulse #3 - for n in 1 to 3 loop - wait until ext_time'event; - end loop; -- n - wave_delayed <= '1'; - for n in 1 to pulse_width loop - wait until clk = '1' and clk'event; - end loop; -- n - wave_delayed <= '0'; - */ - end process pWAVE_REF_GEN; - - wave_ref <= wave_delayed and not wave_delayed_d; + if(clk = '1' and clk'event) then + if(wave_running = '1' and delay_cnt = 0 and wave_completed = '0') then + if(wave_out /= wave_ref) then + log("ERROR : Detected difference between wave_out and wave_ref", VLOW); + error_flag := true; + end if; + end if; + end if; + end process pERROR_CHECK; ----------------------------------------------------------------------------- -- Test the block via configuration & control through the C&S bus ----------------------------------------------------------------------------- - pCFG_and_CTRL : process + pTB_CTRL : process + variable rv : RandomPType; + variable loop_iteration : natural; + alias internal_time is <>; begin passed <= false; - failed <= false; - completed <= false; + -- + error_flag := false; --Set the verbosity level for logging set_log_verbosity(VERBOSITY_LEVEL); - init <= '0'; - offset <= 0; - pulse_width <= 0; - cnt_dir <= '0'; - delay <= (others => '0'); - init_time <= (others => '0'); + log_separator_line(VMEDIUM); + log("Queue&Delay Test - USE_EXT_TIME set to " & to_string(USE_EXT_TIME) & ".", VLOW); + log_separator_line(VMEDIUM); + + init <= '0'; + cnt_dir <= '0'; + no_edge_detect <= '0'; + delay <= (others => '0'); + set_ext_time <= '0'; + ext_time_init <= (others => '0'); + -- + wave_init <= '0'; -- Apply reset - rstN <= '0'; + reset_n <= '0'; wait for 20*clk_period; -- wait for 10*clk_period; wait until clk = '1' and clk'event; - rstN <= '1'; + reset_n <= '1'; - --------------------------------------------------------------------------- - -- Test-Case #1 - --------------------------------------------------------------------------- - -- Count Up, init count positive, no-wrapping all + -- Drive the Q&D block with the waveform generated by the LFSR. + -- Repeat many times, forcing each time a different initial value + -- in the Q&D internal time counter - -- Configure - init <= '1'; - -- - offset <= 50; - pulse_width <= 3; - cnt_dir <= '0'; - delay <= std_logic_vector(to_signed(10, 32)); - init_time <= std_logic_vector(to_signed(0, 32)); + log("Test with internal time reference:", VLOW); + log_separator_line(VMEDIUM); - wait for 5*clk_period; - wait until clk = '1' and clk'event; - init <= '0'; + for delay_idx in 1 to DELAY_TEST_NUM loop + + delay <= std_logic_vector(to_unsigned(rv.RandInt(5, 100), 32)); + log("Delay value set to " & to_string(to_integer(unsigned(delay))) & ":", VMEDIUM); + + loop_iteration := 1; + if(USE_EXT_TIME = false) then + for int_time_msb_idx in 0 to 7 loop + for int_time_lsb_idx in 0 to 127 loop + + internal_time <= force (std_logic_vector(to_unsigned(int_time_msb_idx, 3)) & 22x"3FFFFF" & std_logic_vector(to_unsigned(int_time_lsb_idx, 7))); + wait until clk = '1' and clk'event; + log("Iteration #" & to_string(loop_iteration) & ": starting with internal-time " & to_hstring(internal_time), VMEDIUM); + wait until clk = '1' and clk'event; + internal_time <= release; - -- run the test case - wait until wave_ref = '1'; - wait until wave_ref = '0'; - wait until wave_ref = '1'; - wait until wave_ref = '0'; + wait for 10*clk_period; + wave_init <= '1'; + --delay <= std_logic_vector(to_unsigned(20, 32)); + wait until clk = '1' and clk'event; + wave_init <= '0'; + wait until wave_completed = '1'; + wait for 10*clk_period; + loop_iteration := loop_iteration + 1; + + end loop; -- int_time_lsb_idx + end loop; -- int_time_msb_idx + end if; -- USE_EXT_TIME = false - -- check the results - wait until clk = '1' and clk'event; - if(error_detected = '1') then - failed <= true; - assert false report "ERROR on TC#1" severity error; - completed <= true; - else - assert false report "TC#1 passed" severity note; - end if; + if(USE_EXT_TIME = true) then - --passed <= true; - wait for 5*clk_period; - wait until clk = '1' and clk'event; + log_separator_line(VMEDIUM); + log("Test with external time reference - Positive count direction:", VLOW); + log_separator_line(VMEDIUM); - --------------------------------------------------------------------------- - -- Test-Case #2 - --------------------------------------------------------------------------- - -- Count Up, init count negative, no-wrapping at all + no_edge_detect <= '1'; + + for ext_time_msb_idx in 0 to 7 loop + for ext_time_lsb_idx in 0 to 127 loop + + ext_time_init <= std_logic_vector(to_unsigned(ext_time_msb_idx, 3)) & 22x"3FFFFF" & std_logic_vector(to_unsigned(ext_time_lsb_idx, 7)); + set_ext_time <= '1'; + wait until clk = '1' and clk'event; + set_ext_time <= '0'; + log("Iteration #" & to_string(loop_iteration) & ": starting with external-time " & to_hstring(ext_time_init), VMEDIUM); + wait until clk = '1' and clk'event; - -- Configure - init <= '1'; - -- - offset <= 50; - pulse_width <= 3; - cnt_dir <= '0'; - delay <= std_logic_vector(to_signed(10, 32)); - init_time <= std_logic_vector(to_signed(-100, 32)); + wait for 10*clk_period; + wave_init <= '1'; + --delay <= std_logic_vector(to_unsigned(20, 32)); + wait until clk = '1' and clk'event; + wave_init <= '0'; + wait until wave_completed = '1'; + wait for 10*clk_period; + loop_iteration := loop_iteration + 1; + + end loop; -- ext_time_lsb_idx + end loop; -- ext_time_msb_idx - wait for 5*clk_period; - wait until clk = '1' and clk'event; - init <= '0'; + log_separator_line(VMEDIUM); + log("Test with external time reference - Negative count direction:", VLOW); + log_separator_line(VMEDIUM); - -- run the test case - wait until wave_ref = '1'; - wait until wave_ref = '0'; - wait until wave_ref = '1'; - wait until wave_ref = '0'; + cnt_dir <= '1'; - -- check the results - wait until clk = '1' and clk'event; - if(error_detected = '1') then - failed <= true; - assert false report "ERROR on TC#2" severity error; - completed <= true; - else - assert false report "TC#2 passed" severity note; - end if; + for ext_time_msb_idx in 0 to 7 loop + for ext_time_lsb_idx in 0 to 127 loop + + ext_time_init <= std_logic_vector(to_unsigned(ext_time_msb_idx, 3)) & 22x"0" & std_logic_vector(to_unsigned(ext_time_lsb_idx, 7)); + set_ext_time <= '1'; + wait until clk = '1' and clk'event; + set_ext_time <= '0'; + log("Iteration #" & to_string(loop_iteration) & ": starting with external-time " & to_hstring(ext_time_init), VMEDIUM); + wait until clk = '1' and clk'event; - --passed <= true; - wait for 5*clk_period; - wait until clk = '1' and clk'event; + wait for 10*clk_period; + wave_init <= '1'; + --delay <= std_logic_vector(to_unsigned(20, 32)); + wait until clk = '1' and clk'event; + wave_init <= '0'; + wait until wave_completed = '1'; + wait for 10*clk_period; + loop_iteration := loop_iteration + 1; + + end loop; -- ext_time_lsb_idx + end loop; -- ext_time_msb_idx - --------------------------------------------------------------------------- - -- Test-Case #3 - --------------------------------------------------------------------------- - -- Count Up, init count negative, counter wrapping between the rising and - -- falling edge of the input pulse + end if; -- USE_EXT_TIME = true - -- Configure - init <= '1'; - -- - offset <= 50; - pulse_width <= 3; - cnt_dir <= '0'; - delay <= std_logic_vector(to_signed(10, 32)); - init_time <= std_logic_vector(to_signed(-52, 32)); - - wait for 5*clk_period; - wait until clk = '1' and clk'event; - init <= '0'; - - -- run the test case - wait until wave_ref = '1'; - wait until wave_ref = '0'; - wait until wave_ref = '1'; - wait until wave_ref = '0'; - - -- check the results - wait until clk = '1' and clk'event; - if(error_detected = '1') then - failed <= true; - assert false report "ERROR on TC#3" severity error; - completed <= true; - else - assert false report "TC#3 passed" severity note; - end if; - - --passed <= true; - wait for 5*clk_period; - wait until clk = '1' and clk'event; - - --------------------------------------------------------------------------- - -- Test-Case #4 - --------------------------------------------------------------------------- - -- Count Up, init count negative, counter wrapping between the rising and - -- falling edge of the output pulse - - -- Configure - init <= '1'; - -- - offset <= 50; - pulse_width <= 3; - cnt_dir <= '0'; - delay <= std_logic_vector(to_signed(10, 32)); - init_time <= std_logic_vector(to_signed(-62, 32)); - - wait for 5*clk_period; - wait until clk = '1' and clk'event; - init <= '0'; - - -- run the test case - wait until wave_ref = '1'; - wait until wave_ref = '0'; - wait until wave_ref = '1'; - wait until wave_ref = '0'; - - -- check the results - wait until clk = '1' and clk'event; - if(error_detected = '1') then - failed <= true; - assert false report "ERROR on TC#4" severity error; - completed <= true; - else - assert false report "TC#4 passed" severity note; - end if; - - --passed <= true; - wait for 5*clk_period; - wait until clk = '1' and clk'event; - - --------------------------------------------------------------------------- - -- Test-Case #5 - --------------------------------------------------------------------------- - -- Count Down, init count positive, no-wrapping all - - -- Configure - init <= '1'; - -- - offset <= 50; - pulse_width <= 3; - cnt_dir <= '1'; - delay <= std_logic_vector(to_signed(10, 32)); - init_time <= std_logic_vector(to_signed(100, 32)); - - wait for 5*clk_period; - wait until clk = '1' and clk'event; - init <= '0'; - - -- run the test case - wait until wave_ref = '1'; - wait until wave_ref = '0'; - wait until wave_ref = '1'; - wait until wave_ref = '0'; - - -- check the results - wait until clk = '1' and clk'event; - if(error_detected = '1') then - failed <= true; - assert false report "ERROR on TC#5" severity error; - completed <= true; - else - assert false report "TC#5 passed" severity note; - end if; - - --passed <= true; - wait for 5*clk_period; - wait until clk = '1' and clk'event; - - --------------------------------------------------------------------------- - -- Test-Case #6 - --------------------------------------------------------------------------- - -- Count Down, init count negative, no-wrapping at all - - -- Configure - init <= '1'; - -- - offset <= 50; - pulse_width <= 3; - cnt_dir <= '1'; - delay <= std_logic_vector(to_signed(10, 32)); - init_time <= std_logic_vector(to_signed(-100, 32)); - - wait for 5*clk_period; - wait until clk = '1' and clk'event; - init <= '0'; - - -- run the test case - wait until wave_ref = '1'; - wait until wave_ref = '0'; - wait until wave_ref = '1'; - wait until wave_ref = '0'; - - -- check the results - wait until clk = '1' and clk'event; - if(error_detected = '1') then - failed <= true; - assert false report "ERROR on TC#6" severity error; - completed <= true; - else - assert false report "TC#6 passed" severity note; - end if; - - --passed <= true; - wait for 5*clk_period; - wait until clk = '1' and clk'event; - - --------------------------------------------------------------------------- - -- Test-Case #7 - --------------------------------------------------------------------------- - -- Count Down, init count positive, counter wrapping between the rising and - -- falling edge of the input pulse - - -- Configure - init <= '1'; - -- - offset <= 50; - pulse_width <= 3; - cnt_dir <= '1'; - delay <= std_logic_vector(to_signed(10, 32)); - init_time <= std_logic_vector(to_signed(51, 32)); - - wait for 5*clk_period; - wait until clk = '1' and clk'event; - init <= '0'; - - -- run the test case - wait until wave_ref = '1'; - wait until wave_ref = '0'; - wait until wave_ref = '1'; - wait until wave_ref = '0'; - - -- check the results - wait until clk = '1' and clk'event; - if(error_detected = '1') then - failed <= true; - assert false report "ERROR on TC#7" severity error; - completed <= true; - else - assert false report "TC#7 passed" severity note; - end if; - - --passed <= true; - wait for 5*clk_period; - wait until clk = '1' and clk'event; - - --------------------------------------------------------------------------- - -- Test-Case #8 - --------------------------------------------------------------------------- - -- Count Down, init count positive, counter wrapping between the rising and - -- falling edge of the output pulse - - -- Configure - init <= '1'; - -- - offset <= 50; - pulse_width <= 3; - cnt_dir <= '1'; - delay <= std_logic_vector(to_signed(10, 32)); - init_time <= std_logic_vector(to_signed(62, 32)); - - wait for 5*clk_period; - wait until clk = '1' and clk'event; - init <= '0'; - - -- run the test case - wait until wave_ref = '1'; - wait until wave_ref = '0'; - wait until wave_ref = '1'; - wait until wave_ref = '0'; - - -- check the results - wait until clk = '1' and clk'event; - if(error_detected = '1') then - failed <= true; - assert false report "ERROR on TC#8" severity error; - completed <= true; - else - assert false report "TC#8 passed" severity note; - end if; - - --passed <= true; - wait for 5*clk_period; - wait until clk = '1' and clk'event; - - --------------------------------------------------------------------------- - -- Test-Case #9 - --------------------------------------------------------------------------- - -- Check the minimum latency - - -- Configure - init <= '1'; - -- - offset <= 50; - pulse_width <= 3; - cnt_dir <= '1'; - delay <= std_logic_vector(to_signed(3, 32)); - init_time <= std_logic_vector(to_signed(62, 32)); - - wait for 5*clk_period; - wait until clk = '1' and clk'event; - init <= '0'; - - -- run the test case - wait until wave_ref = '1'; - wait until wave_ref = '0'; - wait until wave_ref = '1'; - wait until wave_ref = '0'; - - -- check the results - wait until clk = '1' and clk'event; - if(error_detected = '1') then - failed <= true; - assert false report "ERROR on TC#9" severity error; - completed <= true; - else - assert false report "TC#9 passed" severity note; - end if; - - --passed <= true; - wait for 5*clk_period; - wait until clk = '1' and clk'event; - - if(failed = false) then + end loop; -- delay_idx + + -- + wait for 10*clk_period; + if(error_flag = false) then passed <= true; - end if; + end if; --------------------------------------------------------------------------- -- End of Testing --------------------------------------------------------------------------- - - completed <= true; wait; - end process pCFG_and_CTRL; + end process pTB_CTRL; + + pERROR_MONITOR : process + begin + wait for 10*clk_period; + if(error_flag = true) then + failed <= true; + wait; + end if; + end process pERROR_MONITOR; pREPORT_RESULT : process begin diff --git a/generic_ip/fire_pulse_manager/3/sim/sim_fpm.do b/generic_ip/fire_pulse_manager/3/sim/sim_fpm.do index feb48d1..39a1f72 100644 --- a/generic_ip/fire_pulse_manager/3/sim/sim_fpm.do +++ b/generic_ip/fire_pulse_manager/3/sim/sim_fpm.do @@ -27,6 +27,8 @@ vcom -2008 -work $WORKLIB $COMMON_PATH/sync_reset.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_redge.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/cs_bus_itf.vhd +vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd +vcom -2008 -work $WORKLIB $COMMON_PATH/queue_and_delay.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd @@ -40,10 +42,8 @@ vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/generic_sequenc vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/generic_sequencer_15.vhd # Pulse Generator -vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/altera/sync_fifo_1.vhd vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_generator_1_pkg.vhd vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_conditioning_1.vhd -vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/queue_and_delay_1.vhd vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/simple_frac_div_1.vhd vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_generator_1.vhd diff --git a/generic_ip/pulse_generator/1/doc/pulse_generator_1.json b/generic_ip/pulse_generator/1/doc/pulse_generator_1.json index 9507a1b..71ef31f 100644 --- a/generic_ip/pulse_generator/1/doc/pulse_generator_1.json +++ b/generic_ip/pulse_generator/1/doc/pulse_generator_1.json @@ -50,7 +50,7 @@ "minor_number" : { "type" : "c", "bit_len" : "8", - "reset" : "0x06", + "reset" : "0x07", "description" : "Minor number" }, "major_number" : { diff --git a/generic_ip/pulse_generator/1/src/altera/sync_fifo_1.vhd b/generic_ip/pulse_generator/1/src/altera/sync_fifo_1.vhd deleted file mode 100644 index fc0a5dc..0000000 --- a/generic_ip/pulse_generator/1/src/altera/sync_fifo_1.vhd +++ /dev/null @@ -1,201 +0,0 @@ --- megafunction wizard: %FIFO% --- GENERATION: STANDARD --- VERSION: WM1.0 --- MODULE: scfifo - --- ============================================================ --- File Name: sync_fifo_1.vhd --- Megafunction Name(s): --- scfifo --- --- Simulation Library Files(s): --- altera_mf --- ============================================================ --- ************************************************************ --- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! --- --- 14.1.1 Build 190 01/19/2015 SJ Web Edition --- ************************************************************ - - ---Copyright (C) 1991-2015 Altera Corporation. All rights reserved. ---Your use of Altera Corporation's design tools, logic functions ---and other software and tools, and its AMPP partner logic ---functions, and any output files from any of the foregoing ---(including device programming or simulation files), and any ---associated documentation or information are expressly subject ---to the terms and conditions of the Altera Program License ---Subscription Agreement, the Altera Quartus II License Agreement, ---the Altera MegaCore Function License Agreement, or other ---applicable license agreement, including, without limitation, ---that your use is for the sole purpose of programming logic ---devices manufactured by Altera and sold by Altera or its ---authorized distributors. Please refer to the applicable ---agreement for further details. - - -LIBRARY ieee; -USE ieee.std_logic_1164.all; - -LIBRARY altera_mf; -USE altera_mf.all; -use work.common_pkg.all; - -entity sync_fifo_1 is - generic ( - FIFO_WIDTH : natural range 1 to 32; - FIFO_DEPTH : natural range 1 to 8182); - port ( - sclr : in std_logic; - clock : in std_logic; - data : in std_logic_vector (FIFO_WIDTH-1 downto 0); - rdreq : in std_logic; - wrreq : in std_logic; - empty : out std_logic; - full : out std_logic; - q : out std_logic_vector (FIFO_WIDTH-1 downto 0); - usedw : out std_logic_vector (log2(FIFO_DEPTH)-1 downto 0) - ); -end sync_fifo_1; - - -ARCHITECTURE SYN OF sync_fifo_1 IS - - SIGNAL sub_wire0 : STD_LOGIC ; - SIGNAL sub_wire1 : STD_LOGIC ; - SIGNAL sub_wire2 : STD_LOGIC_VECTOR (FIFO_WIDTH-1 DOWNTO 0); - SIGNAL sub_wire3 : STD_LOGIC_VECTOR (log2(FIFO_DEPTH)-1 DOWNTO 0); - - - - COMPONENT scfifo - GENERIC ( - add_ram_output_register : STRING; - intended_device_family : STRING; - lpm_numwords : NATURAL; - lpm_showahead : STRING; - lpm_type : STRING; - lpm_width : NATURAL; - lpm_widthu : NATURAL; - overflow_checking : STRING; - underflow_checking : STRING; - use_eab : STRING - ); - PORT ( - sclr : IN STD_LOGIC ; - clock : IN STD_LOGIC ; - data : IN STD_LOGIC_VECTOR (FIFO_WIDTH-1 DOWNTO 0); - rdreq : IN STD_LOGIC ; - wrreq : IN STD_LOGIC ; - empty : OUT STD_LOGIC ; - full : OUT STD_LOGIC ; - q : OUT STD_LOGIC_VECTOR (FIFO_WIDTH-1 DOWNTO 0); - usedw : OUT STD_LOGIC_VECTOR (log2(FIFO_DEPTH)-1 DOWNTO 0) - ); - END COMPONENT; - -BEGIN - empty <= sub_wire0; - full <= sub_wire1; - q <= sub_wire2(FIFO_WIDTH-1 DOWNTO 0); - usedw <= sub_wire3(log2(FIFO_DEPTH)-1 DOWNTO 0); - - scfifo_component : scfifo - GENERIC MAP ( - add_ram_output_register => "OFF", - intended_device_family => "Cyclone V", - lpm_numwords => FIFO_DEPTH, - lpm_showahead => "OFF", - lpm_type => "scfifo", - lpm_width => FIFO_WIDTH, - lpm_widthu => log2(FIFO_DEPTH-1), - overflow_checking => "ON", - underflow_checking => "ON", - use_eab => "ON" - ) - PORT MAP ( - sclr => sclr, - clock => clock, - data => data, - rdreq => rdreq, - wrreq => wrreq, - empty => sub_wire0, - full => sub_wire1, - q => sub_wire2, - usedw => sub_wire3 - ); - - - -END SYN; - --- ============================================================ --- CNX file retrieval info --- ============================================================ --- Retrieval info: PRIVATE: AlmostEmpty NUMERIC "0" --- Retrieval info: PRIVATE: AlmostEmptyThr NUMERIC "-1" --- Retrieval info: PRIVATE: AlmostFull NUMERIC "0" --- Retrieval info: PRIVATE: AlmostFullThr NUMERIC "-1" --- Retrieval info: PRIVATE: CLOCKS_ARE_SYNCHRONIZED NUMERIC "0" --- Retrieval info: PRIVATE: Clock NUMERIC "0" --- Retrieval info: PRIVATE: Depth NUMERIC "256" --- Retrieval info: PRIVATE: Empty NUMERIC "1" --- Retrieval info: PRIVATE: Full NUMERIC "1" --- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V" --- Retrieval info: PRIVATE: LE_BasedFIFO NUMERIC "0" --- Retrieval info: PRIVATE: LegacyRREQ NUMERIC "1" --- Retrieval info: PRIVATE: MAX_DEPTH_BY_9 NUMERIC "0" --- Retrieval info: PRIVATE: OVERFLOW_CHECKING NUMERIC "0" --- Retrieval info: PRIVATE: Optimize NUMERIC "0" --- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0" --- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" --- Retrieval info: PRIVATE: UNDERFLOW_CHECKING NUMERIC "0" --- Retrieval info: PRIVATE: UsedW NUMERIC "1" --- Retrieval info: PRIVATE: Width NUMERIC "32" --- Retrieval info: PRIVATE: dc_aclr NUMERIC "0" --- Retrieval info: PRIVATE: diff_widths NUMERIC "0" --- Retrieval info: PRIVATE: msb_usedw NUMERIC "0" --- Retrieval info: PRIVATE: output_width NUMERIC "32" --- Retrieval info: PRIVATE: rsEmpty NUMERIC "1" --- Retrieval info: PRIVATE: rsFull NUMERIC "0" --- Retrieval info: PRIVATE: rsUsedW NUMERIC "0" --- Retrieval info: PRIVATE: sc_aclr NUMERIC "0" --- Retrieval info: PRIVATE: sc_sclr NUMERIC "1" --- Retrieval info: PRIVATE: wsEmpty NUMERIC "0" --- Retrieval info: PRIVATE: wsFull NUMERIC "1" --- Retrieval info: PRIVATE: wsUsedW NUMERIC "0" --- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all --- Retrieval info: CONSTANT: ADD_RAM_OUTPUT_REGISTER STRING "OFF" --- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V" --- Retrieval info: CONSTANT: LPM_NUMWORDS NUMERIC "256" --- Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "OFF" --- Retrieval info: CONSTANT: LPM_TYPE STRING "scfifo" --- Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "32" --- Retrieval info: CONSTANT: LPM_WIDTHU NUMERIC "8" --- Retrieval info: CONSTANT: OVERFLOW_CHECKING STRING "ON" --- Retrieval info: CONSTANT: UNDERFLOW_CHECKING STRING "ON" --- Retrieval info: CONSTANT: USE_EAB STRING "ON" --- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock" --- Retrieval info: USED_PORT: data 0 0 32 0 INPUT NODEFVAL "data[31..0]" --- Retrieval info: USED_PORT: empty 0 0 0 0 OUTPUT NODEFVAL "empty" --- Retrieval info: USED_PORT: full 0 0 0 0 OUTPUT NODEFVAL "full" --- Retrieval info: USED_PORT: q 0 0 32 0 OUTPUT NODEFVAL "q[31..0]" --- Retrieval info: USED_PORT: rdreq 0 0 0 0 INPUT NODEFVAL "rdreq" --- Retrieval info: USED_PORT: sclr 0 0 0 0 INPUT NODEFVAL "sclr" --- Retrieval info: USED_PORT: usedw 0 0 8 0 OUTPUT NODEFVAL "usedw[7..0]" --- Retrieval info: USED_PORT: wrreq 0 0 0 0 INPUT NODEFVAL "wrreq" --- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0 --- Retrieval info: CONNECT: @data 0 0 32 0 data 0 0 32 0 --- Retrieval info: CONNECT: @rdreq 0 0 0 0 rdreq 0 0 0 0 --- Retrieval info: CONNECT: @sclr 0 0 0 0 sclr 0 0 0 0 --- Retrieval info: CONNECT: @wrreq 0 0 0 0 wrreq 0 0 0 0 --- Retrieval info: CONNECT: empty 0 0 0 0 @empty 0 0 0 0 --- Retrieval info: CONNECT: full 0 0 0 0 @full 0 0 0 0 --- Retrieval info: CONNECT: q 0 0 32 0 @q 0 0 32 0 --- Retrieval info: CONNECT: usedw 0 0 8 0 @usedw 0 0 8 0 --- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo_1.vhd TRUE --- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo_1.inc FALSE --- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo_1.cmp FALSE --- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo_1.bsf FALSE --- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo_inst.vhd FALSE --- Retrieval info: LIB_FILE: altera_mf diff --git a/generic_ip/pulse_generator/1/src/pulse_generator_1.vhd b/generic_ip/pulse_generator/1/src/pulse_generator_1.vhd index 4887e88..05f1ead 100644 --- a/generic_ip/pulse_generator/1/src/pulse_generator_1.vhd +++ b/generic_ip/pulse_generator/1/src/pulse_generator_1.vhd @@ -6,7 +6,7 @@ -- Author : Gianmarco Girau -- Company : Global Inkjet Systems -- Created : 2016-10-24 --- Last update: 2019-07-22 +-- Last update: 2019-10-14 -- SVN ID : Git -- Standard : VHDL'93 ------------------------------------------------------------------------------- @@ -69,7 +69,7 @@ architecture rtl of pulse_generator_1 is -- constants constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF13"; - constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000106"; + constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000107"; signal init_de, init_qd, enable, loc_pd, pd_queue_error : std_logic; @@ -194,8 +194,8 @@ begin -- level, here the size is limited to 128 (on the PMB it was 16) iPD_queue: entity work.queue_and_delay generic map ( - use_ext_time => true, - queue_size => 2 * PD_QUEUE_SIZE) + USE_EXT_TIME => true, + QUEUE_SIZE => 2*PD_QUEUE_SIZE) port map( rstN => reset_n, clk => clk, @@ -422,8 +422,8 @@ begin gPULSE_DELAY_EQUAL: if PULSE_DELAY_EQUAL_EN = true generate iDE: entity work.queue_and_delay generic map ( - use_ext_time => false, - queue_size => 256) + USE_EXT_TIME => false, + QUEUE_SIZE => 256) port map( rstN => reset_n, clk => clk, diff --git a/generic_ip/pulse_generator/2/doc/pulse_generator_2.json b/generic_ip/pulse_generator/2/doc/pulse_generator_2.json index c8db0ce..8608a0d 100644 --- a/generic_ip/pulse_generator/2/doc/pulse_generator_2.json +++ b/generic_ip/pulse_generator/2/doc/pulse_generator_2.json @@ -50,7 +50,7 @@ "minor_number" : { "type" : "c", "bit_len" : "8", - "reset" : "0x00", + "reset" : "0x03", "description" : "Minor number" }, "major_number" : { diff --git a/generic_ip/pulse_generator/2/src/pulse_generator_2.vhd b/generic_ip/pulse_generator/2/src/pulse_generator_2.vhd index 4387077..40afc88 100644 --- a/generic_ip/pulse_generator/2/src/pulse_generator_2.vhd +++ b/generic_ip/pulse_generator/2/src/pulse_generator_2.vhd @@ -6,7 +6,7 @@ -- Author : Gianmarco Girau -- Company : Global Inkjet Systems -- Created : 2016-10-24 --- Last update: 2019-10-01 +-- Last update: 2019-10-10 -- SVN ID : Git -- Standard : VHDL'93 ------------------------------------------------------------------------------- @@ -74,7 +74,7 @@ architecture rtl of pulse_generator_2 is -- constants constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF13"; - constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000202"; + constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000203"; signal init_de, init_qd, enable, loc_pd, pd_queue_error : std_logic; signal ch_ctrl_start_req, pd_pulse, filt_pd, filt_pd_d : std_logic; @@ -229,8 +229,8 @@ begin -- level, here the size is limited to 128 (on the PMB it was 16) iPD_queue: entity work.queue_and_delay generic map ( - use_ext_time => true, - queue_size => 2*PD_QUEUE_SIZE) + USE_EXT_TIME => true, + QUEUE_SIZE => 2*PD_QUEUE_SIZE) port map ( rstN => reset_n, clk => clk, @@ -587,14 +587,15 @@ begin gPULSE_DELAY_EQUAL: if PULSE_DELAY_EQUAL_EN = true generate iDE: entity work.queue_and_delay generic map ( - use_ext_time => false, - queue_size => 256) + DELAY_WIDTH => 16, + USE_EXT_TIME => false, + QUEUE_SIZE => 256) port map ( rstN => reset_n, clk => clk, init => init_de, cnt_dir => '0', - delay => (X"0000" & ch_delay_i), + delay => ch_delay_i, ext_time => (others => '0'), wave_in => gated_pulse, wave_out => retimed_pulse,