Division and modulus operators

This commit is contained in:
Nick Gasson 2008-08-07 14:18:26 +01:00
parent 28d782e13c
commit e4d0a92d7c
4 changed files with 13 additions and 1 deletions

View File

@ -270,6 +270,12 @@ static vhdl_expr *translate_binary(ivl_expr_t e)
case '*':
result = translate_numeric(lhs, rhs, VHDL_BINOP_MULT);
break;
case '/':
result = translate_numeric(lhs, rhs, VHDL_BINOP_DIV);
break;
case '%':
result = translate_numeric(lhs, rhs, VHDL_BINOP_MOD);
break;
case 'e':
result = translate_relation(lhs, rhs, VHDL_BINOP_EQ);
break;

View File

@ -227,6 +227,10 @@ static vhdl_expr *lpm_to_expr(vhdl_scope *scope, ivl_lpm_t lpm)
return binop_lpm_to_expr(scope, lpm, VHDL_BINOP_SUB);
case IVL_LPM_MULT:
return binop_lpm_to_expr(scope, lpm, VHDL_BINOP_MULT);
case IVL_LPM_DIVIDE:
return binop_lpm_to_expr(scope, lpm, VHDL_BINOP_DIV);
case IVL_LPM_MOD:
return binop_lpm_to_expr(scope, lpm, VHDL_BINOP_MOD);
case IVL_LPM_CONCAT:
return concat_lpm_to_expr(scope, lpm);
case IVL_LPM_CMP_GE:

View File

@ -724,7 +724,7 @@ void vhdl_binop_expr::emit(std::ostream &of, int level) const
const char* ops[] = {
"and", "or", "=", "/=", "+", "-", "*", "<",
">", "<=", ">=", "sll", "srl", "xor", "&",
"nand", "nor", "xnor", NULL
"nand", "nor", "xnor", "/", "mod", NULL
};
of << " " << ops[op_] << " ";

View File

@ -84,6 +84,8 @@ enum vhdl_binop_t {
VHDL_BINOP_NAND,
VHDL_BINOP_NOR,
VHDL_BINOP_XNOR,
VHDL_BINOP_DIV,
VHDL_BINOP_MOD,
};
/*