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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc2/] [or1ksim/] [cpu/] [or32/] [insnset.c] - Diff between revs 1744 and 1748

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

Rev 1744 Rev 1748
Line 19... Line 19...
   more details.
   more details.
 
 
   You should have received a copy of the GNU General Public License along
   You should have received a copy of the GNU General Public License along
   with this program.  If not, see <http://www.gnu.org/licenses/>. */
   with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 
 
/* This program is commented throughout in a fashion suitable for processing
 
   with Doxygen. */
 
 
 
 
INSTRUCTION (l_add) {
INSTRUCTION (l_add) {
  orreg_t temp1, temp2, temp3;
  orreg_t temp1, temp2, temp3;
  int8_t temp4;
  int8_t temp4;
 
 
  temp2 = (orreg_t)PARAM2;
  temp2 = (orreg_t)PARAM2;
  temp3 = (orreg_t)PARAM1;
  temp3 = (orreg_t)PARAM1;
  temp1 = temp2 + temp3;
  temp1 = temp2 + temp3;
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  if (ARITH_SET_FLAG) {
  if (ARITH_SET_FLAG) {
    if(!temp1)
    if(!temp1)
      cpu_state.sprs[SPR_SR] |= SPR_SR_F;
      cpu_state.sprs[SPR_SR] |= SPR_SR_F;
    else
    else
      cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
      cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
Line 54... Line 57...
  temp3 = (orreg_t)PARAM1;
  temp3 = (orreg_t)PARAM1;
  temp1 = temp2 + temp3;
  temp1 = temp2 + temp3;
  if(cpu_state.sprs[SPR_SR] & SPR_SR_CY)
  if(cpu_state.sprs[SPR_SR] & SPR_SR_CY)
    temp1++;
    temp1++;
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  if (ARITH_SET_FLAG) {
  if (ARITH_SET_FLAG) {
    if(!temp1)
    if(!temp1)
      cpu_state.sprs[SPR_SR] |= SPR_SR_F;
      cpu_state.sprs[SPR_SR] |= SPR_SR_F;
    else
    else
      cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
      cpu_state.sprs[SPR_SR] &= ~SPR_SR_F;
Line 151... Line 154...
  SET_PARAM0(PARAM1 << 16);
  SET_PARAM0(PARAM1 << 16);
}
}
INSTRUCTION (l_and) {
INSTRUCTION (l_and) {
  uorreg_t temp1;
  uorreg_t temp1;
  temp1 = PARAM1 & PARAM2;
  temp1 = PARAM1 & PARAM2;
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
  if (ARITH_SET_FLAG) {
  if (ARITH_SET_FLAG) {
    if(!temp1)
    if(!temp1)
      cpu_state.sprs[SPR_SR] |= SPR_SR_F;
      cpu_state.sprs[SPR_SR] |= SPR_SR_F;
    else
    else
Line 163... Line 166...
  }
  }
}
}
INSTRUCTION (l_or) {
INSTRUCTION (l_or) {
  uorreg_t temp1;
  uorreg_t temp1;
  temp1 = PARAM1 | PARAM2;
  temp1 = PARAM1 | PARAM2;
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
}
}
INSTRUCTION (l_xor) {
INSTRUCTION (l_xor) {
  uorreg_t temp1;
  uorreg_t temp1;
  temp1 = PARAM1 ^ PARAM2;
  temp1 = PARAM1 ^ PARAM2;
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
}
}
INSTRUCTION (l_sub) {
INSTRUCTION (l_sub) {
  orreg_t temp1;
  orreg_t temp1;
  temp1 = (orreg_t)PARAM1 - (orreg_t)PARAM2;
  temp1 = (orreg_t)PARAM1 - (orreg_t)PARAM2;
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
}
}
/*int mcount = 0;*/
/*int mcount = 0;*/
INSTRUCTION (l_mul) {
INSTRUCTION (l_mul) {
  orreg_t temp1;
  orreg_t temp1;
 
 
  temp1 = (orreg_t)PARAM1 * (orreg_t)PARAM2;
  temp1 = (orreg_t)PARAM1 * (orreg_t)PARAM2;
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
  /*if (!(mcount++ & 1023)) {
  /*if (!(mcount++ & 1023)) {
    PRINTF ("[%i]\n",mcount);
    PRINTF ("[%i]\n",mcount);
    }*/
    }*/
}
}
Line 200... Line 203...
    temp1 = temp2 / temp3;
    temp1 = temp2 / temp3;
  else {
  else {
    except_handle(EXCEPT_ILLEGAL, cpu_state.pc);
    except_handle(EXCEPT_ILLEGAL, cpu_state.pc);
    return;
    return;
  }
  }
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
}
}
INSTRUCTION (l_divu) {
INSTRUCTION (l_divu) {
  uorreg_t temp3, temp2, temp1;
  uorreg_t temp3, temp2, temp1;
 
 
Line 214... Line 217...
    temp1 = temp2 / temp3;
    temp1 = temp2 / temp3;
  else {
  else {
    except_handle(EXCEPT_ILLEGAL, cpu_state.pc);
    except_handle(EXCEPT_ILLEGAL, cpu_state.pc);
    return;
    return;
  }
  }
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
  /* runtime.sim.cycles += 16; */
  /* runtime.sim.cycles += 16; */
}
}
INSTRUCTION (l_sll) {
INSTRUCTION (l_sll) {
  uorreg_t temp1;
  uorreg_t temp1;
 
 
  temp1 = PARAM1 << PARAM2;
  temp1 = PARAM1 << PARAM2;
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
  /* runtime.sim.cycles += 2; */
  /* runtime.sim.cycles += 2; */
}
}
INSTRUCTION (l_sra) {
INSTRUCTION (l_sra) {
  orreg_t temp1;
  orreg_t temp1;
 
 
  temp1 = (orreg_t)PARAM1 >> PARAM2;
  temp1 = (orreg_t)PARAM1 >> PARAM2;
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
  /* runtime.sim.cycles += 2; */
  /* runtime.sim.cycles += 2; */
}
}
INSTRUCTION (l_srl) {
INSTRUCTION (l_srl) {
  uorreg_t temp1;
  uorreg_t temp1;
  temp1 = PARAM1 >> PARAM2;
  temp1 = PARAM1 >> PARAM2;
  set_ov_flag (temp1);
  SET_OV_FLAG_FN (temp1);
  SET_PARAM0(temp1);
  SET_PARAM0(temp1);
  /* runtime.sim.cycles += 2; */
  /* runtime.sim.cycles += 2; */
}
}
INSTRUCTION (l_bf) {
INSTRUCTION (l_bf) {
  if (config.bpb.enabled) {
  if (config.bpb.enabled) {
Line 276... Line 279...
  next_delay_insn = 1;
  next_delay_insn = 1;
}
}
INSTRUCTION (l_jal) {
INSTRUCTION (l_jal) {
  cpu_state.pc_delay = cpu_state.pc + (orreg_t)PARAM0 * 4;
  cpu_state.pc_delay = cpu_state.pc + (orreg_t)PARAM0 * 4;
 
 
  set_reg(LINK_REGNO, cpu_state.pc + 8);
  setsim_reg(LINK_REGNO, cpu_state.pc + 8);
  next_delay_insn = 1;
  next_delay_insn = 1;
  if (config.sim.profile) {
  if (config.sim.profile) {
    struct label_entry *tmp;
    struct label_entry *tmp;
    if (verify_memoryarea(cpu_state.pc_delay) && (tmp = get_label (cpu_state.pc_delay)))
    if (verify_memoryarea(cpu_state.pc_delay) && (tmp = get_label (cpu_state.pc_delay)))
      fprintf (runtime.sim.fprof, "+%08llX %"PRIxADDR" %"PRIxADDR" %s\n",
      fprintf (runtime.sim.fprof, "+%08llX %"PRIxADDR" %"PRIxADDR" %s\n",
Line 292... Line 295...
               cpu_state.pc_delay);
               cpu_state.pc_delay);
  }
  }
}
}
INSTRUCTION (l_jalr) {
INSTRUCTION (l_jalr) {
  cpu_state.pc_delay = PARAM0;
  cpu_state.pc_delay = PARAM0;
  set_reg(LINK_REGNO, cpu_state.pc + 8);
  setsim_reg(LINK_REGNO, cpu_state.pc + 8);
  next_delay_insn = 1;
  next_delay_insn = 1;
}
}
INSTRUCTION (l_jr) {
INSTRUCTION (l_jr) {
  cpu_state.pc_delay = PARAM0;
  cpu_state.pc_delay = PARAM0;
  next_delay_insn = 1;
  next_delay_insn = 1;

powered by: WebSVN 2.1.0

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