3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-23 15:42:32 +00:00

Merge upstream changes

This commit is contained in:
Akash Levy 2025-09-10 23:02:15 -07:00
commit a43de44f9d
18 changed files with 343 additions and 180 deletions

View file

@ -162,7 +162,7 @@ static bool is_hex_dig(char c, int *val, parser::location_type loc)
*val = c - 'A' + 0xA;
return true;
} else if (c == 'x' || c == 'X' || c == 'z' || c == 'Z' || c == '?') {
log_file_warning(loc.begin.filename->c_str(), loc.begin.line, "'%c' not a valid digit in hex escape sequence.\n", c);
log_file_warning(*loc.begin.filename, loc.begin.line, "'%c' not a valid digit in hex escape sequence.\n", c);
*val = 0; // not semantically valid in hex escape...
return true; // ...but still processed as part of hex token
}
@ -176,7 +176,7 @@ static bool is_oct_dig(char c, int *val, parser::location_type loc)
*val = c - '0';
return true;
} else if (c == 'x' || c == 'X' || c == 'z' || c == 'Z' || c == '?') {
log_file_warning(loc.begin.filename->c_str(), loc.begin.line, "'%c' not a valid digit in octal escape sequence.\n", c);
log_file_warning(*loc.begin.filename, loc.begin.line, "'%c' not a valid digit in octal escape sequence.\n", c);
*val = 0; // not semantically valid in octal escape...
return true; // ...but still processed as part of octal token
}
@ -196,7 +196,7 @@ static parser::symbol_type process_str(char *str, int len, bool triple, parser::
if (in + 1 < str + len && (in[1] ^ *in) == ('\n' ^ '\r'))
in++;
if (!triple)
log_file_warning(loc.begin.filename->c_str(), loc.begin.line, "Multi-line string literals should be triple-quoted or escaped.\n");
log_file_warning(*loc.begin.filename, loc.begin.line, "Multi-line string literals should be triple-quoted or escaped.\n");
*out++ = '\n';
break;
case '\\':
@ -233,7 +233,7 @@ static parser::symbol_type process_str(char *str, int len, bool triple, parser::
}
out++;
} else
log_file_warning(loc.begin.filename->c_str(), loc.begin.line, "ignoring invalid hex escape.\n");
log_file_warning(*loc.begin.filename, loc.begin.line, "ignoring invalid hex escape.\n");
break;
case '\\':
*out++ = '\\';
@ -256,7 +256,7 @@ static parser::symbol_type process_str(char *str, int len, bool triple, parser::
in++;
if (in + 1 < str + len && is_oct_dig(in[1], &val, loc)) {
if (*out >= 040)
log_file_warning(loc.begin.filename->c_str(), loc.begin.line, "octal escape exceeds \\377\n");
log_file_warning(*loc.begin.filename, loc.begin.line, "octal escape exceeds \\377\n");
*out = *out * 010 + val;
in++;
}
@ -377,6 +377,7 @@ TIME_SCALE_SUFFIX [munpf]?s
"begin" { return parser::make_TOK_BEGIN(out_loc); }
"end" { return parser::make_TOK_END(out_loc); }
"if" { return parser::make_TOK_IF(out_loc); }
"ifnone" { return parser::make_TOK_IFNONE(out_loc); }
"else" { return parser::make_TOK_ELSE(out_loc); }
"for" { return parser::make_TOK_FOR(out_loc); }
"posedge" { return parser::make_TOK_POSEDGE(out_loc); }

View file

@ -493,7 +493,7 @@
%token TOK_INPUT TOK_OUTPUT TOK_INOUT TOK_WIRE TOK_WAND TOK_WOR TOK_REG TOK_LOGIC
%token TOK_INTEGER TOK_SIGNED TOK_ASSIGN TOK_ALWAYS TOK_INITIAL
%token TOK_ALWAYS_FF TOK_ALWAYS_COMB TOK_ALWAYS_LATCH
%token TOK_BEGIN TOK_END TOK_IF TOK_ELSE TOK_FOR TOK_WHILE TOK_REPEAT
%token TOK_BEGIN TOK_END TOK_IF TOK_ELSE TOK_IFNONE TOK_FOR TOK_WHILE TOK_REPEAT
%token TOK_DPI_FUNCTION TOK_POSEDGE TOK_NEGEDGE TOK_OR TOK_AUTOMATIC
%token TOK_CASE TOK_CASEX TOK_CASEZ TOK_ENDCASE TOK_DEFAULT
%token TOK_FUNCTION TOK_ENDFUNCTION TOK_TASK TOK_ENDTASK TOK_SPECIFY
@ -1581,18 +1581,60 @@ list_of_specparam_assignments:
specparam_assignment:
ignspec_id TOK_EQ ignspec_expr ;
ignspec_opt_cond:
TOK_IF TOK_LPAREN ignspec_expr TOK_RPAREN | %empty;
path_declaration :
simple_path_declaration TOK_SEMICOL
// | edge_sensitive_path_declaration
// | state_dependent_path_declaration
| state_dependent_path_declaration TOK_SEMICOL
;
simple_path_declaration :
ignspec_opt_cond parallel_path_description TOK_EQ path_delay_value |
ignspec_opt_cond full_path_description TOK_EQ path_delay_value
parallel_path_description TOK_EQ path_delay_value |
full_path_description TOK_EQ path_delay_value
;
state_dependent_path_declaration:
TOK_IF TOK_LPAREN module_path_expression TOK_RPAREN simple_path_declaration
// | TOK_IF TOK_LPAREN module_path_expression TOK_RPAREN edge_sensitive_path_declaration
| TOK_IFNONE simple_path_declaration
;
module_path_expression:
module_path_primary
// Flatten out unary_operator to avoid shift/reduce conflict
| TOK_EXCL attr module_path_primary { free_attr($2); }
| TOK_TILDE attr module_path_primary { free_attr($2); }
| TOK_AMP attr module_path_primary { free_attr($2); }
| OP_NAND attr module_path_primary { free_attr($2); }
| TOK_PIPE attr module_path_primary { free_attr($2); }
| OP_NOR attr module_path_primary { free_attr($2); }
| TOK_CARET attr module_path_primary { free_attr($2); }
| OP_XNOR attr module_path_primary { free_attr($2); }
// Flatten out binary_operator to avoid shift/reduce conflict
| module_path_expression OP_EQ attr module_path_expression { free_attr($3); }
| module_path_expression OP_NE attr module_path_expression { free_attr($3); }
| module_path_expression OP_LAND attr module_path_expression { free_attr($3); }
| module_path_expression OP_LOR attr module_path_expression { free_attr($3); }
| module_path_expression TOK_AMP attr module_path_expression { free_attr($3); }
| module_path_expression TOK_PIPE attr module_path_expression { free_attr($3); }
| module_path_expression TOK_CARET attr module_path_expression { free_attr($3); }
| module_path_expression OP_XNOR attr module_path_expression { free_attr($3); }
// | module_path_conditional_expression
;
module_path_primary:
number
| TOK_ID
// Deviate from specification: Normally string would not be allowed, however they are necessary for the ecp5 tests
| TOK_STRING
// | module_path_concatenation
// | module_path_multiple_concatenation
// | function_subroutine_call
// | TOK_LPAREN module_path_minmax_expression TOK_RPAREN
;
number:
integral_number
| TOK_REALVAL
;
path_delay_value :