From: TimRudy <3942818+TimRudy@users.noreply.github.com> Date: Wed, 24 Feb 2021 20:48:15 +0000 (-0500) Subject: Extend "delay" expressions to handle pair and triplet, i.e. rise, fall and turn-off... X-Git-Tag: working-ls180~37 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dcd9f0af23f9b580b044890452ecf1aef59bbb85;p=yosys.git Extend "delay" expressions to handle pair and triplet, i.e. rise, fall and turn-off (#2566) --- diff --git a/frontends/verilog/verilog_parser.y b/frontends/verilog/verilog_parser.y index 7fbd2aa27..89e686818 100644 --- a/frontends/verilog/verilog_parser.y +++ b/frontends/verilog/verilog_parser.y @@ -609,12 +609,17 @@ interface_body_stmt: param_decl | localparam_decl | typedef_decl | defparam_decl | wire_decl | always_stmt | assign_stmt | modport_stmt; +mintypmax_expr: + expr { delete $1; } | + expr ':' expr ':' expr { delete $1; delete $3; delete $5; }; + non_opt_delay: '#' TOK_ID { delete $2; } | '#' TOK_CONSTVAL { delete $2; } | '#' TOK_REALVAL { delete $2; } | - '#' '(' expr ')' { delete $3; } | - '#' '(' expr ':' expr ':' expr ')' { delete $3; delete $5; delete $7; }; + '#' '(' mintypmax_expr ')' | + '#' '(' mintypmax_expr ',' mintypmax_expr ')' | + '#' '(' mintypmax_expr ',' mintypmax_expr ',' mintypmax_expr ')'; delay: non_opt_delay | %empty; diff --git a/tests/verilog/delay_mintypmax.ys b/tests/verilog/delay_mintypmax.ys new file mode 100644 index 000000000..74359f557 --- /dev/null +++ b/tests/verilog/delay_mintypmax.ys @@ -0,0 +1,213 @@ +logger -expect-no-warnings +read_verilog <> b) >>> c; +endmodule +EOT + +design -reset +logger -expect-no-warnings +read_verilog < inA[1]) out <= 1'b1; + else if (inA[0] < inA[1] - hyst) out <= 1'b0; + end +endmodule +EOT + +design -reset +logger -expect-no-warnings +read_verilog <> b) >>> c; +endmodule +EOT + +design -reset +logger -expect-no-warnings +read_verilog < inA[1]) out <= 1'b1; + else if (inA[0] < inA[1] - hyst) out <= 1'b0; + end +endmodule +EOT + +design -reset +logger -expect-no-warnings +read_verilog < inA[1]) out <= 1'b1; + else if (inA[0] < inA[1] - hyst) out <= 1'b0; + end +endmodule +EOT + +design -reset +logger -expect-no-warnings +read_verilog <