コード例 #1
0
def create_trace_tree(state: State,
                      stablestates: List[str]) -> List[List[TraceNodeObj]]:

    tracetree = ForkTree()

    basenode = tracetree.insertnode(TraceNodeObj(state))

    # Initially get loops from states once
    nextlist = get_trans_finalstates_loop([basenode], state.gettransitions())

    while nextlist:
        endnodes = []
        for nextnode in nextlist:
            endnodes += tracetree.appenddata(nextnode[1], nextnode[0])

        nextlist = []
        for node in endnodes:
            state = node.getdata().get_state()
            if not [
                    stateid for stateid in stablestates
                    if state.getstatename() == stateid
            ]:
                nextlist += get_trans_finalstates([node],
                                                  state.gettransitions())

    return tracetree.gettraces()
コード例 #2
0
    def add_immed_request_access(self, state: State) -> None:
        for transition in state.gettransitions():
            # If an access can be performed without awaiting a response, important not request,
            # it can still make a request
            if transition.getaccess() in state.get_access_str():
                if transition.getoutmsg():
                    self.request_access.append(transition.getaccess())
                else:
                    self.immed_access.append(transition.getaccess())

            elif transition.getaccess() in state.get_evict_str():
                if transition.getoutmsg():
                    self.request_evict.append(transition.getaccess())
                else:
                    self.immed_evict.append(transition.getaccess())
            else:
                assert "Unrecognized access"