Add binary NAND and NOR operators

This commit is contained in:
Nick Gasson 2008-08-01 17:42:26 +01:00
parent 3f73c9bb54
commit a26d91557b
3 changed files with 10 additions and 1 deletions

View File

@ -296,6 +296,12 @@ static vhdl_expr *translate_binary(ivl_expr_t e)
case 'a': // Logical AND case 'a': // Logical AND
result = translate_logical(lhs, rhs, VHDL_BINOP_AND); result = translate_logical(lhs, rhs, VHDL_BINOP_AND);
break; break;
case 'A': // Bitwise NAND
result = translate_numeric(lhs, rhs, VHDL_BINOP_NAND);
break;
case 'O': // Bitwise NOR
result = translate_numeric(lhs, rhs, VHDL_BINOP_NOR);
break;
case '|': // Bitwise OR case '|': // Bitwise OR
result = translate_numeric(lhs, rhs, VHDL_BINOP_OR); result = translate_numeric(lhs, rhs, VHDL_BINOP_OR);
break; break;

View File

@ -719,7 +719,8 @@ void vhdl_binop_expr::emit(std::ostream &of, int level) const
while (++it != operands_.end()) { while (++it != operands_.end()) {
const char* ops[] = { const char* ops[] = {
"and", "or", "=", "/=", "+", "-", "*", "<", "and", "or", "=", "/=", "+", "-", "*", "<",
">", "<=", ">=", "sll", "srl", "xor", "&" ">", "<=", ">=", "sll", "srl", "xor", "&",
"nand", "nor", NULL
}; };
of << " " << ops[op_] << " "; of << " " << ops[op_] << " ";

View File

@ -81,6 +81,8 @@ enum vhdl_binop_t {
VHDL_BINOP_SR, VHDL_BINOP_SR,
VHDL_BINOP_XOR, VHDL_BINOP_XOR,
VHDL_BINOP_CONCAT, VHDL_BINOP_CONCAT,
VHDL_BINOP_NAND,
VHDL_BINOP_NOR,
}; };
/* /*