Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr2rf-vme
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
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
wr2rf-vme
Commits
f00f4d0d
Commit
f00f4d0d
authored
Apr 28, 2020
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tb_vtu: add observer for initial pulse.
parent
40e6f0b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
tb_vtu.vhd
hdl/testbench/vtu/tb_vtu.vhd
+17
-2
No files found.
hdl/testbench/vtu/tb_vtu.vhd
View file @
f00f4d0d
...
...
@@ -68,6 +68,8 @@ architecture arch of tb_vtu is
signal
observer_state
:
obs_state_type
:
=
IDLE
;
signal
observer_count
:
natural
;
signal
observer_period
:
time
;
signal
observer_delay
:
time
;
-- Delay between sync and first pulse,
signal
wait_sync
:
boolean
;
begin
-- System clock, 62.5 Mhz
process
...
...
@@ -108,7 +110,7 @@ begin
);
-- VTU observer.
process
(
trig_p
,
observer_cmd
)
process
(
trig_p
,
clk_rf
,
observer_cmd
)
variable
last_ts
:
time
;
variable
this_period
:
time
;
begin
...
...
@@ -119,11 +121,18 @@ begin
observer_state
<=
WORKING
;
observer_count
<=
1
;
last_ts
:
=
now
;
wait_sync
<=
True
;
when
WORKING
=>
report
"VTU observer command overrides the previous one"
severity
error
;
end
case
;
end
if
;
if
rising_edge
(
clk_rf
)
and
sync
=
'1'
and
wait_sync
then
last_ts
:
=
now
;
wait_sync
<=
false
;
report
"VTU observer: got sync"
;
end
if
;
if
trig_p
'event
and
(
observer_cmd
.
square
or
trig_p
=
'1'
)
then
report
"Trigger:"
&
Natural
'image
(
observer_count
);
case
observer_state
is
...
...
@@ -131,7 +140,11 @@ begin
report
"VTU observer: trigger before command"
severity
error
;
when
WORKING
|
OBS_DONE
=>
this_period
:
=
now
-
last_ts
;
if
observer_count
=
2
then
if
observer_count
=
1
then
-- First pulse.
assert
not
wait_sync
report
"VTU observer: trigger before sync"
;
observer_delay
<=
this_period
;
elsif
observer_count
=
2
then
observer_period
<=
this_period
;
elsif
observer_count
>
2
then
if
this_period
/=
observer_period
then
...
...
@@ -280,6 +293,8 @@ begin
wait
on
observer_state
;
-- Check observer status.
assert
observer_state
=
OBS_DONE
severity
error
;
report
natural
'image
(
observer_delay
/
5
ns
);
report
time
'image
(
observer_delay
);
assert
observer_period
=
8
*
5
ns
;
-- Check VTU status.
read_status
(
val
);
...
...
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