Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
MiniEDA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
MiniEDA
Commits
44ce7a53
Commit
44ce7a53
authored
Jan 01, 2023
by
lvzhengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use OpenSTA's verilog parser
parent
97d27f12
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
199 additions
and
40 deletions
+199
-40
src/CMakeLists.txt
+2
-3
src/db_mgr/include/db_mgr/db_mgr.h
+5
-2
src/db_mgr/src/db_mgr.cpp
+3
-0
src/db_mgr/src/parsers/verilog_parser/CMakeLists.txt
+1
-11
src/db_mgr/src/parsers/verilog_parser/verilog_parser.cpp
+37
-19
src/db_mgr/src/parsers/verilog_parser/verilog_parser.h
+11
-5
src/db_mgr/src/parsers/verilog_parser_old/CMakeLists.txt
+29
-0
src/db_mgr/src/parsers/verilog_parser_old/verilog_database.cpp
+0
-0
src/db_mgr/src/parsers/verilog_parser_old/verilog_database.h
+0
-0
src/db_mgr/src/parsers/verilog_parser_old/verilog_parser.cpp
+64
-0
src/db_mgr/src/parsers/verilog_parser_old/verilog_parser.h
+47
-0
No files found.
src/CMakeLists.txt
View file @
44ce7a53
...
...
@@ -89,7 +89,6 @@ add_compile_options(
add_subdirectory
(
main
)
add_subdirectory
(
utl
)
add_subdirectory
(
odb
)
add_subdirectory
(
thirdparty
)
add_subdirectory
(
db_mgr
)
# add_subdirectory(thirdparty)
add_subdirectory
(
sta
)
add_subdirectory
(
db_mgr
)
src/db_mgr/include/db_mgr/db_mgr.h
View file @
44ce7a53
...
...
@@ -19,6 +19,10 @@ namespace utl {
class
Logger
;
}
namespace
sta
{
class
Sta
;
}
namespace
eda
{
namespace
db_mgr
{
...
...
@@ -93,9 +97,8 @@ private:
std
::
unique_ptr
<
odb
::
lefin
>
lef_parser_
;
std
::
unique_ptr
<
odb
::
defin
>
def_parser_
;
// use Limbo's verilog parser
std
::
unique_ptr
<
VParser
>
verilog_parser_
;
std
::
unique_ptr
<
sta
::
Sta
>
sta_
;
};
}
// namespace db_mgr
}
// namespace eda
...
...
src/db_mgr/src/db_mgr.cpp
View file @
44ce7a53
...
...
@@ -4,6 +4,7 @@
#include "defin.h"
#include "utl/Logger.h"
#include "verilog_parser.h"
#include "sta/Sta.hh"
#include <cstring>
...
...
@@ -26,9 +27,11 @@ void DbMgr::init(utl::Logger* logger)
setLogger
(
logger
);
lib_db_
=
odb
::
dbDatabase
::
create
();
lef_parser_
=
std
::
make_unique
<
odb
::
lefin
>
(
lib_db_
,
logger_
,
false
);
sta_
=
std
::
make_unique
<
sta
::
Sta
>
();
// def_parser_
verilog_parser_
=
std
::
make_unique
<
VParser
>
();
verilog_parser_
->
setLogger
(
logger_
);
verilog_parser_
->
setSta
(
sta_
.
get
());
}
DbMgr
::~
DbMgr
()
...
...
src/db_mgr/src/parsers/verilog_parser/CMakeLists.txt
View file @
44ce7a53
...
...
@@ -2,27 +2,17 @@ add_library(db_mgr_verilog_parser)
target_sources
(
db_mgr_verilog_parser
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
/verilog_database.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/verilog_parser.cpp
)
target_include_directories
(
db_mgr_verilog_parser
PUBLIC
.
PRIVATE
${
LIMBO_HOME
}
)
target_link_libraries
(
db_mgr_verilog_parser
PUBLIC
odb
utl
PRIVATE
verilogparser
# built in thirdparty Limbo
Boost::boost
)
target_compile_options
(
db_mgr_verilog_parser
PRIVATE
-D_GLIBCXX_USE_CXX11_ABI=0
# to avoid the std::string bug
OpenSTA
)
src/db_mgr/src/parsers/verilog_parser/verilog_parser.cpp
View file @
44ce7a53
#include "verilog_parser.h"
#include "verilog_database.h"
#include "utl/Logger.h"
#include "db.h"
#include <cstring>
#define _GLIBCXX_USE_CXX11_ABI 0
#include "sta/VerilogReader.hh"
// TODO: add VerilogWriter later
// #include "VerilogWriter.hh"
#include "sta/Sta.hh"
namespace
eda
{
namespace
db_mgr
{
VParser
::
VParser
()
:
current_block_
(
nullptr
),
odb_
(
nullptr
),
logger_
(
nullptr
)
:
logger_
(
nullptr
),
current_block_
(
nullptr
),
odb_
(
nullptr
),
sta_
(
nullptr
)
{}
VParser
::
VParser
(
utl
::
Logger
*
logger
,
odb
::
dbDatabase
*
db
,
sta
::
Sta
*
sta
)
{
v_db_
=
std
::
make_unique
<
VDb
>
();
setLogger
(
logger
);
setOdb
(
db
);
setSta
(
sta
);
}
void
VParser
::
setLogger
(
utl
::
Logger
*
logger
)
{
v_db_
->
setLogger
(
logger
);
logger_
=
logger
;
}
void
VParser
::
setOdb
(
odb
::
dbDatabase
*
db
)
{
v_db_
->
setOdb
(
db
);
odb_
=
db
;
if
(
db
!=
nullptr
)
{
current_block_
=
db
->
getChip
()
->
getBlock
();
}
}
bool
VParser
::
read
(
const
char
*
design_name
,
const
char
*
v_file
)
void
VParser
::
setSta
(
sta
::
Sta
*
sta
)
{
std
::
string
design_name_str
(
design_name
,
std
::
strlen
(
design_name
));
std
::
string
v_file_str
(
v_file
,
std
::
strlen
(
v_file
));
return
read
(
design_name_str
,
v_file_str
);
sta_
=
sta
;
}
bool
VParser
::
read
(
std
::
string
const
&
design_name
,
std
::
string
const
&
v_file
)
{
return
read
(
design_name
.
c_str
(),
v_file
.
c_str
());
}
bool
VParser
::
read
(
const
char
*
design_name
,
const
char
*
v_file
)
{
if
(
current_block_
==
nullptr
)
{
return
false
;
}
if
(
current_block_
->
getConstName
()
!=
design_name
)
{
return
false
;
}
VDb
v_db
;
v_db
.
setLogger
(
logger_
);
v_db
.
setOdb
(
odb_
);
return
VerilogParser
::
read
(
v_db
,
v_file
);
sta
::
NetworkReader
*
network
=
sta_
->
networkReader
();
bool
flag
=
false
;
if
(
network
)
{
sta_
->
readNetlistBefore
();
flag
=
sta
::
readVerilogFile
(
v_file
,
network
);
}
else
{
return
false
;
}
if
(
!
flag
)
{
return
false
;
}
// TODO: copy results to OpenDB
return
true
;
}
VParser
::~
VParser
()
...
...
src/db_mgr/src/parsers/verilog_parser/verilog_parser.h
View file @
44ce7a53
#ifndef _VERILOG_PARSER_H_
#define _VERILOG_PARSER_H_
#include "
limbo/parsers/verilog/bison/VerilogDriver.
h"
#include "
sta/VerilogReader.h
h"
#include <string>
#include <memory>
namespace
odb
{
class
dbDatabase
;
...
...
@@ -14,17 +13,22 @@ namespace utl {
class
Logger
;
}
namespace
sta
{
class
Sta
;
}
namespace
eda
{
namespace
db_mgr
{
using
VerilogParser
::
read
;
class
VDb
;
class
VParser
{
public
:
VParser
();
VParser
(
utl
::
Logger
*
logger
,
odb
::
dbDatabase
*
db
,
sta
::
Sta
*
sta
);
~
VParser
();
bool
read
(
std
::
string
const
&
design_name
,
std
::
string
const
&
v_file
);
...
...
@@ -32,12 +36,14 @@ public:
const
char
*
v_file
);
void
setLogger
(
utl
::
Logger
*
logger
);
void
setOdb
(
odb
::
dbDatabase
*
db
);
void
setSta
(
sta
::
Sta
*
sta
);
private
:
std
::
unique_ptr
<
VDb
>
v_db_
;
odb
::
dbBlock
*
current_block_
;
odb
::
dbDatabase
*
odb_
;
utl
::
Logger
*
logger_
;
sta
::
Sta
*
sta_
;
};
}
// namsepace db_mgr
...
...
src/db_mgr/src/parsers/verilog_parser_old/CMakeLists.txt
0 → 100644
View file @
44ce7a53
add_library
(
db_mgr_verilog_parser
)
target_sources
(
db_mgr_verilog_parser
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
/verilog_database.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/verilog_parser.cpp
)
target_include_directories
(
db_mgr_verilog_parser
PUBLIC
.
PRIVATE
${
LIMBO_HOME
}
)
target_link_libraries
(
db_mgr_verilog_parser
PUBLIC
odb
utl
PRIVATE
verilogparser
# built in thirdparty Limbo
Boost::boost
OpenSTA
)
target_compile_options
(
db_mgr_verilog_parser
PRIVATE
-D_GLIBCXX_USE_CXX11_ABI=0
# to avoid the std::string bug
)
src/db_mgr/src/parsers/verilog_parser/verilog_database.cpp
→
src/db_mgr/src/parsers/verilog_parser
_old
/verilog_database.cpp
View file @
44ce7a53
File moved
src/db_mgr/src/parsers/verilog_parser/verilog_database.h
→
src/db_mgr/src/parsers/verilog_parser
_old
/verilog_database.h
View file @
44ce7a53
File moved
src/db_mgr/src/parsers/verilog_parser_old/verilog_parser.cpp
0 → 100644
View file @
44ce7a53
#include "verilog_parser.h"
#include "verilog_database.h"
#include "utl/Logger.h"
#include "db.h"
#include <cstring>
#define _GLIBCXX_USE_CXX11_ABI 0
namespace
eda
{
namespace
db_mgr
{
VParser
::
VParser
()
:
current_block_
(
nullptr
),
odb_
(
nullptr
),
logger_
(
nullptr
)
{
v_db_
=
std
::
make_unique
<
VDb
>
();
}
void
VParser
::
setLogger
(
utl
::
Logger
*
logger
)
{
v_db_
->
setLogger
(
logger
);
logger_
=
logger
;
}
void
VParser
::
setOdb
(
odb
::
dbDatabase
*
db
)
{
v_db_
->
setOdb
(
db
);
odb_
=
db
;
if
(
db
!=
nullptr
)
{
current_block_
=
db
->
getChip
()
->
getBlock
();
}
}
bool
VParser
::
read
(
const
char
*
design_name
,
const
char
*
v_file
)
{
std
::
string
design_name_str
(
design_name
,
std
::
strlen
(
design_name
));
std
::
string
v_file_str
(
v_file
,
std
::
strlen
(
v_file
));
return
read
(
design_name_str
,
v_file_str
);
}
bool
VParser
::
read
(
std
::
string
const
&
design_name
,
std
::
string
const
&
v_file
)
{
if
(
current_block_
==
nullptr
)
{
return
false
;
}
if
(
current_block_
->
getConstName
()
!=
design_name
)
{
return
false
;
}
VDb
v_db
;
v_db
.
setLogger
(
logger_
);
v_db
.
setOdb
(
odb_
);
return
VerilogParser
::
read
(
v_db
,
v_file
);
}
VParser
::~
VParser
()
{}
}
// db_mgr
}
//
eda
\ No newline at end of file
src/db_mgr/src/parsers/verilog_parser_old/verilog_parser.h
0 → 100644
View file @
44ce7a53
#ifndef _VERILOG_PARSER_H_
#define _VERILOG_PARSER_H_
#include "limbo/parsers/verilog/bison/VerilogDriver.h"
#include "sta/VerilogReader.hh"
#include <string>
#include <memory>
namespace
odb
{
class
dbDatabase
;
class
dbBlock
;
}
namespace
utl
{
class
Logger
;
}
namespace
eda
{
namespace
db_mgr
{
using
VerilogParser
::
read
;
class
VDb
;
class
VParser
{
public
:
VParser
();
~
VParser
();
bool
read
(
std
::
string
const
&
design_name
,
std
::
string
const
&
v_file
);
bool
read
(
const
char
*
design_name
,
const
char
*
v_file
);
void
setLogger
(
utl
::
Logger
*
logger
);
void
setOdb
(
odb
::
dbDatabase
*
db
);
private
:
std
::
unique_ptr
<
VDb
>
v_db_
;
odb
::
dbBlock
*
current_block_
;
odb
::
dbDatabase
*
odb_
;
utl
::
Logger
*
logger_
;
};
}
// namsepace db_mgr
}
// namsepace eda
#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