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
3e0e189b
Commit
3e0e189b
authored
5 years ago
by
Ivar Härnqvist
Browse files
Options
Downloads
Patches
Plain Diff
fix order of core_operations, add missing return type annotations on setters
parent
ddfc0f78
No related branches found
No related tags found
4 merge requests
!31
Resolve "Specify internal input/output dependencies of an Operation"
,
!25
Resolve "System tests iteration 1"
,
!24
Resolve "System tests iteration 1"
,
!23
Resolve "Simulate SFG"
Pipeline
#13101
passed
5 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/core_operations.py
+34
-34
34 additions, 34 deletions
b_asic/core_operations.py
b_asic/special_operations.py
+1
-1
1 addition, 1 deletion
b_asic/special_operations.py
with
35 additions
and
35 deletions
b_asic/core_operations.py
+
34
−
34
View file @
3e0e189b
...
@@ -34,7 +34,7 @@ class Constant(AbstractOperation):
...
@@ -34,7 +34,7 @@ class Constant(AbstractOperation):
return
self
.
param
(
"
value
"
)
return
self
.
param
(
"
value
"
)
@value.setter
@value.setter
def
value
(
self
,
value
:
Number
):
def
value
(
self
,
value
:
Number
)
->
None
:
"""
Set the constant value of this operation.
"""
"""
Set the constant value of this operation.
"""
return
self
.
set_param
(
"
value
"
,
value
)
return
self
.
set_param
(
"
value
"
,
value
)
...
@@ -103,36 +103,22 @@ class Division(AbstractOperation):
...
@@ -103,36 +103,22 @@ class Division(AbstractOperation):
return
a
/
b
return
a
/
b
class
SquareRoot
(
AbstractOperation
):
class
Min
(
AbstractOperation
):
"""
Unary square root operation.
"""
Binary min operation.
TODO: More info.
"""
def
__init__
(
self
,
src0
:
Optional
[
SignalSourceProvider
]
=
None
,
name
:
Name
=
""
):
super
().
__init__
(
input_count
=
1
,
output_count
=
1
,
name
=
name
,
input_sources
=
[
src0
])
@property
def
type_name
(
self
)
->
TypeName
:
return
"
sqrt
"
def
evaluate
(
self
,
a
):
return
sqrt
(
complex
(
a
))
class
ComplexConjugate
(
AbstractOperation
):
"""
Unary complex conjugate operation.
TODO: More info.
TODO: More info.
"""
"""
def
__init__
(
self
,
src0
:
Optional
[
SignalSourceProvider
]
=
None
,
name
:
Name
=
""
):
def
__init__
(
self
,
src0
:
Optional
[
SignalSourceProvider
]
=
None
,
src1
:
Optional
[
SignalSourceProvider
]
=
None
,
name
:
Name
=
""
):
super
().
__init__
(
input_count
=
1
,
output_count
=
1
,
name
=
name
,
input_sources
=
[
src0
])
super
().
__init__
(
input_count
=
2
,
output_count
=
1
,
name
=
name
,
input_sources
=
[
src0
,
src1
])
@property
@property
def
type_name
(
self
)
->
TypeName
:
def
type_name
(
self
)
->
TypeName
:
return
"
conj
"
return
"
min
"
def
evaluate
(
self
,
a
):
def
evaluate
(
self
,
a
,
b
):
return
conjugate
(
a
)
assert
not
isinstance
(
a
,
complex
)
and
not
isinstance
(
b
,
complex
),
\
(
"
core_operations.Min does not support complex numbers.
"
)
return
a
if
a
<
b
else
b
class
Max
(
AbstractOperation
):
class
Max
(
AbstractOperation
):
...
@@ -153,22 +139,36 @@ class Max(AbstractOperation):
...
@@ -153,22 +139,36 @@ class Max(AbstractOperation):
return
a
if
a
>
b
else
b
return
a
if
a
>
b
else
b
class
Min
(
AbstractOperation
):
class
SquareRoot
(
AbstractOperation
):
"""
Bi
nary
min
operation.
"""
U
nary
square root
operation.
TODO: More info.
TODO: More info.
"""
"""
def
__init__
(
self
,
src0
:
Optional
[
SignalSourceProvider
]
=
None
,
src1
:
Optional
[
SignalSourceProvider
]
=
None
,
name
:
Name
=
""
):
def
__init__
(
self
,
src0
:
Optional
[
SignalSourceProvider
]
=
None
,
name
:
Name
=
""
):
super
().
__init__
(
input_count
=
2
,
output_count
=
1
,
name
=
name
,
input_sources
=
[
src0
,
src1
])
super
().
__init__
(
input_count
=
1
,
output_count
=
1
,
name
=
name
,
input_sources
=
[
src0
])
@property
@property
def
type_name
(
self
)
->
TypeName
:
def
type_name
(
self
)
->
TypeName
:
return
"
min
"
return
"
sqrt
"
def
evaluate
(
self
,
a
,
b
):
def
evaluate
(
self
,
a
):
assert
not
isinstance
(
a
,
complex
)
and
not
isinstance
(
b
,
complex
),
\
return
sqrt
(
complex
(
a
))
(
"
core_operations.Min does not support complex numbers.
"
)
return
a
if
a
<
b
else
b
class
ComplexConjugate
(
AbstractOperation
):
"""
Unary complex conjugate operation.
TODO: More info.
"""
def
__init__
(
self
,
src0
:
Optional
[
SignalSourceProvider
]
=
None
,
name
:
Name
=
""
):
super
().
__init__
(
input_count
=
1
,
output_count
=
1
,
name
=
name
,
input_sources
=
[
src0
])
@property
def
type_name
(
self
)
->
TypeName
:
return
"
conj
"
def
evaluate
(
self
,
a
):
return
conjugate
(
a
)
class
Absolute
(
AbstractOperation
):
class
Absolute
(
AbstractOperation
):
...
@@ -209,7 +209,7 @@ class ConstantMultiplication(AbstractOperation):
...
@@ -209,7 +209,7 @@ class ConstantMultiplication(AbstractOperation):
return
self
.
param
(
"
value
"
)
return
self
.
param
(
"
value
"
)
@value.setter
@value.setter
def
value
(
self
,
value
:
Number
):
def
value
(
self
,
value
:
Number
)
->
None
:
"""
Set the constant value of this operation.
"""
"""
Set the constant value of this operation.
"""
return
self
.
set_param
(
"
value
"
,
value
)
return
self
.
set_param
(
"
value
"
,
value
)
...
...
This diff is collapsed.
Click to expand it.
b_asic/special_operations.py
+
1
−
1
View file @
3e0e189b
...
@@ -33,7 +33,7 @@ class Input(AbstractOperation):
...
@@ -33,7 +33,7 @@ class Input(AbstractOperation):
return
self
.
param
(
"
value
"
)
return
self
.
param
(
"
value
"
)
@value.setter
@value.setter
def
value
(
self
,
value
:
Number
):
def
value
(
self
,
value
:
Number
)
->
None
:
"""
Set the current value of this input.
"""
"""
Set the current value of this input.
"""
self
.
set_param
(
"
value
"
,
value
)
self
.
set_param
(
"
value
"
,
value
)
...
...
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