#include "nusmv/shell/cmd/cmd.h"
#include "nusmv/shell/bmc/bmcCmd.h"
#include "nusmv/core/bmc/bmc.h"
#include "nusmv/core/bmc/bmcBmc.h"
#include "nusmv/core/bmc/bmcUtils.h"
#include "nusmv/core/bmc/bmcSimulate.h"
#include "nusmv/core/bmc/bmcTest.h"
#include "nusmv/shell/bmc/sbmc/sbmcCmd.h"
#include "nusmv/core/compile/compile.h"
#include "nusmv/core/enc/enc.h"
#include "nusmv/core/node/printers/MasterPrinter.h"
#include "nusmv/core/prop/propPkg.h"
#include "nusmv/core/simulate/simulate.h"
#include "nusmv/core/trace/exec/SATCompleteTraceExecutor.h"
#include "nusmv/core/trace/exec/SATPartialTraceExecutor.h"
#include "nusmv/core/utils/ErrorMgr.h"
#include "nusmv/core/utils/Logger.h"
#include "nusmv/core/utils/StreamMgr.h"
#include "nusmv/core/wff/w2w/w2w.h"
Defines | |
#define | BMC_USAGE 2 |
Bmc.Cmd module. | |
Functions | |
void | Bmc_AddCmd (NuSMVEnv_ptr env) |
Adds all bmc-related commands to the interactive shell. | |
Outcome | Bmc_Cmd_compute_rel_loop (NuSMVEnv_ptr const env, int *const l, const char *str_loop, const int k) |
Check k and l and assign to l the right value. | |
Outcome | Bmc_cmd_options_handling (NuSMVEnv_ptr env, int argc, char **argv, Prop_Type prop_type, Prop_ptr *res_prop, int *res_k, int *res_l, char **res_a, char **res_s, char **res_o, boolean *res_e, int *res_step_k) |
Bmc commands options handling for commands (optionally) acceping options -k -l -o -a -n -p -P -e. | |
void | Bmc_Cmd_quit (NuSMVEnv_ptr env) |
Remove all bmc-related commands to the interactive shell. | |
int | Bmc_CommandBmcIncSimulate (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandBmcPickState (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandBmcSetup (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandBmcSimulate (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandBmcSimulateCheckFeasibleConstraints (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandCheckInvarBmc (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandCheckLtlSpecBmc (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandCheckLtlSpecBmcOnePb (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandGenInvarBmc (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandGenLtlSpecBmc (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_CommandGenLtlSpecBmcOnePb (NuSMVEnv_ptr env, int argc, char **argv) |
int | Bmc_TestTableau (NuSMVEnv_ptr env, int argc, char **argv) |
void Bmc_AddCmd | ( | NuSMVEnv_ptr | env | ) |
Adds all bmc-related commands to the interactive shell.
AutomaticEnd
Outcome Bmc_Cmd_compute_rel_loop | ( | NuSMVEnv_ptr const | env, | |
int *const | rel_loop, | |||
const char * | str_loop, | |||
const int | k | |||
) |
Check k and l and assign to l the right value.
Check k and l and assign to l the right value.
l is changed
Outcome Bmc_cmd_options_handling | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv, | |||
Prop_Type | prop_type, | |||
Prop_ptr * | res_prop, | |||
int * | res_k, | |||
int * | res_l, | |||
char ** | res_a, | |||
char ** | res_s, | |||
char ** | res_o, | |||
boolean * | res_e, | |||
int * | res_step_k | |||
) |
Bmc commands options handling for commands (optionally) acceping options -k -l -o -a -n -p -P -e.
Output variables called res_* are pointers to variables that will be changed if the user specified a value for the corresponding option. For example if the user specified "-k 2", then res_k will be assigned to 2. The caller can selectively choose which options can be specified by the user, by passing either a valid pointer as output parameter, or NULL to disable the corresponding option. For example by passing NULL as actual parameter of res_l, option -l will be not accepted.
If both specified, k and l will be checked for mutual consistency. Loop will contain a relative value, like the one the user specified.
prop_type is the expected property type, if specified.
All integers values will not be changed if the corresponding options had not be specified by the user, so the caller might assign them to default values before calling this function.
All strings will be allocated by the function if the corresponding options had been used by the user. In this case it is responsability of the caller to free them. Strings will be assigned to NULL if the user had not specified any corresponding option.
Returns OUTCOME_GENERIC_ERROR if an error has occurred; Returns OUTCOME_SUCCESS_REQUIRED_HELP if -h options had been specified; Returns OUTCOME_SUCCESS in all other cases.
Result parameters might change
void Bmc_Cmd_quit | ( | NuSMVEnv_ptr | env | ) |
Remove all bmc-related commands to the interactive shell.
Remove env sbmc command
int Bmc_CommandBmcIncSimulate | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h] [-p | -v] [-r] [[-c "constraints"] | [-t "constraints"] ] [-k steps]
bmc_inc_simulate performs incremental simulation of the model. If no length is specified with -k command parameter, then the number of steps of simulation to perform is taken from the value stored in the environment variable bmc_length.
Command Options:
-p
-v
-r
-i
-a
-c "constraints"
constraints
. The desired sequence of states could not exist if such constraints were too strong or it may happen that at some point of the simulation a future state satisfying those constraints doesn't exist: in that case a trace with a number of states less than steps
trace is obtained. The expression cannot contain next operators, and is automatically shifted by one state in order to constraint only the next steps -t "constraints"
constraints
. The desired sequence of states could not exist if such constraints were too strong or it may happen that at some point of the simulation a future state satisfying those constraints doesn't exist: in that case a trace with a number of states less than steps
trace is obtained. The expression can contain next operators, and is NOT automatically shifted by one state as done with option -c -k steps
steps
states: this is the case in which simulation stops in an intermediate step because it may not exist any future state satisfying those constraints. int Bmc_CommandBmcPickState | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h] [-v] \
Chooses an element from the set of initial states, and makes it the current state
(replacing the old one). The chosen state is stored as the first state of a new trace ready to be lengthened by steps
states by the bmc_simulate
or bmc_inc_simulate
commands. A constraint can be provided to restrict the set of candidate states.
Command Options:
-v
t.1
of the state chosen, where t
is the number of the new trace, that is the number of traces so far generated plus one). -r
-i
-a
-c "constraint"
constraint
to restrict the set of initial states in which the state has to be picked. -s trace.state
int Bmc_CommandBmcSetup | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
int Bmc_CommandBmcSimulate | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h] [-p | -v] [-r] [[-c "constraints"] | [-t "constraints"] ] [-k steps]
bmc_simulate does not require a specification to build the problem, because only the model is used to build it. The problem length is represented by the -k command parameter, or by its default value stored in the environment variable bmc_length.
Command Options:
-p
-v
-r
-c "constraints"
constraints
. The desired sequence of states could not exist if such constraints were too strong or it may happen that at some point of the simulation a future state satisfying those constraints doesn't exist: in that case a trace with a number of states less than steps
trace is obtained. The expression cannot contain next operators, and is automatically shifted by one state in order to constraint only the next steps -t "constraints"
constraints
. The desired sequence of states could not exist if such constraints were too strong or it may happen that at some point of the simulation a future state satisfying those constraints doesn't exist: in that case a trace with a number of states less than steps
trace is obtained. The expression can contain next operators, and is NOT automatically shifted by one state as done with option -c -k steps
steps
states: this is the case in which simulation stops in an intermediate step because it may not exist any future state satisfying those constraints. int Bmc_CommandBmcSimulateCheckFeasibleConstraints | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h | -q] [-c "formula"]*
This command generates feasibility problems for each constraint. Every constraint is checked against current state and FSM's transition relation, in order to exclude the possibility of deadlocks. Constraints found to be feasible can be safely assumed not to cause deadlocks if used in the following step of incremental simulation.
Command options:
-q
-c "formula"
formula
specified on the command-line. This option can be specified multiple times, in order to analyze a list of constraints.int Bmc_CommandCheckInvarBmc | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h | -n idx | -p "formula" [IN context] | -P "name"] [-k max_length] [-a algorithm] [-o filename]
Command options:
-n index
-p "formula [IN context]"
formula
specified on the command-line. context
is the module instance name which the variables in formula
must be evaluated in. -P name
name
in the property database. -k max_length
-a algorithm
-e
int Bmc_CommandCheckLtlSpecBmc | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h | -n idx | -p "formula" [IN context] | -P "name"] [-k max_length] [-l loopback] [-o filename]
This command generates one or more problems, and calls SAT solver for each one. Each problem is related to a specific problem bound, which increases from zero (0) to the given maximum problem length. Here "<i>length</i>" is the bound of the problem that system is going to generate and/or solve.
In this context the maximum problem bound is represented by the -k command parameter, or by its default value stored in the environment variable bmc_length.
The single generated problem also depends on the "<i>loopback</i>" parameter you can explicitly specify by the -l option, or by its default value stored in the environment variable bmc_loopback.
The property to be checked may be specified using the -n idx, the -p "formula" or the -P "name" options.
If you need to generate a dimacs dump file of all generated problems, you must use the option -o "filename".
Command options:
-n index
-p "formula" [IN context]
formula
specified on the command-line. context
is the module instance name which the variables in formula
must be evaluated in. -P name
name
in the property database. -k max_length
-l loopback
-o filename
int Bmc_CommandCheckLtlSpecBmcOnePb | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h | -n idx | -p "formula" [IN context] | -P "name"] [-k length] [-l loopback] [-o filename]
As command check_ltlspec_bmc but it produces only one single problem with fixed bound and loopback values, with no iteration of the problem bound from zero to max_length.
Command options:
-n index
-p "formula [IN context]"
formula
specified on the command-line. context
is the module instance name which the variables in formula
must be evaluated in. -P name
name
in the property database. -k length
-l loopback
-o filename
int Bmc_CommandGenInvarBmc | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h | -n idx | -p "formula" [IN context] | -P "name"] [-o filename]
Command options:
-n index
-p "formula" [IN context]
formula
specified on the command-line. context
is the module instance name which the variables in formula
must be evaluated in. -P "name"
-o filename
int Bmc_CommandGenLtlSpecBmc | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h | -n idx | -p "formula" [IN context] | -P "name"] [-k max_length] [-l loopback] [-o filename]
This command generates one or more problems, and dumps each problem into a dimacs file. Each problem is related to a specific problem bound, which increases from zero (0) to the given maximum problem bound. In this short description "<i>length</i>" is the bound of the problem that system is going to dump out.
In this context the maximum problem bound is represented by the max_length parameter, or by its default value stored in the environment variable bmc_length.
Each dumped problem also depends on the loopback you can explicitly specify by the -l option, or by its default value stored in the environment variable bmc_loopback.
The property to be checked may be specified using the -n idx, the -p "formula" or the -P "name" options.
You may specify dimacs file name by using the option -o "filename", otherwise the default value stored in the environment variable bmc_dimacs_filename will be considered.
Command options:
-n index
-p "formula [IN context]"
formula
specified on the command-line. context
is the module instance name which the variables in formula
must be evaluated in. -P name
name
in the property database. -k max_length
-l loopback
-o filename
int Bmc_CommandGenLtlSpecBmcOnePb | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h | -n idx | -p "formula" [IN context] | -P "name"] [-k length] [-l loopback] [-o filename]
As the gen_ltlspec_bmc command, but it generates and dumps only one problem given its bound and loopback.
Command options:
-n index
-p "formula [IN context]"
formula
specified on the command-line. context
is the module instance name which the variables in formula
must be evaluated in. -P name
name
in the property database. -k length
-l loopback
-o filename
int Bmc_TestTableau | ( | NuSMVEnv_ptr | env, | |
int | argc, | |||
char ** | argv | |||
) |
Command arguments: [-h] [-m | -o output-file] [-n number | -p "psl-expr [IN context]" | -P "name"] [-1] [-k bmc_length] [-l loopback]\
Performs fair PSL model checking using incremental BMC.
A psl-expr
to be checked can be specified at command line using option -p
. Alternatively, option -n
can be used for checking a particular formula in the property database. If neither -n
nor -p
are used, all the PSLSPEC formulas in the database are checked.
Command options:
-m
SPEC
s to the program specified by the PAGER
shell variable if defined, else through the UNIX
command "more". -o output-file
PSLSPEC
s to the file output-file
. -p "psl-expr [IN context]"
context
is the module instance name which the variables in ctl-expr
must be evaluated in. -n number
number
in the property database. -P name
Checks the PSL property named name
in the property database.
-1
Generates and solves a single problem instead of iterating through 0 and bmc_length. -k bmc_length
-l loopback
loopback value may be: