Skip to content

Commit 2763b25

Browse files
committed
SMV: grammar for asynchronous processes
This adds the grammar for "process" module instantiations. They are errored as unsupported by the type checker.
1 parent 1431945 commit 2763b25

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
KNOWNBUG
1+
CORE
22
process1.smv
33

4-
^EXIT=0$
4+
^file .* line 8: no support for asynchronous processes$
5+
^EXIT=2$
56
^SIGNAL=0$
67
--
78
^warning: ignoring
89
--
9-
This does not parse.

src/hw_cbmc_irep_ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ IREP_ID_ONE(smv_setnotin)
3939
IREP_ID_ONE(smv_signed_cast)
4040
IREP_ID_ONE(smv_sizeof)
4141
IREP_ID_ONE(smv_module_instance)
42+
IREP_ID_ONE(smv_process_module_instance)
4243
IREP_ID_ONE(smv_swconst)
4344
IREP_ID_ONE(smv_union)
4445
IREP_ID_ONE(smv_unsigned_cast)

src/smvlang/parser.y

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -598,16 +598,26 @@ simple_type_specifier:
598598
;
599599

600600
module_type_specifier:
601-
module_name
601+
module_name parameter_list_paren_opt
602602
{
603603
init($$, ID_smv_module_instance);
604604
to_smv_module_instance_type(stack_type($$)).base_name(stack_expr($1).id());
605+
stack_expr($$).operands().swap(stack_expr($2).operands());
605606
}
606-
| module_name '(' parameter_list ')'
607+
| process_Token module_name parameter_list_paren_opt
607608
{
608-
init($$, ID_smv_module_instance);
609-
to_smv_module_instance_type(stack_type($$)).base_name(stack_expr($1).id());
610-
stack_expr($$).operands().swap(stack_expr($3).operands());
609+
init($$, ID_smv_process_module_instance);
610+
}
611+
;
612+
613+
parameter_list_paren_opt:
614+
/* optional */
615+
{
616+
init($$);
617+
}
618+
| '(' parameter_list ')'
619+
{
620+
$$ = $2;
611621
}
612622
;
613623

src/smvlang/smv_typecheck.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,14 @@ void smv_typecheckt::flatten_hierarchy(smv_parse_treet::modulet &smv_module)
261261
instance.arguments(),
262262
instance.source_location());
263263
}
264+
265+
if(
266+
element.is_var() &&
267+
element.expr.type().id() == ID_smv_process_module_instance)
268+
{
269+
throw errort().with_location(element.expr.source_location())
270+
<< "no support for asynchronous processes";
271+
}
264272
}
265273
}
266274

@@ -2226,8 +2234,12 @@ void smv_typecheckt::create_var_symbols(
22262234
else
22272235
symbol.pretty_name = strip_smv_prefix(symbol.name);
22282236

2229-
if(symbol.type.id() == ID_smv_module_instance)
2237+
if(
2238+
symbol.type.id() == ID_smv_module_instance ||
2239+
symbol.type.id() == ID_smv_process_module_instance)
2240+
{
22302241
symbol.is_input = false;
2242+
}
22312243
else
22322244
symbol.is_input = true;
22332245

0 commit comments

Comments
 (0)