# vl2mv ping_pong.v # version: 0.2 # date: 11:16:44 12/11/95 (PST) .model ping_pong # I/O ports .mv action_A 2 HIT NO_HIT .mv state_B 2 BALL NO_BALL .mv action_B 2 HIT NO_HIT .mv state_A 2 BALL NO_BALL .subckt player player_A opponent=action_B me=action_A state=state_A .subckt player player_B opponent=action_A me=action_B state=state_B .subckt never_no_balls nnb state_A=state_A state_B=state_B .subckt infinitely_often_hit ioh player_action=action_A # conflict arbitrators # non-blocking assignments # latches # quasi-continuous assignment .end .model player # I/O ports .outputs me .outputs state .inputs opponent .mv me 2 HIT NO_HIT .mv state 2 BALL NO_BALL .mv random 2 HIT NO_HIT .mv opponent 2 HIT NO_HIT # state = 0 .mv state$raw_n0 2 BALL NO_BALL .names state$raw_n0 BALL # non-blocking assignments for initial # assign random = $NDset ( 0,1 ) .names random HIT NO_HIT # assign me = (state == BALL ) ? random : 1 .mv me$raw_n3 2 HIT NO_HIT .mv _n5 2 BALL NO_BALL .names _n5 BALL # state == 0 .names state _n5 _n4 .def 0 - =state 1 .mv _n6 2 HIT NO_HIT .names _n6 NO_HIT # (state == 0) ? random : 1 .mv _n7 2 HIT NO_HIT .names random _n6 _n4 _n7 - - 0 =_n6 - - 1 =random .names _n7 me$raw_n3 - =_n7 .mv _na 2 BALL NO_BALL .names _na BALL .names state _na _n9 .def 0 - =state 1 .names _n9 _n8 1 1 0 0 .mv _nc 2 HIT NO_HIT .names _nc HIT # me == 0 .names me _nc _nb .def 0 - =me 1 .mv _ne 2 HIT NO_HIT .names _ne NO_HIT # opponent == 1 .names opponent _ne _nd .def 0 - =opponent 1 # (me == 0) && (opponent == 1) .names _nb _nd _nf .def 0 1 1 1 .names _nf _n10 - =_nf # state = 1 .mv state$_nf_n11$true 2 BALL NO_BALL .names state$_nf_n11$true NO_BALL # if/else ((me == 0) && (opponent == 1)) .mv state$_nf$raw_n14 2 BALL NO_BALL .names state$_nf_n11$true state _nf state$_nf$raw_n14 - - 0 =state - - 1 =state$_nf_n11$true .mv _n17 2 BALL NO_BALL .names _n17 NO_BALL .names state _n17 _n16 .def 0 - =state 1 .names _n16 _n15 1 1 0 0 .mv _n19 2 HIT NO_HIT .names _n19 HIT # opponent == 0 .names opponent _n19 _n18 .def 0 - =opponent 1 .names _n18 _n1a - =_n18 # state = 0 .mv state$_n18_n1b$true 2 BALL NO_BALL .names state$_n18_n1b$true BALL # if/else (opponent == 0) .mv state$_n18$raw_n1e 2 BALL NO_BALL .names state$_n18_n1b$true state _n18 state$_n18$raw_n1e - - 0 =state - - 1 =state$_n18_n1b$true # case (state ) .mv state$_n15$raw_n21 2 BALL NO_BALL .names state$_n18$raw_n1e state _n15 state$_n15$raw_n21 - - 0 =state - - 1 =state$_n18$raw_n1e .mv state$_n8$raw_n23 2 BALL NO_BALL .names state$_nf$raw_n14 state$_n15$raw_n21 _n8 state$_n8$raw_n23 - - 0 =state$_n15$raw_n21 - - 1 =state$_nf$raw_n14 # conflict arbitrators .names me$raw_n3 me - =me$raw_n3 .names _n8 _n10 _n15 _n1a _n26 .def 0 1 1 - - 1 0 - 1 1 1 .mv _n27 2 BALL NO_BALL .names _n26 state$_n8$raw_n23 state _n27 1 - - =state$_n8$raw_n23 0 - - =state # non-blocking assignments # latches .r state$raw_n0 state - =state$raw_n0 .latch _n27 state # quasi-continuous assignment .end .model never_no_balls # I/O ports .inputs state_B .inputs state_A .mv state_B 2 BALL NO_BALL .mv state 2 GOOD BAD .mv state_A 2 BALL NO_BALL # state = 0 .mv state$raw_n2b 2 GOOD BAD .names state$raw_n2b GOOD # non-blocking assignments for initial .mv _n2e 2 GOOD BAD .names _n2e GOOD .names state _n2e _n2d .def 0 - =state 1 .names _n2d _n2c 1 1 0 0 .mv _n30 2 BALL NO_BALL .names _n30 NO_BALL # state_A == 1 .names state_A _n30 _n2f .def 0 - =state_A 1 .mv _n32 2 BALL NO_BALL .names _n32 NO_BALL # state_B == 1 .names state_B _n32 _n31 .def 0 - =state_B 1 # (state_A == 1) && (state_B == 1) .names _n2f _n31 _n33 .def 0 1 1 1 .names _n33 _n34 - =_n33 # state = 1 .mv state$_n33_n35$true 2 GOOD BAD .names state$_n33_n35$true BAD # if/else ((state_A == 1) && (state_B == 1)) .mv state$_n33$raw_n38 2 GOOD BAD .names state$_n33_n35$true state _n33 state$_n33$raw_n38 - - 0 =state - - 1 =state$_n33_n35$true .mv _n3b 2 GOOD BAD .names _n3b BAD .names state _n3b _n3a .def 0 - =state 1 .names _n3a _n39 1 1 0 0 # state = 1 .mv state$_n39_n3c$true 2 GOOD BAD .names state$_n39_n3c$true BAD # case (state ) .mv state$_n39$raw_n3f 2 GOOD BAD .names state$_n39_n3c$true state _n39 state$_n39$raw_n3f - - 0 =state - - 1 =state$_n39_n3c$true .mv state$_n2c$raw_n41 2 GOOD BAD .names state$_n33$raw_n38 state$_n39$raw_n3f _n2c state$_n2c$raw_n41 - - 0 =state$_n39$raw_n3f - - 1 =state$_n33$raw_n38 # conflict arbitrators .names _n2c _n34 _n39 _n44 .def 0 1 1 - 1 0 - 1 1 .mv _n45 2 GOOD BAD .names _n44 state$_n2c$raw_n41 state _n45 1 - - =state$_n2c$raw_n41 0 - - =state # non-blocking assignments # latches .r state$raw_n2b state - =state$raw_n2b .latch _n45 state # quasi-continuous assignment .end .model infinitely_often_hit # I/O ports .inputs player_action .mv player_action 2 HIT NO_HIT .mv state 2 OKAY PENDING # state = 0 .mv state$raw_n47 2 OKAY PENDING .names state$raw_n47 OKAY # non-blocking assignments for initial .mv _n4a 2 OKAY PENDING .names _n4a OKAY .names state _n4a _n49 .def 0 - =state 1 .names _n49 _n48 1 1 0 0 .mv _n4c 2 HIT NO_HIT .names _n4c NO_HIT # player_action == 1 .names player_action _n4c _n4b .def 0 - =player_action 1 .names _n4b _n4d - =_n4b # state = 1 .mv state$_n4b_n4e$true 2 OKAY PENDING .names state$_n4b_n4e$true PENDING # if/else (player_action == 1) .mv state$_n4b$raw_n51 2 OKAY PENDING .names state$_n4b_n4e$true state _n4b state$_n4b$raw_n51 - - 0 =state - - 1 =state$_n4b_n4e$true .mv _n54 2 OKAY PENDING .names _n54 PENDING .names state _n54 _n53 .def 0 - =state 1 .names _n53 _n52 1 1 0 0 .mv _n56 2 HIT NO_HIT .names _n56 HIT # player_action == 0 .names player_action _n56 _n55 .def 0 - =player_action 1 .names _n55 _n57 - =_n55 # state = 0 .mv state$_n55_n58$true 2 OKAY PENDING .names state$_n55_n58$true OKAY # if/else (player_action == 0) .mv state$_n55$raw_n5b 2 OKAY PENDING .names state$_n55_n58$true state _n55 state$_n55$raw_n5b - - 0 =state - - 1 =state$_n55_n58$true # case (state ) .mv state$_n52$raw_n5e 2 OKAY PENDING .names state$_n55$raw_n5b state _n52 state$_n52$raw_n5e - - 0 =state - - 1 =state$_n55$raw_n5b .mv state$_n48$raw_n60 2 OKAY PENDING .names state$_n4b$raw_n51 state$_n52$raw_n5e _n48 state$_n48$raw_n60 - - 0 =state$_n52$raw_n5e - - 1 =state$_n4b$raw_n51 # conflict arbitrators .names _n48 _n4d _n52 _n57 _n63 .def 0 1 1 - - 1 0 - 1 1 1 .mv _n64 2 OKAY PENDING .names _n63 state$_n48$raw_n60 state _n64 1 - - =state$_n48$raw_n60 0 - - =state # non-blocking assignments # latches .r state$raw_n47 state - =state$raw_n47 .latch _n64 state # quasi-continuous assignment .end