MURPHI2C(1)
π MURPHI2C β NAME π
okay so <rainbow>murphi2c</rainbow> is the little icon that translates a Murphi model to C for simulation. that's it, that's the whole job, and it does it gorgeously. π
(this is the <pink>General Commands Manual</pink> version, section 1, iykyk)
π¦ SYNOPSIS π¦
murphi2c options [--output FILE] [FILE]
like. options, maybe an output path, maybe a file. no biggie. β¨
πΈ DESCRIPTION πΈ
okay bestie listen. murphi2c is a utility that ships bundled with the Rumur model checker. its whole thing is taking a Murphi model and translating it into C source code so you can drop it into a simulator. π«Ά
and the translation? it's designed to match your intuition of what the C equivalent of your Murphi model would look like. like, the produced code is more readable and less micro-optimised than the model checking code that Rumur itself spits out. it's giving "for humans, not for the compiler to flex on". π
π¨ BUT. important. the C translation is only an approximation of the original Murphi model. for example, there is literally no equivalent of the "undefined" value in C. so if your input model relies on details like that, the translation will not precisely match the model. π
and also β the type compatibility rules for Murphi and C differ. so models that use aliases or rely on type equivalence may causemurphi2cto produce C code that does not compile. for those models,murphi2cis only meant to generate an initial skeleton for a C translation. you should always inspect the output C code to confirm it matches your expectations. fr fr, don't skip this. π
if you want more info about Rumur or Murphi, go see rumur(1). π
β¨ OPTIONS β¨
--headerβ generate a C header, as opposed to a source file. π--output FILEor-o FILEβ set the path to write the generated C code to. without this option, code goes to stdout. classic.--sourceβ generate a C source file, as opposed to a header. this is the default, so if you do nothing, you still get a source file. main character energy. π--value-type TYPEβ change the C type used to represent scalar values in the emitted code. by default,intis used. now,murphi2cdoes not validate that the type you specify is a valid C type β it just trusts that you've given something that will be available when you compile the generated code. so like. choose wisely bestie. π--versionβ display version information and exit. the classic "who am i" move. π
π₯ 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. so you get to be the puppet master. π§
// 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);
π heads up on the defaults:failed_assertion,failed_assumptionanderrorall print the message and then callexit(). so like, they end things. meanwhilecoverandlivenessdo nothing at all by default. the duality. π
and now the β¨ record tea β¨:
Murphi records get translated into C structs that use native, platform-dependent member layout. the one exception is if the input model performs aggregate comparisons of record or array expressions β using == or !=. if that's the case, the produced structs will be packed using __attribute__((packed)), so they can be compared with memcmp. no cap. π
π SEE ALSO π
π AUTHOR π
all comments, questions and complaints should be directed to Matthew Fernandez <matthew.fernandez@gmail.com>. be nice. or don't, but he said complaints are fine. π
π LICENSE π
this is free and unencumbered software released into the public domain. periodt. π«Ά
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> π
okay that's the whole page bestie π¦ this was the MURPHI2C(1) page, living in the General Commands Manual, and yeah the footer just says MURPHI2C(1) right back at you like a little mirror. slay. β¨π
πΈ
π¦ where this page comes from
- debian trixie: rumur 2025.02.02-1 Β· Unlicense
- ubuntu noble: rumur 2023.11.27-1 Β· Unlicense
- ubuntu resolute: rumur 2025.02.02-1 Β· Unlicense
- ubuntu stonking: rumur 2025.02.02-1 Β· Unlicense
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms