Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
78f67200
authored
9 years ago
by
Marcus Winter
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'embb455_dataflow_source_semantics' into development
parents
4692cef0
63419b09
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
25 deletions
+50
-25
dataflow_cpp/include/embb/dataflow/internal/source_executor.h
+25
-15
dataflow_cpp/test/dataflow_cpp_test_simple.cc
+11
-4
doc/examples/dataflow/dataflow_producer-snippet.h
+8
-4
doc/examples/dataflow/dataflow_source_function-snippet.h
+6
-2
No files found.
dataflow_cpp/include/embb/dataflow/internal/source_executor.h
View file @
78f67200
...
@@ -53,7 +53,9 @@ class SourceExecutor< Outputs<Slices, O1> > {
...
@@ -53,7 +53,9 @@ class SourceExecutor< Outputs<Slices, O1> > {
Outputs
<
Slices
,
O1
>
&
outputs
)
{
Outputs
<
Slices
,
O1
>
&
outputs
)
{
O1
o1
;
O1
o1
;
bool
result
=
function_
(
o1
);
bool
result
=
function_
(
o1
);
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
if
(
result
)
{
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
}
return
result
;
return
result
;
}
}
...
@@ -78,8 +80,10 @@ class SourceExecutor< Outputs<Slices, O1, O2> > {
...
@@ -78,8 +80,10 @@ class SourceExecutor< Outputs<Slices, O1, O2> > {
O1
o1
;
O1
o1
;
O2
o2
;
O2
o2
;
bool
result
=
function_
(
o1
,
o2
);
bool
result
=
function_
(
o1
,
o2
);
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
if
(
result
)
{
outputs
.
template
Get
<
1
>
().
Send
(
Signal
<
O2
>
(
clock
,
o2
));
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
outputs
.
template
Get
<
1
>
().
Send
(
Signal
<
O2
>
(
clock
,
o2
));
}
return
result
;
return
result
;
}
}
...
@@ -106,9 +110,11 @@ class SourceExecutor< Outputs<Slices, O1, O2, O3> > {
...
@@ -106,9 +110,11 @@ class SourceExecutor< Outputs<Slices, O1, O2, O3> > {
O2
o2
;
O2
o2
;
O3
o3
;
O3
o3
;
bool
result
=
function_
(
o1
,
o2
,
o3
);
bool
result
=
function_
(
o1
,
o2
,
o3
);
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
if
(
result
)
{
outputs
.
template
Get
<
1
>
().
Send
(
Signal
<
O2
>
(
clock
,
o2
));
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
outputs
.
template
Get
<
2
>
().
Send
(
Signal
<
O3
>
(
clock
,
o3
));
outputs
.
template
Get
<
1
>
().
Send
(
Signal
<
O2
>
(
clock
,
o2
));
outputs
.
template
Get
<
2
>
().
Send
(
Signal
<
O3
>
(
clock
,
o3
));
}
return
result
;
return
result
;
}
}
...
@@ -137,10 +143,12 @@ class SourceExecutor< Outputs<Slices, O1, O2, O3, O4> > {
...
@@ -137,10 +143,12 @@ class SourceExecutor< Outputs<Slices, O1, O2, O3, O4> > {
O3
o3
;
O3
o3
;
O4
o4
;
O4
o4
;
bool
result
=
function_
(
o1
,
o2
,
o3
,
o4
);
bool
result
=
function_
(
o1
,
o2
,
o3
,
o4
);
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
if
(
result
)
{
outputs
.
template
Get
<
1
>
().
Send
(
Signal
<
O2
>
(
clock
,
o2
));
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
outputs
.
template
Get
<
2
>
().
Send
(
Signal
<
O3
>
(
clock
,
o3
));
outputs
.
template
Get
<
1
>
().
Send
(
Signal
<
O2
>
(
clock
,
o2
));
outputs
.
template
Get
<
3
>
().
Send
(
Signal
<
O4
>
(
clock
,
o4
));
outputs
.
template
Get
<
2
>
().
Send
(
Signal
<
O3
>
(
clock
,
o3
));
outputs
.
template
Get
<
3
>
().
Send
(
Signal
<
O4
>
(
clock
,
o4
));
}
return
result
;
return
result
;
}
}
...
@@ -172,11 +180,13 @@ class SourceExecutor< Outputs<Slices, O1, O2, O3, O4, O5> > {
...
@@ -172,11 +180,13 @@ class SourceExecutor< Outputs<Slices, O1, O2, O3, O4, O5> > {
O4
o4
;
O4
o4
;
O5
o5
;
O5
o5
;
bool
result
=
function_
(
o1
,
o2
,
o3
,
o4
,
o5
);
bool
result
=
function_
(
o1
,
o2
,
o3
,
o4
,
o5
);
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
if
(
result
)
{
outputs
.
template
Get
<
1
>
().
Send
(
Signal
<
O2
>
(
clock
,
o2
));
outputs
.
template
Get
<
0
>
().
Send
(
Signal
<
O1
>
(
clock
,
o1
));
outputs
.
template
Get
<
2
>
().
Send
(
Signal
<
O3
>
(
clock
,
o3
));
outputs
.
template
Get
<
1
>
().
Send
(
Signal
<
O2
>
(
clock
,
o2
));
outputs
.
template
Get
<
3
>
().
Send
(
Signal
<
O4
>
(
clock
,
o4
));
outputs
.
template
Get
<
2
>
().
Send
(
Signal
<
O3
>
(
clock
,
o3
));
outputs
.
template
Get
<
4
>
().
Send
(
Signal
<
O5
>
(
clock
,
o5
));
outputs
.
template
Get
<
3
>
().
Send
(
Signal
<
O4
>
(
clock
,
o4
));
outputs
.
template
Get
<
4
>
().
Send
(
Signal
<
O5
>
(
clock
,
o5
));
}
return
result
;
return
result
;
}
}
...
...
This diff is collapsed.
Click to expand it.
dataflow_cpp/test/dataflow_cpp_test_simple.cc
View file @
78f67200
...
@@ -56,12 +56,19 @@ embb::base::Atomic<int> source_counter;
...
@@ -56,12 +56,19 @@ embb::base::Atomic<int> source_counter;
int
source_array
[
TEST_COUNT
];
int
source_array
[
TEST_COUNT
];
bool
sourceFunc
(
int
&
out
)
{
bool
sourceFunc
(
int
&
out
)
{
out
=
source_counter
;
if
(
source_counter
<
TEST_COUNT
)
{
out
=
source_counter
;
source_array
[
source_counter
]
=
out
;
source_array
[
source_counter
]
=
out
;
source_counter
++
;
source_counter
++
;
return
source_counter
<
TEST_COUNT
;
return
true
;
}
else
{
return
false
;
}
}
}
embb
::
base
::
Atomic
<
int
>
pred_counter
;
embb
::
base
::
Atomic
<
int
>
pred_counter
;
...
...
This diff is collapsed.
Click to expand it.
doc/examples/dataflow/dataflow_producer-snippet.h
View file @
78f67200
...
@@ -3,10 +3,14 @@ class Producer {
...
@@ -3,10 +3,14 @@ class Producer {
public
:
public
:
explicit
Producer
(
int
seed
)
:
seed_
(
seed
),
count_
(
4
)
{}
explicit
Producer
(
int
seed
)
:
seed_
(
seed
),
count_
(
4
)
{}
bool
Run
(
T
&
x
)
{
bool
Run
(
T
&
x
)
{
// produce a new value x
if
(
count_
>=
0
)
{
x
=
SimpleRand
(
seed_
);
// produce a new value x
count_
--
;
x
=
SimpleRand
(
seed_
);
return
count_
>=
0
;
count_
--
;
return
true
;
}
else
{
return
false
;
}
}
}
private
:
private
:
...
...
This diff is collapsed.
Click to expand it.
doc/examples/dataflow/dataflow_source_function-snippet.h
View file @
78f67200
bool
SourceFunction
(
std
::
string
&
str
)
{
bool
SourceFunction
(
std
::
string
&
str
)
{
std
::
getline
(
file
,
str
);
if
(
!
file
.
eof
())
{
return
!
file
.
eof
();
std
::
getline
(
file
,
str
);
return
true
;
}
else
{
return
false
;
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment