Fix Valgrind warnings

This commit is contained in:
Nick Gasson 2008-06-16 14:26:38 +01:00
parent 7cde5f247e
commit ce72eb4eb4
3 changed files with 8 additions and 7 deletions

View File

@ -59,7 +59,7 @@ static vhdl_expr *translate_signal(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)

View File

@ -187,7 +187,7 @@ vhdl_arch *vhdl_conc_stmt::get_parent() const
}
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 << ";";
}
vhdl_const_bits::vhdl_const_bits(const char *value)
: vhdl_expr(vhdl_type::nsigned(strlen(value))),
value_(value)
vhdl_const_bits::vhdl_const_bits(const char *value, int width)
: vhdl_expr(vhdl_type::nsigned(width))
{
// Can't rely on value being NULL-terminated
while (width--)
value_.push_back(*value++);
}
vhdl_expr *vhdl_const_bits::cast(const vhdl_type *to)

View File

@ -113,7 +113,7 @@ private:
class vhdl_const_bits : public vhdl_expr {
public:
vhdl_const_bits(const char *value);
vhdl_const_bits(const char *value, int width);
void emit(std::ofstream &of, int level) const;
const std::string &get_value() const { return value_; }
vhdl_expr *cast(const vhdl_type *to);