Command line¶
Intrepyd installs no executables of its own: its commands are modules run with
python -m, and each says its options with --help. They print JSON on
standard output, so that a script, or jq, can read them.
| Command | What it does |
|---|---|
python -m intrepyd.diagram simulate |
Simulates a diagram of the editors (*.icircuit) on its stimuli: the trace |
python -m intrepyd.diagram verify |
Proves or refutes the diagram's assertions and targets, with a counterexample |
python -m intrepyd.diagram mcdc |
Generates MC/DC tests for the diagram's decisions |
python -m intrepyd.diagram equivalence |
Whether two diagrams give the same outputs, for every input and at every step |
python -m intrepyd.diagram codegen |
The C of the diagram's circuit, as JSON: the files and the warnings |
python -m intrepyd.diagram catalogue |
The library blocks a diagram may use |
python -m intrepyd.export |
Translates a python program, a Lustre file or a Simulink model into a JSON graph of nets |
python -m intrepyd.codegen |
Writes the C of a diagram, or of a graph that intrepyd.export made, into files |
python -m intrepyd.eula |
Shows the license agreement of the engines, says whether it is accepted, accepts it |
Where a command takes a diagram, - reads it from standard input.
Simulate. Without --steps, a diagram runs for as many steps as its
stimuli have. The values are by block and output (2.0: block 2, output 0):
$ python -m intrepyd.diagram simulate counter.icircuit --steps 4
{"steps": 4, "values": {"1.0": ["F", "F", "T", "F"], "2.0": ["0", "1", "2", "0"], ...}}
Verify. Each assertion and target gets a verdict. An assertion that does
not hold comes with the trace that breaks it. A target that can be reached
comes with the trace that reaches it. --engine picks one of portfolio
(the default), bmc, kind, br or pdr, and --property picks one
block (repeat it for more). --certificates adds a proof certificate in
SMT-LIB 2 to each property that holds:
$ python -m intrepyd.diagram verify counter.icircuit --timeout 10
{"results": [{"block": 9, "kind": "assertion", "name": "at_most_9", "engine": "kind", "time": 0.045, "verdict": "holds"}]}
MC/DC tests. These are the tests of the decisions the diagram marks, or of
the blocks named with --decision. Each test comes with its stimuli and the
trace it gives. --criterion unique-cause gives a stricter set of pairs than
the default masking:
$ python -m intrepyd.diagram mcdc counter.icircuit --decision 12 --depth 12
{"criterion": "masking", "results": [{"decision": 12, "name": "restart", "conditions": [{"name": "reset", "status": "covered", ...}, ...], "tests": [...]}]}
Equivalence. Two diagrams are compared output by output, matching inputs and outputs by name:
$ python -m intrepyd.diagram equivalence old.icircuit new.icircuit
{"inputs": {"reset": "bool"}, "outputs": {"count": "int8"}, ..., "verdict": "equivalent"}
Translate. intrepyd.export turns a model into the JSON graph of its nets.
A python program counts as a model when it builds a Context. --all exports
every Context the program builds:
$ python -m intrepyd.export model.lus --describe # its nodes, the top one, whether it uses int and real
$ python -m intrepyd.export model.lus --int int8 -o model.json
$ python -m intrepyd.export model.slx --mat workspace.mat -o model.json # needs the Simulink translator
$ python -m intrepyd.export program.py -o program.json
Generate C. intrepyd.codegen writes <name>.h and <name>.c: a state,
an init and a step. It takes a diagram, or a graph that intrepyd.export
made. --harness also writes <name>_main.c, which runs the step on a PC
with stimuli in CSV. --checks makes the step report the assertions and
assumptions, and --assumptions the assumptions only, which suits a device.
--ev3 binding.json also writes <name>_ev3.c, the step run on a LEGO EV3
brick, with its inputs and outputs bound to the brick's. From a diagram, the
code is traced to its blocks: a comment before each statement names the
block it computes (/* Control/eq1 [12] */), and <name>_trace.json gives
each block's lines in <name>.c and members in <name>.h:
$ python -m intrepyd.codegen counter.icircuit -o out --harness --checks
out/counter.h
out/counter.c
out/counter_main.c
out/counter_trace.json
$ python -m intrepyd.export model.lus --int int8 -o model.json
$ python -m intrepyd.codegen model.json -o out --name model
The license agreement. The engines run once their agreement is accepted,
either with accept or with INTREPID_ACCEPT_EULA set to its version (see
The engines' license):