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
705153cc
Commit
705153cc
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Add some argument checking
parent
29ba010e
No related branches found
No related tags found
1 merge request
!227
Add some argument checking
Pipeline
#90274
passed
2 years ago
Stage: test
Stage: deploy
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
b_asic/save_load_structure.py
+6
-1
6 additions, 1 deletion
b_asic/save_load_structure.py
b_asic/schedule.py
+3
-0
3 additions, 0 deletions
b_asic/schedule.py
b_asic/simulation.py
+3
-0
3 additions, 0 deletions
b_asic/simulation.py
with
12 additions
and
1 deletion
b_asic/save_load_structure.py
+
6
−
1
View file @
705153cc
...
...
@@ -33,6 +33,9 @@ def sfg_to_python(
True if printing a schedule.
"""
if
not
isinstance
(
sfg
,
SFG
):
raise
TypeError
(
"
An SFG must be provided
"
)
_type
=
"
Schedule
"
if
schedule
else
"
SFG
"
result
=
(
...
...
@@ -139,7 +142,7 @@ def sfg_to_python(
def
python_to_sfg
(
path
:
str
)
->
Tuple
[
SFG
,
Dict
[
str
,
Tuple
[
int
,
int
]]]:
"""
Given a serialized file try to deserialize it and load it to the library.
Given a serialized file
,
try to deserialize it and load it to the library.
Parameters
==========
...
...
@@ -167,6 +170,8 @@ def schedule_to_python(schedule: Schedule) -> str:
schedule : Schedule
The schedule to serialize.
"""
if
not
isinstance
(
schedule
,
Schedule
):
raise
TypeError
(
"
A Schedule must be provided
"
)
sfg_name
=
(
schedule
.
sfg
.
name
.
replace
(
"
"
,
"
_
"
).
replace
(
"
-
"
,
"
_
"
)
if
schedule
.
sfg
.
name
...
...
This diff is collapsed.
Click to expand it.
b_asic/schedule.py
+
3
−
0
View file @
705153cc
...
...
@@ -83,6 +83,9 @@ class Schedule:
laps
:
Optional
[
Dict
[
GraphID
,
int
]]
=
None
,
):
"""
Construct a Schedule from an SFG.
"""
if
not
isinstance
(
sfg
,
SFG
):
raise
TypeError
(
"
An SFG must be provided
"
)
self
.
_original_sfg
=
sfg
()
# Make a copy
self
.
_sfg
=
sfg
self
.
_start_times
=
{}
...
...
This diff is collapsed.
Click to expand it.
b_asic/simulation.py
+
3
−
0
View file @
705153cc
...
...
@@ -59,6 +59,9 @@ class Simulation:
input_providers
:
Optional
[
Sequence
[
Optional
[
InputProvider
]]]
=
None
,
):
"""
Construct a Simulation of an SFG.
"""
if
not
isinstance
(
sfg
,
SFG
):
raise
TypeError
(
"
An SFG must be provided
"
)
# Copy the SFG to make sure it's not modified from the outside.
self
.
_sfg
=
sfg
()
self
.
_results
=
defaultdict
(
list
)
...
...
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