Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Platform-independent core collection
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
18
Issues
18
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
Platform-independent core collection
Commits
57ce05b4
Commit
57ce05b4
authored
Aug 03, 2022
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsp/gc_cordic: move testbench to use Logger/UnitTest code
parent
08b8f29f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1162 additions
and
22 deletions
+1162
-22
Manifest.py
testbench/dsp/gc_cordic/Manifest.py
+1
-1
main.sv
testbench/dsp/gc_cordic/main.sv
+35
-10
wave.do
testbench/dsp/gc_cordic/wave.do
+1126
-11
No files found.
testbench/dsp/gc_cordic/Manifest.py
View file @
57ce05b4
...
...
@@ -15,7 +15,7 @@ include_dirs = [
modules
=
{
"local"
:
[
"../../../"
,
"../../../"
,
"../../../sim/"
],
}
...
...
testbench/dsp/gc_cordic/main.sv
View file @
57ce05b4
`timescale
1
ns
/
1
ps
import
gencores_sim_pkg
::*;
import
gc_cordic_pkg
::*;
const
bit
[
0
:
0
]
MODE_VECTOR
=
1'b0
;
...
...
@@ -51,7 +51,7 @@ module main;
gc_cordic
#(
.
g_N
(
16
)
,
.
g_M
(
16
)
,
.
g_ANGLE_FORMAT
(
1
)
//c_ANGLE_FORMAT_FULL_SCALE_180)
.
g_ANGLE_FORMAT
(
1
)
)
DUT
(
...
...
@@ -117,6 +117,7 @@ module main;
task
automatic
run_cordic_testcase
(
cordic_data_t
in
[$]
,
cordic_data_t
exp_out
[$]
,
int
latency
,
int
max_error
,
bit
check_x
,
bit
check_y
,
bit
check_z
,
output
int
err_count
)
;
automatic
Logger
l
=
Logger
::
get
()
;
automatic
int
j
;
cordic_data_t
out
[$]
;
...
...
@@ -150,19 +151,19 @@ module main;
err
.
z
=
abs
(
e
.
z
-
o
.
z
)
;
if
(
check_x
&&
err
.
x
>
max_error
)
begin
$
error
(
"Sample %d: X expected = %d, actual = %d"
,
j
,
e
.
x
,
o
.
x
)
;
l
.
msg
(
1
,
$
sformatf
(
"Sample %d: X expected = %d, actual = %d"
,
j
,
e
.
x
,
o
.
x
)
)
;
err_count
++;
end
if
(
check_y
&&
err
.
y
>
max_error
)
begin
$
error
(
"Sample %f: Y expected = %d, actual = %d"
,
j
,
e
.
y
,
o
.
y
)
;
l
.
msg
(
1
,
$
sformatf
(
"Sample %f: Y expected = %d, actual = %d"
,
j
,
e
.
y
,
o
.
y
)
)
;
err_count
++;
end
if
(
check_z
&&
err
.
z
>
max_error
)
begin
$
error
(
"Sample %d: Z expected = %d, actual = %d"
,
j
,
e
.
z
,
o
.
z
)
;
l
.
msg
(
1
,
$
sformatf
(
"Sample %d: Z expected = %d, actual = %d"
,
j
,
e
.
z
,
o
.
z
)
)
;
err_count
++;
end
...
...
@@ -198,9 +199,12 @@ module main;
task
automatic
run_testcase_sincos
(
int
nsamples
)
;
automatic
Logger
l
=
Logger
::
get
()
;
cordic_data_t
in
[$]
,
expected
[$]
,
tmp
,
result
;
int
i
,
err_cnt
=
0
;
l
.
startTest
(
"Cordic Angle/Mag -> Sin/Cos"
)
;
cor_mode
=
MODE_ROTATE
;
cor_submode
=
SUBMODE_CIRCULAR
;
...
...
@@ -229,14 +233,23 @@ module main;
end
run_cordic_testcase
(
in
,
expected
,
c_PIPELINE_DELAY
,
20
,
1
,
1
,
0
,
err_cnt
)
;
$
display
(
"Mag/Phase->Sin/Cos: %d errors"
,
err_cnt
)
;
l
.
msg
(
0
,
$
sformatf
(
"Mag/Phase->Sin/Cos: %d errors"
,
err_cnt
)
)
;
if
(
err_cnt
)
l
.
fail
(
"Cordic/s sin/cos value mismatch with model values"
)
;
else
l
.
pass
()
;
endtask
// run_testcase_sincos
task
automatic
run_testcase_angle_mag
(
int
nsamples
)
;
automatic
Logger
l
=
Logger
::
get
()
;
cordic_data_t
in
[$]
,
expected
[$]
,
tmp
,
result
;
int
i
,
err_cnt
=
0
;
l
.
startTest
(
"Cordic Sin/Cos -> Angle/Mag"
)
;
cor_mode
=
MODE_VECTOR
;
cor_submode
=
SUBMODE_CIRCULAR
;
...
...
@@ -259,21 +272,33 @@ module main;
end
run_cordic_testcase
(
in
,
expected
,
c_PIPELINE_DELAY
,
20
,
1
,
0
,
1
,
err_cnt
)
;
$
display
(
"Sin/Cos->Mag/Phase: %d errors"
,
err_cnt
)
;
l
.
msg
(
0
,
$
sformatf
(
"Sin/Cos->Mag/Phase: %d errors"
,
err_cnt
)
)
;
if
(
err_cnt
)
l
.
fail
(
"Cordic/s mag/phase value mismatch with model values"
)
;
else
l
.
pass
()
;
endtask
initial
begin
task
setup
()
;
while
(
!
rst_n
)
@
(
posedge
clk
)
;
@
(
posedge
clk
)
;
endtask
initial
begin
automatic
Logger
l
=
Logger
::
get
()
;
setup
()
;
run_testcase_sincos
(
10000
)
;
run_testcase_angle_mag
(
10000
)
;
l
.
writeTestReport
(
1
)
;
$
stop
;
end
...
...
testbench/dsp/gc_cordic/wave.do
View file @
57ce05b4
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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