Opened 7 years ago
Closed 6 years ago
#4873 closed defect (fixed)
Issue with enumeration-indexed arrays in NF
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | |
Keywords: | Cc: |
Description (last modified by )
Please consider the model Modelica.Electrical.Digital.Examples.FlipFlop. The following runtime error is reported by the NF:
assert | error | Dimension 1 has bounds 1..9, got array subscript 0 assert | info | simulation terminated by an assertion at initialization
In the old FE, equations such as this one were flattened:
FF.RS2.Nor2.auxiliary_n = {Modelica.Electrical.Digital.Interfaces.Logic.'U', Modelica.Electrical.Digital.Interfaces.Logic.'X', Modelica.Electrical.Digital.Interfaces.Logic.'1', Modelica.Electrical.Digital.Interfaces.Logic.'0', Modelica.Electrical.Digital.Interfaces.Logic.'X', Modelica.Electrical.Digital.Interfaces.Logic.'X', Modelica.Electrical.Digital.Interfaces.Logic.'1', Modelica.Electrical.Digital.Interfaces.Logic.'0', Modelica.Electrical.Digital.Interfaces.Logic.'X'}[FF.RS2.Nor2.auxiliary[2]];
In the NF, this is obtained instead:
FF.RS2.Nor2.auxiliary_n = Modelica.Electrical.Digital.Tables.NotTable[FF.RS2.Nor2.auxiliary[2]]; constant enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') Modelica.Electrical.Digital.Tables.NotTable[Modelica.Electrical.Digital.Interfaces.Logic.'U'] = Modelica.Electrical.Digital.Interfaces.Logic.'U' "9-value logic for 'not'"; constant enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') Modelica.Electrical.Digital.Tables.NotTable[Modelica.Electrical.Digital.Interfaces.Logic.'X'] = Modelica.Electrical.Digital.Interfaces.Logic.'X' "9-value logic for 'not'"; constant enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') Modelica.Electrical.Digital.Tables.NotTable[Modelica.Electrical.Digital.Interfaces.Logic.'0'] = Modelica.Electrical.Digital.Interfaces.Logic.'1' "9-value logic for 'not'"; constant enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') Modelica.Electrical.Digital.Tables.NotTable[Modelica.Electrical.Digital.Interfaces.Logic.'1'] = Modelica.Electrical.Digital.Interfaces.Logic.'0' "9-value logic for 'not'"; constant enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') Modelica.Electrical.Digital.Tables.NotTable[Modelica.Electrical.Digital.Interfaces.Logic.'Z'] = Modelica.Electrical.Digital.Interfaces.Logic.'X' "9-value logic for 'not'"; constant enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') Modelica.Electrical.Digital.Tables.NotTable[Modelica.Electrical.Digital.Interfaces.Logic.'W'] = Modelica.Electrical.Digital.Interfaces.Logic.'X' "9-value logic for 'not'"; constant enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') Modelica.Electrical.Digital.Tables.NotTable[Modelica.Electrical.Digital.Interfaces.Logic.'L'] = Modelica.Electrical.Digital.Interfaces.Logic.'1' "9-value logic for 'not'"; constant enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') Modelica.Electrical.Digital.Tables.NotTable[Modelica.Electrical.Digital.Interfaces.Logic.'H'] = Modelica.Electrical.Digital.Interfaces.Logic.'0' "9-value logic for 'not'"; constant enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') Modelica.Electrical.Digital.Tables.NotTable[Modelica.Electrical.Digital.Interfaces.Logic.'-'] = Modelica.Electrical.Digital.Interfaces.Logic.'X' "9-value logic for 'not'";
I'm not sure how this is actually rendered in terms of internal data structures, but it seems that the new one is not accepted by the subsequent code generation phases.
Change History (3)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 6 years ago
Note:
See TracTickets
for help on using tickets.
There are 24
Modelica.Electrical.Digital.Examples
models affected by this issue