Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemVerilog: clocking declarations #945

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
--
10 changes: 10 additions & 0 deletions regression/verilog/clocking/clocking1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module main(input clk);

clocking my_clocking @(posedge clk);
endclocking

// The identifier is optional.
default 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
76 changes: 76 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,73 @@ procedural_timing_control:
// System Verilog standard 1800-2017
// A.6.11 Clocking block

clocking_declaration:
TOK_DEFAULT TOK_CLOCKING clocking_identifier_opt clocking_event ';'
clocking_item_brace
TOK_ENDCLOCKING
{ init($$, ID_verilog_clocking); }
| 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
;

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 +4369,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 +4409,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
Loading