Skip to content
Snippets Groups Projects
Commit c72c374f authored by Pieter Donker's avatar Pieter Donker
Browse files

L2SDP-180, processed review comments.

parent 8fd4e4e0
No related branches found
No related tags found
2 merge requests!100Removed text for XSub that is now written in Confluence Subband correlator...,!59Resolve L2SDP-180
...@@ -217,6 +217,7 @@ regression_test_vhdl = ...@@ -217,6 +217,7 @@ regression_test_vhdl =
tb/vhdl/tb_common_shiftram.vhd tb/vhdl/tb_common_shiftram.vhd
tb/vhdl/tb_common_shiftreg.vhd tb/vhdl/tb_common_shiftreg.vhd
tb/vhdl/tb_common_transpose_symbol.vhd tb/vhdl/tb_common_transpose_symbol.vhd
tb/vhdl/tb_common_variable_delay.vhd
tb/vhdl/tb_resize.vhd tb/vhdl/tb_resize.vhd
#tb/vhdl/tb_round.vhd -- has no self verification yet #tb/vhdl/tb_round.vhd -- has no self verification yet
tb/vhdl/tb_requantize.vhd tb/vhdl/tb_requantize.vhd
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
-- . Delay input pulse by number of given delay cycles -- . Delay input pulse by number of given delay cycles
-- Description: -- Description:
-- . delay input pulse by nof_cycles_delay -- . delay input pulse by nof_cycles_delay
-- . output pulse is derived form low-high transition of input pulse. -- . output pulse is derived from low-high transition of input pulse.
-- . during delay other input pulses are ignored -- . during delay other input pulses are ignored
-- -------------------------------------------------------------------------- -- --------------------------------------------------------------------------
...@@ -33,11 +33,14 @@ USE work.common_pkg.ALL; ...@@ -33,11 +33,14 @@ USE work.common_pkg.ALL;
ENTITY common_variable_delay IS ENTITY common_variable_delay IS
GENERIC (
g_max_delay : NATURAL := 200 * 10**6
);
PORT ( PORT (
rst : IN STD_LOGIC; rst : IN STD_LOGIC;
clk : IN STD_LOGIC; clk : IN STD_LOGIC;
delay : IN NATURAL := 0; delay : IN NATURAL RANGE 0 TO g_max_delay := 0;
enable : IN STD_LOGIC := '0'; enable : IN STD_LOGIC := '0';
in_val : IN STD_LOGIC; in_val : IN STD_LOGIC;
out_val : OUT STD_LOGIC out_val : OUT STD_LOGIC
...@@ -48,40 +51,40 @@ END common_variable_delay; ...@@ -48,40 +51,40 @@ END common_variable_delay;
ARCHITECTURE rtl OF common_variable_delay IS ARCHITECTURE rtl OF common_variable_delay IS
SIGNAL i_out_val : STD_LOGIC; SIGNAL i_out_val : STD_LOGIC;
SIGNAL nxt_i_out_val : STD_LOGIC; SIGNAL nxt_out_val : STD_LOGIC;
SIGNAL delay_cnt : NATURAL; SIGNAL delay_cnt : NATURAL;
SIGNAL nxt_delay_cnt : NATURAL; SIGNAL nxt_delay_cnt : NATURAL;
SIGNAL in_val_lock : STD_LOGIC; SIGNAL in_val_lock : STD_LOGIC := '0';
SIGNAL nxt_in_val_lock : STD_LOGIC; SIGNAL prev_in_val : STD_LOGIC := '0';
BEGIN BEGIN
out_val <= i_out_val; -- AND enable; out_val <= i_out_val;
p_delay: PROCESS(enable, delay, in_val, i_out_val, delay_cnt, in_val_lock) p_delay: PROCESS(enable, in_val, prev_in_val, in_val_lock, nxt_delay_cnt, delay_cnt, delay, i_out_val)
BEGIN BEGIN
nxt_i_out_val <= '0';
nxt_delay_cnt <= delay_cnt + 1;
nxt_in_val_lock <= in_val_lock;
IF enable = '1' THEN IF enable = '1' THEN
IF rising_edge(in_val) THEN IF in_val = '1' AND prev_in_val = '0' THEN -- detect rising_edge of in_val
nxt_in_val_lock <= '1'; in_val_lock <= '1';
IF delay = 0 THEN
nxt_delay_cnt <= 0;
END IF;
END IF; END IF;
IF nxt_in_val_lock = '0' THEN IF in_val_lock = '1' THEN
IF delay_cnt = delay THEN
nxt_out_val <= '1';
END IF;
nxt_delay_cnt <= delay_cnt + 1;
ELSE
nxt_delay_cnt <= 0; nxt_delay_cnt <= 0;
END IF; END IF;
IF nxt_delay_cnt = (delay+1) THEN IF i_out_val = '1' THEN
nxt_i_out_val <= '1'; nxt_out_val <= '0';
nxt_in_val_lock <= '0'; in_val_lock <= '0';
END IF; END IF;
ELSE ELSE
nxt_delay_cnt <= 0; nxt_delay_cnt <= 0;
nxt_in_val_lock <= '0'; nxt_out_val <= '0';
in_val_lock <= '0';
END IF; END IF;
END PROCESS; END PROCESS;
...@@ -91,11 +94,11 @@ BEGIN ...@@ -91,11 +94,11 @@ BEGIN
IF rst = '1' THEN IF rst = '1' THEN
i_out_val <= '0'; i_out_val <= '0';
delay_cnt <= 0; delay_cnt <= 0;
in_val_lock <= '0'; prev_in_val <= '0';
ELSIF rising_edge(clk) THEN ELSIF rising_edge(clk) THEN
i_out_val <= nxt_i_out_val; i_out_val <= nxt_out_val;
delay_cnt <= nxt_delay_cnt; delay_cnt <= nxt_delay_cnt;
in_val_lock <= nxt_in_val_lock; prev_in_val <= in_val;
END IF; END IF;
END PROCESS; END PROCESS;
......
...@@ -57,7 +57,6 @@ ARCHITECTURE rtl OF mms_common_variable_delay IS ...@@ -57,7 +57,6 @@ ARCHITECTURE rtl OF mms_common_variable_delay IS
SIGNAL enable : STD_LOGIC := '0'; SIGNAL enable : STD_LOGIC := '0';
BEGIN BEGIN
enable <= sl(enable_reg); enable <= sl(enable_reg);
......
...@@ -40,7 +40,7 @@ ARCHITECTURE tb OF tb_common_variable_delay IS ...@@ -40,7 +40,7 @@ ARCHITECTURE tb OF tb_common_variable_delay IS
CONSTANT c_clk_period : TIME := 10 ns; CONSTANT c_clk_period : TIME := 10 ns;
CONSTANT c_trigger_interval : NATURAL := 40; -- in clk's CONSTANT c_trigger_interval : NATURAL := 40; -- in clk's
CONSTANT c_trigger_latency : NATURAL := 3; -- in clk's CONSTANT c_trigger_latency : NATURAL := 1; -- in clk's
CONSTANT c_delay_arr : t_natural_arr(0 TO 3) := (0, 1, 3, 12); CONSTANT c_delay_arr : t_natural_arr(0 TO 3) := (0, 1, 3, 12);
SIGNAL tb_end : STD_LOGIC := '0'; SIGNAL tb_end : STD_LOGIC := '0';
...@@ -58,17 +58,7 @@ BEGIN ...@@ -58,17 +58,7 @@ BEGIN
rst <= '1', '0' AFTER c_clk_period*4; rst <= '1', '0' AFTER c_clk_period*4;
-- generate trigger signal -- generate trigger signal
p_trigger : PROCESS proc_common_gen_pulse(c_trigger_interval/2, c_trigger_interval, '1', rst, clk, trigger);
BEGIN
WAIT UNTIL rst = '0';
proc_common_wait_some_cycles(clk, 10);
WAIT UNTIL rising_edge(clk);
WHILE tb_end = '0' LOOP
trigger <= NOT trigger;
proc_common_wait_some_cycles(clk, c_trigger_interval/2);
END LOOP;
WAIT;
END PROCESS;
p_in_stimuli : PROCESS p_in_stimuli : PROCESS
......
...@@ -86,17 +86,7 @@ BEGIN ...@@ -86,17 +86,7 @@ BEGIN
END PROCESS; END PROCESS;
-- generate trigger signal -- generate trigger signal
p_trigger : PROCESS proc_common_gen_pulse(c_trigger_interval/2, c_trigger_interval, '1', rst, clk, trigger);
BEGIN
WAIT UNTIL rst = '0';
proc_common_wait_some_cycles(clk, 10);
WAIT UNTIL rising_edge(clk);
WHILE tb_end = '0' LOOP
trigger <= NOT trigger;
proc_common_wait_some_cycles(clk, c_trigger_interval/2);
END LOOP;
WAIT;
END PROCESS;
-- device under test -- device under test
u_dut : ENTITY work.mms_common_variable_delay u_dut : ENTITY work.mms_common_variable_delay
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment