Skip to content
GitLab
Explore
Sign in
Register
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
73974f32
Commit
73974f32
authored
3 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Added proc_dp_verify_sync() that can print bsn and expected bsn in case of error.
parent
1f317baf
No related branches found
No related tags found
1 merge request
!132
Renamed proc_dp_verify_sync_v2() into overloaded proc_dp_verify_sync() and...
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd
+65
-31
65 additions, 31 deletions
libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd
with
65 additions
and
31 deletions
libraries/base/dp/tb/vhdl/tb_dp_pkg.vhd
+
65
−
31
View file @
73974f32
...
...
@@ -464,20 +464,28 @@ PACKAGE tb_dp_pkg IS
SIGNAL
out_val
:
IN
STD_LOGIC
);
-- Verify the DUT output sync
PROCEDURE
proc_dp_verify_sync
(
CONSTANT
c_sync_period
:
IN
NATURAL
;
CONSTANT
c_sync_offset
:
IN
NATURAL
;
SIGNAL
clk
:
IN
STD_LOGIC
;
PROCEDURE
proc_dp_verify_sync
(
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
);
expected_sync
:
IN
STD_LOGIC
);
PROCEDURE
proc_dp_verify_sync
(
SIGNAL
clk
:
IN
STD_LOGIC
;
SIGNAL
verify_en
:
IN
STD_LOGIC
;
SIGNAL
sync
:
IN
STD_LOGIC
;
SIGNAL
sop
:
IN
STD_LOGIC
;
bsn
:
IN
NATURAL
;
-- for reporting
expected_bsn
:
IN
NATURAL
;
-- for reporting
expected_sync
:
IN
STD_LOGIC
);
PROCEDURE
proc_dp_verify_sync
(
CONSTANT
c_sync_period
:
IN
NATURAL
;
CONSTANT
c_sync_offset
:
IN
NATURAL
;
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
);
PROCEDURE
proc_dp_verify_sync
(
CONSTANT
c_start_bsn
:
IN
NATURAL
;
CONSTANT
c_sync_period
:
IN
NATURAL
;
CONSTANT
c_block_size
:
IN
NATURAL
;
...
...
@@ -2288,34 +2296,38 @@ PACKAGE BODY tb_dp_pkg IS
------------------------------------------------------------------------------
-- PROCEDURE: Verify the DUT output sync
-- . sync is defined such that it can only be active at sop
-- .
assume that the sync occures priodically at bsn MOD c_sync_period = c_sync_offse
t
-- .
report expected_sync from inpu
t
------------------------------------------------------------------------------
PROCEDURE
proc_dp_verify_sync
(
CONSTANT
c_sync_period
:
IN
NATURAL
;
-- BSN sync period
CONSTANT
c_sync_offset
:
IN
NATURAL
;
-- BSN sync offset
SIGNAL
clk
:
IN
STD_LOGIC
;
PROCEDURE
proc_dp_verify_sync
(
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
)
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
VARIABLE
v_bsn
:
NATURAL
:
=
TO_UINT
(
bsn
(
c_bsn_w
-1
DOWNTO
0
));
VARIABLE
v_expected_sync
:
BOOLEAN
;
expected_sync
:
IN
STD_LOGIC
)
IS
BEGIN
-- Determine v_expected_sync
v_expected_sync
:
=
(
v_bsn
-
c_sync_offset
)
MOD
c_sync_period
=
0
;
-- Report sync and v_expected_sync
proc_dp_verify_sync
(
clk
,
verify_en
,
sync
,
sop
,
to_sl
(
v_expected_sync
));
IF
rising_edge
(
clk
)
THEN
IF
verify_en
=
'1'
THEN
-- Check for unexpected sync
IF
sync
=
'1'
THEN
ASSERT
expected_sync
=
'1'
REPORT
"Error: Unexpected sync at BSN"
SEVERITY
ERROR
;
ASSERT
sop
=
'1'
REPORT
"Error: Unexpected sync at inactive sop"
SEVERITY
ERROR
;
END
IF
;
-- Check for missing sync
IF
sop
=
'1'
AND
expected_sync
=
'1'
THEN
ASSERT
sync
=
'1'
REPORT
"Error: Missing sync"
SEVERITY
ERROR
;
END
IF
;
END
IF
;
END
IF
;
END
proc_dp_verify_sync
;
------------------------------------------------------------------------------
-- PROCEDURE: Verify the DUT output sync
-- . sync is defined such that it can only be active at sop
-- . use expected_sync from input
------------------------------------------------------------------------------
PROCEDURE
proc_dp_verify_sync
(
SIGNAL
clk
:
IN
STD_LOGIC
;
SIGNAL
verify_en
:
IN
STD_LOGIC
;
SIGNAL
sync
:
IN
STD_LOGIC
;
SIGNAL
sop
:
IN
STD_LOGIC
;
bsn
:
IN
NATURAL
;
-- for reporting
expected_bsn
:
IN
NATURAL
;
-- for reporting
expected_sync
:
IN
STD_LOGIC
)
IS
BEGIN
IF
rising_edge
(
clk
)
THEN
...
...
@@ -2323,7 +2335,7 @@ PACKAGE BODY tb_dp_pkg IS
-- Check for unexpected sync
IF
sync
=
'1'
THEN
ASSERT
expected_sync
=
'1'
REPORT
"Error: Unexpected sync at BSN"
SEVERITY
ERROR
;
REPORT
"Error: Unexpected sync at BSN
("
&
int_to_str
(
bsn
)
&
" /= "
&
int_to_str
(
expected_bsn
)
&
")
"
SEVERITY
ERROR
;
ASSERT
sop
=
'1'
REPORT
"Error: Unexpected sync at inactive sop"
SEVERITY
ERROR
;
END
IF
;
...
...
@@ -2336,6 +2348,28 @@ PACKAGE BODY tb_dp_pkg IS
END
IF
;
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 sync occures priodically at bsn MOD c_sync_period = c_sync_offset
------------------------------------------------------------------------------
PROCEDURE
proc_dp_verify_sync
(
CONSTANT
c_sync_period
:
IN
NATURAL
;
-- BSN sync period
CONSTANT
c_sync_offset
:
IN
NATURAL
;
-- BSN sync offset
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
)
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
VARIABLE
v_bsn
:
NATURAL
:
=
TO_UINT
(
bsn
(
c_bsn_w
-1
DOWNTO
0
));
VARIABLE
v_expected_sync
:
BOOLEAN
;
BEGIN
-- Determine v_expected_sync
v_expected_sync
:
=
(
v_bsn
-
c_sync_offset
)
MOD
c_sync_period
=
0
;
-- Report sync and v_expected_sync
proc_dp_verify_sync
(
clk
,
verify_en
,
sync
,
sop
,
to_sl
(
v_expected_sync
));
END
proc_dp_verify_sync
;
------------------------------------------------------------------------------
-- PROCEDURE: Verify the DUT output sync
-- . sync is defined such that it can only be active at sop
...
...
@@ -2393,7 +2427,7 @@ PACKAGE BODY tb_dp_pkg IS
END
IF
;
-- Report sync and v_expected_sync
proc_dp_verify_sync
(
clk
,
verify_en
,
sync
,
sop
,
to_sl
(
v_expected_sync
));
proc_dp_verify_sync
(
clk
,
verify_en
,
sync
,
sop
,
v_bsn
,
v_expected_bsn
,
to_sl
(
v_expected_sync
));
END
proc_dp_verify_sync
;
------------------------------------------------------------------------------
...
...
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