Skip to content

Commit

Permalink
VarTime -> VcdTime
Browse files Browse the repository at this point in the history
Signed-off-by: James Cherry <[email protected]>
  • Loading branch information
jjcherry56 committed Oct 28, 2022
1 parent cb54dab commit 62e5c86
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions power/ReadVcdActivities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions power/Vcd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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];
Expand All @@ -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];
Expand Down Expand Up @@ -139,7 +139,7 @@ VcdVar::VcdVar(string name,
{
}

VcdValue::VcdValue(VarTime time,
VcdValue::VcdValue(VcdTime time,
char value,
uint64_t bus_value) :
time_(time),
Expand Down
24 changes: 12 additions & 12 deletions power/Vcd.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand All @@ -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,
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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_;
Expand Down
6 changes: 3 additions & 3 deletions power/VcdReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class VcdReader : public StaState
int stmt_line_;

Vcd *vcd_;
VarTime time_;
VarTime prev_time_;
VcdTime time_;
VcdTime prev_time_;
VcdScope scope_;
};

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 62e5c86

Please sign in to comment.