Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
caesr-pub
systemc-clang
Commits
8876d137
Commit
8876d137
authored
Jul 05, 2019
by
rmrf
Browse files
Testing code formatting
parent
f9d0bb96
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/FindGlobalEvents.cpp
View file @
8876d137
...
...
@@ -39,7 +39,7 @@ json FindGlobalEvents::dump_json() {
json
globals_j
{};
for
(
auto
const
&
event
:
globalEvents
)
{
for
(
auto
const
&
event
:
_
globalEvents
)
{
globals_j
[
"global_declarations"
].
emplace_back
(
event
.
first
)
;
}
std
::
cout
<<
globals_j
.
dump
(
4
)
<<
endl
;
...
...
src/SystemCClang.cpp
View file @
8876d137
...
...
@@ -16,13 +16,13 @@ bool SystemCConsumer::fire() {
_systemcModel
=
new
Model
{}
;
// ANI : Do we need FindGlobalEvents?
FindGlobalEvents
globals
{
tu
,
_
os
};
FindGlobalEvents
globals
{
tu
,
os
_
};
FindGlobalEvents
::
globalEventMapType
eventMap
{
globals
.
getEventMap
()};
globals
.
dump_json
();
_systemcModel
->
addGlobalEvents
(
eventMap
);
// Find the sc_modules
FindSCModules
scmod
{
tu
,
_
os
};
FindSCModules
scmod
{
tu
,
os
_
};
FindSCModules
::
moduleMapType
scmodules
{
scmod
.
getSystemCModulesMap
()};
...
...
@@ -30,22 +30,22 @@ bool SystemCConsumer::fire() {
mitend
=
scmodules
.
end
();
mit
!=
mitend
;
++
mit
)
{
ModuleDecl
*
md
=
new
ModuleDecl
{
mit
->
first
,
mit
->
second
};
//md->setTemplateParameters( scmod.getTemplateParameters() );
//
_
os << "SIZE: " << scmod.getTemplateParameters().size() << "\n";
// os
_
<< "SIZE: " << scmod.getTemplateParameters().size() << "\n";
_systemcModel
->
addModuleDecl
(
md
);
}
////////////////////////////////////////////////////////////////
// Find the sc_main
////////////////////////////////////////////////////////////////
FindSCMain
scmain
{
tu
,
_
os
};
FindSCMain
scmain
{
tu
,
os
_
};
if
(
scmain
.
isSCMainFound
())
{
FunctionDecl
*
fnDecl
{
scmain
.
getSCMainFunctionDecl
()};
FindSimTime
scstart
{
fnDecl
,
_
os
};
FindSimTime
scstart
{
fnDecl
,
os
_
};
_systemcModel
->
addSimulationTime
(
scstart
.
returnSimTime
());
}
else
{
_
os
<<
"
\n
Could not find SCMain"
;
os
_
<<
"
\n
Could not find SCMain"
;
}
////////////////////////////////////////////////////////////////
...
...
@@ -66,57 +66,57 @@ bool SystemCConsumer::fire() {
int
numInstances
{
mainmd
->
getNumInstances
()};
vector
<
ModuleDecl
*>
moduleDeclVec
;
_
os
<<
"
\n
"
;
_
os
<<
"For module: "
<<
mit
->
first
<<
" num instance : "
<<
numInstances
;
os
_
<<
"
\n
"
;
os
_
<<
"For module: "
<<
mit
->
first
<<
" num instance : "
<<
numInstances
;
for
(
unsigned
int
num
{
0
};
num
<
numInstances
;
++
num
)
{
ModuleDecl
*
md
=
new
ModuleDecl
{};
// Find the template arguments for the class.
FindTemplateParameters
tparms
{
mainmd
->
getModuleClassDecl
(),
_
os
};
FindTemplateParameters
tparms
{
mainmd
->
getModuleClassDecl
(),
os
_
};
md
->
setTemplateParameters
(
tparms
.
getTemplateParameters
()
);
_
os
<<
"@@# "
<<
mainmd
->
getTemplateParameters
().
size
()
<<
"
\n
"
;
os
_
<<
"@@# "
<<
mainmd
->
getTemplateParameters
().
size
()
<<
"
\n
"
;
md
->
dump_json
();
vector
<
EntryFunctionContainer
*>
_entryFunctionContainerVector
;
FindConstructor
constructor
{
mainmd
->
getModuleClassDecl
(),
_
os
};
FindConstructor
constructor
{
mainmd
->
getModuleClassDecl
(),
os
_
};
md
->
addConstructor
(
constructor
.
returnConstructorStmt
());
FindPorts
ports
{
mainmd
->
getModuleClassDecl
(),
_
os
};
FindPorts
ports
{
mainmd
->
getModuleClassDecl
(),
os
_
};
md
->
addInputPorts
(
ports
.
getInputPorts
());
md
->
addOutputPorts
(
ports
.
getOutputPorts
());
md
->
addInputOutputPorts
(
ports
.
getInputOutputPorts
());
FindTLMInterfaces
findTLMInterfaces
{
mainmd
->
getModuleClassDecl
(),
_
os
};
FindTLMInterfaces
findTLMInterfaces
{
mainmd
->
getModuleClassDecl
(),
os
_
};
md
->
addInputInterfaces
(
findTLMInterfaces
.
getInputInterfaces
());
md
->
addOutputInterfaces
(
findTLMInterfaces
.
getOutputInterfaces
());
md
->
addInputOutputInterfaces
(
findTLMInterfaces
.
getInputOutputInterfaces
());
FindSignals
signals
{
mainmd
->
getModuleClassDecl
(),
_
os
};
FindSignals
signals
{
mainmd
->
getModuleClassDecl
(),
os
_
};
md
->
addSignals
(
signals
.
getSignals
());
FindEntryFunctions
findEntries
{
mainmd
->
getModuleClassDecl
(),
_
os
};
FindEntryFunctions
findEntries
{
mainmd
->
getModuleClassDecl
(),
os
_
};
FindEntryFunctions
::
entryFunctionVectorType
*
entryFunctions
{
findEntries
.
getEntryFunctions
()};
md
->
addProcess
(
entryFunctions
);
for
(
size_t
i
=
0
;
i
<
entryFunctions
->
size
();
i
++
)
{
EntryFunctionContainer
*
ef
{(
*
entryFunctions
)[
i
]};
FindSensitivity
findSensitivity
{
constructor
.
returnConstructorStmt
(),
_
os
};
FindSensitivity
findSensitivity
{
constructor
.
returnConstructorStmt
(),
os
_
};
ef
->
addSensitivityInfo
(
findSensitivity
);
if
(
ef
->
getEntryMethod
()
==
nullptr
)
{
_
os
<<
"ERROR"
;
os
_
<<
"ERROR"
;
continue
;
}
FindWait
findWaits
{
ef
->
getEntryMethod
(),
_
os
};
FindWait
findWaits
{
ef
->
getEntryMethod
(),
os
_
};
ef
->
addWaits
(
findWaits
);
FindNotify
findNotify
{
ef
->
_entryMethodDecl
,
_
os
};
FindNotify
findNotify
{
ef
->
_entryMethodDecl
,
os
_
};
ef
->
addNotifys
(
findNotify
);
/// Does not compile
...
...
@@ -139,18 +139,18 @@ bool SystemCConsumer::fire() {
}
/*
FindSCMain scmain(tu,
_
os);
FindSCMain scmain(tu, os
_
);
if (scmain.isSCMainFound())
{
FunctionDecl *fnDecl = scmain.getSCMainFunctionDecl();
FindSimTime scstart(fnDecl,
_
os);
FindSimTime scstart(fnDecl, os
_
);
_systemcModel->addSimulationTime(scstart.returnSimTime());
}
else {
_
os <<"\n Could not find SCMain";
os
_
<<"\n Could not find SCMain";
}
FindNetlist findNetlist(scmain.getSCMainFunctionDecl());
...
...
@@ -189,9 +189,9 @@ _systemcModel->addNetlist(findNetlist);
}
}
_
os
<<
"
\n
"
;
_
os
<<
"
\n
## SystemC model
\n
"
;
_systemcModel
->
dump
(
_
os
);
os
_
<<
"
\n
"
;
os
_
<<
"
\n
## SystemC model
\n
"
;
_systemcModel
->
dump
(
os
_
);
return
true
;
}
...
...
@@ -219,7 +219,7 @@ void SystemCConsumer::HandleTranslationUnit(ASTContext &context) {
}
SystemCConsumer
::
SystemCConsumer
(
CompilerInstance
&
ci
)
:
_
os
{
llvm
::
errs
()},
_sm
{
ci
.
getSourceManager
()},
:
os
_
{
llvm
::
errs
()},
_sm
{
ci
.
getSourceManager
()},
_context
{
ci
.
getASTContext
()},
_ci
{
ci
},
_systemcModel
{
nullptr
}
{}
SystemCConsumer
::~
SystemCConsumer
()
{
...
...
src/SystemCClang.h
View file @
8876d137
...
...
@@ -60,7 +60,7 @@ namespace scpar {
class
SystemCConsumer
:
public
ASTConsumer
,
public
RecursiveASTVisitor
<
SystemCConsumer
>
{
public:
llvm
::
raw_ostream
&
_
os
;
llvm
::
raw_ostream
&
os
_
;
SourceManager
&
_sm
;
SystemCConsumer
(
CompilerInstance
&
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment