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
b9c26b2c
Commit
b9c26b2c
authored
9 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Made tb self stopping and self checking by means of golden reference files.
parent
bb467cfc
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/base/common/tb/vhdl/tb_requantize.vhd
+103
-4
103 additions, 4 deletions
libraries/base/common/tb/vhdl/tb_requantize.vhd
with
103 additions
and
4 deletions
libraries/base/common/tb/vhdl/tb_requantize.vhd
+
103
−
4
View file @
b9c26b2c
...
...
@@ -45,7 +45,7 @@ END tb_requantize;
ARCHITECTURE
tb
OF
tb_requantize
IS
CONSTANT
clk_period
:
TIME
:
=
10
ns
;
CONSTANT
c_output_file_dir
:
STRING
:
=
"
../../../
data/"
;
CONSTANT
c_output_file_dir
:
STRING
:
=
"data/"
;
CONSTANT
c_nof_dut
:
NATURAL
:
=
4
;
CONSTANT
g_pipeline_remove_lsb
:
NATURAL
:
=
0
;
...
...
@@ -86,21 +86,41 @@ ARCHITECTURE tb OF tb_requantize IS
-- Verification by means of writing output files that can be compared with stored golden reference files
SIGNAL
out_s_dat_vec
:
STD_LOGIC_VECTOR
(
c_out_dat_w
*
c_nof_dut
-1
DOWNTO
0
);
SIGNAL
ref_s_dat_vec
:
STD_LOGIC_VECTOR
(
c_out_dat_w
*
c_nof_dut
-1
DOWNTO
0
);
SIGNAL
out_s_ovr_vec
:
STD_LOGIC_VECTOR
(
c_nof_dut
-1
DOWNTO
0
);
SIGNAL
ref_s_ovr_vec
:
STD_LOGIC_VECTOR
(
c_nof_dut
-1
DOWNTO
0
);
SIGNAL
out_u_dat_vec
:
STD_LOGIC_VECTOR
(
c_out_dat_w
*
c_nof_dut
-1
DOWNTO
0
);
SIGNAL
ref_u_dat_vec
:
STD_LOGIC_VECTOR
(
c_out_dat_w
*
c_nof_dut
-1
DOWNTO
0
);
SIGNAL
out_u_ovr_vec
:
STD_LOGIC_VECTOR
(
c_nof_dut
-1
DOWNTO
0
);
SIGNAL
ref_u_ovr_vec
:
STD_LOGIC_VECTOR
(
c_nof_dut
-1
DOWNTO
0
);
SIGNAL
ref_val
:
STD_LOGIC
;
SIGNAL
ref_eof
:
STD_LOGIC
;
SIGNAL
rst
:
STD_LOGIC
;
SIGNAL
tb_end
:
STD_LOGIC
:
=
'0'
;
SIGNAL
clk
:
STD_LOGIC
:
=
'1'
;
SIGNAL
rst
:
STD_LOGIC
;
CONSTANT
c_init
:
STD_LOGIC_VECTOR
(
in_dat
'RANGE
)
:
=
(
OTHERS
=>
'0'
);
BEGIN
-- Stimuli
clk
<=
NOT
(
clk
)
AFTER
clk_period
/
2
;
clk
<=
NOT
clk
OR
tb_end
AFTER
clk_period
/
2
;
rst
<=
'1'
,
'0'
AFTER
3
*
clk_period
;
-- Testbench end
p_tb_end
:
PROCESS
BEGIN
tb_end
<=
'0'
;
WAIT
UNTIL
ref_val
=
'1'
;
WAIT
UNTIL
rising_edge
(
clk
);
WAIT
UNTIL
ref_val
=
'0'
;
WAIT
UNTIL
rising_edge
(
clk
);
WAIT
UNTIL
rising_edge
(
clk
);
tb_end
<=
'1'
;
WAIT
;
END
PROCESS
;
p_clk
:
PROCESS
(
rst
,
clk
)
BEGIN
IF
rst
=
'1'
THEN
...
...
@@ -293,7 +313,18 @@ BEGIN
out_ovr
=>
out_u_t_w_ovr
);
-- Verification
-- Verification usign golden results from file
p_verify
:
PROCESS
BEGIN
WAIT
UNTIL
rising_edge
(
clk
);
IF
ref_val
=
'1'
THEN
IF
out_s_dat_vec
/=
ref_s_dat_vec
THEN
REPORT
"Mismatch in signed requantize data"
SEVERITY
ERROR
;
END
IF
;
IF
out_s_ovr_vec
/=
ref_s_ovr_vec
THEN
REPORT
"Mismatch in signed requantize overflow"
SEVERITY
ERROR
;
END
IF
;
IF
out_u_dat_vec
/=
ref_u_dat_vec
THEN
REPORT
"Mismatch in unsigned requantize data"
SEVERITY
ERROR
;
END
IF
;
IF
out_u_ovr_vec
/=
ref_u_ovr_vec
THEN
REPORT
"Mismatch in unsigned requantize overflow"
SEVERITY
ERROR
;
END
IF
;
END
IF
;
END
PROCESS
;
out_s_dat_vec
<=
out_s_r_c_dat
&
out_s_r_w_dat
&
out_s_t_c_dat
&
out_s_t_w_dat
;
out_s_ovr_vec
<=
out_s_r_c_ovr
&
out_s_r_w_ovr
&
out_s_t_c_ovr
&
out_s_t_w_ovr
;
out_u_dat_vec
<=
out_u_r_c_dat
&
out_u_r_w_dat
&
out_u_t_c_dat
&
out_u_t_w_dat
;
...
...
@@ -313,6 +344,23 @@ BEGIN
in_val
=>
reg_val
);
u_ref_file_s_dat
:
ENTITY
tst_lib
.
tst_input
GENERIC
MAP
(
g_file_name
=>
c_output_file_dir
&
"tb_requantize_s_dat.gold"
,
g_file_repeat
=>
1
,
g_nof_data
=>
c_nof_dut
,
g_data_width
=>
c_out_dat_w
,
g_data_type
=>
"SIGNED"
)
PORT
MAP
(
clk
=>
clk
,
rst
=>
rst
,
en
=>
in_val
,
out_dat
=>
ref_s_dat_vec
,
out_val
=>
ref_val
,
out_eof
=>
ref_eof
);
u_output_file_s_ovr
:
ENTITY
tst_lib
.
tst_output
GENERIC
MAP
(
g_file_name
=>
c_output_file_dir
&
"tb_requantize_s_ovr.out"
,
...
...
@@ -327,6 +375,23 @@ BEGIN
in_val
=>
reg_val
);
u_ref_file_s_ovr
:
ENTITY
tst_lib
.
tst_input
GENERIC
MAP
(
g_file_name
=>
c_output_file_dir
&
"tb_requantize_s_ovr.gold"
,
g_file_repeat
=>
1
,
g_nof_data
=>
c_nof_dut
,
g_data_width
=>
1
,
g_data_type
=>
"SIGNED"
)
PORT
MAP
(
clk
=>
clk
,
rst
=>
rst
,
en
=>
in_val
,
out_dat
=>
ref_s_ovr_vec
,
out_val
=>
OPEN
,
out_eof
=>
OPEN
);
u_output_file_u_dat
:
ENTITY
tst_lib
.
tst_output
GENERIC
MAP
(
g_file_name
=>
c_output_file_dir
&
"tb_requantize_u_dat.out"
,
...
...
@@ -341,6 +406,23 @@ BEGIN
in_val
=>
reg_val
);
u_ref_file_u_dat
:
ENTITY
tst_lib
.
tst_input
GENERIC
MAP
(
g_file_name
=>
c_output_file_dir
&
"tb_requantize_u_dat.gold"
,
g_file_repeat
=>
1
,
g_nof_data
=>
c_nof_dut
,
g_data_width
=>
c_out_dat_w
,
g_data_type
=>
"SIGNED"
)
PORT
MAP
(
clk
=>
clk
,
rst
=>
rst
,
en
=>
in_val
,
out_dat
=>
ref_u_dat_vec
,
out_val
=>
OPEN
,
out_eof
=>
OPEN
);
u_output_file_u_ovr
:
ENTITY
tst_lib
.
tst_output
GENERIC
MAP
(
g_file_name
=>
c_output_file_dir
&
"tb_requantize_u_ovr.out"
,
...
...
@@ -355,4 +437,21 @@ BEGIN
in_val
=>
reg_val
);
u_ref_file_u_ovr
:
ENTITY
tst_lib
.
tst_input
GENERIC
MAP
(
g_file_name
=>
c_output_file_dir
&
"tb_requantize_u_ovr.gold"
,
g_file_repeat
=>
1
,
g_nof_data
=>
c_nof_dut
,
g_data_width
=>
1
,
g_data_type
=>
"SIGNED"
)
PORT
MAP
(
clk
=>
clk
,
rst
=>
rst
,
en
=>
in_val
,
out_dat
=>
ref_u_ovr_vec
,
out_val
=>
OPEN
,
out_eof
=>
OPEN
);
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