murphi2c1
Translate a murphi model to c for simulation
Usage
murphi2c options
[--output
FILE]
[FILE]
Overview
Murphi2C is a utility bundled with the Rumur model checker. It can be used to translate a Murphi model into C source code for integration into a simulator. The translation is intended to match the user's intuition of the C equivalent of their Murphi model. That is, the produced code is more readable and less micro-optimised than the model checking code produced by Rumur itself.
The C translation produced by Murphi2C is only an approximation of the original Murphi model. For example, there is no equivalent of the "undefined" value in C. If the input model relies on such details, the translation will not precisely match the model. Similarly the type compatibility rules for Murphi and C differ, so models that use aliases or rely on type equivalence may cause Murphi2C to produce C code that does not compile. For such models, Murphi2C is only intended to generate an initial skeleton for a C translation. You should always inspect the output C code to confirm it matches your expectations.
See rumur(1) for more information about Rumur or Murphi.
Options
-
--header -
Generate a C header, as opposed to a source file.
-
--output FILE or -o FILE -
Set path to write the generated C code to. Without this option, code is written to stdout.
-
--source -
Generate a C source file, as opposed to a header. This is the default.
-
--value-type TYPE -
Change the C type used to represent scalar values in the emitted code. By default, int is used. Murphi2C does not validate that the type you specify is a valid C type, but simply trusts that you have given something that will be available when you compile the generated code.
-
--version -
Display version information and exit.
Notes
The generated C code exposes a set of function pointers that can be overwritten by other code to control the behaviour of certain events:
// Called when a model assertion is violated. The default implementation prints
// the message and then calls exit().
void (*failed_assertion)(const char *message);
// Called when a model assumption is violated. The default implementation prints
// the message and then calls exit().
void (*failed_assumption)(const char *message);
// Called when an error statement is reached. The default implementation prints
// the message and then calls exit().
void (*error)(const char *message);
// Called when a cover condition is hit. The default implementation does
// nothing. void (*cover)(const char *message);
// Called when a liveness condition is hit. The default implementation does
// nothing.
void (*liveness)(const char *message);
Murphi records are translated into C structs that use native, platform-dependent member layout. An exception to this is if the input model performs aggregate comparisons of record or array expressions (using == or !=). If this is the case, the produced structs will be packed (using __attribute__((packed))) to ensure they can be compared with memcmp.
History
- Debian 13 (Trixie): the text shown here
- Debian 12 (Bookworm) to Debian 11 (Bullseye)