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
b1500981
Commit
b1500981
authored
Nov 26, 2022
by
lvzhengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
link db_mgr to minieda
parent
3bdafcdd
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
32 deletions
+87
-32
src/db_mgr/CMakeLists.txt
+1
-0
src/db_mgr/include/db_mgr/MakeDbMgr.h
+21
-0
src/db_mgr/include/db_mgr/db_mgr.h
+10
-2
src/db_mgr/src/MakeDbMgr.cpp
+12
-0
src/db_mgr/src/db_mgr.cpp
+22
-2
src/main/CMakeLists.txt
+1
-1
src/main/MiniEda.cc
+9
-9
src/main/MiniEda.i
+5
-8
src/main/include/eda/MiniEda.hh
+6
-10
No files found.
src/db_mgr/CMakeLists.txt
View file @
b1500981
...
...
@@ -7,6 +7,7 @@ add_library(db_mgr)
target_sources
(
db_mgr
PRIVATE
src/db_mgr.cpp
src/MakeDbMgr.cpp
)
target_include_directories
(
db_mgr
...
...
src/db_mgr/include/db_mgr/MakeDbMgr.h
View file @
b1500981
#pragma once
namespace
eda
{
namespace
db_mgr
{
class
DbMgr
;
}
/*
* this is one of the components of minieda, and
* minieda should first call make*Comp*(), then
* call init*Comp*(this)
*/
// simply return a ptr
db_mgr
::
DbMgr
*
makeDbMgr
();
// initDbMgr();
}
//
namespace
eda
\ No newline at end of file
src/db_mgr/include/db_mgr/db_mgr.h
View file @
b1500981
...
...
@@ -8,6 +8,7 @@
namespace
odb
{
class
dbDatabase
;
class
lefin
;
}
// Logger symbol: MGR
...
...
@@ -16,6 +17,8 @@ class Logger;
}
namespace
eda
{
namespace
db_mgr
{
/* DB Manager: for hierarchical design. A hierarchical design
* contains multiple sub-block within the 'top' module. Because
* dbBlock class in OpenDB only supports two-levels of hierarchy,
...
...
@@ -41,8 +44,8 @@ namespace eda {
class
DbMgr
{
public
:
DbMgr
();
void
delete
DbMgr
();
// dbDatadase::destroy()
bool
readLibDB
();
~
DbMgr
();
// dbDatadase::destroy()
bool
readLibDB
(
const
char
*
path
);
/*
bool readBlockDBs();
bool addBlockDB();
...
...
@@ -51,6 +54,7 @@ public:
bool
haveBlockDB
(
std
::
string
block
);
void
setLogger
(
utl
::
Logger
*
logger
);
void
init
(
utl
::
Logger
*
logger
);
private
:
/* all Blocks share the same lib (.lef files)
...
...
@@ -67,7 +71,11 @@ private:
std
::
unordered_map
<
std
::
string
,
odb
::
dbDatabase
*>
block_dbs_
;
utl
::
Logger
*
logger_
;
// parsers
odb
::
lefin
*
lef_parser_
;
};
}
// namespace db_mgr
}
// namespace eda
#endif // _DB_MGR_H_
src/db_mgr/src/MakeDbMgr.cpp
View file @
b1500981
#include "db_mgr/MakeDbMgr.h"
#include "db_mgr/db_mgr.h"
namespace
eda
{
db_mgr
::
DbMgr
*
makeDbMgr
()
{
return
new
db_mgr
::
DbMgr
();
}
}
//
namespace
eda
\ No newline at end of file
src/db_mgr/src/db_mgr.cpp
View file @
b1500981
#include <libgen.h> // for basename()
#include "db_mgr/db_mgr.h"
#include "db.h"
#include "lefin.h"
#include "utl/Logger.h"
namespace
eda
{
namespace
db_mgr
{
DbMgr
::
DbMgr
()
:
lib_db_
(
nullptr
),
...
...
@@ -11,7 +15,16 @@ DbMgr::DbMgr()
block_dbs_
.
clear
();
}
void
DbMgr
::
deleteDbMgr
()
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
);
}
DbMgr
::~
DbMgr
()
{
if
(
lib_db_
!=
nullptr
)
{
lib_db_
->
destroy
(
lib_db_
);
...
...
@@ -36,10 +49,17 @@ void DbMgr::setLogger(utl::Logger* logger)
logger_
=
logger
;
}
bool
DbMgr
::
readLibDB
()
bool
DbMgr
::
readLibDB
(
const
char
*
path
)
{
const
char
*
libname
=
basename
(
const_cast
<
char
*>
(
path
));
if
(
!
lib_db_
->
getTech
())
{
return
lef_parser_
->
createTechAndLib
(
libname
,
path
)
!=
nullptr
;
}
else
{
return
lef_parser_
->
createLib
(
libname
,
path
)
!=
nullptr
;
}
return
true
;
}
}
// namespace db_mgr
}
// namespace eda
src/main/CMakeLists.txt
View file @
b1500981
...
...
@@ -4,7 +4,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/src/cmake")
include
(
"swig_lib"
)
# paths for submodule
set
(
odb
_HOME
${
PROJECT_SOURCE_DIR
}
/src/odb
)
set
(
ODB
_HOME
${
PROJECT_SOURCE_DIR
}
/src/odb
)
# main program source
set
(
MINIEDA_SOURCE
...
...
src/main/MiniEda.cc
View file @
b1500981
...
...
@@ -4,7 +4,8 @@
#include "utl/MakeLogger.h"
#include "utl/Logger.h"
#include "utl/tcl_utl.h"
#include "odb/db.h"
#include "db_mgr/db_mgr.h"
#include "db_mgr/MakeDbMgr.h"
namespace
eda
{
extern
const
char
*
minieda_swig_tcl_inits
[];
...
...
@@ -24,19 +25,16 @@ namespace eda {
using
utl
::
evalTclInit
;
using
utl
::
initTclUtil
;
using
odb
::
dbDatabase
;
MiniEda
::
MiniEda
()
:
tcl_interp_
(
nullptr
),
logger_
(
nullptr
),
db_
(
nullptr
)
{
}
db_mgr_
(
nullptr
)
{}
MiniEda
::~
MiniEda
()
{
odb
::
dbDatabase
::
destroy
(
db_
)
;
delete
db_mgr_
;
delete
logger_
;
}
...
...
@@ -68,16 +66,18 @@ void MiniEda::init(Tcl_Interp* interp)
}
logger_
=
makeLogger
(
log_filename
,
metrics_filename
);
db_
=
dbDatabase
::
create
();
db_
mgr_
=
makeDbMgr
();
// Init components.
Minieda_swig_Init
(
interp
);
// Import TCL scripts
initTclUtil
(
interp
);
evalTclInit
(
interp
,
eda
::
minieda_swig_tcl_inits
);
evalTclInit
(
interp
,
minieda_swig_tcl_inits
);
// defined in MakeModuleXX.h
initLogger
(
logger_
,
interp
);
// TOBE implemented
// initDbMgr(this);
}
}
// namespace eda
src/main/MiniEda.i
View file @
b1500981
...
...
@@ -3,6 +3,7 @@
#include "eda/MiniEda.hh"
#include "utl/Logger.h"
#include "odb/db.h"
#include "db_mgr/db_mgr.h"
////////////////////////////////////////////////////////////////
//
...
...
@@ -23,17 +24,18 @@ utl::Logger* getLogger()
return MiniEda::miniEda()->getLogger();
}
odb::dbDatabase* getDb()
/*
db_mgr::DbMgr* getDbMgr()
{
return MiniEda::miniEda()->getDb();
return MiniEda::miniEda()->getDb
Mgr
();
}
*/
} // namespace eda
using eda::MiniEda;
using eda::getMiniEda;
using eda::getLogger;
using eda::getDb;
%}
...
...
@@ -62,11 +64,6 @@ void logger_echo(const char* usr_input)
getLogger()->info(utl::EDA, 1, usr_input);
}
odb::dbDatabase* get_db()
{
return getDb();
}
}
%} // inline
...
...
src/main/include/eda/MiniEda.hh
View file @
b1500981
...
...
@@ -8,12 +8,12 @@ namespace utl {
class
Logger
;
}
namespace
odb
{
class
dbDatabase
;
}
namespace
eda
{
namespace
db_mgr
{
class
DbMgr
;
}
class
MiniEda
{
public
:
...
...
@@ -22,9 +22,7 @@ public:
Tcl_Interp
*
tclInterp
()
{
return
tcl_interp_
;
}
utl
::
Logger
*
getLogger
()
{
return
logger_
;
}
// currently, we use db directly
// TODO: makes a db manager
odb
::
dbDatabase
*
getDb
()
{
return
db_
;
}
db_mgr
::
DbMgr
*
getDbMgr
()
{
return
db_mgr_
;
}
protected
:
~
MiniEda
();
...
...
@@ -35,9 +33,7 @@ private:
Tcl_Interp
*
tcl_interp_
;
utl
::
Logger
*
logger_
;
// currently, we use db directly
// TODO: makes a db manager
odb
::
dbDatabase
*
db_
;
db_mgr
::
DbMgr
*
db_mgr_
;
};
int
tclAppInit
(
Tcl_Interp
*
interp
);
...
...
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