예제 #1
0
    def start(self, align=True, branch=True):

        if self.r_count is None:
            self.r_count = self.code.acquire_register()

        if self.mode == CTR and branch:
            if self.step_size() != 1:
                raise Exception(
                    'CTR loops must have step_size of 1, you used ' +
                    str(self.step_size()))

            if self.external_stop:
                self.code.add(ppc.mtctr(self.r_stop))
            else:
                util.load_word(self.code, self.r_count, self.n_steps())
                self.code.add(ppc.mtctr(self.r_count))

            self.code.release_register(self.r_count)
            self.r_count = None

        elif self.mode == DEC:
            util.load_word(self.code, self.r_count, self.get_count())

        elif self.mode == INC:
            if self.r_stop is None and branch:
                self.r_stop = self.code.acquire_register()

            util.load_word(self.code, self.r_count, self.get_start())

            if branch and not self.external_stop:
                util.load_word(self.code, self.r_stop, self.get_count())

        # /end mode if

        if self.r_count is not None:
            # self.current_count = metavar.int_var(self.code, reg = self.r_count)
            self.current_count = vars.UnsignedWord(reg=self.r_count)

        if align and branch:
            # Align the start of the loop on a 16 byte boundary
            while (self.code.size()) % 4 != 0:
                self.code.add(ppc.noop())

        # Label
        self.start_label = self.code.size() + 1

        return
예제 #2
0
  def start(self, align = True, branch = True):

    if self.r_count is None:
      self.r_count = self.code.prgm.acquire_register()
      
    if self.mode == CTR and branch:
      if self.step_size() != 1:
        raise Exception('CTR loops must have step_size of 1, you used ' + str(self.step_size()))

      if self.external_stop:
        self.code.add(ppc.mtctr(self.r_stop))
      else:
        util.load_word(self.code, self.r_count, self.n_steps())
        self.code.add(ppc.mtctr(self.r_count))

      self.code.prgm.release_register(self.r_count)
      self.r_count = None

    elif self.mode == DEC:
      util.load_word(self.code, self.r_count, self.get_count())

    elif self.mode == INC:
      if self.r_stop is None and branch:
        self.r_stop = self.code.prgm.acquire_register()

      util.load_word(self.code, self.r_count, self.get_start())

      if branch and not self.external_stop:
        util.load_word(self.code, self.r_stop, self.get_count())

    # /end mode if

    if self.r_count is not None:
      self.current_count = vars.UnsignedWord(code = self.code, reg = self.r_count)

    if align and branch:
      # Align the start of the loop on a 16 byte boundary
      while (self.code.size()) % 4 != 0:
        self.code.add(ppc.noop())

    # Label
    self.start_label = self.code.prgm.get_unique_label("SYN_ITER_START")
    self.code.add(self.start_label)

    return
예제 #3
0
    def start(self, align=True, branch=True):
        self.obj.start(align=False, branch=branch)

        code = self.obj.code
        # replace count with rank
        if self.obj.mode == CTR:
            raise Expcetion('Parallel CTR loops not supported')
        elif self.obj.mode == DEC:
            raise Expcetion('Parallel DEC loops not supported')
        elif self.obj.mode == INC:
            self._update_inc_count()

        if align and branch:
            # Align the start of the loop on a 16 byte boundary
            while (code.size()) % 4 != 0:
                code.add(ppc.noop())

        # Update the real iterator's label
        self.obj.start_label = code.size() + 1

        return
예제 #4
0
  def start(self, align = True, branch = True):
    self.obj.start(align = False, branch = branch)

    code = self.obj.code
    # replace count with rank
    if self.obj.mode == CTR:
      raise Exception('Parallel CTR loops not supported')
    elif self.obj.mode == DEC:
      raise Exception('Parallel DEC loops not supported')
    elif self.obj.mode == INC:
      self._update_inc_count()
      
    if align and branch:
      # Align the start of the loop on a 16 byte boundary
      while (code.size()) % 4 != 0:
        code.add(ppc.noop())
      
    # Update the real iterator's label
    self.obj.start_label = code.prgm.get_unique_label("PARALLEL_START")
    code.add(self.obj.start_label)

    return