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
4a2cad1f
Commit
4a2cad1f
authored
1 year ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Only use default naming for PlainMemoryVariable
parent
b9b15648
No related branches found
No related tags found
1 merge request
!296
Support for Bireciprocal LWDF
Pipeline
#94688
passed
1 year ago
Stage: test
Stage: deploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/process.py
+13
-15
13 additions, 15 deletions
b_asic/process.py
test/test_process.py
+1
-1
1 addition, 1 deletion
test/test_process.py
with
14 additions
and
16 deletions
b_asic/process.py
+
13
−
15
View file @
4a2cad1f
...
...
@@ -19,20 +19,14 @@ class Process:
Start time of process.
execution_time : int
Execution time (lifetime) of process.
name : str,
optional
The name of the process.
If not provided, generate a name.
name : str,
default:
""
The name of the process.
"""
def
__init__
(
self
,
start_time
:
int
,
execution_time
:
int
,
name
:
Optional
[
str
]
=
None
):
def
__init__
(
self
,
start_time
:
int
,
execution_time
:
int
,
name
:
str
=
""
):
self
.
_start_time
=
start_time
self
.
_execution_time
=
execution_time
if
name
is
None
:
self
.
_name
=
f
"
Proc.
{
Process
.
_name_cnt
}
"
Process
.
_name_cnt
+=
1
else
:
self
.
_name
=
name
self
.
_name
=
name
def
__lt__
(
self
,
other
):
return
self
.
_start_time
<
other
.
start_time
or
(
...
...
@@ -60,9 +54,6 @@ class Process:
def
__repr__
(
self
)
->
str
:
return
f
"
Process(
{
self
.
start_time
}
,
{
self
.
execution_time
}
,
{
self
.
name
!r}
)
"
# Static counter for default names
_name_cnt
=
0
class
OperatorProcess
(
Process
):
"""
...
...
@@ -117,8 +108,8 @@ class MemoryVariable(Process):
write_port : :class:`~b_asic.port.OutputPort`
The OutputPort that the memory variable originates from.
reads : dict
Dictionary with :class:`~b_asic.port.InputPort` that reads the memory variable
as key and
for how long after the *write_time* it will read.
Dictionary with :class:`~b_asic.port.InputPort` that reads the memory variable
as key and
for how long after the *write_time* it will read.
name : str, optional
The name of the process.
"""
...
...
@@ -196,6 +187,10 @@ class PlainMemoryVariable(Process):
self
.
_life_times
=
tuple
(
reads
.
values
())
self
.
_write_port
=
write_port
self
.
_reads
=
reads
if
name
is
None
:
name
=
f
"
Var.
{
PlainMemoryVariable
.
_name_cnt
}
"
PlainMemoryVariable
.
_name_cnt
+=
1
super
().
__init__
(
start_time
=
write_time
,
execution_time
=
max
(
self
.
_life_times
),
...
...
@@ -224,3 +219,6 @@ class PlainMemoryVariable(Process):
f
"
PlainMemoryVariable(
{
self
.
start_time
}
,
{
self
.
write_port
}
,
"
f
"
{
reads
!r}
,
{
self
.
name
!r}
)
"
)
# Static counter for default names
_name_cnt
=
0
This diff is collapsed.
Click to expand it.
test/test_process.py
+
1
−
1
View file @
4a2cad1f
...
...
@@ -12,7 +12,7 @@ def test_PlainMemoryVariable():
assert
mem
.
execution_time
==
2
assert
mem
.
life_times
==
(
1
,
2
)
assert
mem
.
read_ports
==
(
4
,
5
)
assert
repr
(
mem
)
==
"
PlainMemoryVariable(3, 0, {4: 1, 5: 2},
'
Proc
. 0
'
)
"
assert
repr
(
mem
)
==
"
PlainMemoryVariable(3, 0, {4: 1, 5: 2},
'
Var
. 0
'
)
"
mem2
=
PlainMemoryVariable
(
2
,
0
,
{
4
:
2
,
5
:
3
},
'
foo
'
)
assert
repr
(
mem2
)
==
"
PlainMemoryVariable(2, 0, {4: 2, 5: 3},
'
foo
'
)
"
...
...
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