OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_52/] [or1ksim/] [cuc/] [memory.c] - Diff between revs 897 and 904

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 897 Rev 904
Line 156... Line 156...
  for (i = 0; i < f->nmsched; i++)
  for (i = 0; i < f->nmsched; i++)
    printf ("[%i]%i%c ", f->msched[i], f->mtype[i] & MT_WIDTH, (f->mtype[i] & MT_BURST) ? (f->mtype[i] & MT_BURSTE) ? 'E' : 'B' : ' ');
    printf ("[%i]%i%c ", f->msched[i], f->mtype[i] & MT_WIDTH, (f->mtype[i] & MT_BURST) ? (f->mtype[i] & MT_BURSTE) ? 'E' : 'B' : ' ');
  printf ("\n");
  printf ("\n");
#endif
#endif
 
 
 
  /* Assign memory types */
  for (i = 0; i < f->nmsched; i++) {
  for (i = 0; i < f->nmsched; i++) {
    cuc_insn *a = &f->INSN(f->msched[i]);
    cuc_insn *a = &f->INSN(f->msched[i]);
    f->mtype[i] = !II_IS_LOAD(a->index) ? MT_WRITE : 0;
    f->mtype[i] = !II_IS_LOAD(a->index) ? MT_WRITE : 0;
    f->mtype[i] |= II_MEM_WIDTH (a->index);
    f->mtype[i] |= II_MEM_WIDTH (a->index);
    if (a->type & IT_SIGNED) f->mtype[i] |= MT_SIGNED;
    if (a->type & IT_SIGNED) f->mtype[i] |= MT_SIGNED;
  }
  }
 
 
 
  /* Check if they address the same location, so we can join them */
 
  if (otype == MO_WEAK || otype == MO_NONE) {
 
    for (i = 1, j = 1; i < f->nmsched; i++)
 
      /* Exclude memory stores and different memory types */
 
      if (f->mtype[i - 1] == f->mtype[i] && !(f->mtype[i] & MT_WRITE)) {
 
        cuc_insn *a = &f->INSN(f->msched[i - 1]);
 
        cuc_insn *b = &f->INSN(f->msched[i]);
 
        if ((a->opt[1] & OPT_REF) && f->INSN(a->op[1]).index == II_ADD
 
          &&(b->opt[1] & OPT_REF) && f->INSN(b->op[1]).index == II_ADD) {
 
          a = &f->INSN(a->op[1]);
 
          b = &f->INSN(b->op[1]);
 
          /* Not in usual form? */
 
          if (a->opt[1] != b->opt[1] || a->op[1] != b->op[1]
 
           || a->opt[2] != OPT_CONST || b->opt[2] != OPT_CONST) goto keep;
 
 
 
          //printf ("%i %i, ", a->op[2], b->op[2]);
 
 
 
          /* Check if they are the same => do not copy */
 
          if (a->op[2] == b->op[2]
 
            && REF_BB(f->msched[i - 1]) == REF_BB(f->msched[i])) {
 
            /* yes => remove actual instruction */
 
            int t1 = MIN (f->msched[i - 1], f->msched[i]);
 
            int t2 = MAX (f->msched[i - 1], f->msched[i]);
 
            int b, i, j;
 
            cucdebug (2, "Removing %x_%x and using %x_%x instead.\n",
 
              REF_BB(t2), REF_I(t2), REF_BB(t1), REF_I(t1));
 
            change_insn_type (&f->INSN(t2), II_NOP);
 
            /* Update references */
 
            for (b = 0; b < f->num_bb; b++)
 
              for (i = 0; i < f->bb[b].ninsn; i++)
 
                for (j = 0; j < MAX_OPERANDS; j++)
 
                  if (f->bb[b].insn[i].opt[j] & OPT_REF && f->bb[b].insn[i].op[j] == t2)
 
                    f->bb[b].insn[i].op[j] = t1;
 
 
 
          } else goto keep;
 
        }
 
      } else {
 
keep:
 
        f->msched[j] = f->msched[i];
 
        f->mtype[j++] = f->mtype[i];
 
      }
 
    f->nmsched = j;
 
  }
 
 
  if (config.cuc.enable_bursts) {
  if (config.cuc.enable_bursts) {
    //printf ("\n");
    //printf ("\n");
    for (i = 1; i < f->nmsched; i++) {
    for (i = 1; i < f->nmsched; i++) {
      cuc_insn *a = &f->INSN(f->msched[i - 1]);
      cuc_insn *a = &f->INSN(f->msched[i - 1]);
      cuc_insn *b = &f->INSN(f->msched[i]);
      cuc_insn *b = &f->INSN(f->msched[i]);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.