Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RTSD
HDL
Commits
ffd39b03
Commit
ffd39b03
authored
10 years ago
by
Pepping
Browse files
Options
Downloads
Patches
Plain Diff
- Added comments
parent
ef28c9df
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/oneclick/prestudy/multithreads.py
+9
-4
9 additions, 4 deletions
tools/oneclick/prestudy/multithreads.py
with
9 additions
and
4 deletions
tools/oneclick/prestudy/multithreads.py
+
9
−
4
View file @
ffd39b03
...
@@ -55,6 +55,14 @@ class base_component(object):
...
@@ -55,6 +55,14 @@ class base_component(object):
#'>' operator: Connect
#'>' operator: Connect
def
__gt__
(
self
,
other
):
def
__gt__
(
self
,
other
):
return
self
.
__connect__
(
other
)
return
self
.
__connect__
(
other
)
# The __connect__ method fills the out_q attribute.
# out_q is a 3-dimensional list with pointers to the write-side of the
# communication pipes: out_q[x][y][z], where
# x iterates over the fanout (the number of connected snk's).
# y iterates over the number of outputs.
# z indexes the write-side of the pipe and is always [1]
#
def
__connect__
(
self
,
other
):
def
__connect__
(
self
,
other
):
if
hasattr
(
other
,
'
in_q
'
):
if
hasattr
(
other
,
'
in_q
'
):
# Create a list for all outputs.
# Create a list for all outputs.
...
@@ -68,9 +76,6 @@ class base_component(object):
...
@@ -68,9 +76,6 @@ class base_component(object):
else
:
else
:
print
'
Error: downstream component
'
,
other
.
name
,
'
does not have snk
'
print
'
Error: downstream component
'
,
other
.
name
,
'
does not have snk
'
def
run
(
self
):
return
None
# Components inheriting the base component class
# Components inheriting the base component class
class
blockGen
(
threading
.
Thread
,
base_component
):
class
blockGen
(
threading
.
Thread
,
base_component
):
...
@@ -116,7 +121,7 @@ class dataBuffer(threading.Thread, base_component):
...
@@ -116,7 +121,7 @@ class dataBuffer(threading.Thread, base_component):
for
j
in
xrange
(
self
.
nof_packets
):
for
j
in
xrange
(
self
.
nof_packets
):
for
i
in
xrange
(
self
.
nof_inputs
):
for
i
in
xrange
(
self
.
nof_inputs
):
data
.
append
(
self
.
in_q
[
i
][
0
].
recv
())
data
.
append
(
self
.
in_q
[
i
][
0
].
recv
())
time
.
sleep
(
self
.
index
)
time
.
sleep
(
self
.
index
)
# Added a sleep to avoid clashing of the print output.
print
self
.
name
print
self
.
name
for
i
in
data
:
for
i
in
data
:
print
i
print
i
...
...
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