@@ -771,6 +771,12 @@ parameter_port_list_opt:
771
771
{ init ($$); }
772
772
;
773
773
774
+ list_of_ports_opt:
775
+ /* Optional */
776
+ { make_nil ($$); }
777
+ | list_of_ports
778
+ ;
779
+
774
780
list_of_ports: ' (' port_brace ' )' { $$ = $2 ; }
775
781
;
776
782
@@ -2770,14 +2776,34 @@ constant_expression: expression;
2770
2776
// System Verilog standard 1800-2017
2771
2777
// A.5.1 UDP declaration
2772
2778
2773
- udp_declaration: attribute_instance_brace TOK_PRIMITIVE udp_identifier
2774
- ' (' udp_port_list ' )' ' ;' udp_port_declaration_brace
2775
- udp_body TOK_ENDPRIMITIVE
2776
- | attribute_instance_brace TOK_PRIMITIVE udp_identifier
2777
- ' (' udp_declaration_port_list ' )' ' ;'
2778
- udp_body TOK_ENDPRIMITIVE
2779
+ udp_nonansi_declaration:
2780
+ attribute_instance_brace
2781
+ TOK_PRIMITIVE udp_identifier ' (' udp_port_list ' )' ' ;'
2779
2782
;
2780
2783
2784
+ udp_ansi_declaration:
2785
+ attribute_instance_brace
2786
+ TOK_PRIMITIVE udp_identifier ' (' udp_declaration_port_list ' )' ' ;'
2787
+ ;
2788
+
2789
+ udp_declaration:
2790
+ udp_nonansi_declaration
2791
+ udp_port_declaration
2792
+ udp_port_declaration_brace
2793
+ udp_body
2794
+ TOK_ENDPRIMITIVE
2795
+ | udp_ansi_declaration
2796
+ udp_body
2797
+ TOK_ENDPRIMITIVE
2798
+ | TOK_EXTERN udp_nonansi_declaration
2799
+ | TOK_EXTERN udp_ansi_declaration
2800
+ | attribute_instance_brace
2801
+ TOK_PRIMITIVE udp_identifier ' (' ' )' ' ;'
2802
+ udp_port_declaration_brace
2803
+ udp_body
2804
+ TOK_ENDPRIMITIVE
2805
+ ;
2806
+
2781
2807
// System Verilog standard 1800-2017
2782
2808
// A.5.2 UDP ports
2783
2809
@@ -2823,31 +2849,94 @@ port_identifier_brace:
2823
2849
// System Verilog standard 1800-2017
2824
2850
// A.5.3 UDP body
2825
2851
2826
- udp_body: udp_initial_statement_opt TOK_TABLE table_entry_brace TOK_ENDTABLE
2852
+ udp_body: combinational_body ;
2853
+
2854
+ combinational_body:
2855
+ TOK_TABLE
2856
+ combinational_entry_brace
2857
+ TOK_ENDTABLE
2858
+ ;
2859
+
2860
+ combinational_entry_brace:
2861
+ combinational_entry
2862
+ | combinational_entry_brace combinational_entry
2863
+ ;
2864
+
2865
+ combinational_entry:
2866
+ level_input_list TOK_COLON output_symbol ' ;'
2867
+ ;
2868
+
2869
+ sequential_body:
2870
+ udp_initial_statement_opt
2871
+ TOK_TABLE sequential_entry_brace TOK_ENDTABLE
2827
2872
;
2828
2873
2829
2874
udp_initial_statement_opt:
2875
+ /* Optional */
2876
+ | udp_initial_statement
2830
2877
;
2831
2878
2832
- table_entry_brace:
2833
- table_entry
2834
- | table_entry_brace table_entry
2879
+ udp_initial_statement:
2880
+ TOK_INITIAL output_port_identifier ' =' init_val ' ;'
2835
2881
;
2836
2882
2837
- table_entry: input_list TOK_COLON output_or_level_symbol ' ;'
2838
- | input_list TOK_COLON output_or_level_symbol TOK_COLON next_state ' ;'
2883
+ output_port_identifier: new_identifier
2839
2884
;
2840
2885
2841
- input_list:;
2886
+ init_val:
2887
+ // Really 1'b0 | 1'b1 | 1'bx | 1'bX | 1'B0 | 1'B1 | 1'Bx | 1'BX | 1 | 0
2888
+ TOK_NUMBER
2889
+ | new_identifier
2890
+ ;
2842
2891
2843
- output_or_level_symbol:;
2892
+ sequential_entry_brace:
2893
+ sequential_entry
2894
+ | sequential_entry_brace sequential_entry
2895
+ ;
2844
2896
2845
- next_state:;
2897
+ sequential_entry:
2898
+ seq_input_list TOK_COLON current_state TOK_COLON next_state
2899
+ ;
2846
2900
2847
- list_of_ports_opt:
2848
- /* Optional */
2849
- { make_nil ($$); }
2850
- | list_of_ports
2901
+ seq_input_list: level_input_list | edge_input_list
2902
+ ;
2903
+
2904
+ edge_indicator:
2905
+ ' (' level_symbol level_symbol ' )' | edge_symbol
2906
+ ;
2907
+
2908
+ current_state: level_symbol ;
2909
+
2910
+ next_state: output_symbol | ' -' ;
2911
+
2912
+ level_input_list:
2913
+ level_symbol
2914
+ | level_input_list level_symbol
2915
+ ;
2916
+
2917
+ edge_input_list: level_symbol_brace edge_indicator level_symbol_brace ;
2918
+
2919
+ output_symbol:
2920
+ // Really 0 | 1 | x | X
2921
+ TOK_NUMBER
2922
+ | new_identifier
2923
+ ;
2924
+
2925
+ level_symbol_brace:
2926
+ level_symbol
2927
+ | level_symbol_brace level_symbol
2928
+ ;
2929
+
2930
+ level_symbol:
2931
+ // Really 0 | 1 | x | X | ? | b | B
2932
+ TOK_NUMBER
2933
+ | new_identifier
2934
+ ;
2935
+
2936
+ edge_symbol:
2937
+ // Really r | R | f | F | p | P | n | N | *
2938
+ TOK_NUMBER
2939
+ | new_identifier
2851
2940
;
2852
2941
2853
2942
// System Verilog standard 1800-2017
0 commit comments