|
@@ -97,12 +97,17 @@ Void function do_transition(model : Element, start_time : Float, event : String)
|
|
|
transition = set_pop(all_transitions)
|
|
|
if (value_eq(read_attribute(model, transition, "event"), event)):
|
|
|
// Found a match
|
|
|
+ new_state = readAssociationDestination(model, transition)
|
|
|
+ log("Transition to " + new_state)
|
|
|
+
|
|
|
+ // Delete current state
|
|
|
model_delete_element(model, cstate_link)
|
|
|
|
|
|
// Set destination of state
|
|
|
instantiate_link(model, "CurrentStateLink", "", cstate_obj, new_state)
|
|
|
|
|
|
- output("SIM_STATE " + cast_v2s(new_state))
|
|
|
+ log("Do state change")
|
|
|
+ output("SIM_STATE " + cast_v2s(read_attribute(model, new_state, "name")))
|
|
|
|
|
|
// Raise "raise" attribute of transition
|
|
|
raise = read_attribute(model, transition, "raise")
|
|
@@ -139,22 +144,10 @@ Void function execute_fsa(design_model : Element):
|
|
|
output("CONFORMANCE_FAIL")
|
|
|
|
|
|
while (True):
|
|
|
- if (has_input()):
|
|
|
- cmd = input()
|
|
|
- else:
|
|
|
- if (bool_and(conforming == "OK", running)):
|
|
|
- cmd = "skip"
|
|
|
- else:
|
|
|
- cmd = input()
|
|
|
+ cmd = input()
|
|
|
log("Do: " + cmd)
|
|
|
|
|
|
- // Process input
|
|
|
- if (cmd == "skip"):
|
|
|
- if (conforming == "OK"):
|
|
|
- output("SIM_TIME " + cast_v2s(time() - start_time))
|
|
|
- output("SIM_STATE " + cast_v2s(readAssociationDestination(runtime_model, set_pop(allInstances(runtime_model, "CurrentStateLink")))))
|
|
|
-
|
|
|
- elif (cmd == "pause"):
|
|
|
+ if (cmd == "pause"):
|
|
|
// Pausing merely stops a running simulation
|
|
|
if (running):
|
|
|
simulation_time = time() - start_time
|
|
@@ -172,10 +165,8 @@ Void function execute_fsa(design_model : Element):
|
|
|
automatic_sanitization = input()
|
|
|
|
|
|
elif (cmd == "event"):
|
|
|
- String evt
|
|
|
- evt = input()
|
|
|
-
|
|
|
- do_transition(runtime_model, start_time, evt)
|
|
|
+ log("Got event")
|
|
|
+ do_transition(runtime_model, start_time, input())
|
|
|
|
|
|
elif (cmd == "read_available_attributes"):
|
|
|
// Returns a list of all available attributes
|
|
@@ -248,6 +239,10 @@ Void function execute_fsa(design_model : Element):
|
|
|
else:
|
|
|
log("Did not understand command: " + cmd)
|
|
|
|
|
|
+ if (conforming == "OK"):
|
|
|
+ output("SIM_TIME " + cast_v2s(time() - start_time))
|
|
|
+ output("SIM_STATE " + cast_v2s(read_attribute(runtime_model, readAssociationDestination(runtime_model, set_pop(allInstances(runtime_model, "CurrentStateLink"))), "name")))
|
|
|
+
|
|
|
Void function main():
|
|
|
Element model
|
|
|
String verify_result
|