Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit core collection
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
30
Issues
30
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Schedules
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
White Rabbit core collection
Commits
ace05b04
Commit
ace05b04
authored
Oct 19, 2018
by
Tomasz Wlostowski
Committed by
Maciej Lipinski
May 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wr_streamers: fixed timestamp wraparound detection in fixed latency mode
parent
cd1c537c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
18 deletions
+40
-18
fixed_latency_delay.vhd
modules/wr_streamers/fixed_latency_delay.vhd
+10
-7
fixed_latency_ts_match.vhd
modules/wr_streamers/fixed_latency_ts_match.vhd
+27
-10
xrx_streamer.vhd
modules/wr_streamers/xrx_streamer.vhd
+3
-1
No files found.
modules/wr_streamers/fixed_latency_delay.vhd
View file @
ace05b04
...
...
@@ -12,7 +12,9 @@ entity fixed_latency_delay is
g_data_width
:
integer
;
g_buffer_size
:
integer
;
g_use_ref_clock_for_data
:
integer
;
g_clk_ref_rate
:
integer
g_clk_ref_rate
:
integer
;
g_simulation
:
integer
:
=
0
;
g_sim_cycle_counter_range
:
integer
:
=
125000000
);
port
(
rst_n_i
:
in
std_logic
;
...
...
@@ -55,8 +57,6 @@ architecture rtl of fixed_latency_delay is
signal
State
:
t_state
;
signal
clk_data
:
std_logic
;
signal
rst_n_data
:
std_logic
;
signal
rst_n_ref
:
std_logic
;
signal
wr_full
:
std_logic
;
constant
c_datapath_width
:
integer
:
=
g_data_width
+
2
+
28
+
1
;
...
...
@@ -175,7 +175,7 @@ begin
when
TS_WAIT_MATCH
=>
if
delay_miss
=
'1'
or
delay_match
=
'1'
then
if
fifo_last
=
'1'
then
if
fifo_last
=
'1'
and
fifo_empty
=
'0'
then
state
<=
TS_SETUP_MATCH
;
else
state
<=
SEND
;
...
...
@@ -190,7 +190,8 @@ begin
else
state
<=
TS_SETUP_MATCH
;
end
if
;
elsif
fifo_empty
=
'1'
then
state
<=
IDLE
;
end
if
;
end
case
;
end
if
;
...
...
@@ -200,7 +201,9 @@ begin
U_Compare
:
entity
work
.
fixed_latency_ts_match
generic
map
(
g_clk_ref_rate
=>
g_clk_ref_rate
)
g_clk_ref_rate
=>
g_clk_ref_rate
,
g_sim_cycle_counter_range
=>
g_sim_cycle_counter_range
,
g_simulation
=>
g_simulation
)
port
map
(
clk_i
=>
clk_ref_i
,
rst_n_i
=>
rst_n_ref
,
...
...
modules/wr_streamers/fixed_latency_ts_match.vhd
View file @
ace05b04
...
...
@@ -4,7 +4,11 @@ use ieee.numeric_std.all;
entity
fixed_latency_ts_match
is
generic
(
g_clk_ref_rate
:
integer
);
(
g_clk_ref_rate
:
integer
;
g_simulation
:
integer
:
=
0
;
g_sim_cycle_counter_range
:
integer
:
=
125000000
);
port
(
clk_i
:
in
std_logic
;
...
...
@@ -32,11 +36,21 @@ end entity;
architecture
rtl
of
fixed_latency_ts_match
is
constant
c_unwrap_threshold
:
integer
:
=
62500000
;
impure
function
f_cycles_counter_range
return
integer
is
begin
if
g_simulation
=
1
then
return
g_sim_cycle_counter_range
;
else
return
125000000
;
end
if
;
end
function
;
constant
c_rollover_threshold_lo
:
integer
:
=
f_cycles_counter_range
/
4
;
constant
c_rollover_threshold_hi
:
integer
:
=
f_cycles_counter_range
*
3
/
4
;
signal
ts_adjusted
:
unsigned
(
28
downto
0
);
signal
target_cycles
:
unsigned
(
28
downto
0
);
signal
delta
:
signed
(
28
downto
0
);
signal
arm_d
:
std_logic_vector
(
2
downto
0
);
signal
armed
:
std_logic
;
...
...
@@ -64,6 +78,7 @@ begin
begin
if
rising_edge
(
clk_i
)
then
if
rst_n_i
=
'0'
then
armed
<=
'0'
;
arm_d
<=
(
others
=>
'0'
);
miss_o
<=
'0'
;
else
...
...
@@ -73,17 +88,19 @@ begin
match_o
<=
'0'
;
miss_o
<=
'0'
;
ts_adjusted
<=
resize
(
unsigned
(
ts_origin_i
)
+
unsigned
(
ts_latency_i
),
29
);
delta
<=
signed
(
'0'
&
ts_origin_i
)
+
signed
(
'0'
&
ts_latency_i
)
-
signed
(
'0'
&
tm_cycles_i
);
end
if
;
if
delta
<
-
c_unwrap_threshold
or
delta
>
c_unwrap_threshold
then
ts_adjusted
<=
ts_adjusted
+
125000000
;
target_cycles
<=
tm_cycles_scaled
+
125000000
;
if
ts_adjusted
<
c_rollover_threshold_lo
and
tm_cycles_scaled
>
c_rollover_threshold_hi
then
target_cycles
<=
tm_cycles_scaled
+
f_cycles_counter_range
;
if
arm_d
(
0
)
=
'1'
then
ts_adjusted
<=
ts_adjusted
+
f_cycles_counter_range
;
end
if
;
else
target_cycles
<=
tm_cycles_scaled
;
end
if
;
if
(
arm_d
(
1
)
=
'1'
)
then
if
ts_adjusted
<
target_cycles
then
miss_o
<=
'1'
;
...
...
@@ -92,7 +109,7 @@ begin
end
if
;
end
if
;
if
armed
=
'1'
and
ts_adjusted
=
t
arget_cycles
then
if
armed
=
'1'
and
ts_adjusted
=
t
m_cycles_scaled
then
match_o
<=
'1'
;
armed
<=
'0'
;
else
...
...
modules/wr_streamers/xrx_streamer.vhd
View file @
ace05b04
...
...
@@ -275,7 +275,9 @@ begin -- rtl
g_data_width
=>
g_data_width
,
g_buffer_size
=>
32
,
g_use_ref_clock_for_data
=>
g_use_ref_clock_for_data
,
g_clk_ref_rate
=>
g_clk_ref_rate
)
g_clk_ref_rate
=>
g_clk_ref_rate
,
g_sim_cycle_counter_range
=>
g_sim_cycle_counter_range
,
g_simulation
=>
g_simulation
)
port
map
(
rst_n_i
=>
rst_n_i
,
clk_sys_i
=>
clk_sys_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