diff options
author | David Hashe <david.hashe@amd.com> | 2015-07-20 09:15:18 -0500 |
---|---|---|
committer | David Hashe <david.hashe@amd.com> | 2015-07-20 09:15:18 -0500 |
commit | ee0d414fa8dac2371b439778374ec585b358e549 (patch) | |
tree | 94d386b04002226fcf816c64c589d544e67504af /src/mem/slicc/symbols/StateMachine.py | |
parent | 6a288d9de3422024b9e99caa8b3717d98e467314 (diff) | |
download | gem5-ee0d414fa8dac2371b439778374ec585b358e549.tar.xz |
slicc: support for transitions with a wildcard next state
This patches adds support for transitions of the form:
transition(START, EVENTS, *) { ACTIONS }
This allows a machine to collapse states that differ only in the next state
transition to collapse into one, and can help shorten/simplfy some protocols
significantly.
When * is encountered as an end state of a transition, the next state is
determined by calling the machine-specific getNextState function. The next
state is determined before any actions of the transition execute, and
therefore the next state calculation cannot depend on any of the transition
actions.
Diffstat (limited to 'src/mem/slicc/symbols/StateMachine.py')
-rw-r--r-- | src/mem/slicc/symbols/StateMachine.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py index 174d66e0f..8a4d7d9b5 100644 --- a/src/mem/slicc/symbols/StateMachine.py +++ b/src/mem/slicc/symbols/StateMachine.py @@ -1310,8 +1310,17 @@ ${ident}_Controller::doTransitionWorker(${ident}_Event event, case = self.symtab.codeFormatter() # Only set next_state if it changes if trans.state != trans.nextState: - ns_ident = trans.nextState.ident - case('next_state = ${ident}_State_${ns_ident};') + if trans.nextState.isWildcard(): + # When * is encountered as an end state of a transition, + # the next state is determined by calling the + # machine-specific getNextState function. The next state + # is determined before any actions of the transition + # execute, and therefore the next state calculation cannot + # depend on any of the transitionactions. + case('next_state = getNextState(addr);') + else: + ns_ident = trans.nextState.ident + case('next_state = ${ident}_State_${ns_ident};') actions = trans.actions request_types = trans.request_types |