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
1489c7f2
Commit
1489c7f2
authored
1 year ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Remove Input and Output argument to SFG generators
parent
e6152173
No related branches found
Branches containing commit
No related tags found
1 merge request
!271
Remove Input and Output argument to SFG generators
Pipeline
#93693
passed
1 year ago
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/sfg_generators.py
+6
-32
6 additions, 32 deletions
b_asic/sfg_generators.py
with
6 additions
and
32 deletions
b_asic/sfg_generators.py
+
6
−
32
View file @
1489c7f2
...
@@ -21,8 +21,6 @@ from b_asic.special_operations import Delay, Input, Output
...
@@ -21,8 +21,6 @@ from b_asic.special_operations import Delay, Input, Output
def
wdf_allpass
(
def
wdf_allpass
(
coefficients
:
Sequence
[
float
],
coefficients
:
Sequence
[
float
],
input_op
:
Optional
[
Union
[
Input
,
Signal
,
InputPort
]]
=
None
,
output
:
Optional
[
Union
[
Output
,
Signal
,
OutputPort
]]
=
None
,
name
:
Optional
[
str
]
=
None
,
name
:
Optional
[
str
]
=
None
,
latency
:
Optional
[
int
]
=
None
,
latency
:
Optional
[
int
]
=
None
,
latency_offsets
:
Optional
[
Dict
[
str
,
int
]]
=
None
,
latency_offsets
:
Optional
[
Dict
[
str
,
int
]]
=
None
,
...
@@ -37,12 +35,6 @@ def wdf_allpass(
...
@@ -37,12 +35,6 @@ def wdf_allpass(
coefficients : 1D-array
coefficients : 1D-array
Coefficients to use for the allpass section
Coefficients to use for the allpass section
input_op : Input, optional
The Input to connect the SFG to. If not provided, one will be generated.
output : Output, optional
The Output to connect the SFG to. If not provided, one will be generated.
name : Name, optional
name : Name, optional
The name of the SFG. If None,
"
WDF allpass section
"
.
The name of the SFG. If None,
"
WDF allpass section
"
.
...
@@ -65,12 +57,10 @@ def wdf_allpass(
...
@@ -65,12 +57,10 @@ def wdf_allpass(
raise
ValueError
(
"
Coefficients cannot be empty
"
)
raise
ValueError
(
"
Coefficients cannot be empty
"
)
if
np_coefficients
.
ndim
!=
1
:
if
np_coefficients
.
ndim
!=
1
:
raise
TypeError
(
"
coefficients must be a 1D-array
"
)
raise
TypeError
(
"
coefficients must be a 1D-array
"
)
if
input_op
is
None
:
input_op
=
Input
()
if
output
is
None
:
output
=
Output
()
if
name
is
None
:
if
name
is
None
:
name
=
"
WDF allpass section
"
name
=
"
WDF allpass section
"
input_op
=
Input
()
output
=
Output
()
odd_order
=
order
%
2
odd_order
=
order
%
2
if
odd_order
:
if
odd_order
:
# First-order section
# First-order section
...
@@ -119,8 +109,6 @@ def wdf_allpass(
...
@@ -119,8 +109,6 @@ def wdf_allpass(
def
direct_form_fir
(
def
direct_form_fir
(
coefficients
:
Sequence
[
complex
],
coefficients
:
Sequence
[
complex
],
input_op
:
Optional
[
Union
[
Input
,
Signal
,
InputPort
]]
=
None
,
output
:
Optional
[
Union
[
Output
,
Signal
,
OutputPort
]]
=
None
,
name
:
Optional
[
str
]
=
None
,
name
:
Optional
[
str
]
=
None
,
mult_properties
:
Optional
[
Union
[
Dict
[
str
,
int
],
Dict
[
str
,
Dict
[
str
,
int
]]]]
=
None
,
mult_properties
:
Optional
[
Union
[
Dict
[
str
,
int
],
Dict
[
str
,
Dict
[
str
,
int
]]]]
=
None
,
add_properties
:
Optional
[
Union
[
Dict
[
str
,
int
],
Dict
[
str
,
Dict
[
str
,
int
]]]]
=
None
,
add_properties
:
Optional
[
Union
[
Dict
[
str
,
int
],
Dict
[
str
,
Dict
[
str
,
int
]]]]
=
None
,
...
@@ -140,10 +128,6 @@ def direct_form_fir(
...
@@ -140,10 +128,6 @@ def direct_form_fir(
----------
----------
coefficients : 1D-array
coefficients : 1D-array
Coefficients to use for the FIR filter section
Coefficients to use for the FIR filter section
input_op : Input, optional
The Input to connect the SFG to. If not provided, one will be generated.
output : Output, optional
The Output to connect the SFG to. If not provided, one will be generated.
name : Name, optional
name : Name, optional
The name of the SFG. If None,
"
Direct-form FIR filter
"
.
The name of the SFG. If None,
"
Direct-form FIR filter
"
.
mult_properties : dictionary, optional
mult_properties : dictionary, optional
...
@@ -165,16 +149,14 @@ def direct_form_fir(
...
@@ -165,16 +149,14 @@ def direct_form_fir(
raise
ValueError
(
"
Coefficients cannot be empty
"
)
raise
ValueError
(
"
Coefficients cannot be empty
"
)
if
np_coefficients
.
ndim
!=
1
:
if
np_coefficients
.
ndim
!=
1
:
raise
TypeError
(
"
coefficients must be a 1D-array
"
)
raise
TypeError
(
"
coefficients must be a 1D-array
"
)
if
input_op
is
None
:
input_op
=
Input
()
if
output
is
None
:
output
=
Output
()
if
name
is
None
:
if
name
is
None
:
name
=
"
Direct-form FIR filter
"
name
=
"
Direct-form FIR filter
"
if
mult_properties
is
None
:
if
mult_properties
is
None
:
mult_properties
=
{}
mult_properties
=
{}
if
add_properties
is
None
:
if
add_properties
is
None
:
add_properties
=
{}
add_properties
=
{}
input_op
=
Input
()
output
=
Output
()
prev_delay
=
input_op
prev_delay
=
input_op
prev_add
=
None
prev_add
=
None
...
@@ -195,8 +177,6 @@ def direct_form_fir(
...
@@ -195,8 +177,6 @@ def direct_form_fir(
def
transposed_direct_form_fir
(
def
transposed_direct_form_fir
(
coefficients
:
Sequence
[
complex
],
coefficients
:
Sequence
[
complex
],
input_op
:
Optional
[
Union
[
Input
,
Signal
,
InputPort
]]
=
None
,
output
:
Optional
[
Union
[
Output
,
Signal
,
OutputPort
]]
=
None
,
name
:
Optional
[
str
]
=
None
,
name
:
Optional
[
str
]
=
None
,
mult_properties
:
Optional
[
Union
[
Dict
[
str
,
int
],
Dict
[
str
,
Dict
[
str
,
int
]]]]
=
None
,
mult_properties
:
Optional
[
Union
[
Dict
[
str
,
int
],
Dict
[
str
,
Dict
[
str
,
int
]]]]
=
None
,
add_properties
:
Optional
[
Union
[
Dict
[
str
,
int
],
Dict
[
str
,
Dict
[
str
,
int
]]]]
=
None
,
add_properties
:
Optional
[
Union
[
Dict
[
str
,
int
],
Dict
[
str
,
Dict
[
str
,
int
]]]]
=
None
,
...
@@ -216,10 +196,6 @@ def transposed_direct_form_fir(
...
@@ -216,10 +196,6 @@ def transposed_direct_form_fir(
----------
----------
coefficients : 1D-array
coefficients : 1D-array
Coefficients to use for the FIR filter section
Coefficients to use for the FIR filter section
input_op : Input, optional
The Input to connect the SFG to. If not provided, one will be generated.
output : Output, optional
The Output to connect the SFG to. If not provided, one will be generated.
name : Name, optional
name : Name, optional
The name of the SFG. If None,
"
Transposed direct-form FIR filter
"
.
The name of the SFG. If None,
"
Transposed direct-form FIR filter
"
.
mult_properties : dictionary, optional
mult_properties : dictionary, optional
...
@@ -241,16 +217,14 @@ def transposed_direct_form_fir(
...
@@ -241,16 +217,14 @@ def transposed_direct_form_fir(
raise
ValueError
(
"
Coefficients cannot be empty
"
)
raise
ValueError
(
"
Coefficients cannot be empty
"
)
if
np_coefficients
.
ndim
!=
1
:
if
np_coefficients
.
ndim
!=
1
:
raise
TypeError
(
"
coefficients must be a 1D-array
"
)
raise
TypeError
(
"
coefficients must be a 1D-array
"
)
if
input_op
is
None
:
input_op
=
Input
()
if
output
is
None
:
output
=
Output
()
if
name
is
None
:
if
name
is
None
:
name
=
"
Transposed direct-form FIR filter
"
name
=
"
Transposed direct-form FIR filter
"
if
mult_properties
is
None
:
if
mult_properties
is
None
:
mult_properties
=
{}
mult_properties
=
{}
if
add_properties
is
None
:
if
add_properties
is
None
:
add_properties
=
{}
add_properties
=
{}
input_op
=
Input
()
output
=
Output
()
prev_delay
=
None
prev_delay
=
None
for
i
,
coeff
in
enumerate
(
reversed
(
np_coefficients
)):
for
i
,
coeff
in
enumerate
(
reversed
(
np_coefficients
)):
...
...
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