[11] | 1 | # vl2mv ctlp3.v |
---|
| 2 | # version: 0.2 |
---|
| 3 | # date: 11:13:08 12/11/95 (PST) |
---|
| 4 | .model diners |
---|
| 5 | # I/O ports |
---|
| 6 | |
---|
| 7 | .mv s0 4 THINKING HUNGRY EATING READING |
---|
| 8 | .mv s1 4 THINKING HUNGRY EATING READING |
---|
| 9 | .mv s2 4 THINKING HUNGRY EATING READING |
---|
| 10 | .mv _n0 4 THINKING HUNGRY EATING READING |
---|
| 11 | .names _n0 |
---|
| 12 | EATING |
---|
| 13 | .subckt philosopher ph0 out=s0 left=s1 right=s2 init=_n0 |
---|
| 14 | .mv _n1 4 THINKING HUNGRY EATING READING |
---|
| 15 | .names _n1 |
---|
| 16 | READING |
---|
| 17 | .subckt philosopher ph1 out=s1 left=s2 right=s0 init=_n1 |
---|
| 18 | .mv _n2 4 THINKING HUNGRY EATING READING |
---|
| 19 | .names _n2 |
---|
| 20 | HUNGRY |
---|
| 21 | .subckt philosopher ph2 out=s2 left=s0 right=s1 init=_n2 |
---|
| 22 | .subckt starvation str starv=s0 |
---|
| 23 | # conflict arbitrators |
---|
| 24 | # non-blocking assignments |
---|
| 25 | # latches |
---|
| 26 | # quasi-continuous assignment |
---|
| 27 | .end |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | .model philosopher |
---|
| 31 | # I/O ports |
---|
| 32 | .inputs left |
---|
| 33 | .outputs out |
---|
| 34 | .inputs init |
---|
| 35 | .inputs right |
---|
| 36 | |
---|
| 37 | .mv left 4 THINKING HUNGRY EATING READING |
---|
| 38 | .mv out 4 THINKING HUNGRY EATING READING |
---|
| 39 | .mv r0_state 4 THINKING HUNGRY EATING READING |
---|
| 40 | .mv r1_state 4 THINKING HUNGRY EATING READING |
---|
| 41 | .mv state 4 THINKING HUNGRY EATING READING |
---|
| 42 | .mv init 4 THINKING HUNGRY EATING READING |
---|
| 43 | .mv right 4 THINKING HUNGRY EATING READING |
---|
| 44 | # state = init |
---|
| 45 | .mv state$raw_n3 4 THINKING HUNGRY EATING READING |
---|
| 46 | .names init state$raw_n3 |
---|
| 47 | - =init |
---|
| 48 | # non-blocking assignments for initial |
---|
| 49 | # assign r0_state = $NDset ( 0,1 ) |
---|
| 50 | .names r0_state |
---|
| 51 | THINKING |
---|
| 52 | HUNGRY |
---|
| 53 | # assign r1_state = $NDset ( 0,2 ) |
---|
| 54 | .names r1_state |
---|
| 55 | THINKING |
---|
| 56 | EATING |
---|
| 57 | # assign out = state |
---|
| 58 | .mv out$raw_n8 4 THINKING HUNGRY EATING READING |
---|
| 59 | .names state out$raw_n8 |
---|
| 60 | - =state |
---|
| 61 | .mv _nb 4 THINKING HUNGRY EATING READING |
---|
| 62 | .names _nb |
---|
| 63 | READING |
---|
| 64 | .names state _nb _na |
---|
| 65 | .def 0 |
---|
| 66 | - =state 1 |
---|
| 67 | .names _na _n9 |
---|
| 68 | 1 1 |
---|
| 69 | 0 0 |
---|
| 70 | .mv _nd 4 THINKING HUNGRY EATING READING |
---|
| 71 | .names _nd |
---|
| 72 | THINKING |
---|
| 73 | # left == 0 |
---|
| 74 | .names left _nd _nc |
---|
| 75 | .def 0 |
---|
| 76 | - =left 1 |
---|
| 77 | .names _nc _ne |
---|
| 78 | - =_nc |
---|
| 79 | # state = 0 |
---|
| 80 | .mv state$_nc_nf$true 4 THINKING HUNGRY EATING READING |
---|
| 81 | .names state$_nc_nf$true |
---|
| 82 | THINKING |
---|
| 83 | # if/else (left == 0) |
---|
| 84 | .mv state$_nc$raw_n12 4 THINKING HUNGRY EATING READING |
---|
| 85 | .names state$_nc_nf$true state _nc state$_nc$raw_n12 |
---|
| 86 | - - 0 =state |
---|
| 87 | - - 1 =state$_nc_nf$true |
---|
| 88 | .mv _n15 4 THINKING HUNGRY EATING READING |
---|
| 89 | .names _n15 |
---|
| 90 | THINKING |
---|
| 91 | .names state _n15 _n14 |
---|
| 92 | .def 0 |
---|
| 93 | - =state 1 |
---|
| 94 | .names _n14 _n13 |
---|
| 95 | 1 1 |
---|
| 96 | 0 0 |
---|
| 97 | .mv _n17 4 THINKING HUNGRY EATING READING |
---|
| 98 | .names _n17 |
---|
| 99 | READING |
---|
| 100 | # right == 3 |
---|
| 101 | .names right _n17 _n16 |
---|
| 102 | .def 0 |
---|
| 103 | - =right 1 |
---|
| 104 | .names _n16 _n18 |
---|
| 105 | - =_n16 |
---|
| 106 | # state = 3 |
---|
| 107 | .mv state$_n16_n19$true 4 THINKING HUNGRY EATING READING |
---|
| 108 | .names state$_n16_n19$true |
---|
| 109 | READING |
---|
| 110 | # state = r0_state |
---|
| 111 | .mv state$_n16_n1a$false 4 THINKING HUNGRY EATING READING |
---|
| 112 | .names r0_state state$_n16_n1a$false |
---|
| 113 | - =r0_state |
---|
| 114 | # if/else (right == 3) |
---|
| 115 | .mv state$_n16$raw_n1c 4 THINKING HUNGRY EATING READING |
---|
| 116 | .names state$_n16_n19$true state$_n16_n1a$false _n16 state$_n16$raw_n1c |
---|
| 117 | - - 0 =state$_n16_n1a$false |
---|
| 118 | - - 1 =state$_n16_n19$true |
---|
| 119 | .mv _n21 4 THINKING HUNGRY EATING READING |
---|
| 120 | .names _n21 |
---|
| 121 | EATING |
---|
| 122 | .names state _n21 _n20 |
---|
| 123 | .def 0 |
---|
| 124 | - =state 1 |
---|
| 125 | .names _n20 _n1f |
---|
| 126 | 1 1 |
---|
| 127 | 0 0 |
---|
| 128 | # state = r1_state |
---|
| 129 | .mv state$_n1f_n22$true 4 THINKING HUNGRY EATING READING |
---|
| 130 | .names r1_state state$_n1f_n22$true |
---|
| 131 | - =r1_state |
---|
| 132 | .mv _n25 4 THINKING HUNGRY EATING READING |
---|
| 133 | .names _n25 |
---|
| 134 | HUNGRY |
---|
| 135 | .names state _n25 _n24 |
---|
| 136 | .def 0 |
---|
| 137 | - =state 1 |
---|
| 138 | .names _n24 _n23 |
---|
| 139 | 1 1 |
---|
| 140 | 0 0 |
---|
| 141 | .mv _n27 4 THINKING HUNGRY EATING READING |
---|
| 142 | .names _n27 |
---|
| 143 | EATING |
---|
| 144 | # left != 2 |
---|
| 145 | .names left _n27 _n26 |
---|
| 146 | .def 1 |
---|
| 147 | - =left 0 |
---|
| 148 | .mv _n29 4 THINKING HUNGRY EATING READING |
---|
| 149 | .names _n29 |
---|
| 150 | HUNGRY |
---|
| 151 | # right != 1 |
---|
| 152 | .names right _n29 _n28 |
---|
| 153 | .def 1 |
---|
| 154 | - =right 0 |
---|
| 155 | # left != 2 && right != 1 |
---|
| 156 | .names _n26 _n28 _n2a |
---|
| 157 | .def 0 |
---|
| 158 | 1 1 1 |
---|
| 159 | .mv _n2c 4 THINKING HUNGRY EATING READING |
---|
| 160 | .names _n2c |
---|
| 161 | EATING |
---|
| 162 | # right != 2 |
---|
| 163 | .names right _n2c _n2b |
---|
| 164 | .def 1 |
---|
| 165 | - =right 0 |
---|
| 166 | # left != 2 && right != 1 && right != 2 |
---|
| 167 | .names _n2a _n2b _n2d |
---|
| 168 | .def 0 |
---|
| 169 | 1 1 1 |
---|
| 170 | .names _n2d _n2e |
---|
| 171 | - =_n2d |
---|
| 172 | # state = 2 |
---|
| 173 | .mv state$_n2d_n2f$true 4 THINKING HUNGRY EATING READING |
---|
| 174 | .names state$_n2d_n2f$true |
---|
| 175 | EATING |
---|
| 176 | # if/else (left != 2 && right != 1 && right != 2) |
---|
| 177 | .mv state$_n2d$raw_n32 4 THINKING HUNGRY EATING READING |
---|
| 178 | .names state$_n2d_n2f$true state _n2d state$_n2d$raw_n32 |
---|
| 179 | - - 0 =state |
---|
| 180 | - - 1 =state$_n2d_n2f$true |
---|
| 181 | # case (state ) |
---|
| 182 | .mv state$_n23$raw_n35 4 THINKING HUNGRY EATING READING |
---|
| 183 | .names state$_n2d$raw_n32 state _n23 state$_n23$raw_n35 |
---|
| 184 | - - 0 =state |
---|
| 185 | - - 1 =state$_n2d$raw_n32 |
---|
| 186 | .mv state$_n1f$raw_n36 4 THINKING HUNGRY EATING READING |
---|
| 187 | .names state$_n1f_n22$true state$_n23$raw_n35 _n1f state$_n1f$raw_n36 |
---|
| 188 | - - 0 =state$_n23$raw_n35 |
---|
| 189 | - - 1 =state$_n1f_n22$true |
---|
| 190 | .mv state$_n13$raw_n3a 4 THINKING HUNGRY EATING READING |
---|
| 191 | .names state$_n16$raw_n1c state$_n1f$raw_n36 _n13 state$_n13$raw_n3a |
---|
| 192 | - - 0 =state$_n1f$raw_n36 |
---|
| 193 | - - 1 =state$_n16$raw_n1c |
---|
| 194 | .mv state$_n9$raw_n3e 4 THINKING HUNGRY EATING READING |
---|
| 195 | .names state$_nc$raw_n12 state$_n13$raw_n3a _n9 state$_n9$raw_n3e |
---|
| 196 | - - 0 =state$_n13$raw_n3a |
---|
| 197 | - - 1 =state$_nc$raw_n12 |
---|
| 198 | # conflict arbitrators |
---|
| 199 | .names out$raw_n8 out |
---|
| 200 | - =out$raw_n8 |
---|
| 201 | .names _n9 _ne _n13 _n18 _n1f _n23 _n2e _n42 |
---|
| 202 | .def 0 |
---|
| 203 | 1 1 - - - - - 1 |
---|
| 204 | 0 - 1 1 - - - 1 |
---|
| 205 | 0 - 1 0 - - - 1 |
---|
| 206 | 0 - 0 - 1 - - 1 |
---|
| 207 | 0 - 0 - 0 1 1 1 |
---|
| 208 | .mv _n43 4 THINKING HUNGRY EATING READING |
---|
| 209 | .names _n42 state$_n9$raw_n3e state _n43 |
---|
| 210 | 1 - - =state$_n9$raw_n3e |
---|
| 211 | 0 - - =state |
---|
| 212 | # non-blocking assignments |
---|
| 213 | # latches |
---|
| 214 | .r state$raw_n3 state |
---|
| 215 | - =state$raw_n3 |
---|
| 216 | .latch _n43 state |
---|
| 217 | # quasi-continuous assignment |
---|
| 218 | .end |
---|
| 219 | |
---|
| 220 | |
---|
| 221 | .model starvation |
---|
| 222 | # I/O ports |
---|
| 223 | .inputs starv |
---|
| 224 | |
---|
| 225 | .mv starv 4 THINKING HUNGRY EATING READING |
---|
| 226 | # state = 0 |
---|
| 227 | .names state$raw_n49 |
---|
| 228 | 0 |
---|
| 229 | # non-blocking assignments for initial |
---|
| 230 | .names _n4c |
---|
| 231 | 0 |
---|
| 232 | .names state _n4c _n4d |
---|
| 233 | .def 0 |
---|
| 234 | 0 1 1 |
---|
| 235 | 1 0 1 |
---|
| 236 | .names _n4d _n4b |
---|
| 237 | 0 1 |
---|
| 238 | 1 0 |
---|
| 239 | .names _n4b _n4a |
---|
| 240 | 1 1 |
---|
| 241 | 0 0 |
---|
| 242 | .mv _n50 4 THINKING HUNGRY EATING READING |
---|
| 243 | .names _n50 |
---|
| 244 | HUNGRY |
---|
| 245 | # starv == 1 |
---|
| 246 | .names starv _n50 _n4f |
---|
| 247 | .def 0 |
---|
| 248 | - =starv 1 |
---|
| 249 | .names _n4f _n51 |
---|
| 250 | - =_n4f |
---|
| 251 | # state = 1 |
---|
| 252 | .names state$_n4f_n52$true |
---|
| 253 | 1 |
---|
| 254 | # if/else (starv == 1) |
---|
| 255 | .names state$_n4f_n52$true state _n4f state$_n4f$raw_n55 |
---|
| 256 | 0 - 1 0 |
---|
| 257 | 1 - 1 1 |
---|
| 258 | - 0 0 0 |
---|
| 259 | - 1 0 1 |
---|
| 260 | .names _n59 |
---|
| 261 | 1 |
---|
| 262 | .names state _n59 _n5a |
---|
| 263 | .def 0 |
---|
| 264 | 0 1 1 |
---|
| 265 | 1 0 1 |
---|
| 266 | .names _n5a _n58 |
---|
| 267 | 0 1 |
---|
| 268 | 1 0 |
---|
| 269 | .names _n58 _n57 |
---|
| 270 | 1 1 |
---|
| 271 | 0 0 |
---|
| 272 | .mv _n5d 4 THINKING HUNGRY EATING READING |
---|
| 273 | .names _n5d |
---|
| 274 | THINKING |
---|
| 275 | # starv == 0 |
---|
| 276 | .names starv _n5d _n5c |
---|
| 277 | .def 0 |
---|
| 278 | - =starv 1 |
---|
| 279 | .names _n5c _n5e |
---|
| 280 | - =_n5c |
---|
| 281 | # state = 0 |
---|
| 282 | .names state$_n5c_n5f$true |
---|
| 283 | 0 |
---|
| 284 | # if/else (starv == 0) |
---|
| 285 | .names state$_n5c_n5f$true state _n5c state$_n5c$raw_n62 |
---|
| 286 | 0 - 1 0 |
---|
| 287 | 1 - 1 1 |
---|
| 288 | - 0 0 0 |
---|
| 289 | - 1 0 1 |
---|
| 290 | # case (state ) |
---|
| 291 | .names state$_n5c$raw_n62 state _n57 state$_n57$raw_n66 |
---|
| 292 | 0 - 1 0 |
---|
| 293 | 1 - 1 1 |
---|
| 294 | - 0 0 0 |
---|
| 295 | - 1 0 1 |
---|
| 296 | .names state$_n4f$raw_n55 state$_n57$raw_n66 _n4a state$_n4a$raw_n68 |
---|
| 297 | 0 - 1 0 |
---|
| 298 | 1 - 1 1 |
---|
| 299 | - 0 0 0 |
---|
| 300 | - 1 0 1 |
---|
| 301 | # conflict arbitrators |
---|
| 302 | .names _n4a _n51 _n57 _n5e _n6d |
---|
| 303 | .def 0 |
---|
| 304 | 1 1 - - 1 |
---|
| 305 | 0 - 1 1 1 |
---|
| 306 | .names _n6d state$_n4a$raw_n68 state _n6e |
---|
| 307 | 1 0 - 0 |
---|
| 308 | 1 1 - 1 |
---|
| 309 | 0 - 0 0 |
---|
| 310 | 0 - 1 1 |
---|
| 311 | # non-blocking assignments |
---|
| 312 | # latches |
---|
| 313 | .r state$raw_n49 state |
---|
| 314 | 0 0 |
---|
| 315 | 1 1 |
---|
| 316 | .latch _n6e state |
---|
| 317 | # quasi-continuous assignment |
---|
| 318 | .end |
---|
| 319 | |
---|
| 320 | |
---|