add lab1 and lab2 exercises

This commit is contained in:
Mariano Sciacco
2021-11-19 10:36:17 +01:00
parent 4d2c26287f
commit 15e2cad2c9
12 changed files with 511 additions and 2 deletions

25
lab1/switch.smv Normal file
View File

@@ -0,0 +1,25 @@
MODULE main
-- Model of the switch
IVAR
press : boolean;
VAR
mode : {on, off};
x : 0..15;
ASSIGN
init(mode) := off;
next(mode) := case
mode = off & press : on;
mode = on & (press | x >= 10) : off;
TRUE : mode;
esac;
init(x) := 0;
next(x) := case
mode = on & next(mode) = off : 0;
mode = on & x < 10 : x + 1;
TRUE : x;
esac;
INVARSPEC x <= 10;
INVARSPEC mode = off -> x = 0;
INVARSPEC x < 10;
INVARSPEC mode = off;