ccs bounds check
Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
parent
9bda639d9c
commit
e7baf16407
|
|
@ -462,6 +462,7 @@ public:
|
|||
const char *variableString() const;
|
||||
const Unit *unit(const Units *units);
|
||||
size_t size() const { return values_->size(); }
|
||||
bool inBounds(float value) const;
|
||||
float axisValue(size_t index) const { return (*values_)[index]; }
|
||||
// Find the index for value such that axis[index] <= value < axis[index+1].
|
||||
size_t findAxisIndex(float value) const;
|
||||
|
|
@ -505,6 +506,8 @@ public:
|
|||
Table1 *ref_times);
|
||||
~OutputWaveforms();
|
||||
const RiseFall *rf() const { return rf_; }
|
||||
bool inBounds(float in_slew,
|
||||
float load_cap) const;
|
||||
Table1 voltageWaveform(float in_slew,
|
||||
float load_cap);
|
||||
float voltageTime(float in_slew,
|
||||
|
|
|
|||
|
|
@ -1437,6 +1437,15 @@ TableAxis::~TableAxis()
|
|||
delete values_;
|
||||
}
|
||||
|
||||
bool
|
||||
TableAxis::inBounds(float value) const
|
||||
{
|
||||
size_t size = values_->size();
|
||||
return size > 1
|
||||
&& value >= (*values_)[0]
|
||||
&& value <= (*values_)[size - 1];
|
||||
}
|
||||
|
||||
// Bisection search.
|
||||
size_t
|
||||
TableAxis::findAxisIndex(float value) const
|
||||
|
|
@ -1613,6 +1622,14 @@ OutputWaveforms::checkAxes(TableTemplate *tbl_template)
|
|||
&& axis3->variable() == TableAxisVariable::time);
|
||||
}
|
||||
|
||||
bool
|
||||
OutputWaveforms::inBounds(float in_slew,
|
||||
float load_cap) const
|
||||
{
|
||||
return slew_axis_->inBounds(in_slew)
|
||||
&& cap_axis_->inBounds(load_cap);
|
||||
}
|
||||
|
||||
const Table1 *
|
||||
OutputWaveforms::currentWaveform(float slew,
|
||||
float cap)
|
||||
|
|
|
|||
Loading…
Reference in New Issue