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
b06f21cd
Commit
b06f21cd
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Import from correct location
parent
8d22803d
No related branches found
Branches containing commit
No related tags found
1 merge request
!208
Minor fixes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/signal.py
+6
-20
6 additions, 20 deletions
b_asic/signal.py
with
6 additions
and
20 deletions
b_asic/signal.py
+
6
−
20
View file @
b06f21cd
...
@@ -5,12 +5,8 @@ Contains the class for representing the connections between operations.
...
@@ -5,12 +5,8 @@ Contains the class for representing the connections between operations.
"""
"""
from
typing
import
TYPE_CHECKING
,
Iterable
,
Optional
,
Union
from
typing
import
TYPE_CHECKING
,
Iterable
,
Optional
,
Union
from
b_asic.graph_component
import
(
from
b_asic.graph_component
import
AbstractGraphComponent
,
GraphComponent
AbstractGraphComponent
,
from
b_asic.types
import
Name
,
TypeName
GraphComponent
,
Name
,
TypeName
,
)
if
TYPE_CHECKING
:
if
TYPE_CHECKING
:
from
b_asic.operation
import
Operation
from
b_asic.operation
import
Operation
...
@@ -48,9 +44,7 @@ class Signal(AbstractGraphComponent):
...
@@ -48,9 +44,7 @@ class Signal(AbstractGraphComponent):
def
__init__
(
def
__init__
(
self
,
self
,
source
:
Optional
[
Union
[
"
OutputPort
"
,
"
Signal
"
,
"
Operation
"
]]
=
None
,
source
:
Optional
[
Union
[
"
OutputPort
"
,
"
Signal
"
,
"
Operation
"
]]
=
None
,
destination
:
Optional
[
destination
:
Optional
[
Union
[
"
InputPort
"
,
"
Signal
"
,
"
Operation
"
]]
=
None
,
Union
[
"
InputPort
"
,
"
Signal
"
,
"
Operation
"
]
]
=
None
,
bits
:
Optional
[
int
]
=
None
,
bits
:
Optional
[
int
]
=
None
,
name
:
Name
=
Name
(
""
),
name
:
Name
=
Name
(
""
),
):
):
...
@@ -70,11 +64,7 @@ class Signal(AbstractGraphComponent):
...
@@ -70,11 +64,7 @@ class Signal(AbstractGraphComponent):
@property
@property
def
neighbors
(
self
)
->
Iterable
[
GraphComponent
]:
def
neighbors
(
self
)
->
Iterable
[
GraphComponent
]:
return
[
return
[
p
.
operation
for
p
in
[
self
.
source
,
self
.
destination
]
if
p
is
not
None
]
p
.
operation
for
p
in
[
self
.
source
,
self
.
destination
]
if
p
is
not
None
]
@property
@property
def
source
(
self
)
->
Optional
[
"
OutputPort
"
]:
def
source
(
self
)
->
Optional
[
"
OutputPort
"
]:
...
@@ -86,9 +76,7 @@ class Signal(AbstractGraphComponent):
...
@@ -86,9 +76,7 @@ class Signal(AbstractGraphComponent):
"""
The destination InputPort of the signal.
"""
"""
The destination InputPort of the signal.
"""
return
self
.
_destination
return
self
.
_destination
def
set_source
(
def
set_source
(
self
,
source
:
Union
[
"
OutputPort
"
,
"
Signal
"
,
"
Operation
"
])
->
None
:
self
,
source
:
Union
[
"
OutputPort
"
,
"
Signal
"
,
"
Operation
"
]
)
->
None
:
"""
"""
Disconnect the previous source OutputPort of the signal and
Disconnect the previous source OutputPort of the signal and
connect to the entered source OutputPort. Also connect the entered
connect to the entered source OutputPort. Also connect the entered
...
@@ -197,9 +185,7 @@ class Signal(AbstractGraphComponent):
...
@@ -197,9 +185,7 @@ class Signal(AbstractGraphComponent):
"""
"""
if
bits
is
not
None
:
if
bits
is
not
None
:
if
not
isinstance
(
bits
,
int
):
if
not
isinstance
(
bits
,
int
):
raise
TypeError
(
raise
TypeError
(
f
"
Bits must be an int, not
{
type
(
bits
)
}
:
{
bits
!r}
"
)
f
"
Bits must be an int, not
{
type
(
bits
)
}
:
{
bits
!r}
"
)
if
bits
<
0
:
if
bits
<
0
:
raise
ValueError
(
"
Bits cannot be negative
"
)
raise
ValueError
(
"
Bits cannot be negative
"
)
self
.
set_param
(
"
bits
"
,
bits
)
self
.
set_param
(
"
bits
"
,
bits
)
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