mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
Tiny fixes to verilog parser
This commit is contained in:
parent
bee57c808a
commit
e45d1c8865
|
@ -120,6 +120,8 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage)
|
||||||
if (node->type == AST_WIRE) {
|
if (node->type == AST_WIRE) {
|
||||||
if (this_wire_scope.count(node->str) > 0) {
|
if (this_wire_scope.count(node->str) > 0) {
|
||||||
AstNode *first_node = this_wire_scope[node->str];
|
AstNode *first_node = this_wire_scope[node->str];
|
||||||
|
if (!node->is_input && !node->is_output && node->is_reg && node->children.size() == 0)
|
||||||
|
goto wires_are_compatible;
|
||||||
if (first_node->children.size() != node->children.size())
|
if (first_node->children.size() != node->children.size())
|
||||||
goto wires_are_incompatible;
|
goto wires_are_incompatible;
|
||||||
for (size_t j = 0; j < node->children.size(); j++) {
|
for (size_t j = 0; j < node->children.size(); j++) {
|
||||||
|
@ -138,6 +140,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage)
|
||||||
goto wires_are_incompatible;
|
goto wires_are_incompatible;
|
||||||
if (first_node->port_id == 0 && (node->is_input || node->is_output))
|
if (first_node->port_id == 0 && (node->is_input || node->is_output))
|
||||||
goto wires_are_incompatible;
|
goto wires_are_incompatible;
|
||||||
|
wires_are_compatible:
|
||||||
if (node->is_input)
|
if (node->is_input)
|
||||||
first_node->is_input = true;
|
first_node->is_input = true;
|
||||||
if (node->is_output)
|
if (node->is_output)
|
||||||
|
|
|
@ -209,7 +209,12 @@ module:
|
||||||
};
|
};
|
||||||
|
|
||||||
module_para_opt:
|
module_para_opt:
|
||||||
'#' '(' TOK_PARAMETER param_decl_list optional_comma ')' | /* empty */;
|
'#' '(' module_para_list ')' | /* empty */;
|
||||||
|
|
||||||
|
module_para_list:
|
||||||
|
TOK_PARAMETER single_param_decl |
|
||||||
|
TOK_PARAMETER single_param_decl ',' module_para_list |
|
||||||
|
/* empty */;
|
||||||
|
|
||||||
module_args_opt:
|
module_args_opt:
|
||||||
'(' ')' | /* empty */ | '(' module_args optional_comma ')';
|
'(' ')' | /* empty */ | '(' module_args optional_comma ')';
|
||||||
|
|
Loading…
Reference in a new issue