Skip to content

Commit

Permalink
SystemVerilog: clocking declarations
Browse files Browse the repository at this point in the history
This adds parsing for 1800-2017 14.3 clocking block declarations.
  • Loading branch information
kroening committed Jan 23, 2025
1 parent d923a32 commit eadd966
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* SystemVerilog: chandle, event, string
* SystemVerilog: package scope operator
* SystemVerilog: checkers
* SystemVerilog: clocking block declarations

# EBMC 5.4

Expand Down
9 changes: 9 additions & 0 deletions regression/verilog/clocking/clocking1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
clocking1.sv

^no properties$
^EXIT=10$
^SIGNAL=0$
--
^warning: ignoring
--
6 changes: 6 additions & 0 deletions regression/verilog/clocking/clocking1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module main(input clk);

clocking my_clocking @(posedge clk);
endclocking

endmodule
1 change: 1 addition & 0 deletions src/hw_cbmc_irep_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ IREP_ID_ONE(posedge)
IREP_ID_ONE(event_guard)
IREP_ID_ONE(verilog_star_event)
IREP_ID_ONE(verilog_checker)
IREP_ID_ONE(verilog_clocking)
IREP_ID_ONE(verilog_cycle_delay)
IREP_ID_ONE(delay)
IREP_ID_ONE(verilog_non_blocking_assign)
Expand Down
77 changes: 77 additions & 0 deletions src/verilog/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,9 @@ module_or_generate_item:
module_or_generate_item_declaration:
package_or_generate_item_declaration
| genvar_declaration
| clocking_declaration
| TOK_DEFAULT TOK_CLOCKING clocking_identifier ';'
| TOK_DEFAULT TOK_DISABLE TOK_IFF expression_or_dist ';'
;

non_port_module_item:
Expand Down Expand Up @@ -1106,6 +1109,7 @@ checker_or_generate_item_declaration:
| assertion_item_declaration
| covergroup_declaration
| genvar_declaration
| clocking_declaration
| TOK_DEFAULT TOK_CLOCKING clocking_identifier ';'
| TOK_DEFAULT TOK_DISABLE TOK_IFF expression_or_dist ';'
| ';'
Expand Down Expand Up @@ -3483,6 +3487,12 @@ delay_or_event_control:
{ init($$, ID_repeat); }
;


delay_control_opt:
/* Optional */
| delay_control
;

delay_control:
'#' delay_value
{ init($$, ID_delay); mto($$, $2); }
Expand Down Expand Up @@ -3754,11 +3764,74 @@ procedural_timing_control:
// System Verilog standard 1800-2017
// A.6.11 Clocking block

clocking_declaration:
TOK_CLOCKING clocking_identifier_opt clocking_event ';'
clocking_item_brace
TOK_ENDCLOCKING
{ init($$, ID_verilog_clocking); }
| TOK_GLOBAL TOK_CLOCKING clocking_identifier_opt clocking_event ';'
TOK_ENDCLOCKING
{ init($$, ID_verilog_clocking); }
;

clocking_identifier_opt:
/* Optional */
| clocking_identifier
;

default_opt:
/* Optional */
| TOK_DEFAULT
;

clocking_event:
'@' identifier
| '@' '(' event_expression ')'
;

clocking_item_brace:
/* Optional */
| clocking_item_brace clocking_item
;

clocking_item:
TOK_DEFAULT default_skew ';'
| attribute_instance_brace assertion_item_declaration
;

default_skew:
TOK_INPUT clocking_skew
| TOK_OUTPUT clocking_skew
| TOK_INPUT clocking_skew TOK_OUTPUT clocking_skew
;

clocking_direction:
TOK_INPUT clocking_skew_opt
| TOK_OUTPUT clocking_skew_opt
| TOK_INPUT clocking_skew_opt TOK_OUTPUT clocking_skew_opt
| TOK_INOUT
;

list_of_clocking_decl_assign:
clocking_decl_assign
| list_of_clocking_decl_assign ',' clocking_decl_assign
;

clocking_decl_assign:
signal_identifier
| signal_identifier '=' expression
;

clocking_skew_opt:
/* Optional */
| clocking_skew
;

clocking_skew:
edge_identifier delay_control_opt
| delay_control
;

cycle_delay:
"##" number
{ init($$, ID_verilog_cycle_delay); mto($$, $2); }
Expand Down Expand Up @@ -4297,6 +4370,8 @@ class_identifier: TOK_NON_TYPE_IDENTIFIER;

constraint_identifier: TOK_NON_TYPE_IDENTIFIER;

edge_identifier: identifier;

formal_port_identifier: identifier;

genvar_identifier: identifier;
Expand Down Expand Up @@ -4335,6 +4410,8 @@ memory_identifier: identifier;

method_identifier: identifier;

signal_identifier: identifier;

type_identifier: TOK_TYPE_IDENTIFIER
{
init($$, ID_typedef_type);
Expand Down
3 changes: 3 additions & 0 deletions src/verilog/verilog_elaborate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,9 @@ void verilog_typecheckt::collect_symbols(
else if(module_item.id() == ID_verilog_package_import)
{
}
else if(module_item.id() == ID_verilog_clocking)
{
}
else if(module_item.id() == ID_verilog_covergroup)
{
}
Expand Down
3 changes: 3 additions & 0 deletions src/verilog/verilog_interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ void verilog_typecheckt::interface_module_item(
else if(module_item.id() == ID_verilog_package_import)
{
}
else if(module_item.id() == ID_verilog_clocking)
{
}
else if(module_item.id() == ID_verilog_covergroup)
{
}
Expand Down
3 changes: 3 additions & 0 deletions src/verilog/verilog_synthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3276,6 +3276,9 @@ void verilog_synthesist::synth_module_item(
{
// done already
}
else if(module_item.id() == ID_verilog_clocking)
{
}
else if(module_item.id() == ID_verilog_covergroup)
{
}
Expand Down
3 changes: 3 additions & 0 deletions src/verilog/verilog_typecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,9 @@ void verilog_typecheckt::convert_module_item(
else if(module_item.id() == ID_verilog_package_import)
{
}
else if(module_item.id() == ID_verilog_clocking)
{
}
else if(module_item.id() == ID_verilog_covergroup)
{
}
Expand Down

0 comments on commit eadd966

Please sign in to comment.