From f9dc4b03de345e445c87570d7c0be41f44f44632 Mon Sep 17 00:00:00 2001 From: gianmarcogirau Date: Tue, 24 Sep 2019 09:28:08 +0100 Subject: [PATCH] WH-16 - Updated Q&D testbench to issue passed/failure message in a compatible format as other testbenches --- generic_ip/common/0/sim/sim_queue_delay.do | 9 ++-- .../common/0/src/test/queue_and_delay_tb.vhd | 53 ++++++++++++++----- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/generic_ip/common/0/sim/sim_queue_delay.do b/generic_ip/common/0/sim/sim_queue_delay.do index c46d05b..123c6f7 100644 --- a/generic_ip/common/0/sim/sim_queue_delay.do +++ b/generic_ip/common/0/sim/sim_queue_delay.do @@ -3,6 +3,7 @@ .main clear set SRC_PATH ./../src +set TB_PATH ./../src/test vlib ./work vmap work ./work @@ -14,8 +15,10 @@ vcom -work work $SRC_PATH/common_pkg.vhd vcom -work work $SRC_PATH/altera/sync_fifo.vhd vcom -2008 -work work $SRC_PATH/queue_and_delay.vhd -# Compile the Testbench -vcom -2008 -work work $SRC_PATH/test/queue_and_delay_tb.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/queue_and_delay_tb.vhd # Simulate vsim -t ps work.queue_and_delay_tb @@ -29,7 +32,7 @@ set NumericStdNoWarnings 1 do wave_queue_delay.do -when -label end_of_simulation {completed == true} {echo "Simulation Completed"; stop ;} +when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;} run -all #run 100 us; 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 598bb7b..c407dc3 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: 2017-11-06 +-- Last update: 2019-09-24 -- SVN ID : Git -- Standard : VHDL'93 ------------------------------------------------------------------------------- @@ -22,6 +22,9 @@ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; +library work; +use work.log_pkg.all; + entity queue_and_delay_tb is -- ... end queue_and_delay_tb; @@ -55,6 +58,9 @@ architecture behav of queue_and_delay_tb is constant clk_period : time := 10.0 ns; -- ems clock + -- Logging Verbosity Level + constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM; + signal rstN : std_logic; signal clk : std_logic := '0'; signal init : std_logic; @@ -75,6 +81,7 @@ architecture behav of queue_and_delay_tb is 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; @@ -244,6 +251,9 @@ begin -- behav failed <= false; completed <= false; + --Set the verbosity level for logging + set_log_verbosity(VERBOSITY_LEVEL); + init <= '0'; offset <= 0; pulse_width <= 0; @@ -293,7 +303,7 @@ begin -- behav assert false report "TC#1 passed" severity note; end if; - passed <= true; + --passed <= true; wait for 5*clk_period; wait until clk = '1' and clk'event; @@ -331,7 +341,7 @@ begin -- behav assert false report "TC#2 passed" severity note; end if; - passed <= true; + --passed <= true; wait for 5*clk_period; wait until clk = '1' and clk'event; @@ -370,7 +380,7 @@ begin -- behav assert false report "TC#3 passed" severity note; end if; - passed <= true; + --passed <= true; wait for 5*clk_period; wait until clk = '1' and clk'event; @@ -409,7 +419,7 @@ begin -- behav assert false report "TC#4 passed" severity note; end if; - passed <= true; + --passed <= true; wait for 5*clk_period; wait until clk = '1' and clk'event; @@ -447,7 +457,7 @@ begin -- behav assert false report "TC#5 passed" severity note; end if; - passed <= true; + --passed <= true; wait for 5*clk_period; wait until clk = '1' and clk'event; @@ -485,7 +495,7 @@ begin -- behav assert false report "TC#6 passed" severity note; end if; - passed <= true; + --passed <= true; wait for 5*clk_period; wait until clk = '1' and clk'event; @@ -524,7 +534,7 @@ begin -- behav assert false report "TC#7 passed" severity note; end if; - passed <= true; + --passed <= true; wait for 5*clk_period; wait until clk = '1' and clk'event; @@ -563,7 +573,7 @@ begin -- behav assert false report "TC#8 passed" severity note; end if; - passed <= true; + --passed <= true; wait for 5*clk_period; wait until clk = '1' and clk'event; @@ -601,20 +611,37 @@ begin -- behav assert false report "TC#9 passed" severity note; end if; - passed <= true; + --passed <= true; wait for 5*clk_period; wait until clk = '1' and clk'event; - + if(failed = false) then + passed <= true; + end if; + --------------------------------------------------------------------------- -- End of Testing --------------------------------------------------------------------------- completed <= true; - wait for 1 ms; + wait; - end process pCFG_and_CTRL; + end process pCFG_and_CTRL; + + pREPORT_RESULT : process + begin + wait until failed = true or passed = true; + wait for 1 us; + log_separator_line(VLOW); + if(failed = true) then + log("FAILURE: test completed with errors.", VLOW); + elsif(passed = true) then + log("SUCCESS: test successfully completed.", VLOW); + end if; + log_separator_line(VLOW); + test_completed <= true; + end process pREPORT_RESULT; end behav;