Skip to content

Commit f6fadf4

Browse files
kroeningtautschnig
authored andcommitted
SMV: grammar for asynchronous processes
This adds the grammar for "process" module instantiations. They are errored as unsupported by the type checker.
1 parent cc0a2aa commit f6fadf4

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
@@ -42,6 +42,7 @@ IREP_ID_ONE(smv_setnotin)
4242
IREP_ID_ONE(smv_signed_cast)
4343
IREP_ID_ONE(smv_signed_word)
4444
IREP_ID_ONE(smv_sizeof)
45+
IREP_ID_ONE(smv_process_module_instance)
4546
IREP_ID_ONE(smv_swconst)
4647
IREP_ID_ONE(smv_union)
4748
IREP_ID_ONE(smv_unsigned_cast)

src/smvlang/parser.y

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,16 +589,26 @@ simple_type_specifier:
589589
;
590590

591591
module_type_specifier:
592-
module_name
592+
module_name parameter_list_paren_opt
593593
{
594594
init($$, ID_smv_module_instance);
595595
to_smv_module_instance_type(stack_type($$)).base_name(stack_expr($1).id());
596+
stack_expr($$).operands().swap(stack_expr($2).operands());
596597
}
597-
| module_name '(' parameter_list ')'
598+
| process_Token module_name parameter_list_paren_opt
598599
{
599-
init($$, ID_smv_module_instance);
600-
to_smv_module_instance_type(stack_type($$)).base_name(stack_expr($1).id());
601-
stack_expr($$).operands().swap(stack_expr($3).operands());
600+
init($$, ID_smv_process_module_instance);
601+
}
602+
;
603+
604+
parameter_list_paren_opt:
605+
/* optional */
606+
{
607+
init($$);
608+
}
609+
| '(' parameter_list ')'
610+
{
611+
$$ = $2;
602612
}
603613
;
604614

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

@@ -2277,8 +2285,12 @@ void smv_typecheckt::create_var_symbols(
22772285
else
22782286
symbol.pretty_name = strip_smv_prefix(symbol.name);
22792287

2280-
if(symbol.type.id() == ID_smv_module_instance)
2288+
if(
2289+
symbol.type.id() == ID_smv_module_instance ||
2290+
symbol.type.id() == ID_smv_process_module_instance)
2291+
{
22812292
symbol.is_input = false;
2293+
}
22822294
else
22832295
symbol.is_input = true;
22842296

0 commit comments

Comments
 (0)