vhdlpp: Added VType::is_unbounded() method.

This commit is contained in:
Maciej Suminski 2015-01-22 11:17:33 +01:00
parent 756c9ceccf
commit 51b9191021
2 changed files with 18 additions and 0 deletions

View File

@ -148,6 +148,17 @@ void VTypeArray::show(ostream&out) const
out << "<nil>";
}
bool VTypeArray::is_unbounded() const {
for(std::vector<range_t>::const_iterator it = ranges_.begin();
it != ranges_.end(); ++it)
{
if(it->is_box())
return true;
}
return etype_->is_unbounded();
}
VTypeRange::VTypeRange(const VType*base, int64_t max_val, int64_t min_val)
: base_(base)
{

View File

@ -85,6 +85,9 @@ class VType {
// Determines if a type can be used in Verilog packed array.
virtual bool can_be_packed() const { return false; }
// Returns true if the type has an undefined dimension.
virtual bool is_unbounded() const { return false; }
private:
friend struct decl_t;
// This virtual method is called to emit the declaration. This
@ -218,6 +221,8 @@ class VTypeArray : public VType {
bool can_be_packed() const { return etype_->can_be_packed(); }
bool is_unbounded() const;
private:
int emit_with_dims_(std::ostream&out, bool packed, perm_string name) const;
@ -320,6 +325,8 @@ class VTypeDef : public VType {
int emit_def(std::ostream&out, perm_string name) const;
bool can_be_packed() const { return type_->can_be_packed(); }
bool is_unbounded() const { return type_->is_unbounded(); }
private:
int emit_decl(std::ostream&out, perm_string name, bool reg_flag) const;