Fix Valgrind warnings
This commit is contained in:
parent
7cde5f247e
commit
ce72eb4eb4
|
|
@ -59,7 +59,7 @@ static vhdl_expr *translate_signal(ivl_expr_t e)
|
||||||
*/
|
*/
|
||||||
static vhdl_expr *translate_number(ivl_expr_t e)
|
static vhdl_expr *translate_number(ivl_expr_t e)
|
||||||
{
|
{
|
||||||
return new vhdl_const_bits(ivl_expr_bits(e));
|
return new vhdl_const_bits(ivl_expr_bits(e), ivl_expr_width(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
static vhdl_expr *translate_unary(ivl_expr_t e)
|
static vhdl_expr *translate_unary(ivl_expr_t e)
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ vhdl_arch *vhdl_conc_stmt::get_parent() const
|
||||||
}
|
}
|
||||||
|
|
||||||
vhdl_process::vhdl_process(const char *name)
|
vhdl_process::vhdl_process(const char *name)
|
||||||
: name_(name)
|
: name_(name), initial_(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -547,11 +547,12 @@ void vhdl_nbassign_stmt::emit(std::ofstream &of, int level) const
|
||||||
of << ";";
|
of << ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
vhdl_const_bits::vhdl_const_bits(const char *value)
|
vhdl_const_bits::vhdl_const_bits(const char *value, int width)
|
||||||
: vhdl_expr(vhdl_type::nsigned(strlen(value))),
|
: vhdl_expr(vhdl_type::nsigned(width))
|
||||||
value_(value)
|
|
||||||
{
|
{
|
||||||
|
// Can't rely on value being NULL-terminated
|
||||||
|
while (width--)
|
||||||
|
value_.push_back(*value++);
|
||||||
}
|
}
|
||||||
|
|
||||||
vhdl_expr *vhdl_const_bits::cast(const vhdl_type *to)
|
vhdl_expr *vhdl_const_bits::cast(const vhdl_type *to)
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ private:
|
||||||
|
|
||||||
class vhdl_const_bits : public vhdl_expr {
|
class vhdl_const_bits : public vhdl_expr {
|
||||||
public:
|
public:
|
||||||
vhdl_const_bits(const char *value);
|
vhdl_const_bits(const char *value, int width);
|
||||||
void emit(std::ofstream &of, int level) const;
|
void emit(std::ofstream &of, int level) const;
|
||||||
const std::string &get_value() const { return value_; }
|
const std::string &get_value() const { return value_; }
|
||||||
vhdl_expr *cast(const vhdl_type *to);
|
vhdl_expr *cast(const vhdl_type *to);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue