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
78cd30f0
Commit
78cd30f0
authored
4 years ago
by
angloth
Browse files
Options
Downloads
Patches
Plain Diff
Add some minor linting changes to port and operation
parent
3bfa5e12
No related branches found
No related tags found
5 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"
,
!21
Resolve "Print SFG"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/operation.py
+1
-0
1 addition, 0 deletions
b_asic/operation.py
b_asic/port.py
+11
-8
11 additions, 8 deletions
b_asic/port.py
with
12 additions
and
8 deletions
b_asic/operation.py
+
1
−
0
View file @
78cd30f0
...
...
@@ -306,5 +306,6 @@ class AbstractOperation(Operation, AbstractGraphComponent):
def
copy_unconnected
(
self
)
->
GraphComponent
:
new_comp
:
AbstractOperation
=
super
().
copy_unconnected
()
for
name
,
value
in
self
.
params
.
items
():
new_comp
.
set_param
(
name
,
deepcopy
(
value
))
# pylint: disable=no-member
return
new_comp
This diff is collapsed.
Click to expand it.
b_asic/port.py
+
11
−
8
View file @
78cd30f0
...
...
@@ -8,6 +8,7 @@ from copy import copy
from
typing
import
NewType
,
Optional
,
List
,
Iterable
,
TYPE_CHECKING
from
b_asic.signal
import
Signal
from
b_asic.graph_component
import
Name
if
TYPE_CHECKING
:
from
b_asic.operation
import
Operation
...
...
@@ -144,22 +145,24 @@ class InputPort(AbstractPort):
"""
return
None
if
self
.
_source_signal
is
None
else
self
.
_source_signal
.
source
def
connect
(
self
,
src
:
SignalSourceProvider
)
->
Signal
:
def
connect
(
self
,
src
:
SignalSourceProvider
,
name
:
Name
=
""
)
->
Signal
:
"""
Connect the provided signal source to this input port by creating a new signal.
Returns the new signal.
"""
assert
self
.
_source_signal
is
None
,
"
Attempted to connect already connected input port.
"
return
Signal
(
src
.
source
,
self
)
# self._source_signal is set by the signal constructor.
# self._source_signal is set by the signal constructor.
return
Signal
(
source
=
src
.
source
,
destination
=
self
,
name
=
name
)
@property
def
value_length
(
self
)
->
Optional
[
int
]:
"""
Get the number of bits that this port should truncate received values to.
"""
return
self
.
_value_length
@value_length.setter
def
value_length
(
self
,
bits
:
Optional
[
int
])
->
None
:
"""
Set the number of bits that this port should truncate received values to.
"""
assert
bits
is
None
or
(
isinstance
(
bits
,
int
)
and
bits
>=
0
),
"
Value length must be non-negative.
"
assert
bits
is
None
or
(
isinstance
(
bits
,
int
)
and
bits
>=
0
),
"
Value length must be non-negative.
"
self
.
_value_length
=
bits
...
...
@@ -185,7 +188,7 @@ class OutputPort(AbstractPort, SignalSourceProvider):
def
add_signal
(
self
,
signal
:
Signal
)
->
None
:
assert
signal
not
in
self
.
_destination_signals
,
"
Attempted to add already connected signal.
"
self
.
_destination_signals
.
append
(
signal
)
signal
.
set_source
(
self
)
signal
.
set_source
(
self
)
def
remove_signal
(
self
,
signal
:
Signal
)
->
None
:
assert
signal
in
self
.
_destination_signals
,
"
Attempted to remove already removed signal.
"
...
...
@@ -195,7 +198,7 @@ class OutputPort(AbstractPort, SignalSourceProvider):
def
clear
(
self
)
->
None
:
for
signal
in
copy
(
self
.
_destination_signals
):
self
.
remove_signal
(
signal
)
@property
def
source
(
self
)
->
"
OutputPort
"
:
return
self
\ No newline at end of file
return
self
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