Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RTSD
HDL
Commits
3d1528cc
Commit
3d1528cc
authored
2 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Support verifying RSN in dbg_expected_bsn in proc_dp_verify_sync().
parent
17a2bef8
No related branches found
Branches containing commit
No related tags found
1 merge request
!317
Resolve L2SDP-7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd
+63
-2
63 additions, 2 deletions
libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd
libraries/base/dp/tb/vhdl/tb_tb_dp_rsn_source.vhd
+97
-0
97 additions, 0 deletions
libraries/base/dp/tb/vhdl/tb_tb_dp_rsn_source.vhd
with
160 additions
and
2 deletions
libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd
+
63
−
2
View file @
3d1528cc
...
@@ -502,6 +502,20 @@ PACKAGE tb_dp_pkg IS
...
@@ -502,6 +502,20 @@ PACKAGE tb_dp_pkg IS
SIGNAL
dbg_accumulate
:
OUT
NATURAL
;
SIGNAL
dbg_accumulate
:
OUT
NATURAL
;
SIGNAL
dbg_expected_bsn
:
OUT
NATURAL
);
SIGNAL
dbg_expected_bsn
:
OUT
NATURAL
);
PROCEDURE
proc_dp_verify_sync
(
CONSTANT
c_start_bsn
:
IN
NATURAL
;
CONSTANT
c_sync_period
:
IN
NATURAL
;
CONSTANT
c_block_size
:
IN
NATURAL
;
CONSTANT
c_bsn_is_rsn
:
IN
BOOLEAN
;
-- increment BSN by 1 or by c_block_size for RSN
SIGNAL
clk
:
IN
STD_LOGIC
;
SIGNAL
verify_en
:
IN
STD_LOGIC
;
SIGNAL
sync
:
IN
STD_LOGIC
;
SIGNAL
sop
:
IN
STD_LOGIC
;
SIGNAL
bsn
:
IN
STD_LOGIC_VECTOR
;
-- for debug purposes
SIGNAL
dbg_nof_blk
:
OUT
NATURAL
;
SIGNAL
dbg_accumulate
:
OUT
NATURAL
;
SIGNAL
dbg_expected_bsn
:
OUT
NATURAL
);
-- Verify the DUT output sop and eop
-- Verify the DUT output sop and eop
PROCEDURE
proc_dp_verify_sop_and_eop
(
CONSTANT
c_ready_latency
:
IN
NATURAL
;
PROCEDURE
proc_dp_verify_sop_and_eop
(
CONSTANT
c_ready_latency
:
IN
NATURAL
;
CONSTANT
c_verify_valid
:
IN
BOOLEAN
;
CONSTANT
c_verify_valid
:
IN
BOOLEAN
;
...
@@ -2379,6 +2393,7 @@ PACKAGE BODY tb_dp_pkg IS
...
@@ -2379,6 +2393,7 @@ PACKAGE BODY tb_dp_pkg IS
-- . assume that the fractional sync period varies between N and N-1 blocks
-- . assume that the fractional sync period varies between N and N-1 blocks
-- . the fractional sync period starts with N blocks and fits e.g.
-- . the fractional sync period starts with N blocks and fits e.g.
-- dp_bsn_source_v2, dp_bsn_sync_scheduler.
-- dp_bsn_source_v2, dp_bsn_sync_scheduler.
-- . Use block sequence number (BSN) in dbg_expected_bsn.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
PROCEDURE
proc_dp_verify_sync
(
CONSTANT
c_start_bsn
:
IN
NATURAL
;
-- BSN of first sync, start of fractional periods
PROCEDURE
proc_dp_verify_sync
(
CONSTANT
c_start_bsn
:
IN
NATURAL
;
-- BSN of first sync, start of fractional periods
CONSTANT
c_sync_period
:
IN
NATURAL
;
-- number of sample per sync period
CONSTANT
c_sync_period
:
IN
NATURAL
;
-- number of sample per sync period
...
@@ -2392,6 +2407,43 @@ PACKAGE BODY tb_dp_pkg IS
...
@@ -2392,6 +2407,43 @@ PACKAGE BODY tb_dp_pkg IS
SIGNAL
dbg_nof_blk
:
OUT
NATURAL
;
SIGNAL
dbg_nof_blk
:
OUT
NATURAL
;
SIGNAL
dbg_accumulate
:
OUT
NATURAL
;
SIGNAL
dbg_accumulate
:
OUT
NATURAL
;
SIGNAL
dbg_expected_bsn
:
OUT
NATURAL
)
IS
SIGNAL
dbg_expected_bsn
:
OUT
NATURAL
)
IS
BEGIN
proc_dp_verify_sync
(
c_start_bsn
,
c_sync_period
,
c_block_size
,
FALSE
,
clk
,
verify_en
,
sync
,
sop
,
bsn
,
dbg_nof_blk
,
dbg_accumulate
,
dbg_expected_bsn
);
END
proc_dp_verify_sync
;
------------------------------------------------------------------------------
-- PROCEDURE: Verify the DUT output sync
-- . sync is defined such that it can only be active at sop
-- . assume that the fractional sync period varies between N and N-1 blocks
-- . the fractional sync period starts with N blocks and fits e.g.
-- dp_bsn_source_v2, dp_bsn_sync_scheduler.
-- . support using block sequence number (BSN) in dbg_expected_bsn or using
-- raw samples sequence number (RSN) in dbg_expected_bsn
------------------------------------------------------------------------------
PROCEDURE
proc_dp_verify_sync
(
CONSTANT
c_start_bsn
:
IN
NATURAL
;
-- BSN of first sync, start of fractional periods
CONSTANT
c_sync_period
:
IN
NATURAL
;
-- number of sample per sync period
CONSTANT
c_block_size
:
IN
NATURAL
;
-- number of sample per block
CONSTANT
c_bsn_is_rsn
:
IN
BOOLEAN
;
-- increment BSN by 1 or by c_block_size for RSN
SIGNAL
clk
:
IN
STD_LOGIC
;
SIGNAL
verify_en
:
IN
STD_LOGIC
;
SIGNAL
sync
:
IN
STD_LOGIC
;
SIGNAL
sop
:
IN
STD_LOGIC
;
SIGNAL
bsn
:
IN
STD_LOGIC_VECTOR
;
-- for debug purposes
SIGNAL
dbg_nof_blk
:
OUT
NATURAL
;
SIGNAL
dbg_accumulate
:
OUT
NATURAL
;
SIGNAL
dbg_expected_bsn
:
OUT
NATURAL
)
IS
CONSTANT
c_bsn_w
:
NATURAL
:
=
sel_a_b
(
bsn
'LENGTH
>
31
,
31
,
bsn
'LENGTH
);
-- use maximally c_natural_w = 31 bit of BSN slv to allow calculations with integers
CONSTANT
c_bsn_w
:
NATURAL
:
=
sel_a_b
(
bsn
'LENGTH
>
31
,
31
,
bsn
'LENGTH
);
-- use maximally c_natural_w = 31 bit of BSN slv to allow calculations with integers
CONSTANT
c_nof_blk_min
:
NATURAL
:
=
c_sync_period
/
c_block_size
;
-- minimum number of blocks in sync period
CONSTANT
c_nof_blk_min
:
NATURAL
:
=
c_sync_period
/
c_block_size
;
-- minimum number of blocks in sync period
CONSTANT
c_extra
:
NATURAL
:
=
c_sync_period
MOD
c_block_size
;
-- number of extra samples in sync period
CONSTANT
c_extra
:
NATURAL
:
=
c_sync_period
MOD
c_block_size
;
-- number of extra samples in sync period
...
@@ -2405,12 +2457,21 @@ PACKAGE BODY tb_dp_pkg IS
...
@@ -2405,12 +2457,21 @@ PACKAGE BODY tb_dp_pkg IS
IF
c_extra
=
0
THEN
IF
c_extra
=
0
THEN
-- The sync period contains an integer number of blocks (c_extra = 0)
-- The sync period contains an integer number of blocks (c_extra = 0)
-- Determine directly whether the input bsn is expected to have a sync
-- Determine directly whether the input bsn is expected to have a sync
v_expected_sync
:
=
((
v_bsn
-
c_start_bsn
)
MOD
c_nof_blk_min
=
0
);
IF
c_bsn_is_rsn
THEN
v_expected_sync
:
=
((
v_bsn
-
c_start_bsn
)
MOD
(
c_nof_blk_min
*
c_block_size
)
=
0
);
ELSE
v_expected_sync
:
=
((
v_bsn
-
c_start_bsn
)
MOD
c_nof_blk_min
=
0
);
END
IF
;
ELSE
ELSE
-- The sync period contains a fractional number of blocks
-- The sync period contains a fractional number of blocks
-- Determine next expected BSN with sync until the input bsn is reached using a loop
-- Determine next expected BSN with sync until the input bsn is reached using a loop
WHILE
v_expected_bsn
<
v_bsn
LOOP
WHILE
v_expected_bsn
<
v_bsn
LOOP
v_expected_bsn
:
=
v_expected_bsn
+
v_nof_blk
;
-- next expected BSN to have a sync
-- next expected BSN to have a sync
IF
c_bsn_is_rsn
THEN
v_expected_bsn
:
=
v_expected_bsn
+
v_nof_blk
*
c_block_size
;
ELSE
v_expected_bsn
:
=
v_expected_bsn
+
v_nof_blk
;
END
IF
;
v_nof_blk
:
=
c_nof_blk_min
;
v_nof_blk
:
=
c_nof_blk_min
;
v_accumulate
:
=
v_accumulate
-
c_extra
;
v_accumulate
:
=
v_accumulate
-
c_extra
;
...
...
This diff is collapsed.
Click to expand it.
libraries/base/dp/tb/vhdl/tb_tb_dp_rsn_source.vhd
0 → 100644
+
97
−
0
View file @
3d1528cc
-------------------------------------------------------------------------------
--
-- Copyright 2023
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Author: E. Kooistra
-- Purpose: Multi dp for tb_dp_rsn_source
-- Remark:
-- . Derived from tb_tb_dp_bsn_source_v2
-- Usage:
-- > as 4
-- > run -all --> OK
LIBRARY
IEEE
;
USE
IEEE
.
std_logic_1164
.
ALL
;
USE
work
.
tb_dp_pkg
.
ALL
;
ENTITY
tb_tb_dp_rsn_source
IS
END
tb_tb_dp_rsn_source
;
ARCHITECTURE
tb
OF
tb_tb_dp_rsn_source
IS
SIGNAL
tb_end
:
STD_LOGIC
:
=
'0'
;
-- declare tb_end to avoid 'No objects found' error on 'when -label tb_end'
BEGIN
-- from tb_dp_rsn_source.vhd
--
-- g_pps_interval : NATURAL := 240
-- g_bs_block_size : NATURAL := 32
-- g_rs_block_size : NATURAL := 5 --23
-----------------------------------------------------------------------------
-- Tests with g_rs_block_size /= g_bs_block_size
-----------------------------------------------------------------------------
u_12_3_3
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
12
,
3
,
3
);
-- smallest block size
u_16_8_4
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
16
,
8
,
4
);
-- integer number of blocks per g_pps_interval
u_29_17_23
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
29
,
17
,
23
);
-- fractional number of blocks per g_pps_interval
u_9_4_5
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
9
,
4
,
5
);
-- 2 g_bs_block_size < g_pps_interval < 2 g_rs_block_size
u_9_5_4
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
9
,
5
,
4
);
-- 2 g_bs_block_size > g_pps_interval > 2 g_rs_block_size
u_9_5_9
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
9
,
5
,
9
);
-- 1 g_rs_block_size/g_pps_interval
u_9_9_5
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
9
,
9
,
5
);
-- 1 g_bs_block_size/g_pps_interval
-----------------------------------------------------------------------------
-- Same tests as with tb_dp_bsn_source_v2
-- . g_rs_block_size /= g_bs_block_size
-----------------------------------------------------------------------------
-- test integer case
u_20_10
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
20
,
10
,
10
);
-- 20 // 10 = 2, 20 MOD 10 = 0, 20/10 = 2 block/sync
u_22_11
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
22
,
11
,
11
);
-- 22 // 11 = 2, 22 MOD 11 = 0, 22/11 = 2 block/sync
u_39_13
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
39
,
13
,
13
);
-- 39 // 13 = 3, 39 MOD 13 = 0, 39/13 = 3 block/sync
-- test smallest nof block per sync
u_10_10
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
10
,
10
,
10
);
-- 1 block/sync
u_5_5
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
5
,
5
,
5
);
-- 1 block/sync
-- test smallest g_block_size case
u_3_3
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
3
,
3
,
3
);
-- 3 // 3 = 1, 3 MOD 3 = 0, 3/3 = 1 block/sync
u_6_3
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
6
,
3
,
3
);
-- 6 // 3 = 2, 6 MOD 3 = 0, 6/3 = 2 block/sync
u_7_3
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
7
,
3
,
3
);
-- 7 // 3 = 2, 7 MOD 3 = 1, 7/3 = 2.33 block/sync
-- test lofar case with 0.5 fraction in average nof block/sync
u_20_8
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
20
,
8
,
8
);
-- 20 // 8 = 2, 20 MOD 8 = 4, 20/8 = 2.5 block/sync
-- test fractional (corner) cases
u_18_9
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
18
,
9
,
9
);
-- 18 MOD 9 = 0
u_17_9
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
17
,
9
,
9
);
-- 17 MOD 9 = 8 = g_block_size - 1
u_19_9
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
19
,
9
,
9
);
-- 19 MOD 9 = 1
u_20_9
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
20
,
9
,
9
);
-- 20 MOD 9 = 2
u_25_9
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
25
,
9
,
9
);
-- 25 MOD 9 = 7
u_26_9
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
26
,
9
,
9
);
-- 26 MOD 9 = 8 = g_block_size - 1
u_27_9
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
27
,
9
,
9
);
-- 27 MOD 9 = 0
-- test some prime values
u_17_3
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
17
,
3
,
3
);
-- 17 // 3 = 5, 17 MOD 3 = 2, 17/3 = 5.66 block/sync
u_101_17
:
ENTITY
work
.
tb_dp_rsn_source
GENERIC
MAP
(
101
,
17
,
17
);
-- 101 // 17 = 5, 101 MOD 17 = 16, 101/17 = 5.9411 block/sync
END
tb
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment