Merge pull request #1196 from YosysHQ/eddie/fix1178

Fix different synth results between with and without debug output "-g"
This commit is contained in:
Eddie Hung 2019-07-15 13:31:08 -07:00 committed by GitHub
commit 87db41a2bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 5 deletions

View File

@ -61,7 +61,7 @@ int log_force_debug = 0;
int log_debug_suppressed = 0; int log_debug_suppressed = 0;
vector<int> header_count; vector<int> header_count;
pool<RTLIL::IdString> log_id_cache; vector<char*> log_id_cache;
vector<shared_str> string_buf; vector<shared_str> string_buf;
int string_buf_index = -1; int string_buf_index = -1;
@ -69,6 +69,13 @@ static struct timeval initial_tv = { 0, 0 };
static bool next_print_log = false; static bool next_print_log = false;
static int log_newline_count = 0; static int log_newline_count = 0;
static void log_id_cache_clear()
{
for (auto p : log_id_cache)
free(p);
log_id_cache.clear();
}
#if defined(_WIN32) && !defined(__MINGW32__) #if defined(_WIN32) && !defined(__MINGW32__)
// this will get time information and return it in timeval, simulating gettimeofday() // this will get time information and return it in timeval, simulating gettimeofday()
int gettimeofday(struct timeval *tv, struct timezone *tz) int gettimeofday(struct timeval *tv, struct timezone *tz)
@ -414,7 +421,7 @@ void log_push()
void log_pop() void log_pop()
{ {
header_count.pop_back(); header_count.pop_back();
log_id_cache.clear(); log_id_cache_clear();
string_buf.clear(); string_buf.clear();
string_buf_index = -1; string_buf_index = -1;
log_flush(); log_flush();
@ -521,7 +528,7 @@ void log_reset_stack()
{ {
while (header_count.size() > 1) while (header_count.size() > 1)
header_count.pop_back(); header_count.pop_back();
log_id_cache.clear(); log_id_cache_clear();
string_buf.clear(); string_buf.clear();
string_buf_index = -1; string_buf_index = -1;
log_flush(); log_flush();
@ -580,8 +587,8 @@ const char *log_const(const RTLIL::Const &value, bool autoint)
const char *log_id(RTLIL::IdString str) const char *log_id(RTLIL::IdString str)
{ {
log_id_cache.insert(str); log_id_cache.push_back(strdup(str.c_str()));
const char *p = str.c_str(); const char *p = log_id_cache.back();
if (p[0] != '\\') if (p[0] != '\\')
return p; return p;
if (p[1] == '$' || p[1] == '\\' || p[1] == 0) if (p[1] == '$' || p[1] == '\\' || p[1] == 0)