From 8d1000dfd08e8a30dfae520c1f098b82a4ecf0c1 Mon Sep 17 00:00:00 2001 From: Erik Kooistra <kooistra@astron.nl> Date: Fri, 16 Oct 2015 12:21:20 +0000 Subject: [PATCH] Use g_pulse_phase defines when the first pulse occurs after rst release. --- libraries/base/common/src/vhdl/common_pulser.vhd | 9 ++++++++- .../common/src/vhdl/common_pulser_us_ms_s.vhd | 15 +++++++++------ .../base/common/tb/vhdl/tb_common_pulser.vhd | 3 ++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/libraries/base/common/src/vhdl/common_pulser.vhd b/libraries/base/common/src/vhdl/common_pulser.vhd index 019ef371cf..f3cf793ce5 100644 --- a/libraries/base/common/src/vhdl/common_pulser.vhd +++ b/libraries/base/common/src/vhdl/common_pulser.vhd @@ -30,9 +30,15 @@ USE common_lib.common_pkg.ALL; -- The pulse period can dynamically be set via the input pulse_period. -- Default pulse_period = g_pulse_period, to also support static setting of -- the pulse period. The pulse_clr can be used to synchronise the pulser. +-- The g_pulse_phase defines when the first pulse occurs after rst release: +-- . g_pulse_phase=0 : first pulse after g_pulse_period cycles +-- . g_pulse_phase=g_pulse_period : first pulse after g_pulse_period cycles +-- . g_pulse_phase=g_pulse_period-1 : first pulse after 1 cycles +-- . g_pulse_phase=g_pulse_period-N : first pulse after N cycles ENTITY common_pulser IS GENERIC ( - g_pulse_period : NATURAL := 25000 -- nof clk cycles to get pulse period + g_pulse_period : NATURAL := 25000; -- nof clk cycles to get pulse period + g_pulse_phase : INTEGER := 0 ); PORT ( rst : IN STD_LOGIC; @@ -76,6 +82,7 @@ BEGIN u_cnt : ENTITY common_lib.common_counter GENERIC MAP ( + g_init => g_pulse_phase, g_width => c_pulse_period_w ) PORT MAP ( diff --git a/libraries/base/common/src/vhdl/common_pulser_us_ms_s.vhd b/libraries/base/common/src/vhdl/common_pulser_us_ms_s.vhd index 5a910d88f1..6a479b914d 100644 --- a/libraries/base/common/src/vhdl/common_pulser_us_ms_s.vhd +++ b/libraries/base/common/src/vhdl/common_pulser_us_ms_s.vhd @@ -28,9 +28,9 @@ USE common_lib.common_pkg.ALL; ENTITY common_pulser_us_ms_s IS GENERIC ( - g_pulse_us : NATURAL := 125/(10**6); -- nof clk cycles to get us period - g_pulse_ms : NATURAL := 1000; -- nof pulse_us pulses to get ms period - g_pulse_s : NATURAL := 1000 -- nof pulse_ms pulses to get s period + g_pulse_us : NATURAL := 125; -- nof clk cycles to get us period + g_pulse_ms : NATURAL := 1000; -- nof pulse_us pulses to get ms period + g_pulse_s : NATURAL := 1000 -- nof pulse_ms pulses to get s period ); PORT ( rst : IN STD_LOGIC; @@ -78,7 +78,8 @@ BEGIN u_common_pulser_us : ENTITY common_lib.common_pulser GENERIC MAP ( - g_pulse_period => g_pulse_us + g_pulse_period => g_pulse_us, + g_pulse_phase => g_pulse_us-1 ) PORT MAP ( rst => rst, @@ -91,7 +92,8 @@ BEGIN u_common_pulser_ms : ENTITY common_lib.common_pulser GENERIC MAP ( - g_pulse_period => g_pulse_ms + g_pulse_period => g_pulse_ms, + g_pulse_phase => g_pulse_ms-1 ) PORT MAP ( rst => rst, @@ -104,7 +106,8 @@ BEGIN u_common_pulser_s : ENTITY common_lib.common_pulser GENERIC MAP ( - g_pulse_period => g_pulse_s + g_pulse_period => g_pulse_s, + g_pulse_phase => g_pulse_s-1 ) PORT MAP ( rst => rst, diff --git a/libraries/base/common/tb/vhdl/tb_common_pulser.vhd b/libraries/base/common/tb/vhdl/tb_common_pulser.vhd index 0a4393896c..5b00cf780d 100644 --- a/libraries/base/common/tb/vhdl/tb_common_pulser.vhd +++ b/libraries/base/common/tb/vhdl/tb_common_pulser.vhd @@ -81,7 +81,8 @@ BEGIN u_pulse_us : ENTITY work.common_pulser GENERIC MAP ( - g_pulse_period => c_pulse_us + g_pulse_period => c_pulse_us, + g_pulse_phase => c_pulse_us-1 ) PORT MAP ( rst => rst, -- GitLab