Skip to content

Commit 5ffa8e0

Browse files
authored
Merge pull request #945 from diffblue/clocking_declaration
SystemVerilog: clocking declarations
2 parents d923a32 + ed026f5 commit 5ffa8e0

File tree

9 files changed

+109
-0
lines changed

9 files changed

+109
-0
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* SystemVerilog: chandle, event, string
1212
* SystemVerilog: package scope operator
1313
* SystemVerilog: checkers
14+
* SystemVerilog: clocking block declarations
1415

1516
# EBMC 5.4
1617

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
clocking1.sv
3+
4+
^no properties$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
9+
--
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module main(input clk);
2+
3+
clocking my_clocking @(posedge clk);
4+
endclocking
5+
6+
// The identifier is optional.
7+
default clocking @(posedge clk);
8+
endclocking
9+
10+
endmodule

src/hw_cbmc_irep_ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ IREP_ID_ONE(posedge)
132132
IREP_ID_ONE(event_guard)
133133
IREP_ID_ONE(verilog_star_event)
134134
IREP_ID_ONE(verilog_checker)
135+
IREP_ID_ONE(verilog_clocking)
135136
IREP_ID_ONE(verilog_cycle_delay)
136137
IREP_ID_ONE(delay)
137138
IREP_ID_ONE(verilog_non_blocking_assign)

src/verilog/parser.y

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,9 @@ module_or_generate_item:
10241024
module_or_generate_item_declaration:
10251025
package_or_generate_item_declaration
10261026
| genvar_declaration
1027+
| clocking_declaration
1028+
| TOK_DEFAULT TOK_CLOCKING clocking_identifier ';'
1029+
| TOK_DEFAULT TOK_DISABLE TOK_IFF expression_or_dist ';'
10271030
;
10281031

10291032
non_port_module_item:
@@ -1106,6 +1109,7 @@ checker_or_generate_item_declaration:
11061109
| assertion_item_declaration
11071110
| covergroup_declaration
11081111
| genvar_declaration
1112+
| clocking_declaration
11091113
| TOK_DEFAULT TOK_CLOCKING clocking_identifier ';'
11101114
| TOK_DEFAULT TOK_DISABLE TOK_IFF expression_or_dist ';'
11111115
| ';'
@@ -3483,6 +3487,12 @@ delay_or_event_control:
34833487
{ init($$, ID_repeat); }
34843488
;
34853489

3490+
3491+
delay_control_opt:
3492+
/* Optional */
3493+
| delay_control
3494+
;
3495+
34863496
delay_control:
34873497
'#' delay_value
34883498
{ init($$, ID_delay); mto($$, $2); }
@@ -3754,11 +3764,73 @@ procedural_timing_control:
37543764
// System Verilog standard 1800-2017
37553765
// A.6.11 Clocking block
37563766

3767+
clocking_declaration:
3768+
TOK_DEFAULT TOK_CLOCKING clocking_identifier_opt clocking_event ';'
3769+
clocking_item_brace
3770+
TOK_ENDCLOCKING
3771+
{ init($$, ID_verilog_clocking); }
3772+
| TOK_CLOCKING clocking_identifier_opt clocking_event ';'
3773+
clocking_item_brace
3774+
TOK_ENDCLOCKING
3775+
{ init($$, ID_verilog_clocking); }
3776+
| TOK_GLOBAL TOK_CLOCKING clocking_identifier_opt clocking_event ';'
3777+
TOK_ENDCLOCKING
3778+
{ init($$, ID_verilog_clocking); }
3779+
;
3780+
3781+
clocking_identifier_opt:
3782+
/* Optional */
3783+
| clocking_identifier
3784+
;
3785+
37573786
clocking_event:
37583787
'@' identifier
37593788
| '@' '(' event_expression ')'
37603789
;
37613790

3791+
clocking_item_brace:
3792+
/* Optional */
3793+
| clocking_item_brace clocking_item
3794+
;
3795+
3796+
clocking_item:
3797+
TOK_DEFAULT default_skew ';'
3798+
| attribute_instance_brace assertion_item_declaration
3799+
;
3800+
3801+
default_skew:
3802+
TOK_INPUT clocking_skew
3803+
| TOK_OUTPUT clocking_skew
3804+
| TOK_INPUT clocking_skew TOK_OUTPUT clocking_skew
3805+
;
3806+
3807+
clocking_direction:
3808+
TOK_INPUT clocking_skew_opt
3809+
| TOK_OUTPUT clocking_skew_opt
3810+
| TOK_INPUT clocking_skew_opt TOK_OUTPUT clocking_skew_opt
3811+
| TOK_INOUT
3812+
;
3813+
3814+
list_of_clocking_decl_assign:
3815+
clocking_decl_assign
3816+
| list_of_clocking_decl_assign ',' clocking_decl_assign
3817+
;
3818+
3819+
clocking_decl_assign:
3820+
signal_identifier
3821+
| signal_identifier '=' expression
3822+
;
3823+
3824+
clocking_skew_opt:
3825+
/* Optional */
3826+
| clocking_skew
3827+
;
3828+
3829+
clocking_skew:
3830+
edge_identifier delay_control_opt
3831+
| delay_control
3832+
;
3833+
37623834
cycle_delay:
37633835
"##" number
37643836
{ init($$, ID_verilog_cycle_delay); mto($$, $2); }
@@ -4297,6 +4369,8 @@ class_identifier: TOK_NON_TYPE_IDENTIFIER;
42974369

42984370
constraint_identifier: TOK_NON_TYPE_IDENTIFIER;
42994371

4372+
edge_identifier: identifier;
4373+
43004374
formal_port_identifier: identifier;
43014375

43024376
genvar_identifier: identifier;
@@ -4335,6 +4409,8 @@ memory_identifier: identifier;
43354409

43364410
method_identifier: identifier;
43374411

4412+
signal_identifier: identifier;
4413+
43384414
type_identifier: TOK_TYPE_IDENTIFIER
43394415
{
43404416
init($$, ID_typedef_type);

src/verilog/verilog_elaborate.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,9 @@ void verilog_typecheckt::collect_symbols(
844844
else if(module_item.id() == ID_verilog_package_import)
845845
{
846846
}
847+
else if(module_item.id() == ID_verilog_clocking)
848+
{
849+
}
847850
else if(module_item.id() == ID_verilog_covergroup)
848851
{
849852
}

src/verilog/verilog_interfaces.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ void verilog_typecheckt::interface_module_item(
300300
else if(module_item.id() == ID_verilog_package_import)
301301
{
302302
}
303+
else if(module_item.id() == ID_verilog_clocking)
304+
{
305+
}
303306
else if(module_item.id() == ID_verilog_covergroup)
304307
{
305308
}

src/verilog/verilog_synthesis.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3276,6 +3276,9 @@ void verilog_synthesist::synth_module_item(
32763276
{
32773277
// done already
32783278
}
3279+
else if(module_item.id() == ID_verilog_clocking)
3280+
{
3281+
}
32793282
else if(module_item.id() == ID_verilog_covergroup)
32803283
{
32813284
}

src/verilog/verilog_typecheck.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,9 @@ void verilog_typecheckt::convert_module_item(
17341734
else if(module_item.id() == ID_verilog_package_import)
17351735
{
17361736
}
1737+
else if(module_item.id() == ID_verilog_clocking)
1738+
{
1739+
}
17371740
else if(module_item.id() == ID_verilog_covergroup)
17381741
{
17391742
}

0 commit comments

Comments
 (0)