[Avida-SVN] r3548 - development/source/cpu

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Tue Dec 8 12:00:44 PST 2009


Author: brysonda
Date: 2009-12-08 15:00:44 -0500 (Tue, 08 Dec 2009)
New Revision: 3548

Modified:
   development/source/cpu/cHardwareExperimental.cc
   development/source/cpu/cHardwareExperimental.h
Log:
Implement out and zero register instruction in cHardwareExperimental

Modified: development/source/cpu/cHardwareExperimental.cc
===================================================================
--- development/source/cpu/cHardwareExperimental.cc	2009-12-07 15:18:55 UTC (rev 3547)
+++ development/source/cpu/cHardwareExperimental.cc	2009-12-08 20:00:44 UTC (rev 3548)
@@ -134,6 +134,7 @@
     tInstLibEntry<tMethod>("IO-expire", &cHardwareExperimental::Inst_TaskIOExpire, (nInstFlag::DEFAULT | nInstFlag::STALL), "Output ?BX?, and input new number back into ?BX?, if the number has not yet expired"),
     tInstLibEntry<tMethod>("input", &cHardwareExperimental::Inst_TaskInput, nInstFlag::STALL, "Input new number into ?BX?"),
     tInstLibEntry<tMethod>("output", &cHardwareExperimental::Inst_TaskOutput, nInstFlag::STALL, "Output ?BX?"),
+    tInstLibEntry<tMethod>("output-zero", &cHardwareExperimental::Inst_TaskOutputZero, nInstFlag::STALL, "Output ?BX?"),
     tInstLibEntry<tMethod>("output-expire", &cHardwareExperimental::Inst_TaskOutputExpire, nInstFlag::STALL, "Output ?BX?, as long as the output has not yet expired"),
     
     tInstLibEntry<tMethod>("mult", &cHardwareExperimental::Inst_Mult, 0, "Multiple BX by CX and place the result in ?BX?"),
@@ -1468,6 +1469,20 @@
 }
 
 
+bool cHardwareExperimental::Inst_TaskOutputZero(cAvidaContext& ctx)
+{
+  const int reg_used = FindModifiedRegister(REG_BX);
+  sInternalValue& reg = m_threads[m_cur_thread].reg[reg_used];
+  
+  // Do the "put" component
+  m_organism->DoOutput(ctx, reg.value);  // Check for tasks completed.
+  m_last_output = m_cycle_count;
+  
+  setInternalValue(reg, 0);
+  
+  return true;
+}
+
 bool cHardwareExperimental::Inst_TaskOutputExpire(cAvidaContext& ctx)
 {
   const int reg_used = FindModifiedRegister(REG_BX);

Modified: development/source/cpu/cHardwareExperimental.h
===================================================================
--- development/source/cpu/cHardwareExperimental.h	2009-12-07 15:18:55 UTC (rev 3547)
+++ development/source/cpu/cHardwareExperimental.h	2009-12-08 20:00:44 UTC (rev 3548)
@@ -430,6 +430,7 @@
   bool Inst_TaskIOExpire(cAvidaContext& ctx);
   bool Inst_TaskInput(cAvidaContext& ctx);
   bool Inst_TaskOutput(cAvidaContext& ctx);
+  bool Inst_TaskOutputZero(cAvidaContext& ctx);
   bool Inst_TaskOutputExpire(cAvidaContext& ctx);
 
   // Head-based Instructions




More information about the Avida-cvs mailing list