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
b180b926
Commit
b180b926
authored
May 14, 2020
by
Jorge Machado
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create programmable pulse train generator
parent
e5b9d610
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
15 deletions
+44
-15
pulse_gen_pl.vhd
hdl/modules/wr_dio/pulse_gen_pl.vhd
+40
-14
xwr_dio.vhd
hdl/modules/wr_dio/xwr_dio.vhd
+4
-1
No files found.
hdl/modules/wr_dio/pulse_gen_pl.vhd
View file @
b180b926
...
...
@@ -76,8 +76,9 @@ entity pulse_gen_pl is
trig_utc_i
:
in
std_logic_vector
(
39
downto
0
);
trig_cycles_i
:
in
std_logic_vector
(
27
downto
0
);
trig_valid_p1_i
:
in
std_logic
;
pulse_length_i
:
in
std_logic_vector
(
27
downto
0
)
);
pulse_length_i
:
in
std_logic_vector
(
27
downto
0
);
pulse_period_i
:
in
std_logic_vector
(
27
downto
0
)
);
end
pulse_gen_pl
;
...
...
@@ -87,7 +88,7 @@ architecture rtl of pulse_gen_pl is
signal
trig_utc
,
trig_utc_ref
:
std_logic_vector
(
39
downto
0
);
signal
trig_cycles
,
trig_cycles_ref
:
std_logic_vector
(
27
downto
0
);
signal
pulse_length
,
pulse_length_ref
:
std_logic_vector
(
27
downto
0
);
signal
pulse_period
,
pulse_period_ref
:
std_logic_vector
(
27
downto
0
);
-- Signals for the synchronizer
signal
trig_valid_sys_d1
,
trig_valid_sys_d2
:
std_logic
;
signal
rst_from_sync
,
rst_from_sync_d1
:
std_logic
;
...
...
@@ -97,8 +98,11 @@ architecture rtl of pulse_gen_pl is
-- Aux
constant
zeros
:
std_logic_vector
(
27
downto
0
)
:
=
(
others
=>
'0'
);
signal
counter
:
unsigned
(
27
downto
0
);
signal
nozerolength
:
boolean
;
signal
counter
,
train_counter
:
unsigned
(
27
downto
0
);
signal
nozerolength
,
nozeroperiod
:
boolean
;
signal
pulse_o_internal
:
std_logic
;
signal
pulse_train_trigger
:
std_logic
;
signal
load_values
:
std_logic
;
begin
-- architecture rtl
...
...
@@ -110,10 +114,12 @@ begin -- architecture rtl
trig_utc
<=
(
others
=>
'0'
);
trig_cycles
<=
(
others
=>
'0'
);
pulse_length
<=
(
others
=>
'0'
);
pulse_period
<=
(
others
=>
'0'
);
elsif
trig_valid_p1_i
=
'1'
then
trig_utc
<=
trig_utc_i
;
trig_cycles
<=
trig_cycles_i
;
pulse_length
<=
pulse_length_i
;
pulse_period
<=
pulse_period_i
;
end
if
;
end
if
;
end
process
trig_regs
;
...
...
@@ -166,11 +172,13 @@ begin -- architecture rtl
trig_regs_ref
:
process
(
clk_ref_i
)
begin
if
clk_ref_i
'event
and
clk_ref_i
=
'1'
then
if
trig_valid_ref_p1
=
'1'
then
if
trig_valid_ref_p1
=
'1'
or
load_values
=
'1'
then
trig_utc_ref
<=
trig_utc
;
trig_cycles_ref
<=
trig_cycles
;
pulse_length_ref
<=
pulse_length
;
pulse_period_ref
<=
pulse_period
;
pulse_length_ref
<=
pulse_length
;
nozerolength
<=
pulse_length
/=
zeros
;
nozeroperiod
<=
pulse_period
/=
zeros
;
end
if
;
end
if
;
end
process
trig_regs_ref
;
...
...
@@ -192,6 +200,7 @@ begin -- architecture rtl
end
if
;
end
process
ready_for_trig
;
-- Produce output
-- Note rst_n_i is used as an async reset because it comes from the
-- clk_sys_i domain. Not the most elegant but it ensures no glitches
...
...
@@ -201,19 +210,36 @@ begin -- architecture rtl
gen_out
:
process
(
rst_n_i
,
clk_ref_i
)
begin
if
rst_n_i
=
'0'
then
pulse_o
<=
'0'
;
pulse_o
_internal
<=
'0'
;
elsif
clk_ref_i
'event
and
clk_ref_i
=
'1'
then
if
tm_time_valid_i
=
'0'
then
pulse_o
<=
'0'
;
elsif
tm_utc_i
=
trig_utc_ref
and
tm_cycles_i
=
trig_cycles_ref
and
nozerolength
then
pulse_o
<=
'1'
;
pulse_o
_internal
<=
'0'
;
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
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
<=
'0'
;
pulse_o_internal
<=
'0'
;
load_values
<=
'0'
;
end
if
;
end
if
;
end
process
gen_out
;
end
architecture
rtl
;
pulse_o
<=
pulse_o_internal
;
end
architecture
rtl
;
\ No newline at end of file
hdl/modules/wr_dio/xwr_dio.vhd
View file @
b180b926
...
...
@@ -153,6 +153,8 @@ architecture rtl of xwr_dio is
trig_utc_i
:
in
std_logic_vector
(
39
downto
0
);
trig_cycles_i
:
in
std_logic_vector
(
27
downto
0
);
trig_valid_p1_i
:
in
std_logic
;
pulse_length_i
:
in
std_logic_vector
(
27
downto
0
);
pulse_period_i
:
in
std_logic_vector
(
27
downto
0
)
);
end
component
;
...
...
@@ -547,7 +549,8 @@ begin
trig_utc_i
=>
trig_seconds
(
i
),
trig_cycles_i
=>
trig_cycles
(
i
),
trig_valid_p1_i
=>
trig_valid_p1
(
i
),
pulse_length_i
=>
pulse_length
(
i
)
pulse_length_i
=>
pulse_length
(
i
),
pulse_period_i
=>
pulse_period
(
i
)
);
...
...
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