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

Removed advanced, and not or rarely used features, from statistics to make it simpeler.

parent fc9844d8
No related branches found
No related tags found
1 merge request!184Corrected using c_mm_file_reg_bsn_sync_scheduler_xsub. Shortened the sim speed...
...@@ -23,6 +23,17 @@ ...@@ -23,6 +23,17 @@
-- . Daniel van der Schuur -- . Daniel van der Schuur
-- Purpose: -- Purpose:
-- . Provide a generic DP bus checking stage for simulation. -- . Provide a generic DP bus checking stage for simulation.
-- Remark:
-- . EK 17 dec 2021:
-- . removed g_disable_failures, to simplify the component, because default
-- ERROR level is used in practise
-- . removed g_check_data_rate_mbps, to simplify the component, because
-- measuring the average data rate exactly is difficult and requires
-- receiving at least 2 snk_in.sops, to be able to derive mpbs from
-- valid_count / cycle_count between 2 snk_in.sops.
-- . I changed dp_done to end at eop (instead of at next sop), so that an
-- extra next packet is not needed, which reduces the sim time.
--
LIBRARY IEEE, common_lib, work, technology_lib; LIBRARY IEEE, common_lib, work, technology_lib;
USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_1164.ALL;
...@@ -35,14 +46,10 @@ USE technology_lib.technology_select_pkg.ALL; ...@@ -35,14 +46,10 @@ USE technology_lib.technology_select_pkg.ALL;
ENTITY dp_statistics IS ENTITY dp_statistics IS
GENERIC ( GENERIC (
g_disable_failures : BOOLEAN := FALSE; --TRUE: report warnings instead of failures - does not stop sim.
g_runtime_nof_packets : NATURAL; -- Run the test bench for nof_packets before asserting tb_end g_runtime_nof_packets : NATURAL; -- Run the test bench for nof_packets before asserting tb_end
g_runtime_timeout : TIME; -- Report Failure if g_runtime_nof_packets is not reached before this time g_runtime_timeout : TIME; -- Report Failure if g_runtime_nof_packets is not reached before this time
g_check_nof_valid : BOOLEAN := FALSE; -- True enables valid count checking at tb_end. Reports Failure in case of mismatch. g_check_nof_valid : BOOLEAN := FALSE; -- True enables valid count checking at dp_done. Reports Failure in case of mismatch.
g_check_nof_valid_ref : NATURAL := 0; -- . Specify reference valid count here g_check_nof_valid_ref : NATURAL := 0; -- Reference (= expected) valid count
g_check_data_rate_mbps : BOOLEAN := FALSE; -- True enables checking of calculated data rate in Mbps
g_check_data_rate_mbps_ref : NATURAL := 0; -- . Specify reference data rate in Mbps here
g_dp_clk_freq_khz : NATURAL := 200000; -- Used to calculate data rate
g_dp_word_w : NATURAL := 32 -- Used to calculate data rate g_dp_word_w : NATURAL := 32 -- Used to calculate data rate
); );
PORT ( PORT (
...@@ -58,29 +65,28 @@ END dp_statistics; ...@@ -58,29 +65,28 @@ END dp_statistics;
ARCHITECTURE str OF dp_statistics IS ARCHITECTURE str OF dp_statistics IS
CONSTANT c_severity_level : SEVERITY_LEVEL := sel_a_b(g_disable_failures, WARNING, ERROR);
SIGNAL packet_count : NATURAL := 0; SIGNAL packet_count : NATURAL := 0;
SIGNAL valid_count : NATURAL := 0;
SIGNAL cycle_count : NATURAL := 0;
SIGNAL i_tb_end : STD_LOGIC;
SIGNAL timeout : STD_LOGIC;
SIGNAL nxt_packet_count : NATURAL := 0; SIGNAL nxt_packet_count : NATURAL := 0;
SIGNAL valid_count : NATURAL := 0;
SIGNAL nxt_valid_count : NATURAL := 0; SIGNAL nxt_valid_count : NATURAL := 0;
SIGNAL nxt_cycle_count : NATURAL := 0;
SIGNAL nxt_tb_end : STD_LOGIC;
SIGNAL data_rate_mbps : NATURAL; SIGNAL timeout : STD_LOGIC;
SIGNAL dp_done : STD_LOGIC := '0';
SIGNAL nxt_dp_done : STD_LOGIC;
BEGIN BEGIN
-- Make sure tb_end will not cause dp_clk to be stopped before dp_done has
-- been evaluated in p_dp_done_check
tb_end <= dp_done WHEN rising_edge(dp_clk);
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Counters -- Counters
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
nxt_packet_count <= packet_count+1 WHEN snk_in.sop='1' ELSE packet_count; nxt_packet_count <= packet_count+1 WHEN snk_in.sop='1' ELSE packet_count;
nxt_valid_count <= valid_count+1 WHEN snk_in.valid='1'ELSE valid_count; nxt_valid_count <= valid_count+1 WHEN snk_in.valid='1'ELSE valid_count;
nxt_cycle_count <= cycle_count+1 WHEN packet_count>0 OR (packet_count=0 AND snk_in.sop='1') ELSE cycle_count;
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Assert timeout after user specified time -- Assert timeout after user specified time
...@@ -91,47 +97,28 @@ BEGIN ...@@ -91,47 +97,28 @@ BEGIN
timeout <= '0', '1' AFTER g_runtime_timeout; timeout <= '0', '1' AFTER g_runtime_timeout;
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Assert tb_end if we've seen g_runtime_nof_packets packets -- Assert dp_done if we've seen g_runtime_nof_packets packets
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
nxt_tb_end <= '1' WHEN packet_count>g_runtime_nof_packets OR (packet_count=g_runtime_nof_packets AND snk_in.sop='1') ELSE '0'; nxt_dp_done <= '1' WHEN packet_count = g_runtime_nof_packets AND snk_in.eop = '1' ELSE '0';
tb_end <= i_tb_end;
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Derive some interesting statistics -- On dp_done; do the checks defined in the generics
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
p_tb_end_calc: PROCESS(nxt_tb_end, timeout) p_dp_done_check: PROCESS(dp_clk)
BEGIN BEGIN
IF nxt_tb_end='1' AND timeout='0' THEN --Don't calc anything if a timeout occured IF timeout = '1' AND dp_done = '0' THEN
data_rate_mbps <= g_dp_clk_freq_khz * g_dp_word_w / 1000 * valid_count / cycle_count; REPORT "[dp_statistics] Timeout occured!" SEVERITY ERROR; -- report ERROR to have Error in log
END IF;
END PROCESS;
------------------------------------------------------------------------------
-- On tb_end; do the checks defined in the generics
------------------------------------------------------------------------------
p_tb_end_check: PROCESS(dp_clk)
BEGIN
IF timeout='1' AND nxt_tb_end='0' THEN
REPORT "[dp_statistics] Timeout occured!" SEVERITY c_severity_level; -- report ERROR to have Error in log
REPORT "[dp_statistics] Timeout occured!" SEVERITY FAILURE; -- report FAILURE to stop simulation REPORT "[dp_statistics] Timeout occured!" SEVERITY FAILURE; -- report FAILURE to stop simulation
ELSIF nxt_tb_end='1' THEN ELSIF dp_done = '1' THEN
IF falling_edge(dp_clk) THEN IF rising_edge(dp_clk) THEN
-- report valid count -- report valid count
IF g_check_nof_valid = TRUE THEN IF g_check_nof_valid = TRUE THEN
IF valid_count /= g_check_nof_valid_ref THEN IF valid_count /= g_check_nof_valid_ref THEN
REPORT "[dp_statistics] Valid count " & INTEGER'IMAGE(valid_count) & " does not match reference " & INTEGER'IMAGE(g_check_nof_valid_ref) SEVERITY c_severity_level; REPORT "[dp_statistics] Valid count " & INTEGER'IMAGE(valid_count) & " does not match reference " & INTEGER'IMAGE(g_check_nof_valid_ref) SEVERITY ERROR;
ELSE ELSE
REPORT "[dp_statistics] Valid count " & INTEGER'IMAGE(valid_count) & " is OK" SEVERITY NOTE; -- Note to show that the check indeed did happen REPORT "[dp_statistics] Valid count " & INTEGER'IMAGE(valid_count) & " is OK" SEVERITY NOTE; -- Note to show that the check indeed did happen
END IF; END IF;
END IF; END IF;
-- report data rate
IF g_check_data_rate_mbps=TRUE THEN
IF data_rate_mbps/=g_check_data_rate_mbps_ref THEN
REPORT "[dp_statistics] data rate " & INTEGER'IMAGE(data_rate_mbps) & " does not match reference " & INTEGER'IMAGE(g_check_data_rate_mbps_ref) SEVERITY c_severity_level;
ELSE
REPORT "[dp_statistics] data rate " & INTEGER'IMAGE(data_rate_mbps) & " is OK" SEVERITY NOTE; -- Note to show that the check indeed did happen
END IF;
END IF;
END IF; END IF;
END IF; END IF;
END PROCESS; END PROCESS;
...@@ -144,13 +131,11 @@ BEGIN ...@@ -144,13 +131,11 @@ BEGIN
IF dp_rst = '1' THEN IF dp_rst = '1' THEN
packet_count <= 0; packet_count <= 0;
valid_count <= 0; valid_count <= 0;
cycle_count <= 0; dp_done <= '0';
i_tb_end <= '0';
ELSIF(rising_edge(dp_clk)) THEN ELSIF(rising_edge(dp_clk)) THEN
packet_count <= nxt_packet_count; packet_count <= nxt_packet_count;
valid_count <= nxt_valid_count; valid_count <= nxt_valid_count;
cycle_count <= nxt_cycle_count; dp_done <= nxt_dp_done;
i_tb_end <= nxt_tb_end;
END IF; END IF;
END PROCESS; END PROCESS;
......
...@@ -50,13 +50,10 @@ USE technology_lib.technology_select_pkg.ALL; ...@@ -50,13 +50,10 @@ USE technology_lib.technology_select_pkg.ALL;
ENTITY eth_statistics IS ENTITY eth_statistics IS
GENERIC ( GENERIC (
g_disable_failures : BOOLEAN := FALSE; --TRUE: report warnings instead of failures - does not stop sim.
g_runtime_nof_packets : NATURAL; -- Run the test bench for nof_packets before asserting tb_end g_runtime_nof_packets : NATURAL; -- Run the test bench for nof_packets before asserting tb_end
g_runtime_timeout : TIME; -- Report Failure if g_runtime_nof_packets is not reached before this time g_runtime_timeout : TIME; -- Report Failure if g_runtime_nof_packets is not reached before this time
g_check_nof_valid : BOOLEAN := FALSE; -- True enables valid count checking at tb_end. Reports Failure in case of mismatch. g_check_nof_valid : BOOLEAN := FALSE; -- True enables valid count checking at tb_end. Reports Failure in case of mismatch.
g_check_nof_valid_ref : NATURAL := 0; -- . Specify reference valid count here g_check_nof_valid_ref : NATURAL := 0 -- Reference (= expected) valid count
g_check_data_rate_mbps : BOOLEAN := FALSE; -- True enables checking of calculated data rate in Mbps
g_check_data_rate_mbps_ref : NATURAL := 0 -- . Specify reference data rate in Mbps here
); );
PORT ( PORT (
eth_serial_in : IN STD_LOGIC; eth_serial_in : IN STD_LOGIC;
...@@ -68,7 +65,6 @@ END eth_statistics; ...@@ -68,7 +65,6 @@ END eth_statistics;
ARCHITECTURE str OF eth_statistics IS ARCHITECTURE str OF eth_statistics IS
CONSTANT c_eth_clk_freq_khz : NATURAL := 125000;
CONSTANT c_eth_word_w : NATURAL := 32; CONSTANT c_eth_word_w : NATURAL := 32;
CONSTANT c_eth_clk_period : TIME := 8 ns; CONSTANT c_eth_clk_period : TIME := 8 ns;
...@@ -130,14 +126,10 @@ BEGIN ...@@ -130,14 +126,10 @@ BEGIN
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
u_dp_statistics : ENTITY dp_lib.dp_statistics u_dp_statistics : ENTITY dp_lib.dp_statistics
GENERIC MAP ( GENERIC MAP (
g_disable_failures => g_disable_failures,
g_runtime_nof_packets => g_runtime_nof_packets, g_runtime_nof_packets => g_runtime_nof_packets,
g_runtime_timeout => g_runtime_timeout, g_runtime_timeout => g_runtime_timeout,
g_check_nof_valid => g_check_nof_valid, g_check_nof_valid => g_check_nof_valid,
g_check_nof_valid_ref => g_check_nof_valid_ref, g_check_nof_valid_ref => g_check_nof_valid_ref,
g_check_data_rate_mbps => g_check_data_rate_mbps,
g_check_data_rate_mbps_ref => g_check_data_rate_mbps_ref,
g_dp_clk_freq_khz => c_eth_clk_freq_khz,
g_dp_word_w => c_eth_word_w g_dp_word_w => c_eth_word_w
) )
PORT MAP ( PORT MAP (
......
...@@ -38,14 +38,11 @@ USE tech_pll_lib.tech_pll_component_pkg.ALL; ...@@ -38,14 +38,11 @@ USE tech_pll_lib.tech_pll_component_pkg.ALL;
ENTITY tr_10GbE_statistics IS ENTITY tr_10GbE_statistics IS
GENERIC ( GENERIC (
g_technology : NATURAL := c_tech_select_default; g_technology : NATURAL := c_tech_select_default;
g_disable_failures : BOOLEAN := FALSE; --TRUE: report warnings instead of failures - does not stop sim. g_dp_clk_freq_khz : NATURAL := 200000; -- default dp_clk 200 MHz, 5 ns period
g_runtime_nof_packets : NATURAL; -- Run the test bench for nof_packets before asserting tb_end g_runtime_nof_packets : NATURAL; -- Run the test bench for nof_packets before asserting tb_end
g_runtime_timeout : TIME; -- Report Failure if g_runtime_nof_packets is not reached before this time g_runtime_timeout : TIME; -- Report Failure if g_runtime_nof_packets is not reached before this time
g_dp_clk_freq_khz : NATURAL := 200000; -- default dp_clk 200 MHz, 5 ns period
g_check_nof_valid : BOOLEAN := FALSE; -- True enables valid count checking at tb_end. Reports Failure in case of mismatch. g_check_nof_valid : BOOLEAN := FALSE; -- True enables valid count checking at tb_end. Reports Failure in case of mismatch.
g_check_nof_valid_ref : NATURAL := 0; -- . Specify reference valid count here g_check_nof_valid_ref : NATURAL := 0 -- Reference (= expected) valid count
g_check_data_rate_mbps : BOOLEAN := FALSE; -- True enables checking of calculated data rate in Mbps
g_check_data_rate_mbps_ref : NATURAL := 0 -- . Specify reference data rate in Mbps here
); );
PORT ( PORT (
xaui_in : IN STD_LOGIC_VECTOR(3 DOWNTO 0) := (others=>'0'); xaui_in : IN STD_LOGIC_VECTOR(3 DOWNTO 0) := (others=>'0');
...@@ -196,14 +193,10 @@ BEGIN ...@@ -196,14 +193,10 @@ BEGIN
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
u_dp_statistics : ENTITY dp_lib.dp_statistics u_dp_statistics : ENTITY dp_lib.dp_statistics
GENERIC MAP ( GENERIC MAP (
g_disable_failures => g_disable_failures,
g_runtime_nof_packets => g_runtime_nof_packets, g_runtime_nof_packets => g_runtime_nof_packets,
g_runtime_timeout => g_runtime_timeout, g_runtime_timeout => g_runtime_timeout,
g_check_nof_valid => g_check_nof_valid, g_check_nof_valid => g_check_nof_valid,
g_check_nof_valid_ref => g_check_nof_valid_ref, g_check_nof_valid_ref => g_check_nof_valid_ref,
g_check_data_rate_mbps => g_check_data_rate_mbps,
g_check_data_rate_mbps_ref => g_check_data_rate_mbps_ref,
g_dp_clk_freq_khz => g_dp_clk_freq_khz,
g_dp_word_w => c_dp_word_w g_dp_word_w => c_dp_word_w
) )
PORT MAP ( PORT MAP (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment