Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DIO 5ch TTL a
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DIO 5ch TTL a
Commits
4d224a07
Commit
4d224a07
authored
May 05, 2020
by
Jorge Machado
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix delay cycles in immediate pulse train generator
parent
1a316e51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
43 deletions
+49
-43
imm_pulse_train_gen.vhd
hdl/modules/wr_dio/imm_pulse_train_gen.vhd
+49
-43
No files found.
hdl/modules/wr_dio/imm_pulse_train_gen.vhd
View file @
4d224a07
...
...
@@ -53,27 +53,29 @@ architecture Behavioral of imm_pulse_train_gen is
-- Aux
constant
zeros
:
std_logic_vector
(
pulse_period_width
-1
downto
0
)
:
=
(
others
=>
'0'
);
constant
initial_pulse_delay_compensation
:
integer
:
=
7
;
constant
repeat_pulse_delay_compensation
:
integer
:
=
4
;
begin
synchronization
:
process
(
clk_ref_i
,
rst_n_i
)
begin
if
(
rst_n_i
=
'0'
)
then
dio_pulse_immed_stb_d0
<=
'0'
;
dio_pulse_immed_stb_d1
<=
'0'
;
dio_pulse_immed_stb_d2
<=
'0'
;
dio_pulse_immed_stb_d3
<=
'0'
;
elsif
rising_edge
(
clk_ref_i
)
then
dio_pulse_immed_stb_d0
<=
dio_pulse_immed_stb_i
;
dio_pulse_immed_stb_d1
<=
dio_pulse_immed_stb_d0
;
dio_pulse_immed_stb_d2
<=
dio_pulse_immed_stb_d1
;
dio_pulse_immed_stb_d3
<=
dio_pulse_immed_stb_d2
;
nozeroperiod_aux
<=
pulse_period_i
/=
zeros
;
-- Update nozeroperiod each period while the state machine is counting
if
((
dio_pulse_immed_stb_d2
=
'1'
and
dio_pulse_immed_stb_d1
=
'0'
)
or
(
state
=
CAPTURE_PERIOD
))
then
nozeroperiod
<=
nozeroperiod_aux
;
end
if
;
end
if
;
if
(
rst_n_i
=
'0'
)
then
dio_pulse_immed_stb_d0
<=
'0'
;
dio_pulse_immed_stb_d1
<=
'0'
;
dio_pulse_immed_stb_d2
<=
'0'
;
dio_pulse_immed_stb_d3
<=
'0'
;
elsif
rising_edge
(
clk_ref_i
)
then
dio_pulse_immed_stb_d0
<=
dio_pulse_immed_stb_i
;
dio_pulse_immed_stb_d1
<=
dio_pulse_immed_stb_d0
;
dio_pulse_immed_stb_d2
<=
dio_pulse_immed_stb_d1
;
dio_pulse_immed_stb_d3
<=
dio_pulse_immed_stb_d2
;
nozeroperiod_aux
<=
pulse_period_i
/=
zeros
;
if
((
dio_pulse_immed_stb_d2
=
'1'
and
dio_pulse_immed_stb_d1
=
'0'
)
or
(
state
=
CAPTURE_PERIOD
))
then
nozeroperiod
<=
nozeroperiod_aux
;
end
if
;
end
if
;
end
process
;
state_process
:
process
(
clk_ref_i
,
rst_n_i
)
...
...
@@ -85,33 +87,37 @@ begin
elsif
rising_edge
(
clk_ref_i
)
then
case
state
is
when
WAIT_ST
=>
if
(
dio_pulse_immed_stb_d3
=
'1'
or
repeat_pulse
=
'1'
)
and
nozeroperiod
then
state
<=
COUNTING
;
--Store the period two cycle before than the immed_pulse_counter_process to not lost one cycle.
counter
<=
unsigned
(
pulse_period_i
)
-4
;
else
state
<=
WAIT_ST
;
end
if
;
when
COUNTING
=>
if
(
counter
=
0
)
then
state
<=
CAPTURE_PERIOD
;
else
state
<=
COUNTING
;
counter
<=
counter
-1
;
end
if
;
when
CAPTURE_PERIOD
=>
state
<=
TRIGGER
;
when
TRIGGER
=>
state
<=
WAIT_ST
;
if
(
nozeroperiod
)
then
repeat_pulse
<=
'1'
;
else
repeat_pulse
<=
'0'
;
end
if
;
when
others
=>
state
<=
WAIT_ST
;
end
case
;
end
if
;
if
dio_pulse_immed_stb_d3
=
'1'
and
nozeroperiod
then
state
<=
COUNTING
;
--Store the period two cycle before than the immed_pulse_counter_process to not lost one cycle.
counter
<=
unsigned
(
pulse_period_i
)
-
initial_pulse_delay_compensation
;
elsif
repeat_pulse
=
'1'
and
nozeroperiod
then
state
<=
COUNTING
;
--Store the period four cycles before
counter
<=
unsigned
(
pulse_period_i
)
-
repeat_pulse_delay_compensation
;
else
state
<=
WAIT_ST
;
end
if
;
when
COUNTING
=>
if
(
counter
=
0
)
then
state
<=
CAPTURE_PERIOD
;
else
state
<=
COUNTING
;
counter
<=
counter
-1
;
end
if
;
when
CAPTURE_PERIOD
=>
state
<=
TRIGGER
;
when
TRIGGER
=>
state
<=
WAIT_ST
;
if
(
nozeroperiod
)
then
repeat_pulse
<=
'1'
;
else
repeat_pulse
<=
'0'
;
end
if
;
when
others
=>
state
<=
WAIT_ST
;
end
case
;
end
if
;
end
process
;
output_process
:
process
(
counter
,
state
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment