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
5a905f37
Commit
5a905f37
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Fix some typing
parent
722749dd
No related branches found
No related tags found
1 merge request
!225
Fix some typing
Pipeline
#90267
passed
2 years ago
Stage: test
Stage: deploy
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
b_asic/resources.py
+1
-1
1 addition, 1 deletion
b_asic/resources.py
b_asic/schedule.py
+11
-7
11 additions, 7 deletions
b_asic/schedule.py
test/test_resources.py
+4
-3
4 additions, 3 deletions
test/test_resources.py
test/test_schedule.py
+2
-0
2 additions, 0 deletions
test/test_schedule.py
with
18 additions
and
11 deletions
b_asic/resources.py
+
1
−
1
View file @
5a905f37
...
@@ -120,7 +120,7 @@ class ProcessCollection:
...
@@ -120,7 +120,7 @@ class ProcessCollection:
return
self
.
_collection
return
self
.
_collection
def
__len__
(
self
):
def
__len__
(
self
):
return
len
(
self
.
_
_
collection
__
)
return
len
(
self
.
_collection
)
def
add_process
(
self
,
process
:
Process
):
def
add_process
(
self
,
process
:
Process
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
b_asic/schedule.py
+
11
−
7
View file @
5a905f37
...
@@ -79,8 +79,8 @@ class Schedule:
...
@@ -79,8 +79,8 @@ class Schedule:
schedule_time
:
Optional
[
int
]
=
None
,
schedule_time
:
Optional
[
int
]
=
None
,
cyclic
:
bool
=
False
,
cyclic
:
bool
=
False
,
scheduling_algorithm
:
str
=
"
ASAP
"
,
scheduling_algorithm
:
str
=
"
ASAP
"
,
start_times
:
Dict
[
GraphID
,
int
]
=
None
,
start_times
:
Optional
[
Dict
[
GraphID
,
int
]
]
=
None
,
laps
:
Dict
[
GraphID
,
int
]
=
None
,
laps
:
Optional
[
Dict
[
GraphID
,
int
]
]
=
None
,
):
):
"""
Construct a Schedule from an SFG.
"""
"""
Construct a Schedule from an SFG.
"""
self
.
_original_sfg
=
sfg
()
# Make a copy
self
.
_original_sfg
=
sfg
()
# Make a copy
...
@@ -92,6 +92,10 @@ class Schedule:
...
@@ -92,6 +92,10 @@ class Schedule:
if
scheduling_algorithm
==
"
ASAP
"
:
if
scheduling_algorithm
==
"
ASAP
"
:
self
.
_schedule_asap
()
self
.
_schedule_asap
()
elif
scheduling_algorithm
==
"
provided
"
:
elif
scheduling_algorithm
==
"
provided
"
:
if
start_times
is
None
:
raise
ValueError
(
"
Must provide start_times when using
'
provided
'"
)
if
laps
is
None
:
raise
ValueError
(
"
Must provide laps when using
'
provided
'"
)
self
.
_start_times
=
start_times
self
.
_start_times
=
start_times
self
.
_laps
.
update
(
laps
)
self
.
_laps
.
update
(
laps
)
self
.
_remove_delays_no_laps
()
self
.
_remove_delays_no_laps
()
...
@@ -403,10 +407,10 @@ class Schedule:
...
@@ -403,10 +407,10 @@ class Schedule:
"""
"""
if
insert
:
if
insert
:
for
gid
,
y_location
in
self
.
_y_locations
.
items
()
:
for
gid
in
self
.
_y_locations
:
if
y_location
>=
new_y
:
if
self
.
get_
y_location
(
gid
)
>=
new_y
:
self
.
_y_location
s
[
gid
]
+
=
1
self
.
set
_y_location
(
gid
,
self
.
get_y_location
(
gid
)
+
1
)
self
.
_y_location
s
[
graph_id
]
=
new_y
self
.
set
_y_location
(
graph_id
,
new_y
)
used_locations
=
{
*
self
.
_y_locations
.
values
()}
used_locations
=
{
*
self
.
_y_locations
.
values
()}
possible_locations
=
set
(
range
(
max
(
used_locations
)
+
1
))
possible_locations
=
set
(
range
(
max
(
used_locations
)
+
1
))
if
not
possible_locations
-
used_locations
:
if
not
possible_locations
-
used_locations
:
...
@@ -889,7 +893,7 @@ class Schedule:
...
@@ -889,7 +893,7 @@ class Schedule:
def
_reset_y_locations
(
self
)
->
None
:
def
_reset_y_locations
(
self
)
->
None
:
"""
Reset all the y-locations in the schedule to None
"""
"""
Reset all the y-locations in the schedule to None
"""
self
.
_y_locations
=
self
.
_y_locations
=
defaultdict
(
lambda
:
None
)
self
.
_y_locations
=
defaultdict
(
lambda
:
None
)
def
plot_in_axes
(
self
,
ax
:
Axes
,
operation_gap
:
Optional
[
float
]
=
None
)
->
None
:
def
plot_in_axes
(
self
,
ax
:
Axes
,
operation_gap
:
Optional
[
float
]
=
None
)
->
None
:
"""
"""
...
...
This diff is collapsed.
Click to expand it.
test/test_resources.py
+
4
−
3
View file @
5a905f37
import
pickle
import
pickle
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
import
networkx
as
nx
import
pytest
import
pytest
from
b_asic.process
import
Process
from
b_asic.research.interleaver
import
(
from
b_asic.research.interleaver
import
(
generate_matrix_transposer
,
generate_matrix_transposer
,
generate_random_interleaver
,
generate_random_interleaver
,
)
)
from
b_asic.resources
import
ProcessCollection
,
draw_exclusion_graph_coloring
from
b_asic.resources
import
ProcessCollection
class
TestProcessCollectionPlainMemoryVariable
:
class
TestProcessCollectionPlainMemoryVariable
:
...
@@ -44,3 +42,6 @@ class TestProcessCollectionPlainMemoryVariable:
...
@@ -44,3 +42,6 @@ class TestProcessCollectionPlainMemoryVariable:
assert
len
(
collection
.
split_ports
(
read_ports
=
1
,
write_ports
=
1
))
==
1
assert
len
(
collection
.
split_ports
(
read_ports
=
1
,
write_ports
=
1
))
==
1
if
any
(
var
.
execution_time
for
var
in
collection
.
collection
):
if
any
(
var
.
execution_time
for
var
in
collection
.
collection
):
assert
len
(
collection
.
split_ports
(
total_ports
=
1
))
==
2
assert
len
(
collection
.
split_ports
(
total_ports
=
1
))
==
2
def
test_len_process_collection
(
self
,
simple_collection
:
ProcessCollection
):
assert
len
(
simple_collection
)
==
7
This diff is collapsed.
Click to expand it.
test/test_schedule.py
+
2
−
0
View file @
5a905f37
...
@@ -495,6 +495,8 @@ class TestProcesses:
...
@@ -495,6 +495,8 @@ class TestProcesses:
def
test__get_memory_variables_list
(
self
,
secondorder_iir_schedule
):
def
test__get_memory_variables_list
(
self
,
secondorder_iir_schedule
):
mvl
=
secondorder_iir_schedule
.
_get_memory_variables_list
()
mvl
=
secondorder_iir_schedule
.
_get_memory_variables_list
()
assert
len
(
mvl
)
==
12
assert
len
(
mvl
)
==
12
pc
=
secondorder_iir_schedule
.
get_memory_variables
()
assert
len
(
pc
)
==
12
class
TestFigureGeneration
:
class
TestFigureGeneration
:
...
...
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