1
0
mirror of https://github.com/simh/simh.git synced 2026-05-04 23:15:23 +00:00

Official simh-v3.9-0 Merge

This commit is contained in:
Mark Pizzolato
2012-05-02 05:39:27 -07:00
parent eaa17ffce8
commit 38e3d58c72
19 changed files with 73 additions and 498 deletions

View File

@@ -477,16 +477,17 @@ return ((val << 24) & 0xff000000) | (( val << 8) & 0xff0000) |
((val >> 8) & 0xff00) | ((val >> 24) & 0xff);
}
volatile int32 rom_loopval = 0;
int32 rom_read_delay (int32 val)
{
uint32 i, l = rom_delay;
int32 loopval = 0;
if (rom_unit.flags & UNIT_NODELAY)
return val;
/* Calibrate the loop delay factor when first used.
Do this 4 times to and use the largest value computed. */
Do this 4 times and use the largest value computed. */
if (rom_delay == 0) {
uint32 ts, te, c = 10000, samples = 0;
@@ -499,15 +500,15 @@ if (rom_delay == 0) {
away by a good compiler. loopval always is zero. To avoid smart compilers,
the loopval variable is referenced in the function arguments so that the
function expression is not loop invariant. It also must be referenced
by subsequent code or to avoid the whole computation being eliminated. */
by subsequent code to avoid the whole computation being eliminated. */
for (i = 0; i < c; i++)
loopval |= (loopval + ts) ^ rom_swapb (rom_swapb (loopval + ts));
rom_loopval |= (rom_loopval + ts) ^ rom_swapb (rom_swapb (rom_loopval + ts));
te = sim_os_msec ();
if ((te - ts) < 50) /* sample big enough? */
continue;
if (rom_delay < (loopval + (c / (te - ts) / 1000) + 1))
rom_delay = loopval + (c / (te - ts) / 1000) + 1;
if (rom_delay < (rom_loopval + (c / (te - ts) / 1000) + 1))
rom_delay = rom_loopval + (c / (te - ts) / 1000) + 1;
if (++samples >= 4)
break;
c = c / 2;
@@ -517,8 +518,8 @@ if (rom_delay == 0) {
}
for (i = 0; i < l; i++)
loopval |= (loopval + val) ^ rom_swapb (rom_swapb (loopval + val));
return val + loopval;
rom_loopval |= (rom_loopval + val) ^ rom_swapb (rom_swapb (rom_loopval + val));
return val + rom_loopval;
}
int32 rom_rd (int32 pa)