URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/or1ksim/cpu
- from Rev 116 to Rev 118
- ↔ Reverse comparison
Rev 116 → Rev 118
/Makefile.in
174,6 → 174,7
PACKAGE_NAME = @PACKAGE_NAME@ |
PACKAGE_STRING = @PACKAGE_STRING@ |
PACKAGE_TARNAME = @PACKAGE_TARNAME@ |
PACKAGE_URL = @PACKAGE_URL@ |
PACKAGE_VERSION = @PACKAGE_VERSION@ |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
POW_LIB = @POW_LIB@ |
/or32/Makefile.in
207,6 → 207,7
PACKAGE_NAME = @PACKAGE_NAME@ |
PACKAGE_STRING = @PACKAGE_STRING@ |
PACKAGE_TARNAME = @PACKAGE_TARNAME@ |
PACKAGE_URL = @PACKAGE_URL@ |
PACKAGE_VERSION = @PACKAGE_VERSION@ |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
POW_LIB = @POW_LIB@ |
/or32/or32.c
479,8 → 479,8
EF (l_div), 0, it_arith}, |
{"l.divu", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-11 ---- 0xA", |
EF (l_divu), 0, it_arith}, |
{"l.mulu", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-11 ---- 0xB", EFI, |
0, it_arith}, |
{"l.mulu", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-11 ---- 0xB", |
EF (l_mulu), 0, it_arith}, |
{"l.extbs", "rD,rA", "11 0x8 DDDDD AAAAA ---- --00 01-- 0xC", |
EF (l_extbs), 0, it_move}, |
{"l.exths", "rD,rA", "11 0x8 DDDDD AAAAA ---- --00 00-- 0xC", |
/or32/insnset.c
256,45 → 256,143
} |
/*int mcount = 0;*/ |
INSTRUCTION (l_mul) { |
orreg_t temp1; |
|
temp1 = (orreg_t)PARAM1 * (orreg_t)PARAM2; |
SET_OV_FLAG_FN (temp1); |
SET_PARAM0(temp1); |
/*if (!(mcount++ & 1023)) { |
PRINTF ("[%i]\n",mcount); |
}*/ |
orreg_t temp0, temp1, temp2; |
LONGEST ltemp0, ltemp1, ltemp2; |
ULONGEST ultemp0, ultemp1, ultemp2; |
|
/* Args in 32-bit */ |
temp2 = (orreg_t) PARAM2; |
temp1 = (orreg_t) PARAM1; |
|
/* Compute initially in 64-bit */ |
ltemp1 = (LONGEST) temp1; |
ltemp2 = (LONGEST) temp2; |
ltemp0 = ltemp1 * ltemp2; |
|
temp0 = (orreg_t) (ltemp0 & 0xffffffffLL); |
SET_PARAM0 (temp0); |
|
/* We have 2's complement overflow, if the result is less than the smallest |
possible 32-bit negative number, or greater than the largest possible |
32-bit positive number. */ |
if ((ltemp0 < (LONGEST) INT32_MIN) || (ltemp0 > (LONGEST) INT32_MAX)) |
{ |
cpu_state.sprs[SPR_SR] |= SPR_SR_OV; |
} |
else |
{ |
cpu_state.sprs[SPR_SR] &= ~SPR_SR_OV; |
} |
|
/* We have 1's complement overflow, if, as an unsigned operation, the result |
is greater than the largest possible 32-bit unsigned number. This is |
probably quicker than unpicking the bits of the signed result. */ |
ultemp1 = (ULONGEST) temp1 & 0xffffffffULL; |
ultemp2 = (ULONGEST) temp2 & 0xffffffffULL; |
ultemp0 = ultemp1 * ultemp2; |
|
if (ultemp0 > (ULONGEST) UINT32_MAX) |
{ |
cpu_state.sprs[SPR_SR] |= SPR_SR_CY; |
} |
else |
{ |
cpu_state.sprs[SPR_SR] &= ~SPR_SR_CY; |
} |
|
/* Trigger a range exception if the overflow flag is set and the SR[OVE] bit |
is set. */ |
if (((cpu_state.sprs[SPR_SR] & SPR_SR_OVE) == SPR_SR_OVE) && |
((cpu_state.sprs[SPR_SR] & SPR_SR_OV) == SPR_SR_OV)) |
{ |
except_handle (EXCEPT_RANGE, cpu_state.pc); |
} |
} |
INSTRUCTION (l_mulu) { |
uorreg_t temp0, temp1, temp2; |
ULONGEST ultemp0, ultemp1, ultemp2; |
|
/* Args in 32-bit */ |
temp2 = (uorreg_t) PARAM2; |
temp1 = (uorreg_t) PARAM1; |
|
/* Compute initially in 64-bit */ |
ultemp1 = (ULONGEST) temp1 & 0xffffffffULL; |
ultemp2 = (ULONGEST) temp2 & 0xffffffffULL; |
ultemp0 = ultemp1 * ultemp2; |
|
temp0 = (uorreg_t) (ultemp0 & 0xffffffffULL); |
SET_PARAM0 (temp0); |
|
/* We never have 2's complement overflow */ |
cpu_state.sprs[SPR_SR] &= ~SPR_SR_OV; |
|
/* We have 1's complement overflow, if the result is greater than the |
largest possible 32-bit unsigned number. */ |
if (ultemp0 > (ULONGEST) UINT32_MAX) |
{ |
cpu_state.sprs[SPR_SR] |= SPR_SR_CY; |
} |
else |
{ |
cpu_state.sprs[SPR_SR] &= ~SPR_SR_CY; |
} |
} |
INSTRUCTION (l_div) { |
orreg_t temp3, temp2, temp1; |
orreg_t temp3, temp2, temp1; |
|
temp3 = PARAM2; |
temp2 = PARAM1; |
if (temp3) |
temp1 = temp2 / temp3; |
else { |
cpu_state.sprs[SPR_SR] |= SPR_SR_CY; /* Div by zero sets carry */ |
except_handle (EXCEPT_RANGE, cpu_state.pc); |
return; |
} |
SET_OV_FLAG_FN (temp1); |
SET_PARAM0(temp1); |
temp3 = (orreg_t) PARAM2; |
temp2 = (orreg_t) PARAM1; |
|
/* Check for divide by zero (sets carry) */ |
if (0 == temp3) |
{ |
cpu_state.sprs[SPR_SR] |= SPR_SR_CY; |
} |
else |
{ |
temp1 = temp2 / temp3; |
SET_PARAM0(temp1); |
cpu_state.sprs[SPR_SR] &= ~SPR_SR_CY; |
} |
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_OV; /* Never set */ |
|
/* Trigger a range exception if the overflow flag is set and the SR[OVE] bit |
is set. */ |
if (((cpu_state.sprs[SPR_SR] & SPR_SR_OVE) == SPR_SR_OVE) && |
((cpu_state.sprs[SPR_SR] & SPR_SR_CY) == SPR_SR_CY)) |
{ |
except_handle (EXCEPT_RANGE, cpu_state.pc); |
} |
} |
INSTRUCTION (l_divu) { |
uorreg_t temp3, temp2, temp1; |
|
temp3 = PARAM2; |
temp2 = PARAM1; |
if (temp3) |
temp1 = temp2 / temp3; |
else { |
cpu_state.sprs[SPR_SR] |= SPR_SR_CY; /* Div by zero sets carry */ |
except_handle(EXCEPT_RANGE, cpu_state.pc); |
return; |
} |
SET_OV_FLAG_FN (temp1); |
SET_PARAM0(temp1); |
/* runtime.sim.cycles += 16; */ |
temp3 = (uorreg_t) PARAM2; |
temp2 = (uorreg_t) PARAM1; |
|
/* Check for divide by zero (sets carry) */ |
if (0 == temp3) |
{ |
cpu_state.sprs[SPR_SR] |= SPR_SR_CY; |
} |
else |
{ |
temp1 = temp2 / temp3; |
SET_PARAM0(temp1); |
cpu_state.sprs[SPR_SR] &= ~SPR_SR_CY; |
} |
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_OV; /* Never set */ |
|
/* Trigger a range exception if the overflow flag is set and the SR[OVE] bit |
is set. */ |
if (((cpu_state.sprs[SPR_SR] & SPR_SR_OVE) == SPR_SR_OVE) && |
((cpu_state.sprs[SPR_SR] & SPR_SR_CY) == SPR_SR_CY)) |
{ |
except_handle (EXCEPT_RANGE, cpu_state.pc); |
} |
} |
INSTRUCTION (l_sll) { |
uorreg_t temp1; |
/or32/generate.c
315,6 → 315,7
fprintf (fo, "/* This file was automatically generated by generate (see\n"); |
fprintf (fo, " cpu/or32/generate.c) */\n\n"); |
fprintf (fo, "#include <math.h>\n\n"); |
fprintf (fo, "#include <stdint.h>\n\n"); |
fprintf (fo, "typedef union {\n\tfloat fval;\n\tuint32_t hval;\n} FLOAT;\n\n"); |
fprintf (fo, "static void decode_execute (struct iqueue_entry *current)\n{\n"); |
fprintf (fo, " uint32_t insn = current->insn;\n"); |
/dlx/Makefile.in
154,6 → 154,7
PACKAGE_NAME = @PACKAGE_NAME@ |
PACKAGE_STRING = @PACKAGE_STRING@ |
PACKAGE_TARNAME = @PACKAGE_TARNAME@ |
PACKAGE_URL = @PACKAGE_URL@ |
PACKAGE_VERSION = @PACKAGE_VERSION@ |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
POW_LIB = @POW_LIB@ |
/common/Makefile.in
155,6 → 155,7
PACKAGE_NAME = @PACKAGE_NAME@ |
PACKAGE_STRING = @PACKAGE_STRING@ |
PACKAGE_TARNAME = @PACKAGE_TARNAME@ |
PACKAGE_URL = @PACKAGE_URL@ |
PACKAGE_VERSION = @PACKAGE_VERSION@ |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
POW_LIB = @POW_LIB@ |
/or1k/Makefile.in
154,6 → 154,7
PACKAGE_NAME = @PACKAGE_NAME@ |
PACKAGE_STRING = @PACKAGE_STRING@ |
PACKAGE_TARNAME = @PACKAGE_TARNAME@ |
PACKAGE_URL = @PACKAGE_URL@ |
PACKAGE_VERSION = @PACKAGE_VERSION@ |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
POW_LIB = @POW_LIB@ |