3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-14 09:56:16 +00:00

Coding style corrections in SatHelper::dump_model_to_vcd()

This commit is contained in:
Clifford Wolf 2014-02-18 09:28:05 +01:00
parent 61a2bf57b4
commit 32af10fa9b

View file

@ -643,7 +643,7 @@ struct SatHelper
time_t timestamp; time_t timestamp;
struct tm* now; struct tm* now;
char stime[128] = {0}; char stime[128] = {};
time(&timestamp); time(&timestamp);
now = localtime(&timestamp); now = localtime(&timestamp);
strftime(stime, sizeof(stime), "%c", now); strftime(stime, sizeof(stime), "%c", now);
@ -669,7 +669,8 @@ struct SatHelper
fprintf(f, "$timescale 1ns\n"); // arbitrary time scale since actual clock period is unknown/unimportant fprintf(f, "$timescale 1ns\n"); // arbitrary time scale since actual clock period is unknown/unimportant
fprintf(f, "$scope module %s $end\n", module->name.c_str()); fprintf(f, "$scope module %s $end\n", module->name.c_str());
for (auto &info : modelInfo) { for (auto &info : modelInfo)
{
if (vcdnames.find(info.description) != vcdnames.end()) if (vcdnames.find(info.description) != vcdnames.end())
continue; continue;
@ -716,13 +717,12 @@ struct SatHelper
fprintf(f, "$end\n"); fprintf(f, "$end\n");
else else
fprintf(f, "#%d\n", info.timestep); fprintf(f, "#%d\n", info.timestep);
last_timestep = info.timestep; last_timestep = info.timestep;
} }
if(info.width == 1) if(info.width == 1) {
fprintf(f, "%c%s\n", bitvals[value.bits[0]], vcdnames[info.description].c_str()); fprintf(f, "%c%s\n", bitvals[value.bits[0]], vcdnames[info.description].c_str());
else { } else {
fprintf(f, "b"); fprintf(f, "b");
for(int k=info.width-1; k >= 0; k --) //need to flip bit ordering for VCD for(int k=info.width-1; k >= 0; k --) //need to flip bit ordering for VCD
fprintf(f, "%c", bitvals[value.bits[k]]); fprintf(f, "%c", bitvals[value.bits[k]]);