Skip to content
Snippets Groups Projects
Commit 73974f32 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Added proc_dp_verify_sync() that can print bsn and expected bsn in case of error.

parent 1f317baf
No related branches found
No related tags found
1 merge request!132Renamed proc_dp_verify_sync_v2() into overloaded proc_dp_verify_sync() and...
......@@ -464,20 +464,28 @@ PACKAGE tb_dp_pkg IS
SIGNAL out_val : IN STD_LOGIC);
-- Verify the DUT output sync
PROCEDURE proc_dp_verify_sync(CONSTANT c_sync_period : IN NATURAL;
CONSTANT c_sync_offset : IN NATURAL;
SIGNAL clk : IN STD_LOGIC;
PROCEDURE proc_dp_verify_sync(SIGNAL clk : IN STD_LOGIC;
SIGNAL verify_en : IN STD_LOGIC;
SIGNAL sync : IN STD_LOGIC;
SIGNAL sop : IN STD_LOGIC;
SIGNAL bsn : IN STD_LOGIC_VECTOR);
expected_sync : IN STD_LOGIC);
PROCEDURE proc_dp_verify_sync(SIGNAL clk : IN STD_LOGIC;
SIGNAL verify_en : IN STD_LOGIC;
SIGNAL sync : IN STD_LOGIC;
SIGNAL sop : IN STD_LOGIC;
bsn : IN NATURAL; -- for reporting
expected_bsn : IN NATURAL; -- for reporting
expected_sync : IN STD_LOGIC);
PROCEDURE proc_dp_verify_sync(CONSTANT c_sync_period : IN NATURAL;
CONSTANT c_sync_offset : IN NATURAL;
SIGNAL clk : IN STD_LOGIC;
SIGNAL verify_en : IN STD_LOGIC;
SIGNAL sync : IN STD_LOGIC;
SIGNAL sop : IN STD_LOGIC;
SIGNAL bsn : IN STD_LOGIC_VECTOR);
PROCEDURE proc_dp_verify_sync(CONSTANT c_start_bsn : IN NATURAL;
CONSTANT c_sync_period : IN NATURAL;
CONSTANT c_block_size : IN NATURAL;
......@@ -2288,34 +2296,38 @@ PACKAGE BODY tb_dp_pkg IS
------------------------------------------------------------------------------
-- PROCEDURE: Verify the DUT output sync
-- . sync is defined such that it can only be active at sop
-- . assume that the sync occures priodically at bsn MOD c_sync_period = c_sync_offset
-- . report expected_sync from input
------------------------------------------------------------------------------
PROCEDURE proc_dp_verify_sync(CONSTANT c_sync_period : IN NATURAL; -- BSN sync period
CONSTANT c_sync_offset : IN NATURAL; -- BSN sync offset
SIGNAL clk : IN STD_LOGIC;
PROCEDURE proc_dp_verify_sync(SIGNAL clk : IN STD_LOGIC;
SIGNAL verify_en : IN STD_LOGIC;
SIGNAL sync : IN STD_LOGIC;
SIGNAL sop : IN STD_LOGIC;
SIGNAL bsn : IN STD_LOGIC_VECTOR) IS
CONSTANT c_bsn_w : NATURAL := sel_a_b(bsn'LENGTH>31, 31, bsn'LENGTH); -- use maximally c_natural_w = 31 bit of BSN slv to allow calculations with integers
VARIABLE v_bsn : NATURAL := TO_UINT(bsn(c_bsn_w-1 DOWNTO 0));
VARIABLE v_expected_sync : BOOLEAN;
expected_sync : IN STD_LOGIC) IS
BEGIN
-- Determine v_expected_sync
v_expected_sync := (v_bsn - c_sync_offset) MOD c_sync_period = 0;
-- Report sync and v_expected_sync
proc_dp_verify_sync(clk, verify_en, sync, sop, to_sl(v_expected_sync));
IF rising_edge(clk) THEN
IF verify_en='1' THEN
-- Check for unexpected sync
IF sync='1' THEN
ASSERT expected_sync='1'
REPORT "Error: Unexpected sync at BSN" SEVERITY ERROR;
ASSERT sop = '1'
REPORT "Error: Unexpected sync at inactive sop" SEVERITY ERROR;
END IF;
-- Check for missing sync
IF sop='1' AND expected_sync='1' THEN
ASSERT sync = '1'
REPORT "Error: Missing sync" SEVERITY ERROR;
END IF;
END IF;
END IF;
END proc_dp_verify_sync;
------------------------------------------------------------------------------
-- PROCEDURE: Verify the DUT output sync
-- . sync is defined such that it can only be active at sop
-- . use expected_sync from input
------------------------------------------------------------------------------
PROCEDURE proc_dp_verify_sync(SIGNAL clk : IN STD_LOGIC;
SIGNAL verify_en : IN STD_LOGIC;
SIGNAL sync : IN STD_LOGIC;
SIGNAL sop : IN STD_LOGIC;
bsn : IN NATURAL; -- for reporting
expected_bsn : IN NATURAL; -- for reporting
expected_sync : IN STD_LOGIC) IS
BEGIN
IF rising_edge(clk) THEN
......@@ -2323,7 +2335,7 @@ PACKAGE BODY tb_dp_pkg IS
-- Check for unexpected sync
IF sync='1' THEN
ASSERT expected_sync='1'
REPORT "Error: Unexpected sync at BSN" SEVERITY ERROR;
REPORT "Error: Unexpected sync at BSN (" & int_to_str(bsn) & " /= " & int_to_str(expected_bsn) & ")" SEVERITY ERROR;
ASSERT sop = '1'
REPORT "Error: Unexpected sync at inactive sop" SEVERITY ERROR;
END IF;
......@@ -2336,6 +2348,28 @@ PACKAGE BODY tb_dp_pkg IS
END IF;
END proc_dp_verify_sync;
------------------------------------------------------------------------------
-- PROCEDURE: Verify the DUT output sync
-- . sync is defined such that it can only be active at sop
-- . assume that the sync occures priodically at bsn MOD c_sync_period = c_sync_offset
------------------------------------------------------------------------------
PROCEDURE proc_dp_verify_sync(CONSTANT c_sync_period : IN NATURAL; -- BSN sync period
CONSTANT c_sync_offset : IN NATURAL; -- BSN sync offset
SIGNAL clk : IN STD_LOGIC;
SIGNAL verify_en : IN STD_LOGIC;
SIGNAL sync : IN STD_LOGIC;
SIGNAL sop : IN STD_LOGIC;
SIGNAL bsn : IN STD_LOGIC_VECTOR) IS
CONSTANT c_bsn_w : NATURAL := sel_a_b(bsn'LENGTH>31, 31, bsn'LENGTH); -- use maximally c_natural_w = 31 bit of BSN slv to allow calculations with integers
VARIABLE v_bsn : NATURAL := TO_UINT(bsn(c_bsn_w-1 DOWNTO 0));
VARIABLE v_expected_sync : BOOLEAN;
BEGIN
-- Determine v_expected_sync
v_expected_sync := (v_bsn - c_sync_offset) MOD c_sync_period = 0;
-- Report sync and v_expected_sync
proc_dp_verify_sync(clk, verify_en, sync, sop, to_sl(v_expected_sync));
END proc_dp_verify_sync;
------------------------------------------------------------------------------
-- PROCEDURE: Verify the DUT output sync
-- . sync is defined such that it can only be active at sop
......@@ -2393,7 +2427,7 @@ PACKAGE BODY tb_dp_pkg IS
END IF;
-- Report sync and v_expected_sync
proc_dp_verify_sync(clk, verify_en, sync, sop, to_sl(v_expected_sync));
proc_dp_verify_sync(clk, verify_en, sync, sop, v_bsn, v_expected_bsn, to_sl(v_expected_sync));
END proc_dp_verify_sync;
------------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment