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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [cuc/] [insn.c] - Diff between revs 936 and 937

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

Rev 936 Rev 937
Line 56... Line 56...
 
 
{"lrbb", 0,"always @(posedge clk or posedge rst)"},
{"lrbb", 0,"always @(posedge clk or posedge rst)"},
{"cmov", 0,"assign \1 = \4 ? \2 : \3;"},
{"cmov", 0,"assign \1 = \4 ? \2 : \3;"},
{"reg", 0, "always @(posedge clk)"},
{"reg", 0, "always @(posedge clk)"},
 
 
{"nop", 0, NULL},
{"nop", 1, ""},
{"call", 0, "/* function call */"}};
{"call", 0, "/* function call */"}};
 
 
/* Find known instruction and attach them to insn */
/* Find known instruction and attach them to insn */
void change_insn_type (cuc_insn *i, int index)
void change_insn_type (cuc_insn *i, int index)
{
{
Line 69... Line 69...
  i->index = index;
  i->index = index;
  if (i->index == II_NOP) {
  if (i->index == II_NOP) {
    for (j = 0; j < MAX_OPERANDS; j++) i->opt[j] = OPT_NONE;
    for (j = 0; j < MAX_OPERANDS; j++) i->opt[j] = OPT_NONE;
    i->type = 0;
    i->type = 0;
    i->dep = NULL;
    i->dep = NULL;
 
    i->disasm[0] = '\0';
  }
  }
}
}
 
 
/* Returns instruction name */
/* Returns instruction name */
const char *cuc_insn_name (cuc_insn *ii) {
const char *cuc_insn_name (cuc_insn *ii) {
Line 88... Line 89...
    dep_list *l = insn[i].dep;
    dep_list *l = insn[i].dep;
    printf ("%4x%c %-4s ", i, insn[i].index >= 0 ? ':' : '?', cuc_insn_name (&insn[i]));
    printf ("%4x%c %-4s ", i, insn[i].index >= 0 ? ':' : '?', cuc_insn_name (&insn[i]));
    if (verbose) {
    if (verbose) {
      printf ("%-20s insn = %08x, index = %i, type = %04x ",
      printf ("%-20s insn = %08x, index = %i, type = %04x ",
                      insn[i].disasm, insn[i].insn, insn[i].index, insn[i].type);
                      insn[i].disasm, insn[i].insn, insn[i].index, insn[i].type);
    } else printf ("max = %08x type = %04x ", insn[i].max, insn[i].type);
    } else printf ("type = %04x ", insn[i].type);
    for (j = 0; j < MAX_OPERANDS; j++) {
    for (j = 0; j < MAX_OPERANDS; j++) {
      if (insn[i].opt[j] & OPT_DEST) printf ("*");
      if (insn[i].opt[j] & OPT_DEST) printf ("*");
      switch (insn[i].opt[j] & ~OPT_DEST) {
      switch (insn[i].opt[j] & ~OPT_DEST) {
        case OPT_NONE: break;
        case OPT_NONE: break;
        case OPT_CONST: printf ("0x%08x, ", insn[i].op[j]); break;
        case OPT_CONST: if (insn[i].type & IT_COND && (insn[i].index == II_CMOV
 
                         || insn[i].index == II_ADD)) printf ("%x, ", insn[i].op[j]);
 
                        else printf ("0x%08x, ", insn[i].op[j]); break;
        case OPT_JUMP: printf ("J%x ", insn[i].op[j]); break;
        case OPT_JUMP: printf ("J%x ", insn[i].op[j]); break;
        case OPT_REGISTER: printf ("r%i, ", insn[i].op[j]); break;
        case OPT_REGISTER: printf ("r%i, ", insn[i].op[j]); break;
        case OPT_REF: printf ("[%x.%x], ", REF_BB(insn[i].op[j]), REF_I(insn[i].op[j])); break;
        case OPT_REF: printf ("[%x.%x], ", REF_BB(insn[i].op[j]), REF_I(insn[i].op[j])); break;
        case OPT_BB: printf ("BB "); print_bb_num (insn[i].op[j]); printf (", "); break;
        case OPT_BB: printf ("BB "); print_bb_num (insn[i].op[j]); printf (", "); break;
        case OPT_LRBB: printf ("LRBB, "); break;
        case OPT_LRBB: printf ("LRBB, "); break;

powered by: WebSVN 2.1.0

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