Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
mbe-tools
TTool
Commits
0cb1bd4d
Commit
0cb1bd4d
authored
10 years ago
by
Andrea Enrici
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
1cc49155
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Ctranslator/TMLCCodeGeneration.java
+12
-11
12 additions, 11 deletions
src/Ctranslator/TMLCCodeGeneration.java
src/tmltranslator/TMLTask.java
+25
-0
25 additions, 0 deletions
src/tmltranslator/TMLTask.java
with
37 additions
and
11 deletions
src/Ctranslator/TMLCCodeGeneration.java
+
12
−
11
View file @
0cb1bd4d
...
...
@@ -215,8 +215,8 @@ public class TMLCCodeGeneration {
"/********* INIT PREX OPs signals ********/"
+
CR
+
"sig[feed_out].f=true;"
+
CR
+
"sig[src_out].f=true;"
+
CR
+
"/********* OPs schedul
l
er ***************/"
+
CR
+
TAB
+
"while(
ERROR: there are not exit signals
) {"
+
CR
+
"/********* OPs scheduler ***************/"
+
CR
+
TAB
+
"while(
!exit_rule()
) {"
+
CR
+
TAB2
+
"for( int n_op = 0; n_op < NUM_OPS; ++n_op ) {"
+
CR
+
TAB3
+
"valid_signal = (*fire_rule[n_op])();"
+
CR
+
TAB3
+
"if( valid_signal ) {"
+
CR
+
...
...
@@ -225,7 +225,7 @@ public class TMLCCodeGeneration {
TAB3
+
"}"
+
CR
+
TAB2
+
"}"
+
CR
+
TAB2
+
"if( blocked ) {"
+
CR
+
TAB3
+
"printf(\"ERROR:the system got blocked, no new signals\\n\");"
+
CR
+
TAB3
+
"printf(\"ERROR:
the system got blocked, no new signals\\n\");"
+
CR
+
TAB3
+
"return 1;"
+
CR
+
TAB2
+
"}"
+
CR
+
TAB2
+
"blocked = true;"
+
CR
+
...
...
@@ -341,6 +341,7 @@ public class TMLCCodeGeneration {
private
void
generateInitProgram
(
ArrayList
<
TMLTask
>
mappedTasks
)
{
String
init_code
=
""
;
String
XOD
=
""
;
initString
+=
"#include \""
+
applicationName
+
"_final.h\""
+
CR2
;
...
...
@@ -361,29 +362,29 @@ public class TMLCCodeGeneration {
initString
+=
"/**** init code ****/"
+
CR
;
for
(
TMLTask
task:
mappedTasks
)
{
String
XOD
=
task
.
get
Name
().
split
(
"__"
)[
1
]
;
XOD
=
task
.
get
XOD
()
;
if
(
XOD
.
contains
(
"CWP"
)
||
XOD
.
contains
(
"cwp"
)
)
{
CwpMEC
cwp
=
new
CwpMEC
(
XOD
,
""
,
""
,
""
);
CwpMEC
cwp
=
new
CwpMEC
(
XOD
,
task
.
getID0
(),
task
.
getOD0
()
,
""
);
init_code
=
cwp
.
getInitCode
();
}
if
(
XOD
.
contains
(
"CWM"
)
||
XOD
.
contains
(
"cwm"
)
)
{
CwmMEC
cwm
=
new
CwmMEC
(
XOD
,
""
,
""
,
""
);
CwmMEC
cwm
=
new
CwmMEC
(
XOD
,
task
.
getID0
(),
task
.
getOD0
()
,
""
);
init_code
=
cwm
.
getInitCode
();
}
if
(
XOD
.
contains
(
"CWA"
)
||
XOD
.
contains
(
"cwa"
)
)
{
CwaMEC
cwa
=
new
CwaMEC
(
XOD
,
""
,
""
,
""
);
CwaMEC
cwa
=
new
CwaMEC
(
XOD
,
task
.
getID0
(),
task
.
getOD0
()
,
""
);
init_code
=
cwa
.
getInitCode
();
}
if
(
XOD
.
contains
(
"CWL"
)
||
XOD
.
contains
(
"cwl"
)
)
{
CwlMEC
cwl
=
new
CwlMEC
(
XOD
,
""
,
""
,
""
);
CwlMEC
cwl
=
new
CwlMEC
(
XOD
,
task
.
getID0
(),
task
.
getOD0
()
,
""
);
init_code
=
cwl
.
getInitCode
();
}
if
(
XOD
.
contains
(
"SUM"
)
||
XOD
.
contains
(
"sum"
)
)
{
SumMEC
sum
=
new
SumMEC
(
XOD
,
""
,
""
,
""
);
SumMEC
sum
=
new
SumMEC
(
XOD
,
task
.
getID0
(),
task
.
getOD0
()
,
""
);
init_code
=
sum
.
getInitCode
();
}
if
(
XOD
.
contains
(
"FFT"
)
||
XOD
.
contains
(
"fft"
)
)
{
FftMEC
fft
=
new
FftMEC
(
XOD
,
""
,
""
,
""
);
FftMEC
fft
=
new
FftMEC
(
XOD
,
task
.
getID0
(),
task
.
getOD0
()
,
""
);
init_code
=
fft
.
getInitCode
();
}
initString
+=
init_code
+
CR
;
...
...
@@ -404,7 +405,7 @@ public class TMLCCodeGeneration {
}
initString
+=
"}"
;
}
private
ArrayList
<
String
>
getTaskNamePerMappedUnit
(
String
mappedUnit
,
ArrayList
<
TMLTask
>
mappedTasks
)
{
ArrayList
<
String
>
list
=
new
ArrayList
<
String
>();
...
...
This diff is collapsed.
Click to expand it.
src/tmltranslator/TMLTask.java
+
25
−
0
View file @
0cb1bd4d
...
...
@@ -159,6 +159,31 @@ public class TMLTask extends TMLElement {
}
return
list
;
}
public
String
getID0
()
{
if
(
getReadChannels
().
size
()
>
0
)
{
return
getReadChannels
().
get
(
0
).
toString
().
split
(
"__"
)[
1
];
}
else
{
return
""
;
}
}
public
String
getOD0
()
{
if
(
getWriteChannels
().
size
()
>
0
)
{
return
getWriteChannels
().
get
(
0
).
toString
().
split
(
"__"
)[
1
];
}
else
{
return
""
;
}
}
public
String
getXOD
()
{
return
getName
().
split
(
"__"
)[
1
];
}
public
TMLActivity
getActivityDiagram
()
{
return
activity
;
...
...
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