Less than / greater than

This commit is contained in:
Nick Gasson 2008-06-21 15:16:22 +01:00
parent ec23b70bb7
commit d6acb8d059
3 changed files with 12 additions and 7 deletions

View File

@ -169,6 +169,10 @@ static vhdl_expr *translate_binary(ivl_expr_t e)
return translate_numeric(lhs, rhs, VHDL_BINOP_AND); return translate_numeric(lhs, rhs, VHDL_BINOP_AND);
case 'o': case 'o':
return translate_relation(lhs, rhs, VHDL_BINOP_OR); return translate_relation(lhs, rhs, VHDL_BINOP_OR);
case '<':
return translate_relation(lhs, rhs, VHDL_BINOP_LT);
case '>':
return translate_relation(lhs, rhs, VHDL_BINOP_GT);
default: default:
error("No translation for binary opcode '%c'\n", error("No translation for binary opcode '%c'\n",
ivl_expr_opcode(e)); ivl_expr_opcode(e));

View File

@ -740,6 +740,12 @@ void vhdl_binop_expr::emit(std::ofstream &of, int level) const
case VHDL_BINOP_MULT: case VHDL_BINOP_MULT:
of << " * "; of << " * ";
break; break;
case VHDL_BINOP_LT:
of << " < ";
break;
case VHDL_BINOP_GT:
of << " > ";
break;
} }
(*it)->emit(of, level); (*it)->emit(of, level);
@ -789,10 +795,3 @@ void vhdl_while_stmt::emit(std::ofstream &of, int level) const
stmts_.emit(of, indent(level)); stmts_.emit(of, indent(level));
of << "end loop;"; of << "end loop;";
} }

View File

@ -62,6 +62,8 @@ enum vhdl_binop_t {
VHDL_BINOP_ADD, VHDL_BINOP_ADD,
VHDL_BINOP_SUB, VHDL_BINOP_SUB,
VHDL_BINOP_MULT, VHDL_BINOP_MULT,
VHDL_BINOP_LT,
VHDL_BINOP_GT,
}; };
/* /*