This is the mail archive of the
sid@sourceware.org
mailing list for the SID project.
Problem Halting Execution
- From: Joseph Altmaier <joseph dot altmaier at gmail dot com>
- To: sid at sources dot redhat dot com
- Date: Fri, 28 May 2010 10:36:38 -0500
- Subject: Problem Halting Execution
I'm writing a SID port, and I can't get it to halt properly.? What is
the functionality of yield()?? It does not seem to stop instruction
flow.? When yield() is called step_insns() will return after the break
at the end of the loop but then it gets called again.? Included is
pseudocode for my step_insns() function.? Any help would be
appreciated.
Thanks!
Joseph Altmaier
void
*processor*_cpu::step_insns ()
{
? bool found;
? while (true)
??? {
????? get next PC
????? for(int u = 0; u < 2; u++) {//Two execution units
??????? Get next instruction for current execution unit
???? ?? if (the instruction is not found)
? ?? ?? {
??? ?? ?? Get the instruction manually
?? ? ?? }
??? ? ? Instruction disassembley...
??? ? ? try//Execute the instruction and cope with it if the instruction fails.
??? ? ? {
??? ?? ?? Execute the current instruction for the current execution unit
?? ?? ? }
??? ? ? catch (cpu_memory_fault& t)
?? ?? ? {
?? ?? ??? this->memory_trap (t);
? ? ? ??? this->yield ();
? ? ? ? }
??????? catch (cpu_exception& t)
? ? ? ? {
??? ?? ?? this->yield ();//A halt instruction will cause a
cpu_exception and a yeild()
?? ?? ? }
?? ???? try {
? ? ? ??? if(Second execution unit){
??? ??????? Execute a writeback on a pair of write stacks
?? ?? ??? }
? ?? ?? }
?? ?? ? catch (cpu_memory_fault& t)
?? ?? ? {
?? ?? ??? this->memory_trap (t);
?? ?? ??? this->yield();
? ?? ?? }
?? ?? ? catch (cpu_exception& t)
? ?? ?? {
? ?? ???? this->yield ();
? ?? ?? }
?? ???? move ahead through circular pipeline
??????? Do post-instruction processing
? ??? }
????? if (stop_after_insns_p (1))
? ????? break;
??? }
}