.TH MURPHI2C 1
.SH NAME
murphi2c \- translate a Murphi model to C for simulation
.SH SYNOPSIS
.B \fBmurphi2c\fR \fBoptions\fR [\fB--output\fR \fIFILE\fR] [\fIFILE\fR]
.SH DESCRIPTION
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.
.PP
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.
.PP
See
.BR rumur(1)
for more information about Rumur or Murphi.
.SH OPTIONS
\fB--header\fR
.RS
Generate a C header, as opposed to a source file.
.RE
.PP
\fB--output\fR \fIFILE\fR or \fB-o\fR \fIFILE\fR
.RS
Set path to write the generated C code to. Without this option, code is written
to stdout.
.RE
.PP
\fB--source\fR
.RS
Generate a C source file, as opposed to a header. This is the default.
.RE
.PP
\fB--value-type\fR \fITYPE\fR
.RS
Change the C type used to represent scalar values in the emitted code. By
default, \fIint\fR 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.
.RE
.PP
\fB--version\fR
.RS
Display version information and exit.
.RE
.SH 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:
.PP
.RS
// Called when a model assertion is violated. The default implementation prints
.br
// the message and then calls exit().
.br
void (*failed_assertion)(const char *message);
.PP
// Called when a model assumption is violated. The default implementation prints
.br
// the message and then calls exit().
.br
void (*failed_assumption)(const char *message);
.PP
// Called when an error statement is reached. The default implementation prints
.br
// the message and then calls exit().
.br
void (*error)(const char *message);
.PP
// Called when a cover condition is hit. The default implementation does
.br
// nothing.
void (*cover)(const char *message);
.PP
// Called when a liveness condition is hit. The default implementation does
.br
// nothing.
.br
void (*liveness)(const char *message);
.PP
.RE
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 \fB==\fR or \fB!=\fR). If this
is the case, the produced structs will be packed (using
\fB__attribute__((packed))\fR) to ensure they can be compared with \fBmemcmp\fR.
.SH SEE ALSO
rumur(1)
.SH AUTHOR
All comments, questions and complaints should be directed to Matthew Fernandez
<matthew.fernandez@gmail.com>.
.SH LICENSE
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org>