Division and modulus operators
This commit is contained in:
parent
28d782e13c
commit
e4d0a92d7c
|
|
@ -270,6 +270,12 @@ static vhdl_expr *translate_binary(ivl_expr_t e)
|
||||||
case '*':
|
case '*':
|
||||||
result = translate_numeric(lhs, rhs, VHDL_BINOP_MULT);
|
result = translate_numeric(lhs, rhs, VHDL_BINOP_MULT);
|
||||||
break;
|
break;
|
||||||
|
case '/':
|
||||||
|
result = translate_numeric(lhs, rhs, VHDL_BINOP_DIV);
|
||||||
|
break;
|
||||||
|
case '%':
|
||||||
|
result = translate_numeric(lhs, rhs, VHDL_BINOP_MOD);
|
||||||
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
result = translate_relation(lhs, rhs, VHDL_BINOP_EQ);
|
result = translate_relation(lhs, rhs, VHDL_BINOP_EQ);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
return binop_lpm_to_expr(scope, lpm, VHDL_BINOP_SUB);
|
||||||
case IVL_LPM_MULT:
|
case IVL_LPM_MULT:
|
||||||
return binop_lpm_to_expr(scope, lpm, VHDL_BINOP_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:
|
case IVL_LPM_CONCAT:
|
||||||
return concat_lpm_to_expr(scope, lpm);
|
return concat_lpm_to_expr(scope, lpm);
|
||||||
case IVL_LPM_CMP_GE:
|
case IVL_LPM_CMP_GE:
|
||||||
|
|
|
||||||
|
|
@ -724,7 +724,7 @@ void vhdl_binop_expr::emit(std::ostream &of, int level) const
|
||||||
const char* ops[] = {
|
const char* ops[] = {
|
||||||
"and", "or", "=", "/=", "+", "-", "*", "<",
|
"and", "or", "=", "/=", "+", "-", "*", "<",
|
||||||
">", "<=", ">=", "sll", "srl", "xor", "&",
|
">", "<=", ">=", "sll", "srl", "xor", "&",
|
||||||
"nand", "nor", "xnor", NULL
|
"nand", "nor", "xnor", "/", "mod", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
of << " " << ops[op_] << " ";
|
of << " " << ops[op_] << " ";
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,8 @@ enum vhdl_binop_t {
|
||||||
VHDL_BINOP_NAND,
|
VHDL_BINOP_NAND,
|
||||||
VHDL_BINOP_NOR,
|
VHDL_BINOP_NOR,
|
||||||
VHDL_BINOP_XNOR,
|
VHDL_BINOP_XNOR,
|
||||||
|
VHDL_BINOP_DIV,
|
||||||
|
VHDL_BINOP_MOD,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue