Enable binary NAND and NOR operators with -gicarus-misc (issue #552).

These operators are an Icarus Verilog extension.

Currently -gicarus-misc is enabled by default, so most users won't
see a difference.
This commit is contained in:
Martin Whitaker 2024-01-28 22:41:16 +00:00
parent 6826dbb9cb
commit 2a2fa059e2
1 changed files with 21 additions and 7 deletions

28
parse.y
View File

@ -1,7 +1,7 @@
%{ %{
/* /*
* Copyright (c) 1998-2023 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2024 Stephen Williams (steve@icarus.com)
* Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com) * Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -3548,14 +3548,28 @@ expression
$$ = tmp; $$ = tmp;
} }
| expression K_NAND attribute_list_opt expression | expression K_NAND attribute_list_opt expression
{ PEBinary*tmp = new PEBinary('A', $1, $4); { if (gn_icarus_misc_flag) {
FILE_NAME(tmp, @2); PEBinary*tmp = new PEBinary('A', $1, $4);
$$ = tmp; FILE_NAME(tmp, @2);
$$ = tmp;
} else {
yyerror(@2, "error: The binary NAND operator "
"is an Icarus Verilog extension. "
"Use -gicarus-misc to enable it.");
$$ = 0;
}
} }
| expression K_NOR attribute_list_opt expression | expression K_NOR attribute_list_opt expression
{ PEBinary*tmp = new PEBinary('O', $1, $4); { if (gn_icarus_misc_flag) {
FILE_NAME(tmp, @2); PEBinary*tmp = new PEBinary('O', $1, $4);
$$ = tmp; FILE_NAME(tmp, @2);
$$ = tmp;
} else {
yyerror(@2, "error: The binary NOR operator "
"is an Icarus Verilog extension. "
"Use -gicarus-misc to enable it.");
$$ = 0;
}
} }
| expression K_NXOR attribute_list_opt expression | expression K_NXOR attribute_list_opt expression
{ PEBinary*tmp = new PEBinary('X', $1, $4); { PEBinary*tmp = new PEBinary('X', $1, $4);