-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.smv
150 lines (138 loc) Β· 3.8 KB
/
models.smv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
MODULE UART (proc, proc2UARTvalue, proc2UARTAddress, uart2CPU, uart2mem, uart2memValue)
VAR
Rx : unsigned word [ 8 ]; -- receive from outside
Tx : array 0 .. 7 of unsigned word [ 8 ]; --array of bytes
ASSIGN
next (Tx[0]) :=
case
proc = write2UART & proc2UARTAddress = 0 : proc2UARTvalue;
TRUE : (Tx[0]);
esac;
next (Tx[1]) :=
case
proc = write2UART & proc2UARTAddress = 1 : proc2UARTvalue;
TRUE : (Tx[1]);
esac;
next (Tx[2]) :=
case proc = write2UART & proc2UARTAddress = 2 : proc2UARTvalue;
TRUE : (Tx[2]);
esac;
next (Tx[3]) :=
case
proc = write2UART & proc2UARTAddress = 3 : proc2UARTvalue;
TRUE : (Tx[3]);
esac;
next (Tx[4]) :=
case
proc = write2UART & proc2UARTAddress = 4 : proc2UARTvalue;
TRUE : (Tx[4]);
esac;
next (Tx[5]) :=
case
proc = write2UART & proc2UARTAddress = 5 : proc2UARTvalue;
TRUE : (Tx[5]);
esac;
next (Tx[6]) :=
case
proc = write2UART & proc2UARTAddress = 6 : proc2UARTvalue;
TRUE : (Tx[6]);
esac;
next (Tx[7]) :=
case
proc = write2UART & proc2UARTAddress = 7 : proc2UARTvalue;
TRUE : (Tx[7]);
esac;
next (uart2CPU) :=
case
proc = read2UART : Rx;
TRUE : Rx;
esac;
MODULE MEM (proc, proc2memValue, proc2memAddress, mem2proc, uart2memValue, DMAadress)
VAR
data : array 0 .. 7 of unsigned word [ 8 ];
ASSIGN
next (mem2proc) :=
case
proc = read & proc2memAddress = 0 : data[0];
proc = read & proc2memAddress = 1 : data[1];
proc = read & proc2memAddress = 2 : data[2];
proc = read & proc2memAddress = 3 : data[3];
proc = read & proc2memAddress = 4 : data[4];
proc = read & proc2memAddress = 5 : data[5];
proc = read & proc2memAddress = 6 : data[6];
proc = read & proc2memAddress = 7 : data[7];
TRUE : mem2proc;
esac;
next (data[0]) :=
case
proc = write & proc2memAddress = 0 : proc2memValue;
DMAadress = 0 : uart2memValue;
TRUE : data[0];
esac;
next (data[1]) :=
case
proc = write & proc2memAddress = 1 : proc2memValue;
DMAadress = 1 : uart2memValue;
TRUE : data[1];
esac;
next (data[2]) :=
case
proc = write & proc2memAddress = 2 : proc2memValue;
TRUE : data[2];
esac;
next (data[3]) :=
case
proc = write & proc2memAddress = 3 : proc2memValue;
TRUE : data[3];
esac;
next (data[4]) :=
case
proc = write & proc2memAddress = 4 : proc2memValue;
TRUE : data[4];
esac;
next (data[5]) :=
case
proc = write & proc2memAddress = 4 : proc2memValue;
TRUE : data[5];
esac;
next (data[6]) :=
case
proc = write & proc2memAddress = 4 : proc2memValue;
TRUE : data[6];
esac;
next (data[7]) :=
case
proc = write & proc2memAddress = 4 : proc2memValue;
TRUE : data[7];
esac;
MODULE DMA (proc, DMAmemAddress)
VAR
address : 0..7;
control : unsigned word [ 8 ];
ASSIGN
init(control) := 0ud8_31;
next (address) :=
case
proc = setDMAaddress : DMAmemAddress;
TRUE : address;
esac;
MODULE main
VAR
proc : {idle, read, write, read2UART, write2UART, setDMAaddress};
mem2proc : unsigned word [ 8 ];
proc2memValue : unsigned word [ 8 ];
proc2memAddress : 0 .. 7;
DMAmemAddress : 0 .. 7;
uart2CPU : unsigned word [ 8 ];
uart2mem : unsigned word [ 8 ];
proc2UARTvalue : unsigned word [ 8 ];
proc2UARTAddress : 0 .. 7;
uart2memValue : unsigned word [ 8 ]; -- external
memory : MEM (proc, proc2memValue, proc2memAddress, mem2proc, uart2mem, DMAmemAddress);
uart0 : UART (proc, proc2UARTvalue, proc2UARTAddress, uart2CPU, uart2mem, uart2memValue);
dma : DMA (proc, DMAmemAddress);
ASSIGN
LTLSPEC G (proc = write2UART & proc2UARTAddress = 0) -> F ( next(uart0.Tx[0]) = proc2UARTvalue )
LTLSPEC G (proc != write & proc2memAddress != 1 & DMAmemAddress != 1) -> G (memory.data[1] = next(memory.data[1]))
LTLSPEC G (proc = setDMAaddress & DMAmemAddress != 1 & proc2memAddress = 1) -> G (memory.data[1] = next
(memory.data[1]))