vhdlpp: Fix array typedefs in packages.
This commit is contained in:
parent
7f6100be2a
commit
8cac72192f
|
|
@ -195,6 +195,7 @@ class VTypeArray : public VType {
|
|||
|
||||
int elaborate(Entity*ent, Architecture*arc) const;
|
||||
void write_to_stream(std::ostream&fd) const;
|
||||
void write_type_to_stream(std::ostream&fd) const;
|
||||
void show(std::ostream&) const;
|
||||
|
||||
inline size_t dimensions() const { return ranges_.size(); };
|
||||
|
|
@ -312,7 +313,7 @@ class VTypeDef : public VType {
|
|||
inline const VType* peek_definition(void) const { return type_; }
|
||||
|
||||
void write_to_stream(std::ostream&fd) const;
|
||||
void write_type_to_stream(ostream&fd) const;
|
||||
void write_type_to_stream(std::ostream&fd) const;
|
||||
int emit_typedef(std::ostream&out, typedef_context_t&ctx) const;
|
||||
|
||||
int emit_def(std::ostream&out, perm_string name) const;
|
||||
|
|
|
|||
|
|
@ -90,9 +90,40 @@ void VTypeArray::write_range_to_stream_(std::ostream&fd) const
|
|||
fd << ") ";
|
||||
}
|
||||
|
||||
void VTypeArray::write_type_to_stream(ostream&fd) const
|
||||
{
|
||||
// Special case: std_logic_vector
|
||||
if (etype_ == &primitive_STDLOGIC) {
|
||||
fd << "std_logic_vector";
|
||||
if (! ranges_.empty() && ! ranges_[0].is_box()) {
|
||||
write_range_to_stream_(fd);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fd << "array ";
|
||||
|
||||
if (! ranges_.empty()) {
|
||||
assert(ranges_.size() < 2);
|
||||
if (ranges_[0].is_box()) {
|
||||
fd << "(INTEGER range <>) ";
|
||||
} else {
|
||||
write_range_to_stream_(fd);
|
||||
}
|
||||
}
|
||||
|
||||
fd << "of ";
|
||||
|
||||
if(const VTypeDef*tdef = dynamic_cast<const VTypeDef*>(etype_)) {
|
||||
tdef->write_to_stream(fd);
|
||||
} else {
|
||||
etype_->write_to_stream(fd);
|
||||
}
|
||||
}
|
||||
|
||||
void VTypeDef::write_type_to_stream(ostream&fd) const
|
||||
{
|
||||
type_->write_to_stream(fd);
|
||||
type_->write_type_to_stream(fd);
|
||||
}
|
||||
|
||||
void VTypeDef::write_to_stream(ostream&fd) const
|
||||
|
|
|
|||
Loading…
Reference in New Issue