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

Subversion Repositories or2k

[/] [or2k/] [trunk/] [analysis-bin/] [insnanalysis/] [or1k-32-insn.c] - Diff between revs 25 and 26

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

Rev 25 Rev 26
Line 896... Line 896...
            }
            }
          insn_props->has_rB = 0;
          insn_props->has_rB = 0;
          break;
          break;
 
 
        case 0xd:
        case 0xd:
 
          switch(insn_or1k_opcode_0x38_get_op_hi_4bit(insn))
 
            {
 
            case 0x0:
          insn_props->insn_string="l.extws";
          insn_props->insn_string="l.extws";
          insn_props->insn_index=103;
          insn_props->insn_index=103;
 
              break;
 
            case 0x1:
 
              insn_props->insn_string="l.extwz";
 
              insn_props->insn_index=104;
 
              break;
 
            }
          insn_props->has_rB = 0;
          insn_props->has_rB = 0;
          break;
          break;
 
 
        case 0xe:
        case 0xe:
          insn_props->insn_string="l.cmov";
          insn_props->insn_string="l.cmov";
          insn_props->insn_index=104;
          insn_props->insn_index=105;
          break;
          break;
 
 
        case 0xf:
        case 0xf:
          if (insn_or1k_opcode_0x38_get_op_hi_2bit(insn) & 0x1)
          if (insn_or1k_opcode_0x38_get_op_hi_2bit(insn) & 0x1)
            {
            {
              insn_props->insn_string="l.fl1";
              insn_props->insn_string="l.fl1";
              insn_props->insn_index=105;
              insn_props->insn_index=106;
            }
            }
          else
          else
            {
            {
              insn_props->insn_string="l.ff1";
              insn_props->insn_string="l.ff1";
              insn_props->insn_index=106;
              insn_props->insn_index=107;
            }
            }
          insn_props->has_rB = 0;
          insn_props->has_rB = 0;
          break;
          break;
 
 
        default:
        default:
Line 935... Line 944...
      insn_props->has_rB = 1;
      insn_props->has_rB = 1;
      switch (insn_or1k_opcode_0x39_get_op(insn))
      switch (insn_or1k_opcode_0x39_get_op(insn))
        {
        {
        case 0x0:
        case 0x0:
          insn_props->insn_string="l.sfeq";
          insn_props->insn_string="l.sfeq";
          insn_props->insn_index=107;
          insn_props->insn_index=108;
          break;
          break;
        case 0x1:
        case 0x1:
          insn_props->insn_string="l.sfne";
          insn_props->insn_string="l.sfne";
          insn_props->insn_index=108;
          insn_props->insn_index=109;
          break;
          break;
        case 0x2:
        case 0x2:
          insn_props->insn_string="l.sfgtu";
          insn_props->insn_string="l.sfgtu";
          insn_props->insn_index=109;
          insn_props->insn_index=110;
          break;
          break;
        case 0x3:
        case 0x3:
          insn_props->insn_string="l.sfgeu";
          insn_props->insn_string="l.sfgeu";
          insn_props->insn_index=110;
          insn_props->insn_index=111;
          break;
          break;
        case 0x4:
        case 0x4:
          insn_props->insn_string="l.sfltu";
          insn_props->insn_string="l.sfltu";
          insn_props->insn_index=111;
          insn_props->insn_index=112;
          break;
          break;
        case 0x5:
        case 0x5:
          insn_props->insn_string="l.sfleu";
          insn_props->insn_string="l.sfleu";
          insn_props->insn_index=112;
          insn_props->insn_index=113;
          break;
          break;
        case 0xa:
        case 0xa:
          insn_props->insn_string="l.sfgts";
          insn_props->insn_string="l.sfgts";
          insn_props->insn_index=113;
          insn_props->insn_index=114;
          break;
          break;
        case 0xb:
        case 0xb:
          insn_props->insn_string="l.sfges";
          insn_props->insn_string="l.sfges";
          insn_props->insn_index=114;
          insn_props->insn_index=115;
          break;
          break;
        case 0xc:
        case 0xc:
          insn_props->insn_string="l.sflts";
          insn_props->insn_string="l.sflts";
          insn_props->insn_index=115;
          insn_props->insn_index=116;
          break;
          break;
        case 0xd:
        case 0xd:
          insn_props->insn_string="l.sfles";
          insn_props->insn_string="l.sfles";
          insn_props->insn_index=116;
          insn_props->insn_index=117;
          break;
          break;
        default:
        default:
          printf("Unknown opcode for l.sfxxx opcode (0x%x)",
          printf("Unknown opcode for l.sfxxx opcode (0x%x)",
                 insn_or1k_opcode_0x39_get_op(insn));
                 insn_or1k_opcode_0x39_get_op(insn));
          return 1;
          return 1;
Line 1454... Line 1463...
  fprintf(stream,
  fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
          "Insn: \"%s\" statistics (%d times (%f%%))\n",
          "Insn: \"%s\" statistics (%d times (%f%%))\n",
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
          "\"Instruction:\",\"%s\",\"occurrences:\",%d,%f\n",
          "\"Instruction:\",\"%s\",\"occurrences:\",%d,%f%%\n",
#endif
#endif
          insn_info->insn_string,
          insn_info->insn_string,
          insn_info->count,
          insn_info->count,
          (float)(((float)((insn_info)->count))/
          (float)(((float)((insn_info)->count))/
                  ((float)num_seen_insns))*100.f
                  ((float)num_seen_insns))*100.f
Line 1471... Line 1480...
  // Print out top max_stats branch targets
  // Print out top max_stats branch targets
  if (insn_info->has_branchtarg)
  if (insn_info->has_branchtarg)
    {
    {
      fprintf(stream,
      fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
              "Branch values:\n"
              "Branch immediates:\n"
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
              "\"branch distance\",\"occurrences\"\n"
              "\"branch imm\",\"occurrences\",\"frequency\"\n"
#endif
#endif
              );
              );
      i = 0;
      i = 0;
      while(i<insn_info->branch_info.count && i < max_stats)
      while(i<insn_info->branch_info.count && i < max_stats)
        {
        {
Line 1489... Line 1498...
              j : largest_i;
              j : largest_i;
 
 
          // largest_i has index of most frequent value
          // largest_i has index of most frequent value
          fprintf(stream,
          fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
                  "value:\t0x%x\tcount:\t%d\n",
                  "value:\t0x%x\tcount:\t%d,\tfreq:\t%f%%\n",
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
                  "0x%x,%d\n",
                  "0x%x,%d,%f\n",
#endif
#endif
                  insn_info->branch_info.values[largest_i][0],
                  insn_info->branch_info.values[largest_i][0],
                  insn_info->branch_info.values[largest_i][1]);
                  insn_info->branch_info.values[largest_i][1],
 
                  (float)(((float)insn_info->branch_info.values[largest_i][1])
 
                          /((float)((insn_info)->count)))*100.0f);
          insn_info->branch_info.values[largest_i][1] = -1; // clear this one
          insn_info->branch_info.values[largest_i][1] = -1; // clear this one
          i++;
          i++;
        }
        }
    }
    }
  if (insn_info->has_imm)
  if (insn_info->has_imm)
Line 1507... Line 1518...
      fprintf(stream,
      fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
              "Immediate values:\n"
              "Immediate values:\n"
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
              "\"immediate value\",\"count\"\n"
              "\"immediate value\",\"count\",\"frequency\"\n"
#endif
#endif
              );
              );
      i = 0;
      i = 0;
      while(i<insn_info->imm_info.count && i < max_stats)
      while(i<insn_info->imm_info.count && i < max_stats)
        {
        {
Line 1522... Line 1533...
              j : largest_i;
              j : largest_i;
 
 
          // largest_i has index of most frequent value
          // largest_i has index of most frequent value
          fprintf(stream,
          fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
                  "value:\t0x%x\tcount:\t%d\n",
                  "value:\t0x%x\tcount:\t%d\tfreq:\t%f%%\n",
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
                  "0x%x,%d\n",
                  "0x%x,%d,%f\n",
#endif
#endif
                  insn_info->imm_info.values[largest_i][0],
                  insn_info->imm_info.values[largest_i][0],
                  insn_info->imm_info.values[largest_i][1]);
                  insn_info->imm_info.values[largest_i][1],
 
                  (float)(((float)insn_info->imm_info.values[largest_i][1])
 
                          /((float)((insn_info)->count)))*100.0f);
          insn_info->imm_info.values[largest_i][1] = -1; // clear this one
          insn_info->imm_info.values[largest_i][1] = -1; // clear this one
          i++;
          i++;
        }
        }
    }
    }
 
 
Line 1541... Line 1554...
      fprintf(stream,
      fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
              "rD usage:\n"
              "rD usage:\n"
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
              "\"rD\",\"count\"\n"
              "\"rD\",\"count\",\"frequency\"\n"
#endif
#endif
              );
              );
      i = 0;
      i = 0;
      while(i<32 && i < max_stats)
      while(i<32 && i < max_stats)
        {
        {
Line 1560... Line 1573...
            break;
            break;
 
 
          // largest_i has index of most frequent value
          // largest_i has index of most frequent value
          fprintf(stream,
          fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
                  "r%d\tcount:\t%d\n",
                  "r%d\tcount:\t%d\tfreq:\t%f%%\n",
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
                  "\"r%d\",%d\n",
                  "\"r%d\",%d,%f\n",
#endif
#endif
                  largest_i,
                  largest_i,
                  insn_info->rD_use_freq[largest_i]);
                  insn_info->rD_use_freq[largest_i],
 
                  (float)(((float)insn_info->rD_use_freq[largest_i])
 
                          /((float)((insn_info)->count)))*100.0f);
          insn_info->rD_use_freq[largest_i] = -1; // clear this one
          insn_info->rD_use_freq[largest_i] = -1; // clear this one
          i++;
          i++;
        }
        }
    }
    }
 
 
Line 1579... Line 1594...
      fprintf(stream,
      fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
              "rA usage:\n"
              "rA usage:\n"
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
              "\"rA\",\"count\"\n"
              "\"rA\",\"count\",\"frequency\"\n"
#endif
#endif
              );
              );
      i = 0;
      i = 0;
      while(i<32 && i < max_stats)
      while(i<32 && i < max_stats)
        {
        {
Line 1599... Line 1614...
 
 
 
 
          // largest_i has index of most frequent value
          // largest_i has index of most frequent value
          fprintf(stream,
          fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
                  "r%d\tcount:\t%d\n",
                  "r%d\tcount:\t%d\tfreq:\t%f%%\n",
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
                  "\"r%d\",%d\n",
                  "\"r%d\",%d,%f\n",
#endif
#endif
                  largest_i,
                  largest_i,
                  insn_info->rA_use_freq[largest_i]);
                  insn_info->rA_use_freq[largest_i],
 
                  (float)(((float)insn_info->rA_use_freq[largest_i])
 
                          /((float)((insn_info)->count)))*100.0f);
          insn_info->rA_use_freq[largest_i] = -1; // clear this one
          insn_info->rA_use_freq[largest_i] = -1; // clear this one
          i++;
          i++;
        }
        }
    }
    }
 
 
Line 1618... Line 1635...
      fprintf(stream,
      fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
              "rB usage:\n"
              "rB usage:\n"
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
              "\"rB\",\"count\"\n"
              "\"rB\",\"count\",\"frequency\"\n"
#endif
#endif
              );
              );
      i = 0;
      i = 0;
      while(i<32 && i < max_stats)
      while(i<32 && i < max_stats)
        {
        {
Line 1638... Line 1655...
 
 
 
 
          // largest_i has index of most frequent value
          // largest_i has index of most frequent value
          fprintf(stream,
          fprintf(stream,
#ifdef DISPLAY_STRING
#ifdef DISPLAY_STRING
                  "r%d\tcount:\t%d\n",
                  "r%d\tcount:\t%d\tfreq:\t%f%%\n",
#endif
#endif
#ifdef DISPLAY_CSV
#ifdef DISPLAY_CSV
                  "\"r%d\",%d\n",
                  "\"r%d\",%d,%f\n",
#endif
#endif
                  largest_i,
                  largest_i,
                  insn_info->rB_use_freq[largest_i]);
                  insn_info->rB_use_freq[largest_i],
 
                  (float)(((float)insn_info->rB_use_freq[largest_i])
 
                          /((float)((insn_info)->count)))*100.0f);
          insn_info->rB_use_freq[largest_i] = -1; // clear this one
          insn_info->rB_use_freq[largest_i] = -1; // clear this one
          i++;
          i++;
        }
        }
    }
    }
}
}

powered by: WebSVN 2.1.0

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