Add unary OR/NOR

These are currently implemented with reference to an external
Reduce_OR function
This commit is contained in:
Nick Gasson 2008-07-07 15:23:57 +01:00
parent dadd145d09
commit 4db5b9d7ed
2 changed files with 14 additions and 3 deletions

View File

@ -69,11 +69,22 @@ static vhdl_expr *translate_unary(ivl_expr_t e)
if (NULL == operand)
return NULL;
switch (ivl_expr_opcode(e)) {
char opcode = ivl_expr_opcode(e);
switch (opcode) {
case '!':
case '~':
return new vhdl_unaryop_expr
(VHDL_UNARYOP_NOT, operand, new vhdl_type(*operand->get_type()));
case 'N': // NOR
case '|':
{
vhdl_fcall *f = new vhdl_fcall("Reduce_OR", vhdl_type::std_logic());
f->add_expr(operand);
if ('N' == opcode)
return new vhdl_unaryop_expr(VHDL_UNARYOP_NOT, f, vhdl_type::std_logic());
else
return f;
}
default:
error("No translation for unary opcode '%c'\n",
ivl_expr_opcode(e));