Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
systemc-clang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
caesr-pub
systemc-clang
Commits
731af1ee
Commit
731af1ee
authored
Feb 11, 2019
by
rmrf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on PortDecl
parent
7e25e8e5
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
65 additions
and
43 deletions
+65
-43
src/CMakeLists.txt
src/CMakeLists.txt
+1
-1
src/FindSCModules.cpp
src/FindSCModules.cpp
+6
-6
src/FindSCModules.h
src/FindSCModules.h
+5
-5
src/Model.cpp
src/Model.cpp
+4
-4
src/Model.h
src/Model.h
+2
-2
src/ModuleDecl.cpp
src/ModuleDecl.cpp
+9
-9
src/ModuleDecl.h
src/ModuleDecl.h
+13
-9
src/PortDecl.cpp
src/PortDecl.cpp
+15
-3
src/PortDecl.h
src/PortDecl.h
+6
-0
src/SystemCClang.cpp
src/SystemCClang.cpp
+3
-3
src/SystemCClang.h
src/SystemCClang.h
+1
-1
No files found.
src/CMakeLists.txt
View file @
731af1ee
add_library
(
libsystemc-clang
ModuleDecl.cpp
FindModule.cpp
SCModules.cpp
Find
SCModules.cpp
FindSCMain.cpp
FindPorts.cpp
FindTLMInterfaces.cpp
...
...
src/SCModules.cpp
→
src/
Find
SCModules.cpp
View file @
731af1ee
#include "SCModules.h"
#include "
Find
SCModules.h"
#include "FindModule.h"
#include "clang/AST/ASTContext.h"
using
namespace
scpar
;
SCModules
::
SCModules
(
TranslationUnitDecl
*
tuDecl
,
llvm
::
raw_ostream
&
os
)
FindSCModules
::
Find
SCModules
(
TranslationUnitDecl
*
tuDecl
,
llvm
::
raw_ostream
&
os
)
:
_os
(
os
)
{
assert
(
!
(
tuDecl
==
nullptr
));
TraverseDecl
(
tuDecl
);
}
SCModules
::~
SCModules
()
{}
FindSCModules
::~
Find
SCModules
()
{}
bool
SCModules
::
VisitCXXRecordDecl
(
CXXRecordDecl
*
cxxDecl
)
{
bool
Find
SCModules
::
VisitCXXRecordDecl
(
CXXRecordDecl
*
cxxDecl
)
{
FindModule
mod
(
cxxDecl
,
_os
);
if
(
!
mod
.
isSystemCModule
())
{
...
...
@@ -22,11 +22,11 @@ bool SCModules::VisitCXXRecordDecl(CXXRecordDecl *cxxDecl) {
return
true
;
}
SCModules
::
moduleMapType
SCModules
::
getSystemCModulesMap
()
{
FindSCModules
::
moduleMapType
Find
SCModules
::
getSystemCModulesMap
()
{
return
_moduleMap
;
}
void
SCModules
::
dump
()
{
void
Find
SCModules
::
dump
()
{
_os
<<
"
\n
================= SCModules ================"
;
_os
<<
"
\n
Print SystemC Module Map"
;
for
(
moduleMapType
::
iterator
mit
=
_moduleMap
.
begin
();
...
...
src/SCModules.h
→
src/
Find
SCModules.h
View file @
731af1ee
#ifndef _SC_MODULES_H_
#define _SC_MODULES_H_
#ifndef _
FIND_
SC_MODULES_H_
#define _
FIND_
SC_MODULES_H_
#include "clang/AST/DeclCXX.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "llvm/Support/raw_ostream.h"
...
...
@@ -11,13 +11,13 @@ namespace scpar {
using
namespace
clang
;
using
namespace
std
;
class
SCModules
:
public
RecursiveASTVisitor
<
SCModules
>
{
class
FindSCModules
:
public
RecursiveASTVisitor
<
Find
SCModules
>
{
public:
typedef
map
<
string
,
CXXRecordDecl
*>
moduleMapType
;
typedef
pair
<
string
,
CXXRecordDecl
*>
modulePairType
;
SCModules
(
TranslationUnitDecl
*
,
llvm
::
raw_ostream
&
);
virtual
~
SCModules
();
Find
SCModules
(
TranslationUnitDecl
*
,
llvm
::
raw_ostream
&
);
virtual
~
Find
SCModules
();
virtual
bool
VisitCXXRecordDecl
(
CXXRecordDecl
*
);
moduleMapType
getSystemCModulesMap
();
void
dump
();
...
...
src/Model.cpp
View file @
731af1ee
#include "Model.h"
#include "
SCModules.h"
//#include "Find
SCModules.h"
#include <string>
using
namespace
scpar
;
...
...
@@ -104,10 +104,10 @@ void Model::updateModuleDecl() {
}
}
void
Model
::
addSCModules
(
SCModules
*
m
)
{
SCModules
::
moduleMapType
mods
=
m
->
getSystemCModulesMap
();
void
Model
::
addSCModules
(
Find
SCModules
*
m
)
{
Find
SCModules
::
moduleMapType
mods
=
m
->
getSystemCModulesMap
();
for
(
SCModules
::
moduleMapType
::
iterator
mit
=
mods
.
begin
();
mit
!=
mods
.
end
();
for
(
Find
SCModules
::
moduleMapType
::
iterator
mit
=
mods
.
begin
();
mit
!=
mods
.
end
();
mit
++
)
{
addModuleDecl
(
new
ModuleDecl
(
mit
->
first
,
mit
->
second
));
}
...
...
src/Model.h
View file @
731af1ee
...
...
@@ -7,7 +7,7 @@
#include "FindNetlist.h"
#include "FindSimTime.h"
#include "ModuleDecl.h"
#include "SCModules.h"
#include "
Find
SCModules.h"
#include "SCuitable/FindGPUMacro.h"
#include "clang/AST/DeclCXX.h"
#include <map>
...
...
@@ -37,7 +37,7 @@ public:
Model
();
~
Model
();
void
addSCModules
(
SCModules
*
);
void
addSCModules
(
Find
SCModules
*
);
void
addModuleDecl
(
ModuleDecl
*
);
void
addModuleDeclInstances
(
ModuleDecl
*
,
vector
<
ModuleDecl
*>
);
void
addSimulationTime
(
FindSimTime
::
simulationTimeMapType
);
...
...
src/ModuleDecl.cpp
View file @
731af1ee
...
...
@@ -150,7 +150,7 @@ void ModuleDecl::addProcess(FindEntryFunctions::entryFunctionVectorType *efv) {
break
;
}
}
_processes
.
insert
(
process_map_
.
insert
(
processPairType
(
entryName
,
new
ProcessDecl
(
entryType
,
entryName
,
ef
->
_entryMethodDecl
,
ef
)));
}
...
...
@@ -164,7 +164,7 @@ vector<EntryFunctionContainer *> ModuleDecl::getEntryFunctionContainer() {
int
ModuleDecl
::
getNumInstances
()
{
return
_instanceList
.
size
();
}
ModuleDecl
::
processMapType
ModuleDecl
::
getProcessMap
()
{
return
_processes
;
}
ModuleDecl
::
processMapType
ModuleDecl
::
getProcessMap
()
{
return
process_map_
;
}
ModuleDecl
::
portMapType
ModuleDecl
::
getOPorts
()
{
return
_oports
;
}
...
...
@@ -216,10 +216,10 @@ void ModuleDecl::dumpSignalBinding(raw_ostream &os, int tabn) {
}
void
ModuleDecl
::
dumpProcesses
(
raw_ostream
&
os
,
int
tabn
)
{
if
(
_processes
.
size
()
==
0
)
{
if
(
process_map_
.
empty
()
)
{
os
<<
"none
\n
"
;
}
else
{
for
(
auto
pit
:
_processes
)
{
for
(
auto
pit
:
process_map_
)
{
ProcessDecl
*
pd
=
pit
.
second
;
pd
->
dump
(
os
);
os
<<
"
\n
"
;
...
...
src/ModuleDecl.h
View file @
731af1ee
...
...
@@ -20,17 +20,21 @@ using namespace std;
class
ModuleDecl
{
public:
typedef
pair
<
string
,
Signal
*
>
signalPairType
;
typedef
map
<
string
,
Signal
*
>
signalMapType
;
typedef
pair
<
string
,
Signal
*
>
signalPairType
;
typedef
map
<
string
,
Signal
*
>
signalMapType
;
typedef
pair
<
string
,
PortDecl
*>
portPairType
;
typedef
map
<
string
,
PortDecl
*>
portMapType
;
// Maps the name of the port with a pointer to a structure that holds
// information about the port.
typedef
pair
<
string
,
PortDecl
*
>
portPairType
;
typedef
map
<
string
,
PortDecl
*
>
portMapType
;
typedef
pair
<
string
,
InterfaceDecl
*
>
interfacePairType
;
typedef
map
<
string
,
InterfaceDecl
*
>
interfaceMapType
;
typedef
pair
<
string
,
InterfaceDecl
*
>
interfacePairType
;
typedef
map
<
string
,
InterfaceDecl
*
>
interfaceMapType
;
typedef
pair
<
string
,
ProcessDecl
*>
processPairType
;
typedef
map
<
string
,
ProcessDecl
*>
processMapType
;
// Maps the name of the process with a pointer to a structure that holds
// information about the process.
typedef
pair
<
string
,
ProcessDecl
*
>
processPairType
;
typedef
map
<
string
,
ProcessDecl
*
>
processMapType
;
typedef
pair
<
string
,
string
>
moduleProcessPairType
;
...
...
@@ -86,7 +90,7 @@ private:
CXXRecordDecl
*
class_decl_
;
Stmt
*
constructor_stmt_
;
processMapType
_processes
;
processMapType
process_map_
;
portMapType
_iports
;
portMapType
_oports
;
portMapType
_ioports
;
...
...
src/PortDecl.cpp
View file @
731af1ee
//#include <string>
#include "PortDecl.h"
#include "FindTemplateTypes.h"
using
namespace
scpar
;
using
namespace
std
;
PortDecl
::~
PortDecl
()
{
if
(
template_type_
!=
nullptr
)
{
if
(
template_type_
!=
nullptr
)
{
delete
template_type_
;
template_type_
=
nullptr
;
}
}
...
...
@@ -32,4 +33,15 @@ void PortDecl::dump(llvm::raw_ostream &os, int tabn) {
// << template_type_;
os
<<
"Port name: "
<<
port_name_
<<
" "
;
template_type_
->
printTemplateArguments
(
os
);
dump_json
();
}
json
PortDecl
::
dump_json
()
{
json
port_j
;
port_j
[
"module_name"
]
=
getName
();
//port_j["template_type"]
return
port_j
;
}
src/PortDecl.h
View file @
731af1ee
#ifndef _PORT_DECL_H_
#define _PORT_DECL_H_
#include "systemc-clang.h"
#include "json.hpp"
#include <map>
#include <string>
...
...
@@ -10,6 +13,7 @@
namespace
scpar
{
using
namespace
clang
;
using
namespace
std
;
using
json
=
nlohmann
::
json
;
class
PortDecl
{
public:
...
...
@@ -29,6 +33,8 @@ public:
// Print
void
dump
(
raw_ostream
&
,
int
tabn
=
0
);
json
dump_json
();
private:
string
port_name_
;
FindTemplateTypes
*
template_type_
;
...
...
src/SystemCClang.cpp
View file @
731af1ee
...
...
@@ -16,16 +16,16 @@ bool SystemCConsumer::fire() {
_systemcModel
=
new
Model
{};
// Find the sc_modules
SCModules
scmod
{
tu
,
_os
};
Find
SCModules
scmod
{
tu
,
_os
};
// ANI : Do we need FindGlobalEvents?
FindGlobalEvents
fglobals
{
tu
,
_os
};
FindGlobalEvents
::
globalEventMapType
eventMap
{
fglobals
.
getEventMap
()};
_systemcModel
->
addGlobalEvents
(
eventMap
);
SCModules
::
moduleMapType
scmodules
{
scmod
.
getSystemCModulesMap
()};
Find
SCModules
::
moduleMapType
scmodules
{
scmod
.
getSystemCModulesMap
()};
for
(
SCModules
::
moduleMapType
::
iterator
mit
=
scmodules
.
begin
(),
for
(
Find
SCModules
::
moduleMapType
::
iterator
mit
=
scmodules
.
begin
(),
mitend
=
scmodules
.
end
();
mit
!=
mitend
;
++
mit
)
{
ModuleDecl
*
md
=
new
ModuleDecl
{
mit
->
first
,
mit
->
second
};
...
...
src/SystemCClang.h
View file @
731af1ee
...
...
@@ -45,7 +45,7 @@ using namespace clang::tooling;
#include "FindTLMInterfaces.h"
#include "FindWait.h"
#include "Model.h"
#include "SCModules.h"
#include "
Find
SCModules.h"
#include "SCuitable/FindGPUMacro.h"
#include "SCuitable/GlobalSuspensionAutomata.h"
#include "SuspensionAutomata.h"
...
...
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