Open vrozen opened 11 years ago
ToPromela now supports two ways of generating expressions based on a debug flag
The design decision of rounding down flow expressions to the nearest integer still seems good. Edges are memoryless and don't accumulate resources, flow only transports whole number resources and pools only store integer values. However, using floats to implement flow expressions is bad because of rounding errors.
Paul already mentioned we need fixed point instead of floating point. We should probably use decimal encoding making the scaling factor a power of ten. Assuming designers require no more precision than percentages, a fixed factor of 1/100 seems like a good choice. e.g. 1.23 = 123/100.
Fixed point arithmetic might be fully implemented in Promela, although I observed we can also fully implement node behaviors in C because they are deterministic. The advantage would be sharing MM library code with the analysis. The disadvantage would be even worse meta-level debugging, by excluding the use of the Spin interpreter. User-level debugging of Micro-Machinations Traces (.mmt) would not be affected.
MM requires floating point calculations in flow expressions. The result of evaluating these expressions is to round down to the nearest integer number. How can MM expressions be supported?
Promela only supports integer expressions natively, since its values are "abstractions". It does however support embedding C code. The following model does not show the correct value in guided simulation but it does produce a verifier that seems to work correctly.
This only works when taking the following steps
rozen$ spin -a experiment.pml
gcc pan.c
./a.out
/a.out -P experiment.pml.trail