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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [cpu/] [or32/] [insnset.c] - Diff between revs 712 and 713

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

Rev 712 Rev 713
Line 20... Line 20...
 
 
INSTRUCTION (l_add) {
INSTRUCTION (l_add) {
  signed long temp1;
  signed long temp1;
  signed char temp4;
  signed char temp4;
 
 
  IFF (config.cpu.dependstats) cur->func_unit = it_arith;
  IFF (config.cpu.dependstats) current->func_unit = it_arith;
  temp1 = (signed long)eval_operand32(2, &breakpoint)+(signed long)eval_operand32(1, &breakpoint);
  temp1 = (signed long)eval_operand32(2, &breakpoint)+(signed long)eval_operand32(1, &breakpoint);
  set_operand32(0, temp1, &breakpoint);
  set_operand32(0, temp1, &breakpoint);
  set_ov_flag (temp1);
  set_ov_flag (temp1);
  if (ARITH_SET_FLAG) {
  if (ARITH_SET_FLAG) {
    flag = temp1 == 0;
    flag = temp1 == 0;
Line 35... Line 35...
  if (temp4 == temp1)
  if (temp4 == temp1)
    mstats.byteadd++;
    mstats.byteadd++;
}
}
INSTRUCTION (l_sw) {
INSTRUCTION (l_sw) {
  int old_cyc = 0;
  int old_cyc = 0;
  IFF (config.cpu.dependstats) cur->func_unit = it_store;
  IFF (config.cpu.dependstats) current->func_unit = it_store;
  IFF (config.cpu.sbuf_len) old_cyc = mem_cycles;
  IFF (config.cpu.sbuf_len) old_cyc = mem_cycles;
  set_operand32(0, eval_operand32(1, &breakpoint), &breakpoint);
  set_operand32(0, eval_operand32(1, &breakpoint), &breakpoint);
  if (config.cpu.sbuf_len) {
  if (config.cpu.sbuf_len) {
    int t = mem_cycles;
    int t = mem_cycles;
    mem_cycles = old_cyc;
    mem_cycles = old_cyc;
    sbuf_store (t - old_cyc);
    sbuf_store (t - old_cyc);
  }
  }
}
}
INSTRUCTION (l_sb) {
INSTRUCTION (l_sb) {
  int old_cyc = 0;
  int old_cyc = 0;
  IFF (config.cpu.dependstats) cur->func_unit = it_store;
  IFF (config.cpu.dependstats) current->func_unit = it_store;
  IFF (config.cpu.sbuf_len) old_cyc = mem_cycles;
  IFF (config.cpu.sbuf_len) old_cyc = mem_cycles;
  set_operand8(0, eval_operand32(1, &breakpoint), &breakpoint);
  set_operand8(0, eval_operand32(1, &breakpoint), &breakpoint);
  if (config.cpu.sbuf_len) {
  if (config.cpu.sbuf_len) {
    int t = mem_cycles;
    int t = mem_cycles;
    mem_cycles = old_cyc;
    mem_cycles = old_cyc;
    sbuf_store (t- old_cyc);
    sbuf_store (t- old_cyc);
  }
  }
}
}
INSTRUCTION (l_sh) {
INSTRUCTION (l_sh) {
  int old_cyc = 0;
  int old_cyc = 0;
  IFF (config.cpu.dependstats) cur->func_unit = it_store;
  IFF (config.cpu.dependstats) current->func_unit = it_store;
  IFF (config.cpu.sbuf_len) old_cyc = mem_cycles;
  IFF (config.cpu.sbuf_len) old_cyc = mem_cycles;
  set_operand16(0, eval_operand32(1, &breakpoint), &breakpoint);
  set_operand16(0, eval_operand32(1, &breakpoint), &breakpoint);
  if (config.cpu.sbuf_len) {
  if (config.cpu.sbuf_len) {
    int t = mem_cycles;
    int t = mem_cycles;
    mem_cycles = old_cyc;
    mem_cycles = old_cyc;
    sbuf_store (t - old_cyc);
    sbuf_store (t - old_cyc);
  }
  }
}
}
INSTRUCTION (l_lwz) {
INSTRUCTION (l_lwz) {
  unsigned long val;
  unsigned long val;
  IFF (config.cpu.dependstats) cur->func_unit = it_load;
  IFF (config.cpu.dependstats) current->func_unit = it_load;
  if (config.cpu.sbuf_len) sbuf_load ();
  if (config.cpu.sbuf_len) sbuf_load ();
  val = eval_operand32(1, &breakpoint);
  val = eval_operand32(1, &breakpoint);
  /* If eval operand produced exception don't set anything */
  /* If eval operand produced exception don't set anything */
  if (!pending.valid)
  if (!pending.valid)
    set_operand32(0, val, &breakpoint);
    set_operand32(0, val, &breakpoint);
}
}
INSTRUCTION (l_lbs) {
INSTRUCTION (l_lbs) {
  signed char val;
  signed char val;
  IFF (config.cpu.dependstats) cur->func_unit = it_load;
  IFF (config.cpu.dependstats) current->func_unit = it_load;
  if (config.cpu.sbuf_len) sbuf_load ();
  if (config.cpu.sbuf_len) sbuf_load ();
  val = eval_operand8(1, &breakpoint);
  val = eval_operand8(1, &breakpoint);
  /* If eval opreand produced exception don't set anything */
  /* If eval opreand produced exception don't set anything */
  if (!pending.valid)
  if (!pending.valid)
    set_operand32(0, val, &breakpoint);
    set_operand32(0, val, &breakpoint);
}
}
INSTRUCTION (l_lbz) {
INSTRUCTION (l_lbz) {
  unsigned char val;
  unsigned char val;
  IFF (config.cpu.dependstats) cur->func_unit = it_load;
  IFF (config.cpu.dependstats) current->func_unit = it_load;
  if (config.cpu.sbuf_len) sbuf_load ();
  if (config.cpu.sbuf_len) sbuf_load ();
  val = eval_operand8(1, &breakpoint);
  val = eval_operand8(1, &breakpoint);
  /* If eval opreand produced exception don't set anything */
  /* If eval opreand produced exception don't set anything */
  if (!pending.valid)
  if (!pending.valid)
    set_operand32(0, val, &breakpoint);
    set_operand32(0, val, &breakpoint);
}
}
INSTRUCTION (l_lhs) {
INSTRUCTION (l_lhs) {
  signed short val;
  signed short val;
  IFF (config.cpu.dependstats) cur->func_unit = it_load;
  IFF (config.cpu.dependstats) current->func_unit = it_load;
  if (config.cpu.sbuf_len) sbuf_load ();
  if (config.cpu.sbuf_len) sbuf_load ();
  val = eval_operand16(1, &breakpoint);
  val = eval_operand16(1, &breakpoint);
  /* If eval opreand produced exception don't set anything */
  /* If eval opreand produced exception don't set anything */
  if (!pending.valid)
  if (!pending.valid)
    set_operand32(0, val, &breakpoint);
    set_operand32(0, val, &breakpoint);
}
}
INSTRUCTION (l_lhz) {
INSTRUCTION (l_lhz) {
  unsigned short val;
  unsigned short val;
  IFF (config.cpu.dependstats) cur->func_unit = it_load;
  IFF (config.cpu.dependstats) current->func_unit = it_load;
  if (config.cpu.sbuf_len) sbuf_load ();
  if (config.cpu.sbuf_len) sbuf_load ();
  val = eval_operand16(1, &breakpoint);
  val = eval_operand16(1, &breakpoint);
  /* If eval opreand produced exception don't set anything */
  /* If eval opreand produced exception don't set anything */
  if (!pending.valid)
  if (!pending.valid)
    set_operand32(0, val, &breakpoint);
    set_operand32(0, val, &breakpoint);
}
}
INSTRUCTION (l_movhi) {
INSTRUCTION (l_movhi) {
  IFF (config.cpu.dependstats) cur->func_unit = it_movimm;
  IFF (config.cpu.dependstats) current->func_unit = it_movimm;
  set_operand32(0, eval_operand32(1, &breakpoint) << 16, &breakpoint);
  set_operand32(0, eval_operand32(1, &breakpoint) << 16, &breakpoint);
}
}
INSTRUCTION (l_and) {
INSTRUCTION (l_and) {
  unsigned long temp1;
  unsigned long temp1;
  IFF (config.cpu.dependstats) cur->func_unit = it_arith;
  IFF (config.cpu.dependstats) current->func_unit = it_arith;
  set_operand32(0, temp1 = set_ov_flag (eval_operand32(1, &breakpoint) & (unsigned)eval_operand32(2, &breakpoint)), &breakpoint);
  set_operand32(0, temp1 = set_ov_flag (eval_operand32(1, &breakpoint) & (unsigned)eval_operand32(2, &breakpoint)), &breakpoint);
  if (ARITH_SET_FLAG) {
  if (ARITH_SET_FLAG) {
    flag = temp1 == 0;
    flag = temp1 == 0;
    setsprbits(SPR_SR, SPR_SR_F, flag);
    setsprbits(SPR_SR, SPR_SR_F, flag);
  }
  }
}
}
INSTRUCTION (l_or) {
INSTRUCTION (l_or) {
  IFF (config.cpu.dependstats) cur->func_unit = it_arith;
  IFF (config.cpu.dependstats) current->func_unit = it_arith;
  set_operand32(0, set_ov_flag (eval_operand32(1, &breakpoint) | (unsigned)eval_operand32(2, &breakpoint)), &breakpoint);
  set_operand32(0, set_ov_flag (eval_operand32(1, &breakpoint) | (unsigned)eval_operand32(2, &breakpoint)), &breakpoint);
}
}
INSTRUCTION (l_xor) {
INSTRUCTION (l_xor) {
  IFF (config.cpu.dependstats) cur->func_unit = it_arith;
  IFF (config.cpu.dependstats) current->func_unit = it_arith;
  set_operand32(0, set_ov_flag (eval_operand32(1, &breakpoint) ^ (signed)eval_operand32(2, &breakpoint)), &breakpoint);
  set_operand32(0, set_ov_flag (eval_operand32(1, &breakpoint) ^ (signed)eval_operand32(2, &breakpoint)), &breakpoint);
}
}
INSTRUCTION (l_sub) {
INSTRUCTION (l_sub) {
  IFF (config.cpu.dependstats) cur->func_unit = it_arith;
  IFF (config.cpu.dependstats) current->func_unit = it_arith;
  set_operand32(0, set_ov_flag ((signed long)eval_operand32(1, &breakpoint) - (signed long)eval_operand32(2, &breakpoint)), &breakpoint);
  set_operand32(0, set_ov_flag ((signed long)eval_operand32(1, &breakpoint) - (signed long)eval_operand32(2, &breakpoint)), &breakpoint);
}
}
/*int mcount = 0;*/
/*int mcount = 0;*/
INSTRUCTION (l_mul) {
INSTRUCTION (l_mul) {
  signed long temp3, temp2, temp1;
  signed long temp3, temp2, temp1;
 
 
  IFF (config.cpu.dependstats) cur->func_unit = it_arith;
  IFF (config.cpu.dependstats) current->func_unit = it_arith;
  set_operand32(0, set_ov_flag ((signed long)eval_operand32(1, &breakpoint) * (signed long)eval_operand32(2, &breakpoint)), &breakpoint);
  set_operand32(0, set_ov_flag ((signed long)eval_operand32(1, &breakpoint) * (signed long)eval_operand32(2, &breakpoint)), &breakpoint);
  /*if (!(mcount++ & 1023)) {
  /*if (!(mcount++ & 1023)) {
    printf ("[%i]\n",mcount);
    printf ("[%i]\n",mcount);
    }*/
    }*/
}
}
INSTRUCTION (l_div) {
INSTRUCTION (l_div) {
  signed long temp3, temp2, temp1;
  signed long temp3, temp2, temp1;
 
 
  IFF (config.cpu.dependstats) cur->func_unit = it_arith;
  IFF (config.cpu.dependstats) current->func_unit = it_arith;
  temp3 = eval_operand32(2, &breakpoint);
  temp3 = eval_operand32(2, &breakpoint);
  temp2 = eval_operand32(1, &breakpoint);
  temp2 = eval_operand32(1, &breakpoint);
  if (temp3)
  if (temp3)
    temp1 = temp2 / temp3;
    temp1 = temp2 / temp3;
  else {
  else {
Line 163... Line 163...
  set_operand32(0, set_ov_flag (temp1), &breakpoint);
  set_operand32(0, set_ov_flag (temp1), &breakpoint);
}
}
INSTRUCTION (l_divu) {
INSTRUCTION (l_divu) {
  unsigned long temp3, temp2, temp1;
  unsigned long temp3, temp2, temp1;
 
 
  IFF (config.cpu.dependstats) cur->func_unit = it_arith;
  IFF (config.cpu.dependstats) current->func_unit = it_arith;
  temp3 = eval_operand32(2, &breakpoint);
  temp3 = eval_operand32(2, &breakpoint);
  temp2 = eval_operand32(1, &breakpoint);
  temp2 = eval_operand32(1, &breakpoint);
  temp1 = temp2 / temp3;
  temp1 = temp2 / temp3;
  /* cycles += 16; */
  /* cycles += 16; */
  set_operand32(0, set_ov_flag (temp1), &breakpoint);
  set_operand32(0, set_ov_flag (temp1), &breakpoint);
}
}
INSTRUCTION (l_sll) {
INSTRUCTION (l_sll) {
  int sign = 1;
  int sign = 1;
  IFF (config.cpu.dependstats) cur->func_unit = it_shift;
  IFF (config.cpu.dependstats) current->func_unit = it_shift;
  if ((signed)eval_operand32(1, &breakpoint) < 0)
  if ((signed)eval_operand32(1, &breakpoint) < 0)
    sign = -1;
    sign = -1;
  /* cycles += 2; */
  /* cycles += 2; */
  set_operand32(0, set_ov_flag (eval_operand32(1, &breakpoint) << eval_operand32(2, &breakpoint)), &breakpoint);
  set_operand32(0, set_ov_flag (eval_operand32(1, &breakpoint) << eval_operand32(2, &breakpoint)), &breakpoint);
}
}
INSTRUCTION (l_sra) {
INSTRUCTION (l_sra) {
  unsigned long sign = 0;
  unsigned long sign = 0;
  IFF (config.cpu.dependstats) cur->func_unit = it_shift;
  IFF (config.cpu.dependstats) current->func_unit = it_shift;
 
 
  if ((signed)eval_operand32(1, &breakpoint) < 0)
  if ((signed)eval_operand32(1, &breakpoint) < 0)
    sign = -1;
    sign = -1;
  /* cycles += 2; */
  /* cycles += 2; */
  set_operand32(0, set_ov_flag ((signed)eval_operand32(1, &breakpoint) >> eval_operand32(2, &breakpoint)), &breakpoint);
  set_operand32(0, set_ov_flag ((signed)eval_operand32(1, &breakpoint) >> eval_operand32(2, &breakpoint)), &breakpoint);
}
}
INSTRUCTION (l_srl) {
INSTRUCTION (l_srl) {
  IFF (config.cpu.dependstats) cur->func_unit = it_shift;
  IFF (config.cpu.dependstats) current->func_unit = it_shift;
  /* cycles += 2; */
  /* cycles += 2; */
  set_operand32(0, set_ov_flag (eval_operand32(1, &breakpoint) >> eval_operand32(2, &breakpoint)), &breakpoint);
  set_operand32(0, set_ov_flag (eval_operand32(1, &breakpoint) >> eval_operand32(2, &breakpoint)), &breakpoint);
}
}
INSTRUCTION (l_bf) {
INSTRUCTION (l_bf) {
  if (config.bpb.enabled) {
  if (config.bpb.enabled) {
    int fwd = (eval_operand32(0, &breakpoint) >= pc) ? 1 : 0;
    int fwd = (eval_operand32(0, &breakpoint) >= pc) ? 1 : 0;
    IFF (config.cpu.dependstats) cur->func_unit = it_branch;
    IFF (config.cpu.dependstats) current->func_unit = it_branch;
    mstats.bf[flag][fwd]++;
    mstats.bf[flag][fwd]++;
    bpb_update(cur->insn_addr, flag);
    bpb_update(current->insn_addr, flag);
  }
  }
  if (flag) {
  if (flag) {
    pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4;
    pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4;
    btic_update(pcnext);
    btic_update(pcnext);
    next_delay_insn = 1;
    next_delay_insn = 1;
Line 210... Line 210...
  }
  }
}
}
INSTRUCTION (l_bnf) {
INSTRUCTION (l_bnf) {
  if (config.bpb.enabled) {
  if (config.bpb.enabled) {
    int fwd = (eval_operand32(0, &breakpoint) >= pc) ? 1 : 0;
    int fwd = (eval_operand32(0, &breakpoint) >= pc) ? 1 : 0;
    IFF (config.cpu.dependstats) cur->func_unit = it_branch;
    IFF (config.cpu.dependstats) current->func_unit = it_branch;
    mstats.bnf[!flag][fwd]++;
    mstats.bnf[!flag][fwd]++;
    bpb_update(cur->insn_addr, flag == 0);
    bpb_update(current->insn_addr, flag == 0);
  }
  }
  if (flag == 0) {
  if (flag == 0) {
    pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4;
    pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4;
    btic_update(pcnext);
    btic_update(pcnext);
    next_delay_insn = 1;
    next_delay_insn = 1;
Line 224... Line 224...
    btic_update(pc);
    btic_update(pc);
  }
  }
}
}
INSTRUCTION (l_j) {
INSTRUCTION (l_j) {
  pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4;
  pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4;
  IFF (config.cpu.dependstats) cur->func_unit = it_jump;
  IFF (config.cpu.dependstats) current->func_unit = it_jump;
  next_delay_insn = 1;
  next_delay_insn = 1;
}
}
INSTRUCTION (l_jal) {
INSTRUCTION (l_jal) {
  pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4;
  pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4;
 
 
  IFF (config.cpu.dependstats) cur->func_unit = it_jump;
  IFF (config.cpu.dependstats) current->func_unit = it_jump;
  set_reg32(LINK_REGNO, pc + 8);
  set_reg32(LINK_REGNO, pc + 8);
  next_delay_insn = 1;
  next_delay_insn = 1;
  if (config.sim.profile) {
  if (config.sim.profile) {
    struct mem_entry *entry;
    struct mem_entry *entry;
    struct label_entry *tmp;
    struct label_entry *tmp;
Line 243... Line 243...
    else
    else
      fprintf (runtime.sim.fprof, "+%08X %08X %08X @%08X\n", cycles, pc + 8, pcdelay, pcdelay);
      fprintf (runtime.sim.fprof, "+%08X %08X %08X @%08X\n", cycles, pc + 8, pcdelay, pcdelay);
  }
  }
}
}
INSTRUCTION (l_jalr) {
INSTRUCTION (l_jalr) {
  IFF (config.cpu.dependstats) cur->func_unit = it_jump;
  IFF (config.cpu.dependstats) current->func_unit = it_jump;
  pcdelay = eval_operand32(0, &breakpoint);
  pcdelay = eval_operand32(0, &breakpoint);
  set_reg32(LINK_REGNO, pc + 8);
  set_reg32(LINK_REGNO, pc + 8);
  next_delay_insn = 1;
  next_delay_insn = 1;
}
}
INSTRUCTION (l_jr) {
INSTRUCTION (l_jr) {
  IFF (config.cpu.dependstats) cur->func_unit = it_jump;
  IFF (config.cpu.dependstats) current->func_unit = it_jump;
  pcdelay = eval_operand32(0, &breakpoint);
  pcdelay = eval_operand32(0, &breakpoint);
  next_delay_insn = 1;
  next_delay_insn = 1;
  if (config.sim.profile)
  if (config.sim.profile)
    fprintf (runtime.sim.fprof, "-%08X %08X\n", cycles, pcdelay);
    fprintf (runtime.sim.fprof, "-%08X %08X\n", cycles, pcdelay);
}
}
INSTRUCTION (l_rfe) {
INSTRUCTION (l_rfe) {
  IFF (config.cpu.dependstats) cur->func_unit = it_exception;
  IFF (config.cpu.dependstats) current->func_unit = it_exception;
  pcnext = mfspr(SPR_EPCR_BASE);
  pcnext = mfspr(SPR_EPCR_BASE);
  mtspr(SPR_SR, mfspr(SPR_ESR_BASE));
  mtspr(SPR_SR, mfspr(SPR_ESR_BASE));
}
}
INSTRUCTION (l_nop) {
INSTRUCTION (l_nop) {
  unsigned long stackaddr;
  unsigned long stackaddr;
  int k = eval_operand32(0, &breakpoint);
  int k = eval_operand32(0, &breakpoint);
  IFF (config.cpu.dependstats) cur->func_unit = it_nop;
  IFF (config.cpu.dependstats) current->func_unit = it_nop;
  switch (k) {
  switch (k) {
    case NOP_NOP:
    case NOP_NOP:
      break;
      break;
    case NOP_EXIT:
    case NOP_EXIT:
      printf("exit(%d)\n", evalsim_reg32 (3));
      printf("exit(%d)\n", evalsim_reg32 (3));
Line 288... Line 288...
      printf("report %i (0x%x);\n", k - NOP_REPORT_FIRST, evalsim_reg32(3));
      printf("report %i (0x%x);\n", k - NOP_REPORT_FIRST, evalsim_reg32(3));
      break;
      break;
  }
  }
}
}
INSTRUCTION (l_sfeq) {
INSTRUCTION (l_sfeq) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = eval_operand32(0, &breakpoint) == eval_operand32(1, &breakpoint);
  flag = eval_operand32(0, &breakpoint) == eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_sfne) {
INSTRUCTION (l_sfne) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = eval_operand32(0, &breakpoint) != eval_operand32(1, &breakpoint);
  flag = eval_operand32(0, &breakpoint) != eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_sfgts) {
INSTRUCTION (l_sfgts) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = (signed)eval_operand32(0, &breakpoint) > (signed)eval_operand32(1, &breakpoint);
  flag = (signed)eval_operand32(0, &breakpoint) > (signed)eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_sfges) {
INSTRUCTION (l_sfges) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = (signed)eval_operand32(0, &breakpoint) >= (signed)eval_operand32(1, &breakpoint);
  flag = (signed)eval_operand32(0, &breakpoint) >= (signed)eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_sflts) {
INSTRUCTION (l_sflts) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = (signed)eval_operand32(0, &breakpoint) < (signed)eval_operand32(1, &breakpoint);
  flag = (signed)eval_operand32(0, &breakpoint) < (signed)eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_sfles) {
INSTRUCTION (l_sfles) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = (signed)eval_operand32(0, &breakpoint) <= (signed)eval_operand32(1, &breakpoint);
  flag = (signed)eval_operand32(0, &breakpoint) <= (signed)eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_sfgtu) {
INSTRUCTION (l_sfgtu) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = (unsigned)eval_operand32(0, &breakpoint) > (unsigned)eval_operand32(1, &breakpoint);
  flag = (unsigned)eval_operand32(0, &breakpoint) > (unsigned)eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_sfgeu) {
INSTRUCTION (l_sfgeu) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = (unsigned)eval_operand32(0, &breakpoint) >= (unsigned) eval_operand32(1, &breakpoint);
  flag = (unsigned)eval_operand32(0, &breakpoint) >= (unsigned) eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_sfltu) {
INSTRUCTION (l_sfltu) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = (unsigned)eval_operand32(0, &breakpoint) < (unsigned)eval_operand32(1, &breakpoint);
  flag = (unsigned)eval_operand32(0, &breakpoint) < (unsigned)eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_sfleu) {
INSTRUCTION (l_sfleu) {
  IFF (config.cpu.dependstats) cur->func_unit = it_compare;
  IFF (config.cpu.dependstats) current->func_unit = it_compare;
  flag = (unsigned)eval_operand32(0, &breakpoint) <= (unsigned)eval_operand32(1, &breakpoint);
  flag = (unsigned)eval_operand32(0, &breakpoint) <= (unsigned)eval_operand32(1, &breakpoint);
  setsprbits(SPR_SR, SPR_SR_F, flag);
  setsprbits(SPR_SR, SPR_SR_F, flag);
}
}
INSTRUCTION (l_extbs) {
INSTRUCTION (l_extbs) {
  unsigned char x;
  unsigned char x;
  IFF (config.cpu.dependstats) cur->func_unit = it_move;
  IFF (config.cpu.dependstats) current->func_unit = it_move;
  x = eval_operand32(1, &breakpoint);
  x = eval_operand32(1, &breakpoint);
  set_operand32(0, (signed long)x, &breakpoint);
  set_operand32(0, (signed long)x, &breakpoint);
}
}
INSTRUCTION (l_extbz) {
INSTRUCTION (l_extbz) {
  unsigned char x;
  unsigned char x;
  IFF (config.cpu.dependstats) cur->func_unit = it_move;
  IFF (config.cpu.dependstats) current->func_unit = it_move;
  x = eval_operand32(1, &breakpoint);
  x = eval_operand32(1, &breakpoint);
  set_operand32(0, (unsigned long)x, &breakpoint);
  set_operand32(0, (unsigned long)x, &breakpoint);
}
}
INSTRUCTION (l_exths) {
INSTRUCTION (l_exths) {
  unsigned short x;
  unsigned short x;
  IFF (config.cpu.dependstats) cur->func_unit = it_move;
  IFF (config.cpu.dependstats) current->func_unit = it_move;
  x = eval_operand32(1, &breakpoint);
  x = eval_operand32(1, &breakpoint);
  set_operand32(0, (signed long)x, &breakpoint);
  set_operand32(0, (signed long)x, &breakpoint);
}
}
INSTRUCTION (l_exthz) {
INSTRUCTION (l_exthz) {
  unsigned short x;
  unsigned short x;
  IFF (config.cpu.dependstats) cur->func_unit = it_move;
  IFF (config.cpu.dependstats) current->func_unit = it_move;
  x = eval_operand32(1, &breakpoint);
  x = eval_operand32(1, &breakpoint);
  set_operand32(0, (unsigned long)x, &breakpoint);
  set_operand32(0, (unsigned long)x, &breakpoint);
}
}
INSTRUCTION (l_extws) {
INSTRUCTION (l_extws) {
  unsigned int x;
  unsigned int x;
  IFF (config.cpu.dependstats) cur->func_unit = it_move;
  IFF (config.cpu.dependstats) current->func_unit = it_move;
  x = eval_operand32(1, &breakpoint);
  x = eval_operand32(1, &breakpoint);
  set_operand32(0, (signed long)x, &breakpoint);
  set_operand32(0, (signed long)x, &breakpoint);
}
}
INSTRUCTION (l_extwz) {
INSTRUCTION (l_extwz) {
  unsigned int x;
  unsigned int x;
  IFF (config.cpu.dependstats) cur->func_unit = it_move;
  IFF (config.cpu.dependstats) current->func_unit = it_move;
  x = eval_operand32(1, &breakpoint);
  x = eval_operand32(1, &breakpoint);
  set_operand32(0, (unsigned long)x, &breakpoint);
  set_operand32(0, (unsigned long)x, &breakpoint);
}
}
INSTRUCTION (l_mtspr) {
INSTRUCTION (l_mtspr) {
  unsigned long regno = eval_operand32(0, &breakpoint) + eval_operand32(2, &breakpoint);
  unsigned long regno = eval_operand32(0, &breakpoint) + eval_operand32(2, &breakpoint);
Line 381... Line 381...
 
 
  if (runtime.sim.fspr_log) {
  if (runtime.sim.fspr_log) {
    fprintf(runtime.sim.fspr_log, "Write to SPR  : [%08lX] <- [%08lX]\n", regno, value);
    fprintf(runtime.sim.fspr_log, "Write to SPR  : [%08lX] <- [%08lX]\n", regno, value);
  }
  }
 
 
  IFF (config.cpu.dependstats) cur->func_unit = it_move;
  IFF (config.cpu.dependstats) current->func_unit = it_move;
  if (mfspr(SPR_SR) & SPR_SR_SM)
  if (mfspr(SPR_SR) & SPR_SR_SM)
    mtspr(regno, value);
    mtspr(regno, value);
  else {
  else {
    printf("WARNING: trying to write SPR while SR[SUPV] is cleared.\n");
    printf("WARNING: trying to write SPR while SR[SUPV] is cleared.\n");
    cont_run = 0;
    cont_run = 0;
Line 397... Line 397...
 
 
  if (runtime.sim.fspr_log) {
  if (runtime.sim.fspr_log) {
    fprintf(runtime.sim.fspr_log, "Read from SPR : [%08lX] -> [%08lX]\n", regno, value);
    fprintf(runtime.sim.fspr_log, "Read from SPR : [%08lX] -> [%08lX]\n", regno, value);
  }
  }
 
 
  IFF (config.cpu.dependstats) cur->func_unit = it_move;
  IFF (config.cpu.dependstats) current->func_unit = it_move;
  if (mfspr(SPR_SR) & SPR_SR_SM)
  if (mfspr(SPR_SR) & SPR_SR_SM)
    set_operand32(0, value, &breakpoint);
    set_operand32(0, value, &breakpoint);
  else {
  else {
    set_operand32(0, 0, &breakpoint);
    set_operand32(0, 0, &breakpoint);
    printf("WARNING: trying to read SPR while SR[SUPV] is cleared.\n");
    printf("WARNING: trying to read SPR while SR[SUPV] is cleared.\n");
Line 417... Line 417...
}
}
INSTRUCTION (l_mac) {
INSTRUCTION (l_mac) {
  sprword lo, hi;
  sprword lo, hi;
  LONGEST l;
  LONGEST l;
  long x, y;
  long x, y;
  IFF (config.cpu.dependstats) cur->func_unit = it_mac;
  IFF (config.cpu.dependstats) current->func_unit = it_mac;
  lo = mfspr (SPR_MACLO);
  lo = mfspr (SPR_MACLO);
  hi = mfspr (SPR_MACHI);
  hi = mfspr (SPR_MACHI);
  x = eval_operand32(0, &breakpoint);
  x = eval_operand32(0, &breakpoint);
  y = eval_operand32(1, &breakpoint);
  y = eval_operand32(1, &breakpoint);
  printf ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y));
  printf ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y));
Line 437... Line 437...
}
}
INSTRUCTION (l_msb) {
INSTRUCTION (l_msb) {
  sprword lo, hi;
  sprword lo, hi;
  LONGEST l;
  LONGEST l;
  long x, y;
  long x, y;
  IFF (config.cpu.dependstats) cur->func_unit = it_mac;
  IFF (config.cpu.dependstats) current->func_unit = it_mac;
  lo = mfspr (SPR_MACLO);
  lo = mfspr (SPR_MACLO);
  hi = mfspr (SPR_MACHI);
  hi = mfspr (SPR_MACHI);
  x = eval_operand32(0, &breakpoint);
  x = eval_operand32(0, &breakpoint);
  y = eval_operand32(1, &breakpoint);
  y = eval_operand32(1, &breakpoint);
  printf ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y));
  printf ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y));
Line 456... Line 456...
  printf ("(%08x,%08x)\n", hi, lo);
  printf ("(%08x,%08x)\n", hi, lo);
}
}
INSTRUCTION (l_macrc) {
INSTRUCTION (l_macrc) {
  sprword lo, hi;
  sprword lo, hi;
  LONGEST l;
  LONGEST l;
  IFF (config.cpu.dependstats) cur->func_unit = it_mac;
  IFF (config.cpu.dependstats) current->func_unit = it_mac;
  /* No need for synchronization here -- all MAC instructions are 1 cycle long.  */
  /* No need for synchronization here -- all MAC instructions are 1 cycle long.  */
  lo =  mfspr (SPR_MACLO);
  lo =  mfspr (SPR_MACLO);
  hi =  mfspr (SPR_MACHI);
  hi =  mfspr (SPR_MACHI);
  l = (ULONGEST) lo | ((LONGEST)hi << 32);
  l = (ULONGEST) lo | ((LONGEST)hi << 32);
  l >>= 28;
  l >>= 28;
Line 468... Line 468...
  set_operand32(0, (long)l, &breakpoint);
  set_operand32(0, (long)l, &breakpoint);
  mtspr (SPR_MACLO, 0);
  mtspr (SPR_MACLO, 0);
  mtspr (SPR_MACHI, 0);
  mtspr (SPR_MACHI, 0);
}
}
INSTRUCTION (l_cmov) {
INSTRUCTION (l_cmov) {
  IFF (config.cpu.dependstats) cur->func_unit = it_move;
  IFF (config.cpu.dependstats) current->func_unit = it_move;
  set_operand32(0, flag ? eval_operand32(1, &breakpoint) : eval_operand32(2, &breakpoint), &breakpoint);
  set_operand32(0, flag ? eval_operand32(1, &breakpoint) : eval_operand32(2, &breakpoint), &breakpoint);
}
}
INSTRUCTION (l_cust1) {
INSTRUCTION (l_cust1) {
  /*int destr = cur->insn >> 21;
  /*int destr = current->insn >> 21;
    int src1r = cur->insn >> 15;
    int src1r = current->insn >> 15;
    int src2r = cur->insn >> 9;*/
    int src2r = current->insn >> 9;*/
}
}
INSTRUCTION (l_cust2) {
INSTRUCTION (l_cust2) {
}
}
INSTRUCTION (l_cust3) {
INSTRUCTION (l_cust3) {
}
}

powered by: WebSVN 2.1.0

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