[11] | 1 | # vl2mv crd.v |
---|
| 2 | # version: 0.2 |
---|
| 3 | # date: 11:12:45 12/11/95 (PST) |
---|
| 4 | .model environment |
---|
| 5 | # I/O ports |
---|
| 6 | .outputs test |
---|
| 7 | .outputs status_A |
---|
| 8 | |
---|
| 9 | .mv status_B 3 no_cars car_waiting cars_passing |
---|
| 10 | .mv signal_B 3 stop go slow |
---|
| 11 | .mv status_A 3 no_cars car_waiting cars_passing |
---|
| 12 | .mv signal_A 3 stop go slow |
---|
| 13 | .mv signal 3 go_slow go_A go_B |
---|
| 14 | .subckt POLICEMAN police status_A=status_A status_B=status_B signal=signal |
---|
| 15 | # assign signal_A = (signal == go_A ) ? 1 : (signal == go_slow ) ? 2 : 0 |
---|
| 16 | .mv signal_A$raw_n0 3 stop go slow |
---|
| 17 | .mv _n2 3 go_slow go_A go_B |
---|
| 18 | .names _n2 |
---|
| 19 | go_A |
---|
| 20 | # signal == 1 |
---|
| 21 | .names signal _n2 _n1 |
---|
| 22 | .def 0 |
---|
| 23 | - =signal 1 |
---|
| 24 | .mv _n4 3 go_slow go_A go_B |
---|
| 25 | .names _n4 |
---|
| 26 | go_slow |
---|
| 27 | # signal == 0 |
---|
| 28 | .names signal _n4 _n3 |
---|
| 29 | .def 0 |
---|
| 30 | - =signal 1 |
---|
| 31 | .mv _n5 3 stop go slow |
---|
| 32 | .names _n5 |
---|
| 33 | slow |
---|
| 34 | .mv _n6 3 stop go slow |
---|
| 35 | .names _n6 |
---|
| 36 | stop |
---|
| 37 | # (signal == 0) ? 2 : 0 |
---|
| 38 | .mv _n7 3 stop go slow |
---|
| 39 | .names _n5 _n6 _n3 _n7 |
---|
| 40 | - - 0 =_n6 |
---|
| 41 | - - 1 =_n5 |
---|
| 42 | .mv _n8 3 stop go slow |
---|
| 43 | .names _n8 |
---|
| 44 | go |
---|
| 45 | # (signal == 1) ? 1 : (signal == 0) ? 2 : 0 |
---|
| 46 | .mv _n9 3 stop go slow |
---|
| 47 | .names _n8 _n7 _n1 _n9 |
---|
| 48 | - - 0 =_n7 |
---|
| 49 | - - 1 =_n8 |
---|
| 50 | .names _n9 signal_A$raw_n0 |
---|
| 51 | - =_n9 |
---|
| 52 | # assign signal_B = (signal == go_B ) ? 1 : (signal == go_slow ) ? 2 : 0 |
---|
| 53 | .mv signal_B$raw_na 3 stop go slow |
---|
| 54 | .mv _nc 3 go_slow go_A go_B |
---|
| 55 | .names _nc |
---|
| 56 | go_B |
---|
| 57 | # signal == 2 |
---|
| 58 | .names signal _nc _nb |
---|
| 59 | .def 0 |
---|
| 60 | - =signal 1 |
---|
| 61 | .mv _ne 3 go_slow go_A go_B |
---|
| 62 | .names _ne |
---|
| 63 | go_slow |
---|
| 64 | # signal == 0 |
---|
| 65 | .names signal _ne _nd |
---|
| 66 | .def 0 |
---|
| 67 | - =signal 1 |
---|
| 68 | .mv _nf 3 stop go slow |
---|
| 69 | .names _nf |
---|
| 70 | slow |
---|
| 71 | .mv _n10 3 stop go slow |
---|
| 72 | .names _n10 |
---|
| 73 | stop |
---|
| 74 | # (signal == 0) ? 2 : 0 |
---|
| 75 | .mv _n11 3 stop go slow |
---|
| 76 | .names _nf _n10 _nd _n11 |
---|
| 77 | - - 0 =_n10 |
---|
| 78 | - - 1 =_nf |
---|
| 79 | .mv _n12 3 stop go slow |
---|
| 80 | .names _n12 |
---|
| 81 | go |
---|
| 82 | # (signal == 2) ? 1 : (signal == 0) ? 2 : 0 |
---|
| 83 | .mv _n13 3 stop go slow |
---|
| 84 | .names _n12 _n11 _nb _n13 |
---|
| 85 | - - 0 =_n11 |
---|
| 86 | - - 1 =_n12 |
---|
| 87 | .names _n13 signal_B$raw_na |
---|
| 88 | - =_n13 |
---|
| 89 | .subckt ROAD road_A signal=signal_A status=status_A |
---|
| 90 | .subckt ROAD road_B signal=signal_B status=status_B |
---|
| 91 | # assign test = ((status_A == cars_passing ) && (status_B == cars_passing )) ? 0 : 1 |
---|
| 92 | .mv _n16 3 no_cars car_waiting cars_passing |
---|
| 93 | .names _n16 |
---|
| 94 | cars_passing |
---|
| 95 | # status_A == 2 |
---|
| 96 | .names status_A _n16 _n15 |
---|
| 97 | .def 0 |
---|
| 98 | - =status_A 1 |
---|
| 99 | .mv _n18 3 no_cars car_waiting cars_passing |
---|
| 100 | .names _n18 |
---|
| 101 | cars_passing |
---|
| 102 | # status_B == 2 |
---|
| 103 | .names status_B _n18 _n17 |
---|
| 104 | .def 0 |
---|
| 105 | - =status_B 1 |
---|
| 106 | # (status_A == 2) && (status_B == 2) |
---|
| 107 | .names _n15 _n17 _n19 |
---|
| 108 | .def 0 |
---|
| 109 | 1 1 1 |
---|
| 110 | .names _n1a |
---|
| 111 | 0 |
---|
| 112 | .names _n1b |
---|
| 113 | 1 |
---|
| 114 | # ((status_A == 2) && (status_B == 2)) ? 0 : 1 |
---|
| 115 | .names _n1a _n1b _n19 _n1c |
---|
| 116 | 0 - 1 0 |
---|
| 117 | 1 - 1 1 |
---|
| 118 | - 0 0 0 |
---|
| 119 | - 1 0 1 |
---|
| 120 | .names _n1c test$raw_n14 |
---|
| 121 | - =_n1c |
---|
| 122 | .subckt collision col status_A=status_A status_B=status_B |
---|
| 123 | .subckt starvation starv stat=status_A |
---|
| 124 | # conflict arbitrators |
---|
| 125 | .names test$raw_n14 test |
---|
| 126 | 0 0 |
---|
| 127 | 1 1 |
---|
| 128 | .names signal_B$raw_na signal_B |
---|
| 129 | - =signal_B$raw_na |
---|
| 130 | .names signal_A$raw_n0 signal_A |
---|
| 131 | - =signal_A$raw_n0 |
---|
| 132 | # non-blocking assignments |
---|
| 133 | # latches |
---|
| 134 | # quasi-continuous assignment |
---|
| 135 | .end |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | .model POLICEMAN |
---|
| 139 | # I/O ports |
---|
| 140 | .inputs status_B |
---|
| 141 | .inputs status_A |
---|
| 142 | .outputs signal |
---|
| 143 | |
---|
| 144 | .mv status_B 3 no_cars car_waiting cars_passing |
---|
| 145 | .mv status_A 3 no_cars car_waiting cars_passing |
---|
| 146 | .mv signal 3 go_slow go_A go_B |
---|
| 147 | .mv state 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 148 | # assign ri_state = $NDset ( 0,1 ) |
---|
| 149 | .names ri_state |
---|
| 150 | 0 |
---|
| 151 | 1 |
---|
| 152 | .names _n22 |
---|
| 153 | 0 |
---|
| 154 | .names ri_state _n22 _n23 |
---|
| 155 | .def 0 |
---|
| 156 | 0 1 1 |
---|
| 157 | 1 0 1 |
---|
| 158 | .names _n23 _n21 |
---|
| 159 | 0 1 |
---|
| 160 | 1 0 |
---|
| 161 | .names _n21 _n20 |
---|
| 162 | 1 1 |
---|
| 163 | 0 0 |
---|
| 164 | # state = 0 |
---|
| 165 | .mv state$_n20_n25$true 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 166 | .names state$_n20_n25$true |
---|
| 167 | go_A_init |
---|
| 168 | .names _n28 |
---|
| 169 | 1 |
---|
| 170 | .names ri_state _n28 _n29 |
---|
| 171 | .def 0 |
---|
| 172 | 0 1 1 |
---|
| 173 | 1 0 1 |
---|
| 174 | .names _n29 _n27 |
---|
| 175 | 0 1 |
---|
| 176 | 1 0 |
---|
| 177 | .names _n27 _n26 |
---|
| 178 | 1 1 |
---|
| 179 | 0 0 |
---|
| 180 | # state = 2 |
---|
| 181 | .mv state$_n26_n2b$true 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 182 | .names state$_n26_n2b$true |
---|
| 183 | go_B_init |
---|
| 184 | # case (ri_state ) |
---|
| 185 | .mv state$_n26$raw_n2e 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 186 | .names state$_n26_n2b$true state$_n26_n2b$true _n26 state$_n26$raw_n2e |
---|
| 187 | - - 0 =state$_n26_n2b$true |
---|
| 188 | - - 1 =state$_n26_n2b$true |
---|
| 189 | .mv state$_n20$raw_n2f 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 190 | .names state$_n20_n25$true state$_n26$raw_n2e _n20 state$_n20$raw_n2f |
---|
| 191 | - - 0 =state$_n26$raw_n2e |
---|
| 192 | - - 1 =state$_n20_n25$true |
---|
| 193 | # non-blocking assignments for initial |
---|
| 194 | # assign signal = ((state == go_A_init ) || (state == go_B_init )) ? 0 : (state == go_A_state ) ? 1 : 2 |
---|
| 195 | .mv signal$raw_n33 3 go_slow go_A go_B |
---|
| 196 | .mv _n35 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 197 | .names _n35 |
---|
| 198 | go_A_init |
---|
| 199 | # state == 0 |
---|
| 200 | .names state _n35 _n34 |
---|
| 201 | .def 0 |
---|
| 202 | - =state 1 |
---|
| 203 | .mv _n37 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 204 | .names _n37 |
---|
| 205 | go_B_init |
---|
| 206 | # state == 2 |
---|
| 207 | .names state _n37 _n36 |
---|
| 208 | .def 0 |
---|
| 209 | - =state 1 |
---|
| 210 | # (state == 0) || (state == 2) |
---|
| 211 | .names _n34 _n36 _n38 |
---|
| 212 | .def 1 |
---|
| 213 | 0 0 0 |
---|
| 214 | .mv _n3a 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 215 | .names _n3a |
---|
| 216 | go_A_state |
---|
| 217 | # state == 1 |
---|
| 218 | .names state _n3a _n39 |
---|
| 219 | .def 0 |
---|
| 220 | - =state 1 |
---|
| 221 | .mv _n3b 3 go_slow go_A go_B |
---|
| 222 | .names _n3b |
---|
| 223 | go_A |
---|
| 224 | .mv _n3c 3 go_slow go_A go_B |
---|
| 225 | .names _n3c |
---|
| 226 | go_B |
---|
| 227 | # (state == 1) ? 1 : 2 |
---|
| 228 | .mv _n3d 3 go_slow go_A go_B |
---|
| 229 | .names _n3b _n3c _n39 _n3d |
---|
| 230 | - - 0 =_n3c |
---|
| 231 | - - 1 =_n3b |
---|
| 232 | .mv _n3e 3 go_slow go_A go_B |
---|
| 233 | .names _n3e |
---|
| 234 | go_slow |
---|
| 235 | # ((state == 0) || (state == 2)) ? 0 : (state == 1) ? 1 : 2 |
---|
| 236 | .mv _n3f 3 go_slow go_A go_B |
---|
| 237 | .names _n3e _n3d _n38 _n3f |
---|
| 238 | - - 0 =_n3d |
---|
| 239 | - - 1 =_n3e |
---|
| 240 | .names _n3f signal$raw_n33 |
---|
| 241 | - =_n3f |
---|
| 242 | # assign r_state = $NDset ( 0,1 ) |
---|
| 243 | .names r_state |
---|
| 244 | 0 |
---|
| 245 | 1 |
---|
| 246 | .mv _n44 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 247 | .names _n44 |
---|
| 248 | go_A_init |
---|
| 249 | .names state _n44 _n43 |
---|
| 250 | .def 0 |
---|
| 251 | - =state 1 |
---|
| 252 | .names _n43 _n42 |
---|
| 253 | 1 1 |
---|
| 254 | 0 0 |
---|
| 255 | .names _n47 |
---|
| 256 | 0 |
---|
| 257 | .names r_state _n47 _n48 |
---|
| 258 | .def 0 |
---|
| 259 | 0 1 1 |
---|
| 260 | 1 0 1 |
---|
| 261 | .names _n48 _n46 |
---|
| 262 | 0 1 |
---|
| 263 | 1 0 |
---|
| 264 | .names _n46 _n45 |
---|
| 265 | 1 1 |
---|
| 266 | 0 0 |
---|
| 267 | # state = 0 |
---|
| 268 | .mv state$_n45_n4a$true 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 269 | .names state$_n45_n4a$true |
---|
| 270 | go_A_init |
---|
| 271 | .names _n4d |
---|
| 272 | 1 |
---|
| 273 | .names r_state _n4d _n4e |
---|
| 274 | .def 0 |
---|
| 275 | 0 1 1 |
---|
| 276 | 1 0 1 |
---|
| 277 | .names _n4e _n4c |
---|
| 278 | 0 1 |
---|
| 279 | 1 0 |
---|
| 280 | .names _n4c _n4b |
---|
| 281 | 1 1 |
---|
| 282 | 0 0 |
---|
| 283 | # state = 1 |
---|
| 284 | .mv state$_n4b_n50$true 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 285 | .names state$_n4b_n50$true |
---|
| 286 | go_A_state |
---|
| 287 | # case (r_state ) |
---|
| 288 | .mv state$_n4b$raw_n53 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 289 | .names state$_n4b_n50$true state _n4b state$_n4b$raw_n53 |
---|
| 290 | - - 0 =state |
---|
| 291 | - - 1 =state$_n4b_n50$true |
---|
| 292 | .mv state$_n45$raw_n54 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 293 | .names state$_n45_n4a$true state$_n4b$raw_n53 _n45 state$_n45$raw_n54 |
---|
| 294 | - - 0 =state$_n4b$raw_n53 |
---|
| 295 | - - 1 =state$_n45_n4a$true |
---|
| 296 | .mv _n5a 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 297 | .names _n5a |
---|
| 298 | go_B_init |
---|
| 299 | .names state _n5a _n59 |
---|
| 300 | .def 0 |
---|
| 301 | - =state 1 |
---|
| 302 | .names _n59 _n58 |
---|
| 303 | 1 1 |
---|
| 304 | 0 0 |
---|
| 305 | .names _n5d |
---|
| 306 | 0 |
---|
| 307 | .names r_state _n5d _n5e |
---|
| 308 | .def 0 |
---|
| 309 | 0 1 1 |
---|
| 310 | 1 0 1 |
---|
| 311 | .names _n5e _n5c |
---|
| 312 | 0 1 |
---|
| 313 | 1 0 |
---|
| 314 | .names _n5c _n5b |
---|
| 315 | 1 1 |
---|
| 316 | 0 0 |
---|
| 317 | # state = 2 |
---|
| 318 | .mv state$_n5b_n60$true 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 319 | .names state$_n5b_n60$true |
---|
| 320 | go_B_init |
---|
| 321 | .names _n63 |
---|
| 322 | 1 |
---|
| 323 | .names r_state _n63 _n64 |
---|
| 324 | .def 0 |
---|
| 325 | 0 1 1 |
---|
| 326 | 1 0 1 |
---|
| 327 | .names _n64 _n62 |
---|
| 328 | 0 1 |
---|
| 329 | 1 0 |
---|
| 330 | .names _n62 _n61 |
---|
| 331 | 1 1 |
---|
| 332 | 0 0 |
---|
| 333 | # state = 3 |
---|
| 334 | .mv state$_n61_n66$true 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 335 | .names state$_n61_n66$true |
---|
| 336 | go_B_state |
---|
| 337 | # case (r_state ) |
---|
| 338 | .mv state$_n61$raw_n69 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 339 | .names state$_n61_n66$true state _n61 state$_n61$raw_n69 |
---|
| 340 | - - 0 =state |
---|
| 341 | - - 1 =state$_n61_n66$true |
---|
| 342 | .mv state$_n5b$raw_n6a 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 343 | .names state$_n5b_n60$true state$_n61$raw_n69 _n5b state$_n5b$raw_n6a |
---|
| 344 | - - 0 =state$_n61$raw_n69 |
---|
| 345 | - - 1 =state$_n5b_n60$true |
---|
| 346 | .mv _n6f 3 go_slow go_A go_B |
---|
| 347 | .names _n6f |
---|
| 348 | go_A |
---|
| 349 | # signal == 1 |
---|
| 350 | .names signal _n6f _n6e |
---|
| 351 | .def 0 |
---|
| 352 | - =signal 1 |
---|
| 353 | .mv _n71 3 no_cars car_waiting cars_passing |
---|
| 354 | .names _n71 |
---|
| 355 | car_waiting |
---|
| 356 | # status_B == 1 |
---|
| 357 | .names status_B _n71 _n70 |
---|
| 358 | .def 0 |
---|
| 359 | - =status_B 1 |
---|
| 360 | # (signal == 1) && (status_B == 1) |
---|
| 361 | .names _n6e _n70 _n72 |
---|
| 362 | .def 0 |
---|
| 363 | 1 1 1 |
---|
| 364 | .names _n72 _n73 |
---|
| 365 | - =_n72 |
---|
| 366 | # state = 2 |
---|
| 367 | .mv state$_n72_n74$true 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 368 | .names state$_n72_n74$true |
---|
| 369 | go_B_init |
---|
| 370 | .mv _n76 3 go_slow go_A go_B |
---|
| 371 | .names _n76 |
---|
| 372 | go_B |
---|
| 373 | # signal == 2 |
---|
| 374 | .names signal _n76 _n75 |
---|
| 375 | .def 0 |
---|
| 376 | - =signal 1 |
---|
| 377 | .mv _n78 3 no_cars car_waiting cars_passing |
---|
| 378 | .names _n78 |
---|
| 379 | car_waiting |
---|
| 380 | # status_A == 1 |
---|
| 381 | .names status_A _n78 _n77 |
---|
| 382 | .def 0 |
---|
| 383 | - =status_A 1 |
---|
| 384 | # (signal == 2) && (status_A == 1) |
---|
| 385 | .names _n75 _n77 _n79 |
---|
| 386 | .def 0 |
---|
| 387 | 1 1 1 |
---|
| 388 | .names _n79 _n7a |
---|
| 389 | - =_n79 |
---|
| 390 | # state = 0 |
---|
| 391 | .mv state$_n79_n7b$true 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 392 | .names state$_n79_n7b$true |
---|
| 393 | go_A_init |
---|
| 394 | # if/else ((signal == 2) && (status_A == 1)) |
---|
| 395 | .mv state$_n79$raw_n7e 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 396 | .names state$_n79_n7b$true state _n79 state$_n79$raw_n7e |
---|
| 397 | - - 0 =state |
---|
| 398 | - - 1 =state$_n79_n7b$true |
---|
| 399 | # if/else ((signal == 1) && (status_B == 1)) |
---|
| 400 | .mv state$_n72$raw_n80 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 401 | .names state$_n72_n74$true state$_n79$raw_n7e _n72 state$_n72$raw_n80 |
---|
| 402 | - - 0 =state$_n79$raw_n7e |
---|
| 403 | - - 1 =state$_n72_n74$true |
---|
| 404 | # case (state ) |
---|
| 405 | .mv state$_n58$raw_n84 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 406 | .names state$_n5b$raw_n6a state$_n72$raw_n80 _n58 state$_n58$raw_n84 |
---|
| 407 | - - 0 =state$_n72$raw_n80 |
---|
| 408 | - - 1 =state$_n5b$raw_n6a |
---|
| 409 | .mv state$_n42$raw_n88 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 410 | .names state$_n45$raw_n54 state$_n58$raw_n84 _n42 state$_n42$raw_n88 |
---|
| 411 | - - 0 =state$_n58$raw_n84 |
---|
| 412 | - - 1 =state$_n45$raw_n54 |
---|
| 413 | # conflict arbitrators |
---|
| 414 | .names signal$raw_n33 signal |
---|
| 415 | - =signal$raw_n33 |
---|
| 416 | .names _n42 _n45 _n4b _n58 _n5b _n61 _n73 _n7a _n8b |
---|
| 417 | .def 0 |
---|
| 418 | 1 1 - - - - - - 1 |
---|
| 419 | 1 0 1 - - - - - 1 |
---|
| 420 | 0 - - 1 1 - - - 1 |
---|
| 421 | 0 - - 1 0 1 - - 1 |
---|
| 422 | 0 - - 0 - - 1 - 1 |
---|
| 423 | 0 - - 0 - - 0 1 1 |
---|
| 424 | .mv _n8c 4 go_A_init go_A_state go_B_init go_B_state |
---|
| 425 | .names _n8b state$_n42$raw_n88 state _n8c |
---|
| 426 | 1 - - =state$_n42$raw_n88 |
---|
| 427 | 0 - - =state |
---|
| 428 | # non-blocking assignments |
---|
| 429 | # latches |
---|
| 430 | .r state$_n20$raw_n2f state |
---|
| 431 | - =state$_n20$raw_n2f |
---|
| 432 | .latch _n8c state |
---|
| 433 | # quasi-continuous assignment |
---|
| 434 | .end |
---|
| 435 | |
---|
| 436 | |
---|
| 437 | .model ROAD |
---|
| 438 | # I/O ports |
---|
| 439 | .outputs status |
---|
| 440 | .inputs signal |
---|
| 441 | |
---|
| 442 | .mv status 3 no_cars car_waiting cars_passing |
---|
| 443 | .mv signal 3 stop go slow |
---|
| 444 | .mv state 4 STOPPED_init STOPPED GO_init GO |
---|
| 445 | # state = 0 |
---|
| 446 | .mv state$raw_n93 4 STOPPED_init STOPPED GO_init GO |
---|
| 447 | .names state$raw_n93 |
---|
| 448 | STOPPED_init |
---|
| 449 | # non-blocking assignments for initial |
---|
| 450 | # assign status = (state == STOPPED_init ) ? 0 : (state == STOPPED ) ? 1 : (state == GO_init ) ? 2 : (state == GO ) ? 0 : 0 |
---|
| 451 | .mv status$raw_n94 3 no_cars car_waiting cars_passing |
---|
| 452 | .mv _n96 4 STOPPED_init STOPPED GO_init GO |
---|
| 453 | .names _n96 |
---|
| 454 | STOPPED_init |
---|
| 455 | # state == 0 |
---|
| 456 | .names state _n96 _n95 |
---|
| 457 | .def 0 |
---|
| 458 | - =state 1 |
---|
| 459 | .mv _n98 4 STOPPED_init STOPPED GO_init GO |
---|
| 460 | .names _n98 |
---|
| 461 | STOPPED |
---|
| 462 | # state == 1 |
---|
| 463 | .names state _n98 _n97 |
---|
| 464 | .def 0 |
---|
| 465 | - =state 1 |
---|
| 466 | .mv _n9a 4 STOPPED_init STOPPED GO_init GO |
---|
| 467 | .names _n9a |
---|
| 468 | GO_init |
---|
| 469 | # state == 2 |
---|
| 470 | .names state _n9a _n99 |
---|
| 471 | .def 0 |
---|
| 472 | - =state 1 |
---|
| 473 | .mv _n9c 4 STOPPED_init STOPPED GO_init GO |
---|
| 474 | .names _n9c |
---|
| 475 | GO |
---|
| 476 | # state == 3 |
---|
| 477 | .names state _n9c _n9b |
---|
| 478 | .def 0 |
---|
| 479 | - =state 1 |
---|
| 480 | .mv _n9d 3 no_cars car_waiting cars_passing |
---|
| 481 | .names _n9d |
---|
| 482 | no_cars |
---|
| 483 | .mv _n9e 3 no_cars car_waiting cars_passing |
---|
| 484 | .names _n9e |
---|
| 485 | no_cars |
---|
| 486 | # (state == 3) ? 0 : 0 |
---|
| 487 | .mv _n9f 3 no_cars car_waiting cars_passing |
---|
| 488 | .names _n9d _n9e _n9b _n9f |
---|
| 489 | - - 0 =_n9e |
---|
| 490 | - - 1 =_n9d |
---|
| 491 | .mv _na0 3 no_cars car_waiting cars_passing |
---|
| 492 | .names _na0 |
---|
| 493 | cars_passing |
---|
| 494 | # (state == 2) ? 2 : (state == 3) ? 0 : 0 |
---|
| 495 | .mv _na1 3 no_cars car_waiting cars_passing |
---|
| 496 | .names _na0 _n9f _n99 _na1 |
---|
| 497 | - - 0 =_n9f |
---|
| 498 | - - 1 =_na0 |
---|
| 499 | .mv _na2 3 no_cars car_waiting cars_passing |
---|
| 500 | .names _na2 |
---|
| 501 | car_waiting |
---|
| 502 | # (state == 1) ? 1 : (state == 2) ? 2 : (state == 3) ? 0 : 0 |
---|
| 503 | .mv _na3 3 no_cars car_waiting cars_passing |
---|
| 504 | .names _na2 _na1 _n97 _na3 |
---|
| 505 | - - 0 =_na1 |
---|
| 506 | - - 1 =_na2 |
---|
| 507 | .mv _na4 3 no_cars car_waiting cars_passing |
---|
| 508 | .names _na4 |
---|
| 509 | no_cars |
---|
| 510 | # (state == 0) ? 0 : (state == 1) ? 1 : (state == 2) ? 2 : (state == 3) ? 0 : 0 |
---|
| 511 | .mv _na5 3 no_cars car_waiting cars_passing |
---|
| 512 | .names _na4 _na3 _n95 _na5 |
---|
| 513 | - - 0 =_na3 |
---|
| 514 | - - 1 =_na4 |
---|
| 515 | .names _na5 status$raw_n94 |
---|
| 516 | - =_na5 |
---|
| 517 | # assign r_state = $NDset ( 0,1 ) |
---|
| 518 | .names r_state |
---|
| 519 | 0 |
---|
| 520 | 1 |
---|
| 521 | .mv _naa 4 STOPPED_init STOPPED GO_init GO |
---|
| 522 | .names _naa |
---|
| 523 | STOPPED_init |
---|
| 524 | .names state _naa _na9 |
---|
| 525 | .def 0 |
---|
| 526 | - =state 1 |
---|
| 527 | .names _na9 _na8 |
---|
| 528 | 1 1 |
---|
| 529 | 0 0 |
---|
| 530 | .names _nad |
---|
| 531 | 0 |
---|
| 532 | .names r_state _nad _nae |
---|
| 533 | .def 0 |
---|
| 534 | 0 1 1 |
---|
| 535 | 1 0 1 |
---|
| 536 | .names _nae _nac |
---|
| 537 | 0 1 |
---|
| 538 | 1 0 |
---|
| 539 | .names _nac _nab |
---|
| 540 | 1 1 |
---|
| 541 | 0 0 |
---|
| 542 | # state = 0 |
---|
| 543 | .mv state$_nab_nb0$true 4 STOPPED_init STOPPED GO_init GO |
---|
| 544 | .names state$_nab_nb0$true |
---|
| 545 | STOPPED_init |
---|
| 546 | .names _nb3 |
---|
| 547 | 1 |
---|
| 548 | .names r_state _nb3 _nb4 |
---|
| 549 | .def 0 |
---|
| 550 | 0 1 1 |
---|
| 551 | 1 0 1 |
---|
| 552 | .names _nb4 _nb2 |
---|
| 553 | 0 1 |
---|
| 554 | 1 0 |
---|
| 555 | .names _nb2 _nb1 |
---|
| 556 | 1 1 |
---|
| 557 | 0 0 |
---|
| 558 | # state = 1 |
---|
| 559 | .mv state$_nb1_nb6$true 4 STOPPED_init STOPPED GO_init GO |
---|
| 560 | .names state$_nb1_nb6$true |
---|
| 561 | STOPPED |
---|
| 562 | # case (r_state ) |
---|
| 563 | .mv state$_nb1$raw_nb9 4 STOPPED_init STOPPED GO_init GO |
---|
| 564 | .names state$_nb1_nb6$true state _nb1 state$_nb1$raw_nb9 |
---|
| 565 | - - 0 =state |
---|
| 566 | - - 1 =state$_nb1_nb6$true |
---|
| 567 | .mv state$_nab$raw_nba 4 STOPPED_init STOPPED GO_init GO |
---|
| 568 | .names state$_nab_nb0$true state$_nb1$raw_nb9 _nab state$_nab$raw_nba |
---|
| 569 | - - 0 =state$_nb1$raw_nb9 |
---|
| 570 | - - 1 =state$_nab_nb0$true |
---|
| 571 | .mv _nc0 4 STOPPED_init STOPPED GO_init GO |
---|
| 572 | .names _nc0 |
---|
| 573 | STOPPED |
---|
| 574 | .names state _nc0 _nbf |
---|
| 575 | .def 0 |
---|
| 576 | - =state 1 |
---|
| 577 | .names _nbf _nbe |
---|
| 578 | 1 1 |
---|
| 579 | 0 0 |
---|
| 580 | .mv _nc2 3 stop go slow |
---|
| 581 | .names _nc2 |
---|
| 582 | go |
---|
| 583 | # signal == 1 |
---|
| 584 | .names signal _nc2 _nc1 |
---|
| 585 | .def 0 |
---|
| 586 | - =signal 1 |
---|
| 587 | .names _nc1 _nc3 |
---|
| 588 | - =_nc1 |
---|
| 589 | # state = 2 |
---|
| 590 | .mv state$_nc1_nc4$true 4 STOPPED_init STOPPED GO_init GO |
---|
| 591 | .names state$_nc1_nc4$true |
---|
| 592 | GO_init |
---|
| 593 | # if/else (signal == 1) |
---|
| 594 | .mv state$_nc1$raw_nc7 4 STOPPED_init STOPPED GO_init GO |
---|
| 595 | .names state$_nc1_nc4$true state _nc1 state$_nc1$raw_nc7 |
---|
| 596 | - - 0 =state |
---|
| 597 | - - 1 =state$_nc1_nc4$true |
---|
| 598 | .mv _nca 4 STOPPED_init STOPPED GO_init GO |
---|
| 599 | .names _nca |
---|
| 600 | GO_init |
---|
| 601 | .names state _nca _nc9 |
---|
| 602 | .def 0 |
---|
| 603 | - =state 1 |
---|
| 604 | .names _nc9 _nc8 |
---|
| 605 | 1 1 |
---|
| 606 | 0 0 |
---|
| 607 | .mv _ncc 3 stop go slow |
---|
| 608 | .names _ncc |
---|
| 609 | stop |
---|
| 610 | # signal == 0 |
---|
| 611 | .names signal _ncc _ncb |
---|
| 612 | .def 0 |
---|
| 613 | - =signal 1 |
---|
| 614 | .names _ncb _ncd |
---|
| 615 | - =_ncb |
---|
| 616 | # state = 0 |
---|
| 617 | .mv state$_ncb_nce$true 4 STOPPED_init STOPPED GO_init GO |
---|
| 618 | .names state$_ncb_nce$true |
---|
| 619 | STOPPED_init |
---|
| 620 | .names _nd1 |
---|
| 621 | 0 |
---|
| 622 | .names r_state _nd1 _nd2 |
---|
| 623 | .def 0 |
---|
| 624 | 0 1 1 |
---|
| 625 | 1 0 1 |
---|
| 626 | .names _nd2 _nd0 |
---|
| 627 | 0 1 |
---|
| 628 | 1 0 |
---|
| 629 | .names _nd0 _ncf |
---|
| 630 | 1 1 |
---|
| 631 | 0 0 |
---|
| 632 | # state = 2 |
---|
| 633 | .mv state$_ncf_nd4$true 4 STOPPED_init STOPPED GO_init GO |
---|
| 634 | .names state$_ncf_nd4$true |
---|
| 635 | GO_init |
---|
| 636 | .names _nd7 |
---|
| 637 | 1 |
---|
| 638 | .names r_state _nd7 _nd8 |
---|
| 639 | .def 0 |
---|
| 640 | 0 1 1 |
---|
| 641 | 1 0 1 |
---|
| 642 | .names _nd8 _nd6 |
---|
| 643 | 0 1 |
---|
| 644 | 1 0 |
---|
| 645 | .names _nd6 _nd5 |
---|
| 646 | 1 1 |
---|
| 647 | 0 0 |
---|
| 648 | # state = 3 |
---|
| 649 | .mv state$_nd5_nda$true 4 STOPPED_init STOPPED GO_init GO |
---|
| 650 | .names state$_nd5_nda$true |
---|
| 651 | GO |
---|
| 652 | # case (r_state ) |
---|
| 653 | .mv state$_nd5$raw_ndd 4 STOPPED_init STOPPED GO_init GO |
---|
| 654 | .names state$_nd5_nda$true state _nd5 state$_nd5$raw_ndd |
---|
| 655 | - - 0 =state |
---|
| 656 | - - 1 =state$_nd5_nda$true |
---|
| 657 | .mv state$_ncf$raw_nde 4 STOPPED_init STOPPED GO_init GO |
---|
| 658 | .names state$_ncf_nd4$true state$_nd5$raw_ndd _ncf state$_ncf$raw_nde |
---|
| 659 | - - 0 =state$_nd5$raw_ndd |
---|
| 660 | - - 1 =state$_ncf_nd4$true |
---|
| 661 | # if/else (signal == 0) |
---|
| 662 | .mv state$_ncb$raw_ne3 4 STOPPED_init STOPPED GO_init GO |
---|
| 663 | .names state$_ncb_nce$true state$_ncf$raw_nde _ncb state$_ncb$raw_ne3 |
---|
| 664 | - - 0 =state$_ncf$raw_nde |
---|
| 665 | - - 1 =state$_ncb_nce$true |
---|
| 666 | .mv _ne8 4 STOPPED_init STOPPED GO_init GO |
---|
| 667 | .names _ne8 |
---|
| 668 | GO |
---|
| 669 | .names state _ne8 _ne7 |
---|
| 670 | .def 0 |
---|
| 671 | - =state 1 |
---|
| 672 | .names _ne7 _ne6 |
---|
| 673 | 1 1 |
---|
| 674 | 0 0 |
---|
| 675 | # state = 0 |
---|
| 676 | .mv state$_ne6_ne9$true 4 STOPPED_init STOPPED GO_init GO |
---|
| 677 | .names state$_ne6_ne9$true |
---|
| 678 | STOPPED_init |
---|
| 679 | # case (state ) |
---|
| 680 | .mv state$_ne6$raw_nec 4 STOPPED_init STOPPED GO_init GO |
---|
| 681 | .names state$_ne6_ne9$true state _ne6 state$_ne6$raw_nec |
---|
| 682 | - - 0 =state |
---|
| 683 | - - 1 =state$_ne6_ne9$true |
---|
| 684 | .mv state$_nc8$raw_nee 4 STOPPED_init STOPPED GO_init GO |
---|
| 685 | .names state$_ncb$raw_ne3 state$_ne6$raw_nec _nc8 state$_nc8$raw_nee |
---|
| 686 | - - 0 =state$_ne6$raw_nec |
---|
| 687 | - - 1 =state$_ncb$raw_ne3 |
---|
| 688 | .mv state$_nbe$raw_nf2 4 STOPPED_init STOPPED GO_init GO |
---|
| 689 | .names state$_nc1$raw_nc7 state$_nc8$raw_nee _nbe state$_nbe$raw_nf2 |
---|
| 690 | - - 0 =state$_nc8$raw_nee |
---|
| 691 | - - 1 =state$_nc1$raw_nc7 |
---|
| 692 | .mv state$_na8$raw_nf6 4 STOPPED_init STOPPED GO_init GO |
---|
| 693 | .names state$_nab$raw_nba state$_nbe$raw_nf2 _na8 state$_na8$raw_nf6 |
---|
| 694 | - - 0 =state$_nbe$raw_nf2 |
---|
| 695 | - - 1 =state$_nab$raw_nba |
---|
| 696 | # conflict arbitrators |
---|
| 697 | .names status$raw_n94 status |
---|
| 698 | - =status$raw_n94 |
---|
| 699 | .names _na8 _nab _nb1 _nbe _nc3 _nc8 _ncd _ncf _nd5 _ne6 _nf9 |
---|
| 700 | .def 0 |
---|
| 701 | 1 1 - - - - - - - - 1 |
---|
| 702 | 1 0 1 - - - - - - - 1 |
---|
| 703 | 0 - - 1 1 - - - - - 1 |
---|
| 704 | 0 - - 0 - 1 1 - - - 1 |
---|
| 705 | 0 - - 0 - 1 0 1 - - 1 |
---|
| 706 | 0 - - 0 - 1 0 0 1 - 1 |
---|
| 707 | 0 - - 0 - 0 - - - 1 1 |
---|
| 708 | .mv _nfa 4 STOPPED_init STOPPED GO_init GO |
---|
| 709 | .names _nf9 state$_na8$raw_nf6 state _nfa |
---|
| 710 | 1 - - =state$_na8$raw_nf6 |
---|
| 711 | 0 - - =state |
---|
| 712 | # non-blocking assignments |
---|
| 713 | # latches |
---|
| 714 | .r state$raw_n93 state |
---|
| 715 | - =state$raw_n93 |
---|
| 716 | .latch _nfa state |
---|
| 717 | # quasi-continuous assignment |
---|
| 718 | .end |
---|
| 719 | |
---|
| 720 | |
---|
| 721 | .model collision |
---|
| 722 | # I/O ports |
---|
| 723 | .inputs status_B |
---|
| 724 | .inputs status_A |
---|
| 725 | |
---|
| 726 | .mv status_B 3 no_cars car_waiting cars_passing |
---|
| 727 | .mv status_A 3 no_cars car_waiting cars_passing |
---|
| 728 | .mv state 2 GOOD BAD |
---|
| 729 | # state = 0 |
---|
| 730 | .mv state$raw_n100 2 GOOD BAD |
---|
| 731 | .names state$raw_n100 |
---|
| 732 | GOOD |
---|
| 733 | # non-blocking assignments for initial |
---|
| 734 | .mv _n103 2 GOOD BAD |
---|
| 735 | .names _n103 |
---|
| 736 | GOOD |
---|
| 737 | .names state _n103 _n102 |
---|
| 738 | .def 0 |
---|
| 739 | - =state 1 |
---|
| 740 | .names _n102 _n101 |
---|
| 741 | 1 1 |
---|
| 742 | 0 0 |
---|
| 743 | .mv _n105 3 no_cars car_waiting cars_passing |
---|
| 744 | .names _n105 |
---|
| 745 | cars_passing |
---|
| 746 | # status_A == 2 |
---|
| 747 | .names status_A _n105 _n104 |
---|
| 748 | .def 0 |
---|
| 749 | - =status_A 1 |
---|
| 750 | .mv _n107 3 no_cars car_waiting cars_passing |
---|
| 751 | .names _n107 |
---|
| 752 | cars_passing |
---|
| 753 | # status_B == 2 |
---|
| 754 | .names status_B _n107 _n106 |
---|
| 755 | .def 0 |
---|
| 756 | - =status_B 1 |
---|
| 757 | # (status_A == 2) && (status_B == 2) |
---|
| 758 | .names _n104 _n106 _n108 |
---|
| 759 | .def 0 |
---|
| 760 | 1 1 1 |
---|
| 761 | .names _n108 _n109 |
---|
| 762 | - =_n108 |
---|
| 763 | # state = 1 |
---|
| 764 | .mv state$_n108_n10a$true 2 GOOD BAD |
---|
| 765 | .names state$_n108_n10a$true |
---|
| 766 | BAD |
---|
| 767 | # if/else ((status_A == 2) && (status_B == 2)) |
---|
| 768 | .mv state$_n108$raw_n10d 2 GOOD BAD |
---|
| 769 | .names state$_n108_n10a$true state _n108 state$_n108$raw_n10d |
---|
| 770 | - - 0 =state |
---|
| 771 | - - 1 =state$_n108_n10a$true |
---|
| 772 | # case (state ) |
---|
| 773 | .mv state$_n101$raw_n110 2 GOOD BAD |
---|
| 774 | .names state$_n108$raw_n10d state _n101 state$_n101$raw_n110 |
---|
| 775 | - - 0 =state |
---|
| 776 | - - 1 =state$_n108$raw_n10d |
---|
| 777 | # conflict arbitrators |
---|
| 778 | .names _n101 _n109 _n111 |
---|
| 779 | .def 0 |
---|
| 780 | 1 1 1 |
---|
| 781 | .mv _n112 2 GOOD BAD |
---|
| 782 | .names _n111 state$_n101$raw_n110 state _n112 |
---|
| 783 | 1 - - =state$_n101$raw_n110 |
---|
| 784 | 0 - - =state |
---|
| 785 | # non-blocking assignments |
---|
| 786 | # latches |
---|
| 787 | .r state$raw_n100 state |
---|
| 788 | - =state$raw_n100 |
---|
| 789 | .latch _n112 state |
---|
| 790 | # quasi-continuous assignment |
---|
| 791 | .end |
---|
| 792 | |
---|
| 793 | |
---|
| 794 | .model starvation |
---|
| 795 | # I/O ports |
---|
| 796 | .inputs stat |
---|
| 797 | |
---|
| 798 | .mv state 2 OK NOT_OK |
---|
| 799 | .mv stat 3 no_cars car_waiting cars_passing |
---|
| 800 | # state = 0 |
---|
| 801 | .mv state$raw_n114 2 OK NOT_OK |
---|
| 802 | .names state$raw_n114 |
---|
| 803 | OK |
---|
| 804 | # non-blocking assignments for initial |
---|
| 805 | .mv _n117 2 OK NOT_OK |
---|
| 806 | .names _n117 |
---|
| 807 | OK |
---|
| 808 | .names state _n117 _n116 |
---|
| 809 | .def 0 |
---|
| 810 | - =state 1 |
---|
| 811 | .names _n116 _n115 |
---|
| 812 | 1 1 |
---|
| 813 | 0 0 |
---|
| 814 | .mv _n119 3 no_cars car_waiting cars_passing |
---|
| 815 | .names _n119 |
---|
| 816 | car_waiting |
---|
| 817 | # stat == 1 |
---|
| 818 | .names stat _n119 _n118 |
---|
| 819 | .def 0 |
---|
| 820 | - =stat 1 |
---|
| 821 | .names _n118 _n11a |
---|
| 822 | - =_n118 |
---|
| 823 | # state = 1 |
---|
| 824 | .mv state$_n118_n11b$true 2 OK NOT_OK |
---|
| 825 | .names state$_n118_n11b$true |
---|
| 826 | NOT_OK |
---|
| 827 | # if/else (stat == 1) |
---|
| 828 | .mv state$_n118$raw_n11e 2 OK NOT_OK |
---|
| 829 | .names state$_n118_n11b$true state _n118 state$_n118$raw_n11e |
---|
| 830 | - - 0 =state |
---|
| 831 | - - 1 =state$_n118_n11b$true |
---|
| 832 | .mv _n121 2 OK NOT_OK |
---|
| 833 | .names _n121 |
---|
| 834 | NOT_OK |
---|
| 835 | .names state _n121 _n120 |
---|
| 836 | .def 0 |
---|
| 837 | - =state 1 |
---|
| 838 | .names _n120 _n11f |
---|
| 839 | 1 1 |
---|
| 840 | 0 0 |
---|
| 841 | .mv _n123 3 no_cars car_waiting cars_passing |
---|
| 842 | .names _n123 |
---|
| 843 | cars_passing |
---|
| 844 | # stat == 2 |
---|
| 845 | .names stat _n123 _n122 |
---|
| 846 | .def 0 |
---|
| 847 | - =stat 1 |
---|
| 848 | .names _n122 _n124 |
---|
| 849 | - =_n122 |
---|
| 850 | # state = 0 |
---|
| 851 | .mv state$_n122_n125$true 2 OK NOT_OK |
---|
| 852 | .names state$_n122_n125$true |
---|
| 853 | OK |
---|
| 854 | # if/else (stat == 2) |
---|
| 855 | .mv state$_n122$raw_n128 2 OK NOT_OK |
---|
| 856 | .names state$_n122_n125$true state _n122 state$_n122$raw_n128 |
---|
| 857 | - - 0 =state |
---|
| 858 | - - 1 =state$_n122_n125$true |
---|
| 859 | # case (state ) |
---|
| 860 | .mv state$_n11f$raw_n12b 2 OK NOT_OK |
---|
| 861 | .names state$_n122$raw_n128 state _n11f state$_n11f$raw_n12b |
---|
| 862 | - - 0 =state |
---|
| 863 | - - 1 =state$_n122$raw_n128 |
---|
| 864 | .mv state$_n115$raw_n12d 2 OK NOT_OK |
---|
| 865 | .names state$_n118$raw_n11e state$_n11f$raw_n12b _n115 state$_n115$raw_n12d |
---|
| 866 | - - 0 =state$_n11f$raw_n12b |
---|
| 867 | - - 1 =state$_n118$raw_n11e |
---|
| 868 | # conflict arbitrators |
---|
| 869 | .names _n115 _n11a _n11f _n124 _n130 |
---|
| 870 | .def 0 |
---|
| 871 | 1 1 - - 1 |
---|
| 872 | 0 - 1 1 1 |
---|
| 873 | .mv _n131 2 OK NOT_OK |
---|
| 874 | .names _n130 state$_n115$raw_n12d state _n131 |
---|
| 875 | 1 - - =state$_n115$raw_n12d |
---|
| 876 | 0 - - =state |
---|
| 877 | # non-blocking assignments |
---|
| 878 | # latches |
---|
| 879 | .r state$raw_n114 state |
---|
| 880 | - =state$raw_n114 |
---|
| 881 | .latch _n131 state |
---|
| 882 | # quasi-continuous assignment |
---|
| 883 | .end |
---|
| 884 | |
---|
| 885 | |
---|