k-legacy
k-legacy copied to clipboard
cell is initialized with .Set instead of .Map
I have a configuration that contains the following cells:
...
<statefuls>
<stateful multiplicity="*">
<stype> .K </stype>
<name> .K </name>
<opts> .Map </opts>
<vals> .Map </vals>
<width> .K </width>
</stateful>
</statefuls>
Note <vals> .Map </vals>
And I have the following rule
rule <k> @processDec(counter Name:Id { type : T:CounterType ; SOpt:StatefulOptionals COpt:CounterOptionals }) => @addTableDirect(Name) ... </k>
<statefuls>
(.Bag =>
<stateful>
<stype> $counter </stype>
<name> Name </name>
<opts> ("$counter_type" |-> T) @processStatefulOpts(SOpt, ("$binding" |-> $static_global)) @processCounterOpts(COpt, ("$signed" |-> false) ("$saturating" |-> false)) </opts>
<width> 0 </width> // = inf
...
</stateful>
) ...
</statefuls>
before this rule is applied my configuration is as follows:
<k> @processDec ( counter my_indirect_counter { type : packets ; ( static : m_table ) ; ( ( instance_count : 16384 ) ; .StatefulOptionals ) .CounterOptionals } ) ~> .... </k>
...
<statefuls> .StatefulCellBag </statefuls>
After the application of the rules I get:
<k> @addTableDirect ( my_indirect_counter ) ~> ... </k>
<statefuls>
<stateful>
<stype> $counter </stype>
<name> my_indirect_counter </name>
<opts> "$counter_type" |-> packets "$instant_count" |-> 16384 "$table" |-> m_table "$saturating" |-> false "$signed" |-> false "$binding" |-> $static </opts>
<vals> .Set </vals>
<width> 0 </width>
</stateful>
</statefuls>
Note that <vals>
is intialized with .Set instead of .Map
Unfortunately I can not create a minimal example that exhibits the problem as smaller programs do not exhibit this problem. For example this has no problem:
module TEST
syntax X ::= "@processDec"
configuration
<T>
<k> $PGM:X </k>
<statefuls>
<stateful multiplicity="*">
<stype> .K </stype>
<name> .K </name>
<opts> .Map </opts>
<vals> .Map </vals>
<width> .K </width>
</stateful>
</statefuls>
</T>
rule <k> @processDec => . ... </k>
<statefuls>
(.Bag =>
<stateful>
<stype> "$coutner" </stype>
<name> "name" </name>
<opts> ("$counter_type" |-> "direct") </opts>
<width> 0 </width>
...
</stateful>
) ...
</statefuls>
endmodule