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
582bb5a1
authored
Mar 10, 2016
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dataflow_cpp: linux fixes
parent
c3872ad0
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
41 additions
and
53 deletions
+41
-53
dataflow_cpp/include/embb/dataflow/internal/constant_source.h
+2
-2
dataflow_cpp/include/embb/dataflow/internal/inputs.h
+2
-2
dataflow_cpp/include/embb/dataflow/internal/process.h
+4
-4
dataflow_cpp/include/embb/dataflow/internal/scheduler_mtapi.h
+1
-1
dataflow_cpp/include/embb/dataflow/internal/select.h
+2
-6
dataflow_cpp/include/embb/dataflow/internal/sink.h
+6
-5
dataflow_cpp/include/embb/dataflow/internal/source.h
+2
-2
dataflow_cpp/include/embb/dataflow/internal/switch.h
+2
-5
dataflow_cpp/include/embb/dataflow/network.h
+17
-19
dataflow_cpp/test/dataflow_cpp_test_simple.cc
+2
-6
tasks_cpp/src/node.cc
+1
-1
No files found.
dataflow_cpp/include/embb/dataflow/internal/constant_source.h
View file @
582bb5a1
...
...
@@ -46,9 +46,9 @@ class ConstantSource
Type
value_
;
public
:
explicit
ConstantSource
(
Network
&
network
,
Type
value
)
ConstantSource
(
Scheduler
*
sched
,
Type
value
)
:
value_
(
value
)
{
SetScheduler
(
network
.
GetScheduler
()
);
SetScheduler
(
sched
);
}
virtual
bool
HasOutputs
()
const
{
...
...
dataflow_cpp/include/embb/dataflow/internal/inputs.h
View file @
582bb5a1
...
...
@@ -168,7 +168,7 @@ class Inputs<T1, T2, embb::base::internal::Nil,
return
this
->
template
Get
<
0
>
().
IsConnected
()
&
this
->
template
Get
<
1
>
().
IsConnected
();
}
private
:
private
:
embb
::
base
::
Atomic
<
int
>
*
count_
;
ClockListener
*
listener_
;
int
slices_
;
...
...
@@ -233,7 +233,7 @@ class Inputs<T1, T2, T3, embb::base::internal::Nil,
this
->
template
Get
<
1
>
().
IsConnected
()
&
this
->
template
Get
<
2
>
().
IsConnected
();
}
private
:
private
:
embb
::
base
::
Atomic
<
int
>
*
count_
;
ClockListener
*
listener_
;
int
slices_
;
...
...
dataflow_cpp/include/embb/dataflow/internal/process.h
View file @
582bb5a1
...
...
@@ -53,11 +53,11 @@ class Process< Serial, Inputs<I1, I2, I3, I4, I5>,
typedef
ProcessExecutor
<
InputsType
,
OutputsType
>
ExecutorType
;
typedef
typename
ExecutorType
::
FunctionType
FunctionType
;
explicit
Process
(
Network
&
network
,
FunctionType
function
)
:
inputs_
(
network
.
GetSlices
()
)
Process
(
int
slices
,
Scheduler
*
sched
,
FunctionType
function
)
:
inputs_
(
slices
)
,
executor_
(
function
)
,
action_
(
NULL
)
,
slices_
(
network
.
GetSlices
()
)
{
,
slices_
(
slices
)
{
next_clock_
=
0
;
queued_clock_
=
0
;
bool
ordered
=
Serial
;
...
...
@@ -73,7 +73,7 @@ class Process< Serial, Inputs<I1, I2, I3, I4, I5>,
for
(
int
ii
=
0
;
ii
<
slices_
;
ii
++
)
{
action_
[
ii
]
=
Action
();
}
SetScheduler
(
network
.
GetScheduler
()
);
SetScheduler
(
sched
);
}
~
Process
()
{
...
...
dataflow_cpp/include/embb/dataflow/internal/scheduler_mtapi.h
View file @
582bb5a1
...
...
@@ -40,7 +40,7 @@ namespace internal {
class
SchedulerMTAPI
:
public
Scheduler
{
public
:
SchedulerMTAPI
(
int
slices
)
explicit
SchedulerMTAPI
(
int
slices
)
:
slices_
(
slices
)
{
embb
::
tasks
::
Node
&
node
=
embb
::
tasks
::
Node
::
GetInstance
();
...
...
dataflow_cpp/include/embb/dataflow/internal/select.h
View file @
582bb5a1
...
...
@@ -34,9 +34,6 @@
namespace
embb
{
namespace
dataflow
{
class
Network
;
namespace
internal
{
template
<
typename
Type
>
...
...
@@ -47,10 +44,9 @@ class Select
typedef
Inputs
<
bool
,
Type
,
Type
>
InputsType
;
typedef
Outputs
<
Type
>
OutputsType
;
Select
(
Network
&
network
)
:
inputs_
(
network
.
GetSlices
()
)
{
Select
(
int
slices
,
Scheduler
*
sched
)
:
inputs_
(
slices
),
slices_
(
slices
)
{
inputs_
.
SetListener
(
this
);
slices_
=
network
.
GetSlices
();
SetScheduler
(
network
.
GetScheduler
());
SetScheduler
(
sched
);
}
virtual
bool
HasInputs
()
const
{
...
...
dataflow_cpp/include/embb/dataflow/internal/sink.h
View file @
582bb5a1
...
...
@@ -48,11 +48,12 @@ class Sink< Inputs<I1, I2, I3, I4, I5> >
typedef
SinkExecutor
<
InputsType
>
ExecutorType
;
typedef
typename
ExecutorType
::
FunctionType
FunctionType
;
explicit
Sink
(
Network
&
network
,
FunctionType
function
)
:
inputs_
(
network
.
GetSlices
())
Sink
(
int
slices
,
Scheduler
*
sched
,
ClockListener
*
listener
,
FunctionType
function
)
:
inputs_
(
slices
)
,
executor_
(
function
)
,
action_
(
NULL
)
,
slices_
(
network
.
GetSlices
()
)
{
,
slices_
(
slices
)
{
next_clock_
=
0
;
queued_clock_
=
0
;
queue_id_
=
GetNextProcessID
();
...
...
@@ -63,8 +64,8 @@ class Sink< Inputs<I1, I2, I3, I4, I5> >
for
(
int
ii
=
0
;
ii
<
slices_
;
ii
++
)
{
action_
[
ii
]
=
Action
();
}
SetListener
(
&
network
);
SetScheduler
(
network
.
GetScheduler
()
);
SetListener
(
listener
);
SetScheduler
(
sched
);
}
~
Sink
()
{
...
...
dataflow_cpp/include/embb/dataflow/internal/source.h
View file @
582bb5a1
...
...
@@ -48,9 +48,9 @@ class Source< Outputs<O1, O2, O3, O4, O5> >
typedef
SourceExecutor
<
OutputsType
>
ExecutorType
;
typedef
typename
ExecutorType
::
FunctionType
FunctionType
;
explicit
Source
(
Network
&
network
,
FunctionType
function
)
Source
(
Scheduler
*
sched
,
FunctionType
function
)
:
executor_
(
function
),
not_done_
(
true
)
{
SetScheduler
(
network
.
GetScheduler
()
);
SetScheduler
(
sched
);
}
virtual
bool
HasOutputs
()
const
{
...
...
dataflow_cpp/include/embb/dataflow/internal/switch.h
View file @
582bb5a1
...
...
@@ -34,9 +34,6 @@
namespace
embb
{
namespace
dataflow
{
class
Network
;
namespace
internal
{
template
<
typename
Type
>
...
...
@@ -47,9 +44,9 @@ class Switch
typedef
Inputs
<
bool
,
Type
>
InputsType
;
typedef
Outputs
<
Type
,
Type
>
OutputsType
;
Switch
(
Network
&
network
)
:
inputs_
(
network
.
GetSlices
()
)
{
Switch
(
int
slices
,
Scheduler
*
sched
)
:
inputs_
(
slices
)
{
inputs_
.
SetListener
(
this
);
SetScheduler
(
network
.
GetScheduler
()
);
SetScheduler
(
sched
);
}
virtual
bool
HasInputs
()
const
{
...
...
dataflow_cpp/include/embb/dataflow/network.h
View file @
582bb5a1
...
...
@@ -60,7 +60,7 @@ class Network {
* Constructs an empty network.
* \param slices Number of concurrent tokens allowed in the network.
*/
Network
(
int
slices
)
{}
explicit
Network
(
int
slices
)
{}
/**
* Input port class.
...
...
@@ -681,7 +681,8 @@ class Network {
class
Network
:
public
internal
::
ClockListener
{
public
:
Network
(
int
slices
)
:
sink_counter_
(
NULL
),
slices_
(
slices
),
sched_
(
NULL
)
{
explicit
Network
(
int
slices
)
:
sink_counter_
(
NULL
),
slices_
(
slices
),
sched_
(
NULL
)
{
sched_
=
embb
::
base
::
Allocation
::
New
<
internal
::
SchedulerMTAPI
>
(
slices_
);
sink_counter_
=
reinterpret_cast
<
embb
::
base
::
Atomic
<
int
>*>
(
embb
::
base
::
Allocation
::
Allocate
(
...
...
@@ -709,7 +710,8 @@ class Network : public internal::ClockListener {
typename
T5
=
embb
::
base
::
internal
::
Nil
>
class
Inputs
:
public
internal
::
Inputs
<
T1
,
T2
,
T3
,
T4
,
T5
>
{
public
:
explicit
Inputs
(
int
slices
)
:
internal
::
Inputs
(
slices
)
{}
explicit
Inputs
(
int
slices
)
:
internal
::
Inputs
<
T1
,
T2
,
T3
,
T4
,
T5
>
(
slices
)
{}
};
template
<
typename
T1
,
typename
T2
=
embb
::
base
::
internal
::
Nil
,
...
...
@@ -718,7 +720,8 @@ class Network : public internal::ClockListener {
typename
T5
=
embb
::
base
::
internal
::
Nil
>
class
Outputs
:
public
internal
::
Outputs
<
T1
,
T2
,
T3
,
T4
,
T5
>
{
public
:
explicit
Outputs
()
:
internal
::
Outputs
()
{}
explicit
Outputs
()
:
internal
::
Outputs
<
T1
,
T2
,
T3
,
T4
,
T5
>
()
{}
};
template
<
class
Inputs
,
class
Outputs
>
class
SerialProcess
;
...
...
@@ -739,7 +742,8 @@ class Network : public internal::ClockListener {
explicit
SerialProcess
(
Network
&
network
,
FunctionType
function
)
:
internal
::
Process
<
true
,
internal
::
Inputs
<
I1
,
I2
,
I3
,
I4
,
I5
>
,
internal
::
Outputs
<
O1
,
O2
,
O3
,
O4
,
O5
>
>
(
network
,
function
)
{
internal
::
Outputs
<
O1
,
O2
,
O3
,
O4
,
O5
>
>
(
network
.
slices_
,
network
.
sched_
,
function
)
{
network
.
processes_
.
push_back
(
this
);
}
};
...
...
@@ -762,7 +766,8 @@ class Network : public internal::ClockListener {
explicit
ParallelProcess
(
Network
&
network
,
FunctionType
function
)
:
internal
::
Process
<
false
,
internal
::
Inputs
<
I1
,
I2
,
I3
,
I4
,
I5
>
,
internal
::
Outputs
<
O1
,
O2
,
O3
,
O4
,
O5
>
>
(
network
,
function
)
{
internal
::
Outputs
<
O1
,
O2
,
O3
,
O4
,
O5
>
>
(
network
.
slices_
,
network
.
sched_
,
function
)
{
network
.
processes_
.
push_back
(
this
);
}
};
...
...
@@ -771,7 +776,7 @@ class Network : public internal::ClockListener {
class
Switch
:
public
internal
::
Switch
<
Type
>
{
public
:
explicit
Switch
(
Network
&
network
)
:
internal
::
Switch
<
Type
>
(
network
)
{
:
internal
::
Switch
<
Type
>
(
network
.
slices_
,
network
.
sched_
)
{
network
.
processes_
.
push_back
(
this
);
}
};
...
...
@@ -780,7 +785,7 @@ class Network : public internal::ClockListener {
class
Select
:
public
internal
::
Select
<
Type
>
{
public
:
explicit
Select
(
Network
&
network
)
:
internal
::
Select
<
Type
>
(
network
)
{
:
internal
::
Select
<
Type
>
(
network
.
slices_
,
network
.
sched_
)
{
network
.
processes_
.
push_back
(
this
);
}
};
...
...
@@ -797,7 +802,8 @@ class Network : public internal::ClockListener {
explicit
Sink
(
Network
&
network
,
FunctionType
function
)
:
internal
::
Sink
<
internal
::
Inputs
<
I1
,
I2
,
I3
,
I4
,
I5
>
>
(
network
,
function
)
{
internal
::
Inputs
<
I1
,
I2
,
I3
,
I4
,
I5
>
>
(
network
.
slices_
,
network
.
sched_
,
&
network
,
function
)
{
network
.
sinks_
.
push_back
(
this
);
network
.
sink_count_
++
;
}
...
...
@@ -816,7 +822,7 @@ class Network : public internal::ClockListener {
explicit
Source
(
Network
&
network
,
FunctionType
function
)
:
internal
::
Source
<
internal
::
Outputs
<
O1
,
O2
,
O3
,
O4
,
O5
>
>
(
network
,
function
)
{
internal
::
Outputs
<
O1
,
O2
,
O3
,
O4
,
O5
>
>
(
network
.
sched_
,
function
)
{
network
.
sources_
.
push_back
(
this
);
}
};
...
...
@@ -825,19 +831,11 @@ class Network : public internal::ClockListener {
class
ConstantSource
:
public
internal
::
ConstantSource
<
Type
>
{
public
:
explicit
ConstantSource
(
Network
&
network
,
Type
value
)
:
internal
::
ConstantSource
<
Type
>
(
network
,
value
)
{
:
internal
::
ConstantSource
<
Type
>
(
network
.
sched_
,
value
)
{
network
.
sources_
.
push_back
(
this
);
}
};
int
GetSlices
()
const
{
return
slices_
;
}
internal
::
Scheduler
*
GetScheduler
()
const
{
return
sched_
;
}
bool
IsValid
()
{
bool
valid
=
true
;
for
(
size_t
ii
=
0
;
ii
<
sources_
.
size
();
ii
++
)
{
...
...
dataflow_cpp/test/dataflow_cpp_test_simple.cc
View file @
582bb5a1
...
...
@@ -170,7 +170,8 @@ void SimpleTest::TestBasic() {
MySource
source
(
network
,
embb
::
base
::
MakeFunction
(
sourceFunc
));
MyFilter
filter
(
network
,
embb
::
base
::
MakeFunction
(
filterFunc
));
MyMult
mult
(
network
,
embb
::
base
::
MakeFunction
(
multFunc
));
MySink
sink
(
network
,
embb
::
base
::
MakeFunction
(
asink
,
&
ArraySink
<
TEST_COUNT
>::
Run
));
MySink
sink
(
network
,
embb
::
base
::
MakeFunction
(
asink
,
&
ArraySink
<
TEST_COUNT
>::
Run
));
MyPred
pred
(
network
,
embb
::
base
::
MakeFunction
(
predFunc
));
MySwitch
sw
(
network
);
MySelect
sel
(
network
);
...
...
@@ -208,11 +209,6 @@ void SimpleTest::TestBasic() {
sel
.
GetOutput
<
0
>
()
>>
sink
.
GetInput
<
0
>
();
// network.AddSource(constant);
// network.AddSource(source);
// network.Initialize(NUM_SLICES);
try
{
if
(
!
network
.
IsValid
())
{
EMBB_THROW
(
embb
::
base
::
ErrorException
,
"network is invalid"
);
...
...
tasks_cpp/src/node.cc
View file @
582bb5a1
...
...
@@ -41,7 +41,7 @@ namespace {
static
embb
::
tasks
::
Node
*
node_instance
=
NULL
;
#if TASKS_CPP_AUTOMATIC_INITIALIZE
static
embb_spinlock_t
init_mutex
=
{
0
};
static
embb_spinlock_t
init_mutex
=
{
{
0
}
};
#endif
}
...
...
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