Pseudo-halt timing fix
This commit is contained in:
parent
0c914fce1a
commit
bcd80d291b
|
@ -1860,7 +1860,7 @@ static uint32_t cpuUntil(VB *sim, uint32_t clocks) {
|
||||||
|
|
||||||
/* Pseudo-halting */
|
/* Pseudo-halting */
|
||||||
if (sim->cpu.operation == CPU_PHALT) {
|
if (sim->cpu.operation == CPU_PHALT) {
|
||||||
if (sim->cpu.clocks == 0) /* Requires an interrupt */
|
if (sim->cpu.clocks == 0)
|
||||||
return clocks;
|
return clocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,11 +121,12 @@ static int phMatches(VB *sim, uint32_t address, int type, int32_t value) {
|
||||||
return
|
return
|
||||||
sim->ph.adtre == sim->cpu.adtre &&
|
sim->ph.adtre == sim->cpu.adtre &&
|
||||||
sim->ph.chcw == cpuGetSystemRegister(sim, VB_CHCW) &&
|
sim->ph.chcw == cpuGetSystemRegister(sim, VB_CHCW) &&
|
||||||
|
sim->ph.ecr == cpuGetSystemRegister(sim, VB_ECR) &&
|
||||||
sim->ph.eipc == sim->cpu.eipc &&
|
sim->ph.eipc == sim->cpu.eipc &&
|
||||||
sim->ph.eipsw == sim->cpu.eipsw &&
|
sim->ph.eipsw == sim->cpu.eipsw &&
|
||||||
sim->ph.fepc == sim->cpu.fepc &&
|
sim->ph.fepc == sim->cpu.fepc &&
|
||||||
sim->ph.fepsw == sim->cpu.fepsw &&
|
sim->ph.fepsw == sim->cpu.fepsw &&
|
||||||
sim->ph.psw == cpuGetSystemRegister(sim, VB_PSW)
|
sim->ph.psw == cpuGetSystemRegister(sim, VB_PSW )
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,6 +230,7 @@ static int phAssess(VB *sim, uint32_t address, int type, int32_t value) {
|
||||||
sim->ph.program[x - 1] = sim->cpu.program[x];
|
sim->ph.program[x - 1] = sim->cpu.program[x];
|
||||||
sim->ph.adtre = sim->cpu.adtre;
|
sim->ph.adtre = sim->cpu.adtre;
|
||||||
sim->ph.chcw = cpuGetSystemRegister(sim, VB_CHCW);
|
sim->ph.chcw = cpuGetSystemRegister(sim, VB_CHCW);
|
||||||
|
sim->ph.ecr = cpuGetSystemRegister(sim, VB_ECR);
|
||||||
sim->ph.eipc = sim->cpu.eipc;
|
sim->ph.eipc = sim->cpu.eipc;
|
||||||
sim->ph.eipsw = sim->cpu.eipsw;
|
sim->ph.eipsw = sim->cpu.eipsw;
|
||||||
sim->ph.fepc = sim->cpu.fepc;
|
sim->ph.fepc = sim->cpu.fepc;
|
||||||
|
|
22
core/vb.c
22
core/vb.c
|
@ -322,6 +322,7 @@ struct VB {
|
||||||
/* CPU snapshot */
|
/* CPU snapshot */
|
||||||
uint32_t adtre;
|
uint32_t adtre;
|
||||||
uint32_t chcw;
|
uint32_t chcw;
|
||||||
|
uint32_t ecr;
|
||||||
uint32_t eipc;
|
uint32_t eipc;
|
||||||
uint32_t eipsw;
|
uint32_t eipsw;
|
||||||
uint32_t fepc;
|
uint32_t fepc;
|
||||||
|
@ -381,12 +382,21 @@ static int32_t SignExtend(int32_t value, int32_t bits) {
|
||||||
|
|
||||||
/* Process a simulation for a given number of clocks */
|
/* Process a simulation for a given number of clocks */
|
||||||
static int sysEmulate(VB *sim, uint32_t clocks) {
|
static int sysEmulate(VB *sim, uint32_t clocks) {
|
||||||
int ret;
|
int ret = 0;
|
||||||
ret = cpuEmulate(sim, clocks);
|
|
||||||
padEmulate(sim, clocks);
|
/* CPU is in a pseudo-halt state that requires an interrupt to exit */
|
||||||
tmrEmulate(sim, clocks);
|
int never =
|
||||||
vsuEmulate(sim, clocks);
|
sim->cpu.operation == CPU_PHALT &&
|
||||||
ret |= vipEmulate(sim, clocks);
|
sim->ph.operation == PH_NEVER
|
||||||
|
;
|
||||||
|
|
||||||
|
/* Process all components */
|
||||||
|
if (!never) ret = cpuEmulate(sim, clocks);
|
||||||
|
padEmulate(sim, clocks);
|
||||||
|
tmrEmulate(sim, clocks);
|
||||||
|
vsuEmulate(sim, clocks);
|
||||||
|
ret |= vipEmulate(sim, clocks);
|
||||||
|
if ( never) ret |= cpuEmulate(sim, clocks);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue