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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc1/] [or1ksim/] [cpu/] [or32/] [generate.c] - Diff between revs 1350 and 1432

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

Rev 1350 Rev 1432
Line 191... Line 191...
      if (opd->type & OPTYPE_SIG)
      if (opd->type & OPTYPE_SIG)
        shift_fprintf (level, fo, "if(%c & 0x%08x) %c |= 0x%x;\n",
        shift_fprintf (level, fo, "if(%c & 0x%08x) %c |= 0x%x;\n",
                       'a' + num_ops, 1 << sbit, 'a' + num_ops,
                       'a' + num_ops, 1 << sbit, 'a' + num_ops,
                       0xffffffff << sbit);
                       0xffffffff << sbit);
      opd++;
      opd++;
      shift_fprintf (level, fo, "(signed)%c += (signed)reg[(insn >> %i) & 0x%x];\n",
      shift_fprintf (level, fo, "(signed)%c += (signed)cpu_state.reg[(insn >> %i) & 0x%x];\n",
                     'a' + num_ops, opd->type & OPTYPE_SHR,
                     'a' + num_ops, opd->type & OPTYPE_SHR,
                     (1 << opd->data) - 1);
                     (1 << opd->data) - 1);
      dis = 1;
      dis = 1;
      dis_op = num_ops;
      dis_op = num_ops;
    }
    }
Line 206... Line 206...
        shift_fprintf (level, fo, "if(%c & 0x%08x) %c |= 0x%x;\n",
        shift_fprintf (level, fo, "if(%c & 0x%08x) %c |= 0x%x;\n",
                       'a' + num_ops, 1 << sbit, 'a' + num_ops,
                       'a' + num_ops, 1 << sbit, 'a' + num_ops,
                       0xffffffff << sbit);
                       0xffffffff << sbit);
      if ((opd->type & OPTYPE_REG) && !dis) {
      if ((opd->type & OPTYPE_REG) && !dis) {
        if(!i) {
        if(!i) {
          shift_fprintf (level, fo, "#define SET_PARAM0(val) reg[a] = val\n");
          shift_fprintf (level, fo, "#define SET_PARAM0(val) cpu_state.reg[a] = val\n");
          set_param = 1;
          set_param = 1;
        }
        }
        shift_fprintf (level, fo, "#define PARAM%i reg[%c]\n", num_ops,
        shift_fprintf (level, fo, "#define PARAM%i cpu_state.reg[%c]\n", num_ops,
                      'a' + num_ops);
                      'a' + num_ops);
        if(opd->type & OPTYPE_DST)
        if(opd->type & OPTYPE_DST)
          write_to_reg = 1;
          write_to_reg = 1;
      } else {
      } else {
        shift_fprintf (level, fo, "#define PARAM%i %c\n", num_ops,
        shift_fprintf (level, fo, "#define PARAM%i %c\n", num_ops,
Line 258... Line 258...
  fprintf (fo, "\n");
  fprintf (fo, "\n");
 
 
  shift_fprintf (level++, fo, "if (do_stats) {\n");
  shift_fprintf (level++, fo, "if (do_stats) {\n");
 
 
  if (dis_op >= 0)
  if (dis_op >= 0)
    shift_fprintf (level, fo, "insn_ea = %c;\n", 'a' + dis_op);
    shift_fprintf (level, fo, "cpu_state.insn_ea = %c;\n", 'a' + dis_op);
 
 
  shift_fprintf (level, fo, "current->insn_index = %i;   /* \"%s\" */\n", index,
  shift_fprintf (level, fo, "current->insn_index = %i;   /* \"%s\" */\n", index,
                 insn_name (index));
                 insn_name (index));
 
 
  shift_fprintf (level, fo, "analysis(current);\n");
  shift_fprintf (level, fo, "analysis(current);\n");
  shift_fprintf (--level, fo, "}\n");
  shift_fprintf (--level, fo, "}\n");
 
 
  if (write_to_reg)
  if (write_to_reg)
    shift_fprintf (level, fo, "reg[0] = 0; /* Repair in case we changed it */\n");
    shift_fprintf (level, fo, "cpu_state.reg[0] = 0; /* Repair in case we changed it */\n");
  shift_fprintf (--level, fo, "}\n");
  shift_fprintf (--level, fo, "}\n");
  return 0;
  return 0;
}
}
 
 
/* Generates .c file header */
/* Generates .c file header */

powered by: WebSVN 2.1.0

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