Professional Documents
Culture Documents
Yogananda Jeppu
Copyright Notice
NuSMV by Yogananda Jeppu is licensed under a
Attribution You must attribute the work in the manner specified by the author or
licensor (but not in any way that suggests that they endorse you or your use of the work).
Noncommercial You may not use this work for commercial purposes.
Share Alike If you alter, transform, or build upon this work, you may distribute the
resulting work only under the same or similar license to this one.
For details please visit the website.
Background
I am Yogananda Jeppu. I have a PhD in safety critical control
NuSMV
NuSMV is a reimplementation and extension of SMV
NuSMV Directory
Running NuSMV
Nusmv example01.smv
Interactive execution
Nusmv int example01.smv
go
check_ltlspec
show_traces -p 2 -o trace.txt
quit
NuSMV
NuSMV defines variable states, initial states and their next
states.
This is defined in the main program with the syntax
MODULE main
Keyword VAR is used to define the variables
Keyword ASSIGN is used to assign values to variables
MODULE main
VAR
b0 : boolean;
ASSIGN
init(b0) := FALSE;
next(b0) := !bo;
7
Types
Boolean : FALSE, TRUE
x : boolean;
Enumerative
xe : {ready, steady, get_set, go}; -- the dashes are comments
xi : {2, 7, 10} integers can be enumerative
Bounded integers
bi : -10 .. 10;
Integers
Bi : integer;
Words
unsigned word [3];
8
Types
Arrays
VAR
x : array 0..10 of boolean; -- array of 11 elements
y : array -1..1 of {red, green, orange}; -- array of 3 elements
z : array 1..10 of array 1..5 of boolean; -- array of array
ASSIGN
init(x[5]) := bool(1);
init(y[0]) := {red, green}; -- any value in the set
init(z[3][2]) := TRUE;
Define Transitions
10
Expressions
arithmetic operators:
+ - * / mod - (unary)
comparison operators:
=, !=, >, <, <=, >=
logic operators:
&, |, xor, ! (not), ->, <->
bitwise operators:
<<, >>
expressions
toint(boolean_var)
11
Case Expressions
a: = case
c1 : e1;
c2 : e2;
...
TRUE : en;
esac;
If c1 then a=e1
Elseif c2 then a=e2
Else
a=en
end
case
Examples
MODULE main
TRANS
VAR
case
sg : boolean;
add3 : boolean;
add5 : boolean;
add11 : boolean;
ASSIGN
init(sum) :=0;
esac;
init(sum1) :=0;
13
Modules
MODULE counter(in)
VAR out: 0..9;
...
MODULE main
VAR m1 : counter(m2.out);
m2 : counter(m1.out);
...
14
a
Xa
Fa
15
aUb
16
Examples
17