@@ -521,12 +521,17 @@ def STATE_GROUP_TO_C_CODE(
521521 text += " }\n "
522522 continue
523523
524- # At this point the stage is absolutely empty, assume to be delay state for delaying return
525- #raise Exception("Need assumed delay state for return?")
526- text += " // ASSUMED EMPTY DELAY STATE FOR RETURN\n "
527- text += " FSM_STATE = RETURN_REG;\n "
528- text += " FUNC_CALL_RETURN_FSM_STATE = ENTRY_REG;\n "
529- text += " }\n "
524+ # At this point the stage assumed to be returning/done?
525+ # From a subroutine or main?
526+ if state_info .sub_func_name is not None :
527+ text += " // Assumed subroutine returning to scheduled return state\n "
528+ text += " FSM_STATE = " + state_info .sub_func_name + "_FUNC_CALL_RETURN_FSM_STATE;\n "
529+ text += " }\n "
530+ else :
531+ text += " // ASSUMED EMPTY DELAY STATE FOR RETURN\n "
532+ text += " FSM_STATE = RETURN_REG;\n "
533+ text += " FUNC_CALL_RETURN_FSM_STATE = ENTRY_REG;\n "
534+ text += " }\n "
530535
531536 return text
532537
@@ -995,7 +1000,7 @@ def GET_STATE_TRANS_LISTS(start_state, parser_state, visited_states=None):
9951000 # print()
9961001 # visited_states is primarily to resolve loops for user instead of requiring __clk()?
9971002 if start_state in visited_states :
998- return [[start_state ]]
1003+ return [[]] #[[ start_state]]
9991004 visited_states .append (start_state )
10001005
10011006 debug = False
@@ -1784,7 +1789,8 @@ def GET_GROUPED_STATE_TRANSITIONS(
17841789 return []
17851790 state_groups = [None ] * (max (state_to_latest_index .values ()) + 1 )
17861791 for state , index in state_to_latest_index .items ():
1787- # print("Last Index",index,state.name)
1792+ if debug :
1793+ print ("Last Index" ,index ,state .name )
17881794 if state_groups [index ] is None :
17891795 state_groups [index ] = set ()
17901796 state_groups [index ].add (state )
0 commit comments