URL
https://opencores.org/ocsvn/or1k_old/or1k_old/trunk
Subversion Repositories or1k_old
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 557 to Rev 558
- ↔ Reverse comparison
Rev 557 → Rev 558
/trunk/or1ksim/cpu/or32/execute.c
52,9 → 52,6
int supercycles; |
int issued_per_cycle = 4; |
int hazardwait = 0; |
int nops = 0; |
int nop_period = 0; |
int nop_maxperiod = 0; |
|
/* Whether break was hit - so we can step over a break */ |
static int break_just_hit = 0; |
421,7 → 418,6
pcprev = pc; /* Store value for later */ |
pc = pcnext; |
pcnext = delay_insn ? pcdelay : pcnext + 4; |
nop_period++; |
} |
|
static inline void analysis() |
510,8 → 506,8
if(config.debug.enabled && CheckDebugUnit(DebugInstructionFetch, pc_phy)) |
breakpoint++; |
|
cur = current; |
cur->func_unit = it_unknown; |
cur = current; |
IFF (config.cpu.dependstats) IFF (config.cpu.dependstats) cur->func_unit = it_unknown; |
op = &cur->op[0]; |
|
/* printf("0x%04x: Executing \"%s\"\n",pc,cur->insn); */ |
640,7 → 636,7
signed long temp1; |
signed char temp4; |
|
cur->func_unit = it_arith; |
IFF (config.cpu.dependstats) cur->func_unit = it_arith; |
temp1 = (signed long)eval_operand32(2, &breakpoint)+(signed long)eval_operand32(1, &breakpoint); |
set_operand32(0, temp1, &breakpoint); |
|
649,80 → 645,75
mstats.byteadd++; |
} |
void l_sw() { |
cur->func_unit = it_store; |
IFF (config.cpu.dependstats) cur->func_unit = it_store; |
set_operand32(0, eval_operand32(1, &breakpoint), &breakpoint); |
} |
void l_sb() { |
cur->func_unit = it_store; |
IFF (config.cpu.dependstats) cur->func_unit = it_store; |
set_operand8(0, eval_operand32(1, &breakpoint), &breakpoint); |
} |
void l_sh() { |
cur->func_unit = it_store; |
IFF (config.cpu.dependstats) cur->func_unit = it_store; |
set_operand16(0, eval_operand32(1, &breakpoint), &breakpoint); |
} |
void l_lwz() { |
unsigned long val; |
cur->func_unit = it_load; |
IFF (config.cpu.dependstats) cur->func_unit = it_load; |
val = eval_operand32(1, &breakpoint); |
/* If eval opreand produced exception don't set anything */ |
if (pending.valid == 1) |
return; |
set_operand32(0, val, &breakpoint); |
if (!pending.valid) |
set_operand32(0, val, &breakpoint); |
} |
void l_lbs() { |
signed char val; |
cur->func_unit = it_load; |
IFF (config.cpu.dependstats) cur->func_unit = it_load; |
val = eval_operand8(1, &breakpoint); |
/* If eval opreand produced exception don't set anything */ |
if (pending.valid == 1) |
return; |
set_operand32(0, val, &breakpoint); |
if (!pending.valid) |
set_operand32(0, val, &breakpoint); |
} |
void l_lbz() { |
unsigned char val; |
cur->func_unit = it_load; |
IFF (config.cpu.dependstats) cur->func_unit = it_load; |
val = eval_operand8(1, &breakpoint); |
/* If eval opreand produced exception don't set anything */ |
if (pending.valid == 1) |
return; |
set_operand32(0, val, &breakpoint); |
if (!pending.valid) |
set_operand32(0, val, &breakpoint); |
} |
void l_lhs() { |
signed short val; |
cur->func_unit = it_load; |
IFF (config.cpu.dependstats) cur->func_unit = it_load; |
val = eval_operand16(1, &breakpoint); |
/* If eval opreand produced exception don't set anything */ |
if (pending.valid == 1) |
return; |
set_operand32(0, val, &breakpoint); |
if (!pending.valid) |
set_operand32(0, val, &breakpoint); |
} |
void l_lhz() { |
unsigned short val; |
cur->func_unit = it_load; |
IFF (config.cpu.dependstats) cur->func_unit = it_load; |
val = eval_operand16(1, &breakpoint); |
/* If eval opreand produced exception don't set anything */ |
if (pending.valid == 1) |
return; |
set_operand32(0, val, &breakpoint); |
if (!pending.valid) |
set_operand32(0, val, &breakpoint); |
} |
void l_movhi() { |
cur->func_unit = it_movimm; |
IFF (config.cpu.dependstats) cur->func_unit = it_movimm; |
set_operand32(0, eval_operand32(1, &breakpoint) << 16, &breakpoint); |
} |
void l_and() { |
cur->func_unit = it_arith; |
IFF (config.cpu.dependstats) cur->func_unit = it_arith; |
set_operand32(0, eval_operand32(1, &breakpoint) & (unsigned)eval_operand32(2, &breakpoint), &breakpoint); |
} |
void l_or() { |
cur->func_unit = it_arith; |
IFF (config.cpu.dependstats) cur->func_unit = it_arith; |
set_operand32(0, eval_operand32(1, &breakpoint) | (unsigned)eval_operand32(2, &breakpoint), &breakpoint); |
} |
void l_xor() { |
cur->func_unit = it_arith; |
IFF (config.cpu.dependstats) cur->func_unit = it_arith; |
set_operand32(0, eval_operand32(1, &breakpoint) ^ (signed)eval_operand32(2, &breakpoint), &breakpoint); |
} |
void l_sub() { |
cur->func_unit = it_arith; |
IFF (config.cpu.dependstats) cur->func_unit = it_arith; |
set_operand32(0, (signed long)eval_operand32(1, &breakpoint) - (signed long)eval_operand32(2, &breakpoint), &breakpoint); |
} |
/*int mcount = 0;*/ |
729,7 → 720,7
void l_mul() { |
signed long temp3, temp2, temp1; |
|
cur->func_unit = it_arith; |
IFF (config.cpu.dependstats) cur->func_unit = it_arith; |
set_operand32(0, (signed long)eval_operand32(1, &breakpoint) * (signed long)eval_operand32(2, &breakpoint), &breakpoint); |
/*if (!(mcount++ & 1023)) { |
printf ("[%i]\n",mcount); |
738,7 → 729,7
void l_div() { |
signed long temp3, temp2, temp1; |
|
cur->func_unit = it_arith; |
IFF (config.cpu.dependstats) cur->func_unit = it_arith; |
temp3 = eval_operand32(2, &breakpoint); |
temp2 = eval_operand32(1, &breakpoint); |
if (temp3) |
752,7 → 743,7
void l_divu() { |
unsigned long temp3, temp2, temp1; |
|
cur->func_unit = it_arith; |
IFF (config.cpu.dependstats) cur->func_unit = it_arith; |
temp3 = eval_operand32(2, &breakpoint); |
temp2 = eval_operand32(1, &breakpoint); |
temp1 = temp2 / temp3; |
761,7 → 752,7
} |
void l_sll() { |
int sign = 1; |
cur->func_unit = it_shift; |
IFF (config.cpu.dependstats) cur->func_unit = it_shift; |
if ((signed)eval_operand32(1, &breakpoint) < 0) |
sign = -1; |
/* cycles += 2; */ |
769,7 → 760,7
} |
void l_sra() { |
unsigned long sign = 0; |
cur->func_unit = it_shift; |
IFF (config.cpu.dependstats) cur->func_unit = it_shift; |
|
if ((signed)eval_operand32(1, &breakpoint) < 0) |
sign = -1; |
777,7 → 768,7
set_operand32(0, (signed)eval_operand32(1, &breakpoint) >> eval_operand32(2, &breakpoint), &breakpoint); |
} |
void l_srl() { |
cur->func_unit = it_shift; |
IFF (config.cpu.dependstats) cur->func_unit = it_shift; |
/* cycles += 2; */ |
set_operand32(0, eval_operand32(1, &breakpoint) >> eval_operand32(2, &breakpoint), &breakpoint); |
} |
784,7 → 775,7
void l_bf() { |
if (config.bpb.enabled) { |
int fwd = (eval_operand32(0, &breakpoint) >= pc) ? 1 : 0; |
cur->func_unit = it_branch; |
IFF (config.cpu.dependstats) cur->func_unit = it_branch; |
mstats.bf[flag][fwd]++; |
bpb_update(cur->insn_addr, flag); |
} |
800,7 → 791,7
void l_bnf() { |
if (config.bpb.enabled) { |
int fwd = (eval_operand32(0, &breakpoint) >= pc) ? 1 : 0; |
cur->func_unit = it_branch; |
IFF (config.cpu.dependstats) cur->func_unit = it_branch; |
mstats.bnf[!flag][fwd]++; |
bpb_update(cur->insn_addr, flag == 0); |
} |
816,7 → 807,7
void l_j() { |
debug(5, "\nl.j relative: pc=%x pcnext=%x\n", pc, pcnext); |
pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4; |
cur->func_unit = it_jump; |
IFF (config.cpu.dependstats) cur->func_unit = it_jump; |
next_delay_insn = 1; |
} |
void l_jal() { |
823,7 → 814,7
debug(5, "\nl.jal relative: pc=%x pcnext=%x\n", pc, pcnext); |
pcdelay = pc + (signed)eval_operand32(0, &breakpoint) * 4; |
|
cur->func_unit = it_jump; |
IFF (config.cpu.dependstats) cur->func_unit = it_jump; |
set_reg32(LINK_REGNO, pc + 8); |
next_delay_insn = 1; |
if (config.sim.profile) { |
836,13 → 827,13
} |
} |
void l_jalr() { |
cur->func_unit = it_jump; |
IFF (config.cpu.dependstats) cur->func_unit = it_jump; |
pcdelay = eval_operand32(0, &breakpoint); |
set_reg32(LINK_REGNO, pc + 8); |
next_delay_insn = 1; |
} |
void l_jr() { |
cur->func_unit = it_jump; |
IFF (config.cpu.dependstats) cur->func_unit = it_jump; |
pcdelay = eval_operand32(0, &breakpoint); |
next_delay_insn = 1; |
if (config.sim.profile) |
849,7 → 840,7
fprintf (runtime.sim.fprof, "-%08X %08X\n", cycles, pcdelay); |
} |
void l_rfe() { |
cur->func_unit = it_exception; |
IFF (config.cpu.dependstats) cur->func_unit = it_exception; |
pcnext = mfspr(SPR_EPCR_BASE); |
mtspr(SPR_SR, mfspr(SPR_ESR_BASE)); |
} |
856,11 → 847,7
void l_nop() { |
unsigned long stackaddr; |
int k = eval_operand32(0, &breakpoint); |
cur->func_unit = it_nop; |
if (nop_period > nop_maxperiod) |
nop_maxperiod = nop_period; |
nop_period = 0; |
nops++; |
IFF (config.cpu.dependstats) cur->func_unit = it_nop; |
switch (k) { |
case NOP_NOP: |
break; |
885,57 → 872,57
} |
} |
void l_sfeq() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = eval_operand32(0, &breakpoint) == eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_sfne() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = eval_operand32(0, &breakpoint) != eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_sfgts() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = (signed)eval_operand32(0, &breakpoint) > (signed)eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_sfges() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = (signed)eval_operand32(0, &breakpoint) >= (signed)eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_sflts() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = (signed)eval_operand32(0, &breakpoint) < (signed)eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_sfles() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = (signed)eval_operand32(0, &breakpoint) <= (signed)eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_sfgtu() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = (unsigned)eval_operand32(0, &breakpoint) > (unsigned)eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_sfgeu() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = (unsigned)eval_operand32(0, &breakpoint) >= (unsigned) eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_sfltu() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = (unsigned)eval_operand32(0, &breakpoint) < (unsigned)eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_sfleu() { |
cur->func_unit = it_compare; |
IFF (config.cpu.dependstats) cur->func_unit = it_compare; |
flag = (unsigned)eval_operand32(0, &breakpoint) <= (unsigned)eval_operand32(1, &breakpoint); |
setsprbits(SPR_SR, SPR_SR_F, flag); |
} |
void l_mtspr() { |
cur->func_unit = it_move; |
IFF (config.cpu.dependstats) cur->func_unit = it_move; |
if (mfspr(SPR_SR) & SPR_SR_SUPV) |
mtspr(eval_operand32(0, &breakpoint) + eval_operand32(2, &breakpoint), eval_operand32(1, &breakpoint)); |
else { |
944,7 → 931,7
} |
} |
void l_mfspr() { |
cur->func_unit = it_move; |
IFF (config.cpu.dependstats) cur->func_unit = it_move; |
if (mfspr(SPR_SR) & SPR_SR_SUPV) |
set_operand32(0, mfspr(eval_operand32(1, &breakpoint) + eval_operand32(2, &breakpoint)), &breakpoint); |
else { |
966,7 → 953,7
sprword lo, hi; |
LONGEST l; |
LONGEST x, y; |
cur->func_unit = it_mac; |
IFF (config.cpu.dependstats) cur->func_unit = it_mac; |
lo = mfspr (SPR_MACLO); |
hi = mfspr (SPR_MACHI); |
x = eval_operand32(0, &breakpoint); |
985,7 → 972,7
void l_msb() { |
sprword lo, hi; |
LONGEST l; |
cur->func_unit = it_mac; |
IFF (config.cpu.dependstats) cur->func_unit = it_mac; |
lo = mfspr (SPR_MACLO); |
hi = mfspr (SPR_MACHI); |
l = (ULONGEST)lo | ((LONGEST)hi << 32); |
/trunk/or1ksim/cpu/common/stats.c
198,9 → 198,8
printf("No DMMU. Set UPR[DMP]\n"); |
|
{ |
extern int loadcycles, storecycles, nops, nop_maxperiod; |
extern int loadcycles, storecycles; |
printf("Additional LOAD CYCLES: %u STORE CYCLES: %u\n", loadcycles, storecycles); |
printf("l.nop count: %u maxgap: %u\n", nops, nop_maxperiod); |
} |
} |
|