Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
f0a7458a
Commit
f0a7458a
authored
3 months ago
by
Simon Bjurek
Browse files
Options
Downloads
Patches
Plain Diff
Removed test that took too long for pipeline and added docstring for the fft function.
parent
30719d0b
No related branches found
No related tags found
1 merge request
!462
Add SFG generator for DIF FFT
Pipeline
#155547
passed
3 months ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/sfg_generators.py
+12
-0
12 additions, 0 deletions
b_asic/sfg_generators.py
test/test_sfg_generators.py
+0
-22
0 additions, 22 deletions
test/test_sfg_generators.py
with
12 additions
and
22 deletions
b_asic/sfg_generators.py
+
12
−
0
View file @
f0a7458a
...
@@ -378,6 +378,18 @@ def direct_form_2_iir(
...
@@ -378,6 +378,18 @@ def direct_form_2_iir(
def
radix_2_dif_fft
(
points
:
int
)
->
SFG
:
def
radix_2_dif_fft
(
points
:
int
)
->
SFG
:
"""
Generates a radix-2 decimation-in-frequency FFT structure.
Parameters
----------
points : int
Number of points for the FFT, needs to be a positive power of 2.
Returns
-------
SFG
Signal Flow Graph
"""
if
points
<
0
:
if
points
<
0
:
raise
ValueError
(
"
Points must be positive number.
"
)
raise
ValueError
(
"
Points must be positive number.
"
)
if
points
&
(
points
-
1
)
!=
0
:
if
points
&
(
points
-
1
)
!=
0
:
...
...
This diff is collapsed.
Click to expand it.
test/test_sfg_generators.py
+
0
−
22
View file @
f0a7458a
...
@@ -358,28 +358,6 @@ def test_radix_2_dif_fft_256_points_sinus_input():
...
@@ -358,28 +358,6 @@ def test_radix_2_dif_fft_256_points_sinus_input():
assert
np
.
isclose
(
a
,
b
)
assert
np
.
isclose
(
a
,
b
)
def
test_radix_2_dif_fft_512_points_sinus_input_half_frequency
():
POINTS
=
512
sfg
=
radix_2_dif_fft
(
points
=
POINTS
)
assert
len
(
sfg
.
inputs
)
==
POINTS
assert
len
(
sfg
.
outputs
)
==
POINTS
n
=
np
.
linspace
(
0
,
2
*
np
.
pi
,
POINTS
)
waveform
=
np
.
sin
(
0.5
*
n
)
input_samples
=
[
Constant
(
waveform
[
i
])
for
i
in
range
(
POINTS
)]
sim
=
Simulation
(
sfg
,
input_samples
)
sim
.
run_for
(
1
)
exp_res
=
np
.
fft
.
fft
(
waveform
)
res
=
sim
.
results
for
i
in
range
(
POINTS
):
a
=
res
[
str
(
i
)]
b
=
exp_res
[
i
]
assert
np
.
isclose
(
a
,
b
)
def
test_radix_2_dif_fft_negative_number_of_points
():
def
test_radix_2_dif_fft_negative_number_of_points
():
POINTS
=
-
8
POINTS
=
-
8
with
pytest
.
raises
(
ValueError
,
match
=
"
Points must be positive number.
"
):
with
pytest
.
raises
(
ValueError
,
match
=
"
Points must be positive number.
"
):
...
...
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