Commit 8b471d37 by lvzhengyang

fix bugs of last commit

parent 0f90bd91
...@@ -28,3 +28,8 @@ target_link_libraries(db_mgr ...@@ -28,3 +28,8 @@ target_link_libraries(db_mgr
PRIVATE PRIVATE
db_mgr_verilog_parser db_mgr_verilog_parser
) )
# target_compile_options(db_mgr
# PRIVATE
# -D_GLIBCXX_USE_CXX11_ABI=0 # to avoid the std::string bug
# )
\ No newline at end of file
...@@ -63,10 +63,8 @@ public: ...@@ -63,10 +63,8 @@ public:
bool cont_on_err, bool cont_on_err,
bool is_floorplan, bool is_floorplan,
bool is_incr); // incr: incremental bool is_incr); // incr: incremental
// bool readVerilog(const char* design_name, bool readVerilog(const char* design_name,
// const char* v_file); const char* v_file);
bool readVerilog(const std::string& design_name,
const std::string& v_file);
void setCurrentBlock(const char* design); void setCurrentBlock(const char* design);
void setCurrentBlock(odb::dbDatabase* db); void setCurrentBlock(odb::dbDatabase* db);
......
...@@ -210,16 +210,14 @@ bool DbMgr::readBlockDef(const char* block_name, ...@@ -210,16 +210,14 @@ bool DbMgr::readBlockDef(const char* block_name,
return true; return true;
} }
// bool DbMgr::readVerilog(const char* design_name, bool DbMgr::readVerilog(const char* design_name,
// const char* v_file) const char* v_file)
bool DbMgr::readVerilog(const std::string& design_name,
const std::string& v_file)
{ {
if (design_name.c_str()!= nullptr) { if (design_name != nullptr) {
if (haveBlockDB(design_name.c_str())) { if (haveBlockDB(design_name)) {
setCurrentBlock(design_name.c_str()); setCurrentBlock(design_name);
} else { } else {
setCurrentBlock(createBlockDB(design_name.c_str())); setCurrentBlock(createBlockDB(design_name));
} }
} else { } else {
if (current_block_db_ == nullptr) { if (current_block_db_ == nullptr) {
...@@ -228,8 +226,12 @@ bool DbMgr::readVerilog(const std::string& design_name, ...@@ -228,8 +226,12 @@ bool DbMgr::readVerilog(const std::string& design_name,
} }
} }
verilog_parser_->setOdb(current_block_db_); verilog_parser_->setOdb(current_block_db_);
return true; /*
// return verilog_parser_->read(design_name, v_file); const std::string design_name_str(design_name, std::strlen(design_name));
const std::string v_file_str(v_file, std::strlen(v_file));
return verilog_parser_->read(design_name_str, v_file_str);
*/
return verilog_parser_->read(design_name, v_file);
} }
} // namespace db_mgr } // namespace db_mgr
......
...@@ -36,12 +36,10 @@ bool delete_blk_db(const char* block_name) ...@@ -36,12 +36,10 @@ bool delete_blk_db(const char* block_name)
return getDbMgr()->deleteBlockDB(block_name); return getDbMgr()->deleteBlockDB(block_name);
} }
/* bool read_verilog(const char* design, const char* v_file)
bool read_verilog(const std::string& design, const std::string& v_file)
{ {
return getDbMgr()->readVerilog(design, v_file); return getDbMgr()->readVerilog(design, v_file);
} }
*/
} // namespace db_mgr } // namespace db_mgr
......
...@@ -61,5 +61,5 @@ proc read_verilog { args } { ...@@ -61,5 +61,5 @@ proc read_verilog { args } {
set design $keys(-design) set design $keys(-design)
} }
set filename [file nativename [lindex $args 0]] set filename [file nativename [lindex $args 0]]
# db_mgr::read_verilog $design $filename db_mgr::read_verilog $design $filename
} }
...@@ -4,7 +4,6 @@ target_sources(db_mgr_verilog_parser ...@@ -4,7 +4,6 @@ target_sources(db_mgr_verilog_parser
PRIVATE PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/verilog_database.cpp ${CMAKE_CURRENT_SOURCE_DIR}/verilog_database.cpp
${CMAKE_CURRENT_SOURCE_DIR}/verilog_parser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/verilog_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_bison.cpp
) )
target_include_directories(db_mgr_verilog_parser target_include_directories(db_mgr_verilog_parser
......
...@@ -24,17 +24,6 @@ VDb::~VDb() ...@@ -24,17 +24,6 @@ VDb::~VDb()
current_module_ = nullptr; current_module_ = nullptr;
} }
/*
bool VDb::read(const std::string& design_name,
const std::string& v_file)
{
if (current_block_->getConstName() != design_name) {
return false;
}
return VerilogParser::read(*this, v_file);
}
*/
void VDb::setOdb(odb::dbDatabase* odb) void VDb::setOdb(odb::dbDatabase* odb)
{ {
odb_ = odb; odb_ = odb;
......
...@@ -20,10 +20,6 @@ public: ...@@ -20,10 +20,6 @@ public:
VDb(); VDb();
VDb(odb::dbDatabase* odb); VDb(odb::dbDatabase* odb);
~VDb(); ~VDb();
/*
bool read(const std::string& design_name,
const std::string& v_file);
*/
void setOdb(odb::dbDatabase* odb); void setOdb(odb::dbDatabase* odb);
void setLogger(utl::Logger* logger); void setLogger(utl::Logger* logger);
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#include "utl/Logger.h" #include "utl/Logger.h"
#include "db.h" #include "db.h"
#include <cstring>
#define _GLIBCXX_USE_CXX11_ABI 0 #define _GLIBCXX_USE_CXX11_ABI 0
namespace eda { namespace eda {
...@@ -31,6 +33,14 @@ void VParser::setOdb(odb::dbDatabase* db) ...@@ -31,6 +33,14 @@ void VParser::setOdb(odb::dbDatabase* db)
} }
} }
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, bool VParser::read(std::string const& design_name,
std::string const& v_file) std::string const& v_file)
{ {
......
...@@ -28,6 +28,8 @@ public: ...@@ -28,6 +28,8 @@ public:
~VParser(); ~VParser();
bool read(std::string const& design_name, bool read(std::string const& design_name,
std::string const& v_file); std::string const& v_file);
bool read(const char* design_name,
const char* v_file);
void setLogger(utl::Logger* logger); void setLogger(utl::Logger* logger);
void setOdb(odb::dbDatabase* db); void setOdb(odb::dbDatabase* db);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment