Esempio n. 1
0
    def reached_loop_dblock(self, lbl, etime, instcnt, tid):
        # Start of loop reached again.
        if self.is_start(lbl) and self.is_loop(lbl):
            str_lbl = lbl.replace(self._data.start_str(),"")
            if str_lbl not in self._data._stack:
                self._data._stack.append(str_lbl)
                print 'HDP LOOP: pushed %s, stack: %s' %(str_lbl,self._data._stack)
            if not self._data.exists_lbreak(str_lbl):
                dblock = deadline_block.deadline_block()
                dblock.id = str_lbl
                dblock.block_type = "LOOP"
                dblock.execution_time = [etime]
                dblock.instruction_count = [instcnt]
                dblock.deadline_value = self.strip_deadline(lbl)
                dblock.pcs = dict()
                self._data._lbreaks[str_lbl] = dblock

            else:
                dblock = self._data._lbreaks[str_lbl]
                dblock.execution_time.append(etime)

        # End of loop reached.
        elif self.is_end(lbl) and self.is_loop(lbl):
            str_lbl = lbl.replace(self._data.end_str(),"")
            # Exit end of a loop 
            if lbl.find("_end_end") != -1:
                if self._data.exists_lbreak(str_lbl):
                    dblock = self._data._lbreaks[str_lbl]
                    dblock.execution_time.append(etime)
                    self._data._loops[str_lbl + '_' + str(len(self._data._loops))] = dblock
                    del self._data._lbreaks[str_lbl]

                    if len(self._data._stack) > 0: 
                        lab = self._data._stack.pop()
                        print 'HDP LOOP: popped %s, stack: %s' %(lab,self._data._stack)
            else:
                if self._data.exists_lbreak(str_lbl):
                    dblock = self._data._lbreaks[str_lbl]
                    dblock.execution_time.append(etime)
Esempio n. 2
0
    def reached_sequential_dblock(self, lbl, etime, instcnt, tid):
        str_lbl = lbl
        if self.is_end(str_lbl) and not self.is_loop(str_lbl):
            str_lbl = str_lbl.replace(self._data.end_str(),"")
            # Exit end of a sequential deadline.            
            
            if lbl.find("_end_end") != -1 and len(self._data._stack) > 0:
                lab = self._data._stack.pop()
                print 'HDP: popped %s, stack: %s' %(lab,self._data._stack)
                if lab == str_lbl:
                    dblock = self._data._lbreaks[str_lbl]
                    dblock.wc_execution_time = etime - dblock.wc_execution_time
                    dblock.instruction_count = instcnt - dblock.instruction_count
                
        elif self.is_start(str_lbl) and not self.is_loop(str_lbl) :
            # Start of a sequential deadline.
            str_lbl = str_lbl.replace(self._data.start_str(),"")
            dblock = deadline_block.deadline_block()
            dblock.init(str_lbl, etime, instcnt, 1, self.strip_deadline(lbl),dict())
            dblock.block_type = "SEQUENCE"

            self._data._lbreaks[str_lbl] = dblock
            self._data._stack.append(str_lbl)