Commit 1a316e51 authored by Jorge Machado's avatar Jorge Machado

Modified programmable pulse train process. It is working now

parent 85963c01
......@@ -200,24 +200,6 @@ begin -- architecture rtl
end if;
end process ready_for_trig;
-- Pulse train generator
pulse_train_gen : process(rst_n_i, clk_ref_i)
begin
if rst_n_i = '0' then
pulse_train_trigger <= '0';
elsif clk_ref_i'event and clk_ref_i = '1' then
if train_counter = 1 then
pulse_train_trigger <= '1';
train_counter <= train_counter-1;
elsif train_counter /= 0 then
train_counter <= train_counter-1;
elsif(pulse_o_internal = '1' and nozeroperiod) then
train_counter <= unsigned(pulse_period_ref)-2;
else
pulse_train_trigger <= '0';
end if;
end if;
end process pulse_train_gen;
-- Produce output
-- Note rst_n_i is used as an async reset because it comes from the
......@@ -232,23 +214,28 @@ begin -- architecture rtl
elsif clk_ref_i'event and clk_ref_i = '1' then
if tm_time_valid_i = '0' then
pulse_o_internal <= '0';
elsif tm_utc_i = trig_utc_ref and tm_cycles_i = trig_cycles_ref and nozerolength then
elsif tm_utc_i = trig_utc_ref and tm_cycles_i = trig_cycles_ref and nozerolength then --Original trigger
pulse_o_internal <= '1';
counter <= unsigned(pulse_length_ref)-1;
elsif tm_utc_i >= trig_utc_ref and tm_cycles_i >= trig_cycles_ref and nozeroperiod and pulse_o_internal = '0' then
if(pulse_train_trigger = '1') then
pulse_o_internal <= '1';
counter <= unsigned(pulse_length_ref)-1;
end if;
elsif counter = 1 then --Update the pulse length value in the last cycle of the pulse generation
load_values <= '1';
counter <= counter-1;
elsif counter /= 0 then
train_counter <= unsigned(pulse_period_ref); --Store the value of the period
elsif counter /= 0 then --The period counter is reduced at the same time than the pulse counter
counter <= counter-1;
if(nozeroperiod) then
train_counter <= train_counter-1;
end if;
-- elsif(train_counter = 10) then --Load new values for then next cycle
-- load_values <= '1';
elsif(train_counter = 1) then --Period trigger. Rearm both counters
pulse_o_internal <= '1';
counter <= unsigned(pulse_length_ref)-1;
train_counter <= unsigned(pulse_period_ref);
elsif train_counter /= 0 then
train_counter <= train_counter-1;
pulse_o_internal <= '0';
load_values <= '0';
else
pulse_o_internal <= '0';
load_values <= '0';
pulse_o_internal <= '0';
load_values <= '0';
end if;
end if;
end process gen_out;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment