vhdlpp: Apply case equality operator for logic type.

This commit is contained in:
Maciej Suminski 2016-02-29 16:48:10 +01:00
parent 41a45a8db0
commit c25be111a3
1 changed files with 14 additions and 2 deletions

View File

@ -888,9 +888,21 @@ int ExpRelation::emit(ostream&out, Entity*ent, ScopeBase*scope) const
int errors = 0;
errors += emit_operand1(out, ent, scope);
const VType*type1 = peek_operand1()->probe_type(ent, scope);
const VType*type2 = peek_operand2()->probe_type(ent, scope);
bool logical_compare = false;
// Apply case equality operator if any of the operands is of logic type
if(((type1 && (type1->type_match(&primitive_STDLOGIC) ||
type1->type_match(&primitive_STDLOGIC_VECTOR)))
|| (type2 && (type2->type_match(&primitive_STDLOGIC) ||
type2->type_match(&primitive_STDLOGIC_VECTOR))))) {
logical_compare = true;
}
switch (fun_) {
case EQ:
out << " == ";
out << (logical_compare ? " === " : " == ");
break;
case LT:
out << " < ";
@ -899,7 +911,7 @@ int ExpRelation::emit(ostream&out, Entity*ent, ScopeBase*scope) const
out << " > ";
break;
case NEQ:
out << " != ";
out << (logical_compare ? " !== " : " != ");
break;
case LE:
out << " <= ";