VarTime -> VcdTime

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2022-10-28 10:52:27 -07:00
parent cb54dabdfd
commit 62e5c864a5
4 changed files with 24 additions and 24 deletions

View File

@ -62,16 +62,16 @@ setVcdActivities(Vcd &vcd,
for (Clock *clk : *sta->sdc()->clocks())
clk_period = min(clk->period(), clk_period);
VarTime time_max = vcd.timeMax();
VcdTime time_max = vcd.timeMax();
for (VcdVar &var : vcd.vars()) {
const VcdValues &var_values = vcd.values(var);
if (!var_values.empty()) {
int transition_count = 0;
char prev_value = var_values[0].value();
VarTime prev_time = var_values[0].time();
VarTime high_time = 0;
VcdTime prev_time = var_values[0].time();
VcdTime high_time = 0;
for (const VcdValue &var_value : var_values) {
VarTime time = var_value.time();
VcdTime time = var_value.time();
char value = var_value.value();
if (prev_value == '1')
high_time += time - prev_time;

View File

@ -64,13 +64,13 @@ Vcd::setTimeScale(double time_scale)
}
void
Vcd::setMinDeltaTime(VarTime min_delta_time)
Vcd::setMinDeltaTime(VcdTime min_delta_time)
{
min_delta_time_ = min_delta_time;
}
void
Vcd::setTimeMax(VarTime time_max)
Vcd::setTimeMax(VcdTime time_max)
{
time_max_ = time_max;
}
@ -96,7 +96,7 @@ Vcd::varIdValid(string &id)
void
Vcd::varAppendValue(string &id,
VarTime time,
VcdTime time,
char value)
{
VcdValues &values = id_values_map_[id];
@ -105,7 +105,7 @@ Vcd::varAppendValue(string &id,
void
Vcd::varAppendBusValue(string &id,
VarTime time,
VcdTime time,
int64_t bus_value)
{
VcdValues &values = id_values_map_[id];
@ -139,7 +139,7 @@ VcdVar::VcdVar(string name,
{
}
VcdValue::VcdValue(VarTime time,
VcdValue::VcdValue(VcdTime time,
char value,
uint64_t bus_value) :
time_(time),

View File

@ -34,7 +34,7 @@ using std::min;
class VcdVar;
class VcdValue;
typedef vector<VcdValue> VcdValues;
typedef int64_t VarTime;
typedef int64_t VcdTime;
typedef vector<string> VcdScope;
enum class VcdVarType { wire, reg, parameter, real };
@ -57,10 +57,10 @@ public:
double timeUnitScale() const { return time_unit_scale_; }
void setTimeUnit(const string &time_unit,
double time_unit_scale);
VarTime timeMax() const { return time_max_; }
void setTimeMax(VarTime time_max);
VarTime minDeltaTime() const { return min_delta_time_; }
void setMinDeltaTime(VarTime min_delta_time);
VcdTime timeMax() const { return time_max_; }
void setTimeMax(VcdTime time_max);
VcdTime minDeltaTime() const { return min_delta_time_; }
void setMinDeltaTime(VcdTime min_delta_time);
vector<VcdVar> vars() { return vars_; }
void makeVar(string &name,
VcdVarType type,
@ -70,10 +70,10 @@ public:
int maxVarNameLength() const { return max_var_name_length_; }
bool varIdValid(string &id);
void varAppendValue(string &id,
VarTime time,
VcdTime time,
char value);
void varAppendBusValue(string &id,
VarTime time,
VcdTime time,
int64_t bus_value);
private:
@ -88,8 +88,8 @@ private:
size_t max_var_name_length_;
int max_var_width_;
map<string, VcdValues> id_values_map_;
VarTime min_delta_time_;
VarTime time_max_;
VcdTime min_delta_time_;
VcdTime time_max_;
};
class VcdVar
@ -114,15 +114,15 @@ private:
class VcdValue
{
public:
VcdValue(VarTime time,
VcdValue(VcdTime time,
char value,
uint64_t bus_value);
VarTime time() const { return time_; }
VcdTime time() const { return time_; }
char value() const { return value_; }
uint64_t busValue() const { return bus_value_; }
private:
VarTime time_;
VcdTime time_;
// 01XUZ or '\0' when width > 1 to use bus_value_.
char value_;
uint64_t bus_value_;

View File

@ -55,8 +55,8 @@ private:
int stmt_line_;
Vcd *vcd_;
VarTime time_;
VarTime prev_time_;
VcdTime time_;
VcdTime prev_time_;
VcdScope scope_;
};
@ -358,7 +358,7 @@ reportWaveforms(Vcd &vcd,
size_t value_index = 0;
VcdValue var_value = var_values[value_index];
VcdValue prev_var_value = var_values[value_index];
VarTime next_value_time = var_values[value_index + 1].time();
VcdTime next_value_time = var_values[value_index + 1].time();
for (double time = 0.0; time < vcd.timeMax(); time += time_delta) {
if (time >= next_value_time) {
if (value_index < var_values.size() - 1)