[Avida-SVN] r3124 - in branches/interrupt: . source/cpu

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Sun Jan 18 19:05:53 PST 2009


Author: beckma24
Date: 2009-01-18 22:05:52 -0500 (Sun, 18 Jan 2009)
New Revision: 3124

Modified:
   branches/interrupt/build_avida
   branches/interrupt/source/cpu/cHardwareCPU.cc
Log:
Added print statements specific to interrupt model to trace files.  Fixed issue where IP was being inc'd when an interrupt ended

Modified: branches/interrupt/build_avida
===================================================================
--- branches/interrupt/build_avida	2009-01-18 18:18:46 UTC (rev 3123)
+++ branches/interrupt/build_avida	2009-01-19 03:05:52 UTC (rev 3124)
@@ -3,6 +3,6 @@
 mkdir -p cbuild
 cd cbuild
 cmake "$@" ../
-make
+make -j
 make install
 

Modified: branches/interrupt/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/interrupt/source/cpu/cHardwareCPU.cc	2009-01-18 18:18:46 UTC (rev 3123)
+++ branches/interrupt/source/cpu/cHardwareCPU.cc	2009-01-19 03:05:52 UTC (rev 3124)
@@ -139,7 +139,7 @@
 			read_label.Clear();
 			next_label.Clear();
 			
-			// set all other heads to same spot
+			// set all heads to same spot
 			for(int i = 0; i < NUM_HEADS; i++) {
 				hardware->GetHead(i,m_id).Set(search_head.GetPosition());
 			}
@@ -982,7 +982,7 @@
   // leave this out if there are no differences to keep it cleaner
   if ( m_organism->GetPhenotype().GetTimeUsed() != m_organism->GetPhenotype().GetCPUCyclesUsed() )
   {
-    fp << "  EnergyUsed:" << m_organism->GetPhenotype().GetTimeUsed();
+    fp << "  EnergyUsed:" << m_organism->GetPhenotype().GetTimeUsed();  // NOT ENERGY MODEL
   }
   fp << endl;
   
@@ -1019,7 +1019,16 @@
       fp << "Ox" << setbase(16) << setfill('0') << setw(8) << (m_promoters[i].GetRegulatedBitCode()) << " "; 
     }
     fp << setfill(' ') << setbase(10) << endl;
-  }    
+  }
+	
+	if(m_world->GetConfig().INTERRUPT_ENABLED.Get() == 1) {
+		cLocalThread* currentThread = GetThread(GetCurThread());
+		if(currentThread->isInterrupted())
+			fp << "Interrupted: Saved IP " << (currentThread->pushedState.heads[0]).GetPosition() << endl;
+		else
+			fp << "NOT Interrupted " <<endl;
+	}
+	fp << "Queued messages: "<< m_organism->NumQueuedMessages() << endl;
   fp.flush();
 }
 
@@ -6082,6 +6091,9 @@
 	 On MSG_received_handler_END, process next interrupt or restore previous state
 	 */
 	const int threadID = GetCurThread();
+	if(m_threads[threadID].isInterrupted()) {
+		m_advance_ip = false;
+	}
 	m_threads[threadID].interruptContextSwitch(cLocalThread::INTERRUPT_COMPLETE);
 	return true;
 }




More information about the Avida-cvs mailing list