vhdlpp: and_reduce() and or_reduce() functions.
This commit is contained in:
parent
5101b3b64b
commit
c8fe897446
|
|
@ -877,6 +877,12 @@ const VType* ExpFunc::fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*) c
|
|||
return new VTypeArray(element, width, 0, sign);
|
||||
}
|
||||
|
||||
if(name_ == "and_reduce" || name_ == "or_reduce") {
|
||||
ivl_assert(*this, argv_.size() == 1);
|
||||
const VType*element = &primitive_STDLOGIC;
|
||||
return new VTypeArray(element, 0, 0, false);
|
||||
}
|
||||
|
||||
// Other cases
|
||||
Subprogram*prog = def_;
|
||||
|
||||
|
|
@ -888,6 +894,7 @@ const VType* ExpFunc::fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*) c
|
|||
if(!prog)
|
||||
prog = library_find_subprogram(name_);
|
||||
|
||||
cerr << get_fileline() << ": sorry: VHDL function " << name_ << " not yet implemented" << endl;
|
||||
ivl_assert(*this, prog);
|
||||
|
||||
return def_->peek_return_type();
|
||||
|
|
|
|||
|
|
@ -647,6 +647,16 @@ int ExpFunc::emit(ostream&out, Entity*ent, ScopeBase*scope)
|
|||
errors += argv_[0]->emit(out, ent, scope);
|
||||
out << ")";
|
||||
|
||||
} else if (name_ == "and_reduce" && argv_.size() == 1) {
|
||||
out << "&(";
|
||||
errors += argv_[0]->emit(out, ent, scope);
|
||||
out << ")";
|
||||
|
||||
} else if (name_ == "or_reduce" && argv_.size() == 1) {
|
||||
out << "|(";
|
||||
errors += argv_[0]->emit(out, ent, scope);
|
||||
out << ")";
|
||||
|
||||
} else {
|
||||
// If this function has an elaborated definition, and if
|
||||
// that definition is in a package, then include the
|
||||
|
|
|
|||
Loading…
Reference in New Issue