def build_fsm_spec_random(num_states):
    'Build an FSM spec with the specified number of states.\n\n    The FSM spec exploits only single input and single output. As a side \n    product, a list of output patterns are also returned.\n\n    Parameters\n    ----------\n    num_states : int\n        The number of states of the FSM.\n\n    Returns\n    -------\n    dict\n        The FSM spec that can be consumed by the FSM generator.\n    list\n        The output patterns associated with this FSM spec.\n\n    '
    (input_pin, output_pin) = list(pin_dict.keys())[0:2]
    if (num_states == 1):
        return ({'inputs': [('rst', input_pin)], 'outputs': [('test', output_pin)], 'states': ['S0'], 'transitions': [['1', '*', 'S0', '']]}, None)
    else:
        fsm_spec_state = {'inputs': [('rst', input_pin)], 'outputs': [('test', output_pin)], 'states': [], 'transitions': [['1', '*', 'S0', '']]}
        output_pattern_list = list()
        for i in range(num_states):
            current_state = 'S{}'.format(i)
            next_state = 'S{}'.format(((i + 1) % num_states))
            fsm_spec_state['states'] += [current_state]
            output_pattern = '{}'.format(randint(0, 1))
            transition = ['0', current_state, next_state, output_pattern]
            fsm_spec_state['transitions'] += [transition]
            output_pattern_list.append(int(output_pattern))
        return (fsm_spec_state, output_pattern_list)
Build an FSM spec with the specified number of states.

The FSM spec exploits only single input and single output. As a side 
product, a list of output patterns are also returned.

Parameters
----------
num_states : int
    The number of states of the FSM.

Returns
-------
dict
    The FSM spec that can be consumed by the FSM generator.
list
    The output patterns associated with this FSM spec.
def build_fsm_spec_random(num_states):
    'Build an FSM spec with the specified number of states.\n\n    The FSM spec exploits only single input and single output. As a side \n    product, a list of output patterns are also returned.\n\n    Parameters\n    ----------\n    num_states : int\n        The number of states of the FSM.\n\n    Returns\n    -------\n    dict\n        The FSM spec that can be consumed by the FSM generator.\n    list\n        The output patterns associated with this FSM spec.\n\n    '
    (input_pin, output_pin) = list(pin_dict.keys())[0:2]
    if (num_states == 1):
        return ({'inputs': [('rst', input_pin)], 'outputs': [('test', output_pin)], 'states': ['S0'], 'transitions': [['1', '*', 'S0', ]]}, None)
    else:
        fsm_spec_state = {'inputs': [('rst', input_pin)], 'outputs': [('test', output_pin)], 'states': [], 'transitions': [['1', '*', 'S0', ]]}
        output_pattern_list = list()
        for i in range(num_states):
            current_state = 'S{}'.format(i)
            next_state = 'S{}'.format(((i + 1) % num_states))
            fsm_spec_state['states'] += [current_state]
            output_pattern = '{}'.format(randint(0, 1))
            transition = ['0', current_state, next_state, output_pattern]
            fsm_spec_state['transitions'] += [transition]
            output_pattern_list.append(int(output_pattern))
        return (fsm_spec_state, output_pattern_list)