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
374c8b04
Commit
374c8b04
authored
Nov 28, 2022
by
lvzhengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement read_lef
parent
b1500981
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
137 additions
and
39 deletions
+137
-39
.vscode/settings.json
+8
-0
README.md
+6
-4
src/db_mgr/CMakeLists.txt
+8
-4
src/db_mgr/include/db_mgr/MakeDbMgr.h
+4
-1
src/db_mgr/include/db_mgr/db_mgr.h
+4
-3
src/db_mgr/src/MakeDbMgr.cpp
+19
-2
src/db_mgr/src/db_mgr.cpp
+17
-15
src/db_mgr/src/db_mgr.i
+31
-0
src/db_mgr/src/db_mgr.tcl
+32
-0
src/main/MiniEda.cc
+1
-2
src/main/MiniEda.i
+6
-3
src/main/MiniEda.tcl
+0
-4
src/utl/src/Logger.i
+1
-1
No files found.
.vscode/settings.json
0 → 100644
View file @
374c8b04
{
"C_Cpp.default.configurationProvider"
:
"go2sh.cmake-integration"
,
"files.associations"
:
{
"*.cps"
:
"javascript"
,
"logger.h"
:
"c"
}
}
\ No newline at end of file
README.md
View file @
374c8b04
...
...
@@ -5,14 +5,12 @@
## TODO
*
add OpenDB
*
with swig
*
use the original OpenDB, and build the tcl api by myself.
*
add DB Manager
*
manager multi block circuits. Because OpenDB supports only 2-level hierarchical dbBlock.
*
each db is a block?
*
clean up Util.tcl
## DONE
### 2022.10.30
...
...
@@ -37,3 +35,7 @@
*
logger: based on spdlog
*
tcl_utl: evalTclInit which decode the user defined tcl scripts.
### 2022.11.27
*
add OpenDB
src/db_mgr/CMakeLists.txt
View file @
374c8b04
include
(
"swig_lib"
)
# swig_lib()
add_library
(
db_mgr
)
swig_lib
(
NAME db_mgr
NAMESPACE db_mgr
I_FILE src/db_mgr.i
SCRIPTS src/db_mgr.tcl
SWIG_INCLUDES
${
MINIEDA_HOME
}
/src/utl
)
target_sources
(
db_mgr
PRIVATE
...
...
@@ -13,10 +16,11 @@ target_sources(db_mgr
target_include_directories
(
db_mgr
PUBLIC
include
${
MINIEDA_HOME
}
/src/main/include
)
target_link_libraries
(
db_mgr
P
RIVATE
P
UBLIC
odb
utl
)
...
...
src/db_mgr/include/db_mgr/MakeDbMgr.h
View file @
374c8b04
...
...
@@ -6,6 +6,8 @@ namespace db_mgr {
class
DbMgr
;
}
class
MiniEda
;
/*
* this is one of the components of minieda, and
* minieda should first call make*Comp*(), then
...
...
@@ -15,6 +17,6 @@ class DbMgr;
// simply return a ptr
db_mgr
::
DbMgr
*
makeDbMgr
();
// initDbMgr(
);
void
initDbMgr
(
MiniEda
*
minieda
);
}
//
namespace
eda
\ No newline at end of file
src/db_mgr/include/db_mgr/db_mgr.h
View file @
374c8b04
...
...
@@ -5,6 +5,7 @@
#include <unordered_map>
#include <string>
#include <memory>
namespace
odb
{
class
dbDatabase
;
...
...
@@ -45,7 +46,8 @@ class DbMgr {
public
:
DbMgr
();
~
DbMgr
();
// dbDatadase::destroy()
bool
readLibDB
(
const
char
*
path
);
bool
readLibDB
(
const
char
*
path
,
const
char
*
libname
,
bool
isTech
=
false
,
bool
isLib
=
true
);
/*
bool readBlockDBs();
bool addBlockDB();
...
...
@@ -72,8 +74,7 @@ private:
utl
::
Logger
*
logger_
;
// parsers
odb
::
lefin
*
lef_parser_
;
std
::
unique_ptr
<
odb
::
lefin
>
lef_parser_
;
};
}
// namespace db_mgr
}
// namespace eda
...
...
src/db_mgr/src/MakeDbMgr.cpp
View file @
374c8b04
#include <tcl.h>
#include "db_mgr/MakeDbMgr.h"
#include "db_mgr/db_mgr.h"
#include "utl/Logger.h"
#include "utl/tcl_utl.h"
#include "eda/MiniEda.hh"
extern
"C"
{
extern
int
Db_mgr_Init
(
Tcl_Interp
*
interp
);
}
namespace
eda
{
extern
const
char
*
db_mgr_tcl_inits
[];
db_mgr
::
DbMgr
*
makeDbMgr
()
{
return
new
db_mgr
::
DbMgr
();
}
}
//
namespace
eda
\ No newline at end of file
void
initDbMgr
(
MiniEda
*
minieda
)
{
Tcl_Interp
*
interp
=
minieda
->
tclInterp
();
utl
::
evalTclInit
(
interp
,
db_mgr_tcl_inits
);
minieda
->
getDbMgr
()
->
init
(
minieda
->
getLogger
());
Db_mgr_Init
(
interp
);
}
}
// namespace eda
src/db_mgr/src/db_mgr.cpp
View file @
374c8b04
#include <libgen.h> // for basename()
#include "db_mgr/db_mgr.h"
#include "db.h"
#include "lefin.h"
...
...
@@ -18,21 +16,19 @@ DbMgr::DbMgr()
void
DbMgr
::
init
(
utl
::
Logger
*
logger
)
{
setLogger
(
logger
);
lib_db_
=
new
odb
::
dbDatabase
();
bool
ignore_non_routing_layers
=
false
;
lef_parser_
=
new
odb
::
lefin
(
lib_db_
,
logger_
,
ignore_non_routing_layers
);
lib_db_
=
odb
::
dbDatabase
::
create
();
lef_parser_
=
std
::
make_unique
<
odb
::
lefin
>
(
lib_db_
,
logger_
,
false
);
}
DbMgr
::~
DbMgr
()
{
if
(
lib_db_
!=
nullptr
)
{
lib_db_
->
destroy
(
lib_db_
);
odb
::
dbDatabase
::
destroy
(
lib_db_
);
}
if
(
!
block_dbs_
.
empty
())
{
for
(
auto
item
:
block_dbs_
)
{
odb
::
dbDatabase
*
block_
db
=
item
.
second
;
block_db
->
destroy
(
block_
db
);
odb
::
dbDatabase
*
db
=
item
.
second
;
odb
::
dbDatabase
::
destroy
(
db
);
}
block_dbs_
.
clear
();
}
...
...
@@ -49,17 +45,23 @@ void DbMgr::setLogger(utl::Logger* logger)
logger_
=
logger
;
}
bool
DbMgr
::
readLibDB
(
const
char
*
path
)
bool
DbMgr
::
readLibDB
(
const
char
*
path
,
const
char
*
libname
,
bool
isTech
,
bool
isLib
)
{
const
char
*
libname
=
basename
(
const_cast
<
char
*>
(
path
));
if
(
!
lib_db_
->
getTech
())
{
return
lef_parser_
->
createTechAndLib
(
libname
,
path
)
!=
nullptr
;
if
(
isTech
&&
isLib
)
{
lef_parser_
->
createTechAndLib
(
libname
,
path
);
}
else
if
(
isTech
&&
!
isLib
)
{
lef_parser_
->
createTech
(
path
);
}
else
if
(
!
isTech
&&
isLib
)
{
lef_parser_
->
createLib
(
libname
,
path
);
}
else
{
return
lef_parser_
->
createLib
(
libname
,
path
)
!=
nullptr
;
logger_
->
warn
(
utl
::
MGR
,
1
,
"Failed to read {}. LEF file must be Tech or Lib."
,
path
);
return
false
;
}
return
true
;
}
}
// namespace db_mgr
}
// namespace eda
src/db_mgr/src/db_mgr.i
0 → 100644
View file @
374c8b04
%{
#include "db_mgr/db_mgr.h"
#include "utl/Logger.h"
namespace eda {
// defined in MiniEda.i
utl::Logger* getLogger();
db_mgr::DbMgr* getDbMgr();
} // namespace eda
using eda::getDbMgr;
using eda::getLogger;
%}
%include "Exception.i"
%inline %{
namespace db_mgr {
bool read_lef(const char* file_path, const char* libname,
bool isTech, bool isLib)
{
return getDbMgr()->readLibDB(file_path, libname, isTech, isLib);
}
} // namespace db_mgr
%} // inline
src/db_mgr/src/db_mgr.tcl
0 → 100644
View file @
374c8b04
define_cmd_args
"read_lef"
{
[
-tech
]
\
[
-lib
]
\
lef_name
\
}
proc
read_lef
{
args
}
{
parse_key_args
"read_lef"
args
\
keys
{}
\
flags
{
-tech -library
}
set lef_name
[
file
nativename
[
lindex
$args
0
]]
if
{
!
[
file
exists
$lef
_name
]
}
{
utl::error
"MGR"
1
"
$lef
_name does not exist."
}
if
{
!
[
file
readable
$lef
_name
]
}
{
utl::error
"MGR"
2
"
$lef
_name is not readable."
}
set is_tech
[
info
exists flags
(
-tech
)]
if
{
$is
_tech
}
{
set is_lib
[
info
exists flags
(
-lib
)]
}
else
{
# default true
set is_lib 1
}
set lib_name
[
file
rootname
[
file
tail
$lef
_name
]]
db_mgr::read_lef
$lef
_name
$lib
_name
$is
_tech
$is
_lib
}
\ No newline at end of file
src/main/MiniEda.cc
View file @
374c8b04
...
...
@@ -76,8 +76,7 @@ void MiniEda::init(Tcl_Interp* interp)
// defined in MakeModuleXX.h
initLogger
(
logger_
,
interp
);
// TOBE implemented
// initDbMgr(this);
initDbMgr
(
this
);
}
}
// namespace eda
src/main/MiniEda.i
View file @
374c8b04
...
...
@@ -24,12 +24,10 @@ utl::Logger* getLogger()
return MiniEda::miniEda()->getLogger();
}
/*
db_mgr::DbMgr* getDbMgr()
{
return MiniEda::miniEda()->getDbMgr();
}
*/
} // namespace eda
...
...
@@ -46,7 +44,7 @@ using eda::getLogger;
////////////////////////////////////////////////////////////////
#ifdef SWIGTCL
// %include "../
Exception.i"
%include "
Exception.i"
// %typemap(in) utl::ToolId {
// int length;
...
...
@@ -64,6 +62,11 @@ void logger_echo(const char* usr_input)
getLogger()->info(utl::EDA, 1, usr_input);
}
// void read_lef(const char* lef_file)
// {
// getDbMgr()->readLibDB(lef_file);
// }
}
%} // inline
...
...
src/main/MiniEda.tcl
View file @
374c8b04
...
...
@@ -8,7 +8,3 @@ proc simple_test {args} {
parse_key_args
"simple_test"
args keys
{
-tmp
}
logger_echo
$keys
(
-tmp
)
}
proc
get_db
{}
{
eda::get_db
}
src/utl/src/Logger.i
View file @
374c8b04
...
...
@@ -55,7 +55,7 @@ using eda::getLogger;
}
// Catch exceptions in inline functions.
// %include "../../
Exception.i"
%include "
Exception.i"
%inline %{
...
...
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