Skip to content
Snippets Groups Projects
Commit 943cb1b8 authored by Daniel van der Schuur's avatar Daniel van der Schuur
Browse files

-Added support for range(0,1,1) = [0], before the lowest range supported was

 range(0,2,1) = [0,1].
-Reverified in sim using tb_tb_dp_counter and tb_dp_counter_func.
parent 3283022b
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
-- . Faster changing dimensions carry over in slower changing dimensions -- . Faster changing dimensions carry over in slower changing dimensions
-- when dimension maximum is reached -- when dimension maximum is reached
-- . The outputs are in sync with / apply to src_out. -- . The outputs are in sync with / apply to src_out.
-- . range(0,2,1) = [0, 1] is the smallest count range allowed -- . range(0,1,1) = [0] is the smallest count range
-- Usage: -- Usage:
-- . The count values themselves (c0..c4) are very useful to tag streaming -- . The count values themselves (c0..c4) are very useful to tag streaming
-- data with corresponding ID indices. -- data with corresponding ID indices.
......
...@@ -94,27 +94,33 @@ BEGIN ...@@ -94,27 +94,33 @@ BEGIN
v.count_max := '0'; v.count_max := '0';
v.count_init := '0'; v.count_init := '0';
IF count_en='1' THEN
-- Start counting / init -- Start counting / init
IF r.count_en='0' AND count_en='1' THEN IF r.count_en='0' THEN
v.count_en := '1'; v.count_en := '1';
v.count := TO_UVEC(g_range_start+count_offset, c_count_w); v.count := TO_UVEC(g_range_start+count_offset, c_count_w);
v.count_min := '1'; v.count_min := '1';
v.count_init := '1'; v.count_init := '1';
-- keep counting -- keep counting
ELSIF count_en='1' THEN ELSE
v.count := INCR_UVEC(r.count, g_range_step); v.count := INCR_UVEC(r.count, g_range_step);
IF check_max='1' AND r.count = TO_UVEC(c_count_max-g_range_step, c_count_w) THEN -- count max almost reached IF c_count_max>0 AND check_max='1' AND r.count = TO_UVEC(c_count_max-g_range_step, c_count_w) THEN -- count max almost reached
v.count_max := '1'; v.count_max := '1';
ELSIF r.count = TO_UVEC(c_count_max, c_count_w) THEN -- count max reached ELSIF r.count = TO_UVEC(c_count_max, c_count_w) THEN -- count max reached
-- Reset count to start value -- Reset count to start value
v.count := TO_UVEC(g_range_start, c_count_w); v.count := TO_UVEC(g_range_start, c_count_w);
v.count_min := '1'; v.count_min := '1';
END IF; END IF;
ELSIF check_max='1' THEN END IF;
IF r.count = TO_UVEC(c_count_max, c_count_w) THEN -- count max reached
-- If the maximum count is 0, count_max is always high.
IF c_count_max=0 THEN
v.count_max := '1'; v.count_max := '1';
END IF; END IF;
ELSIF check_max='1' AND r.count = TO_UVEC(c_count_max, c_count_w) THEN -- count max reached
v.count_max := '1';
END IF; END IF;
IF rst = '1' THEN IF rst = '1' THEN
......
...@@ -52,7 +52,7 @@ ENTITY tb_dp_counter IS ...@@ -52,7 +52,7 @@ ENTITY tb_dp_counter IS
g_nof_counters : NATURAL := 3; g_nof_counters : NATURAL := 3;
-- min range = [0,2,1] => (0,1) 'the Python way' -- min range = [0,2,1] => (0,1) 'the Python way'
g_range_start : t_nat_natural_arr(9 DOWNTO 0) := (0,0,0,0,0,0,0, 1, 0, 0); g_range_start : t_nat_natural_arr(9 DOWNTO 0) := (0,0,0,0,0,0,0, 1, 0, 0);
g_range_stop : t_nat_natural_arr(9 DOWNTO 0) := (2,2,2,2,2,2,7,16,16,16); g_range_stop : t_nat_natural_arr(9 DOWNTO 0) := (2,2,2,2,2,2,7,16,16, 1);
g_range_step : t_nat_natural_arr(9 DOWNTO 0) := (1,1,1,1,1,1,2, 2, 2, 1) g_range_step : t_nat_natural_arr(9 DOWNTO 0) := (1,1,1,1,1,1,2, 2, 2, 1)
); );
END tb_dp_counter; END tb_dp_counter;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment