[Avida-cvs] [avida-svn] r732 - in development: Avida.xcodeproj source/analyze source/cpu source/tools support/config
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Mon Jun 5 12:04:50 PDT 2006
Author: brysonda
Date: 2006-06-05 15:04:50 -0400 (Mon, 05 Jun 2006)
New Revision: 732
Modified:
development/Avida.xcodeproj/project.pbxproj
development/source/analyze/cAnalyze.cc
development/source/cpu/cHardwareSMT.cc
development/source/cpu/cHardwareSMT.h
development/source/cpu/cHeadMultiMem.h
development/source/tools/tObjectFactory.h
development/support/config/inst_set.smt
Log:
Add in SMT function call instructions: Call-Flow, Call-Label, Return.
Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj 2006-06-03 02:25:55 UTC (rev 731)
+++ development/Avida.xcodeproj/project.pbxproj 2006-06-05 19:04:50 UTC (rev 732)
@@ -251,9 +251,6 @@
70CA6EDF08DB7F8200068AC2 /* cInstruction.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70CA6EBF08DB7F8200068AC2 /* cInstruction.cc */; };
70CA6EE008DB7F8200068AC2 /* cInstSet.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70CA6EC008DB7F8200068AC2 /* cInstSet.cc */; };
70CA6EE108DB7F8200068AC2 /* cInstUtil.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70CA6EC108DB7F8200068AC2 /* cInstUtil.cc */; };
- 70D46934085F61DA004C8409 /* trio.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC3146D076253A1008F7A48 /* trio.c */; };
- 70D46935085F61DD004C8409 /* trionan.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC31471076253A1008F7A48 /* trionan.c */; };
- 70D46936085F61DF004C8409 /* triostr.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC31474076253A1008F7A48 /* triostr.c */; };
70DCAC7A097AF731002F8733 /* cBarScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70DCAC59097AF730002F8733 /* cBarScreen.cc */; };
70DCAC7D097AF731002F8733 /* cEnvironmentScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70DCAC5C097AF730002F8733 /* cEnvironmentScreen.cc */; };
70DCAC7F097AF731002F8733 /* cHistScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70DCAC5E097AF730002F8733 /* cHistScreen.cc */; };
@@ -2207,9 +2204,6 @@
buildActionMask = 2147483647;
files = (
DCC3166107628531008F7A48 /* avida.cc in Sources */,
- 70D46934085F61DA004C8409 /* trio.c in Sources */,
- 70D46935085F61DD004C8409 /* trionan.c in Sources */,
- 70D46936085F61DF004C8409 /* triostr.c in Sources */,
70C1EF4808C393BA00F50912 /* cCodeLabel.cc in Sources */,
70C1EF5908C3948C00F50912 /* cCPUMemory.cc in Sources */,
70C1EF6208C3954700F50912 /* cCPUStack.cc in Sources */,
Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc 2006-06-03 02:25:55 UTC (rev 731)
+++ development/source/analyze/cAnalyze.cc 2006-06-05 19:04:50 UTC (rev 732)
@@ -2621,11 +2621,11 @@
////////////////////////////////////////////////
// Check if all the genotypes having same length
- int length_genome;
+ int length_genome = 0;
if (genotype_database.size() > 0) {
length_genome = genotype_database.begin()->second->GetLength();
}
- map<int, cAnalyzeGenotype *>::iterator gen_iterator = genotype_database.begin();
+ map<int, cAnalyzeGenotype*>::iterator gen_iterator = genotype_database.begin();
for (; gen_iterator != genotype_database.end(); ++ gen_iterator) {
if (gen_iterator->second->GetLength() != length_genome) {
cerr << "Genotype " << gen_iterator->first << " has different genome length." << endl;
@@ -3172,7 +3172,7 @@
int num_insts = inst_set.GetSize();
map<int, tMatrix<double> > point_mut;
int size_community = community.size();
- int length_genome;
+ int length_genome = 0;
if (size_community > 1) {
length_genome = community[0]->GetLength();
}
@@ -3278,8 +3278,9 @@
}
double min_new_info = length_genome;
- double oo_initial_entropy, oo_conditional_entropy;
- cAnalyzeGenotype * used_genotype;
+ double oo_initial_entropy = 0.0;
+ double oo_conditional_entropy = 0.0;
+ cAnalyzeGenotype* used_genotype = NULL;
tMatrix<double> this_prob = point_mut.find(genotype->GetID())->second;
// For any given genotype, calculate the new information in genotype
@@ -3436,7 +3437,7 @@
filename.Set("%spairdata.%s.dat", static_cast<const char*>(directory),
static_cast<const char*>(genName));
- ofstream& fp = m_world->GetDataFileOFStream(filename);
+ // @DMB -- ofstream& fp = m_world->GetDataFileOFStream(filename);
if (verbose >= nAnalyze::VERBOSE_ON)
cout << "\t\t...with filename: " << filename << endl;
Modified: development/source/cpu/cHardwareSMT.cc
===================================================================
--- development/source/cpu/cHardwareSMT.cc 2006-06-03 02:25:55 UTC (rev 731)
+++ development/source/cpu/cHardwareSMT.cc 2006-06-05 19:04:50 UTC (rev 732)
@@ -96,6 +96,9 @@
cInstEntry("Net-Last", &cHardwareSMT::Inst_NetLast), // 42
cInstEntry("Rotate-Left", &cHardwareSMT::Inst_RotateLeft), // 43
cInstEntry("Rotate-Right", &cHardwareSMT::Inst_RotateRight), // 44
+ cInstEntry("Call-Flow", &cHardwareSMT::Inst_CallFlow), // 44
+ cInstEntry("Call-Label", &cHardwareSMT::Inst_CallLabel), // 44
+ cInstEntry("Return", &cHardwareSMT::Inst_Return), // 44
cInstEntry("NULL", &cHardwareSMT::Inst_Nop) // Last Instruction Always NULL
};
@@ -1675,3 +1678,59 @@
return true;
}
+
+//45
+bool cHardwareSMT::Inst_CallFlow(cAvidaContext& ctx)
+{
+ const int dst = FindModifiedStack(STACK_AX);
+
+ const int location = IP().GetPosition() & 0xFFFF;
+ const int mem_space = IP().GetMemSpace() << 8;
+ const int ra = location | mem_space;
+
+ Stack(dst).Push(ra);
+
+ cHeadMultiMem& flow = GetHead(nHardware::HEAD_FLOW);
+ IP().Set(flow.GetPosition(), flow.GetMemSpace());
+
+ return true;
+}
+
+//46
+bool cHardwareSMT::Inst_CallLabel(cAvidaContext& ctx)
+{
+ const int dst = FindModifiedStack(STACK_AX);
+
+ const unsigned int location = IP().GetPosition() & 0xFFFF;
+ const unsigned int mem_space = IP().GetMemSpace() << 8;
+ const unsigned int ra = location | mem_space;
+
+ Stack(dst).Push(ra);
+
+ ReadLabel(MAX_MEMSPACE_LABEL);
+
+ if (GetLabel().GetSize() != 0) {
+ int mem_space_used = FindMemorySpaceLabel(GetLabel(), -1);
+ if (mem_space_used > -1) {
+ // Jump to beginning of memory space
+ IP().Set(0, mem_space_used);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+//47
+bool cHardwareSMT::Inst_Return(cAvidaContext& ctx)
+{
+ const int src = FindModifiedStack(STACK_AX);
+ const unsigned int ra = Stack(src).Pop();
+
+ const int location = ra & 0xFFFF;
+ const int mem_space = NormalizeMemSpace(ra >> 8);
+
+ IP().Set(location, mem_space);
+
+ return true;
+}
Modified: development/source/cpu/cHardwareSMT.h
===================================================================
--- development/source/cpu/cHardwareSMT.h 2006-06-03 02:25:55 UTC (rev 731)
+++ development/source/cpu/cHardwareSMT.h 2006-06-05 19:04:50 UTC (rev 732)
@@ -299,6 +299,10 @@
bool Inst_NetLast(cAvidaContext& ctx); // 42
bool Inst_RotateLeft(cAvidaContext& ctx); // 43
bool Inst_RotateRight(cAvidaContext& ctx); // 44
+ bool Inst_CallFlow(cAvidaContext& ctx); // 45
+ bool Inst_CallLabel(cAvidaContext& ctx); // 46
+ bool Inst_Return(cAvidaContext& ctx); // 47
+
};
Modified: development/source/cpu/cHeadMultiMem.h
===================================================================
--- development/source/cpu/cHeadMultiMem.h 2006-06-03 02:25:55 UTC (rev 731)
+++ development/source/cpu/cHeadMultiMem.h 2006-06-05 19:04:50 UTC (rev 732)
@@ -27,7 +27,7 @@
void Adjust();
void Reset(int in_mem_space = 0, cHardwareBase* new_hardware = NULL);
- void Set(int new_pos, int in_mem_space = 0, cHardwareBase * in_hardware = NULL);
+ void Set(int new_pos, int in_mem_space = 0, cHardwareBase* in_hardware = NULL);
void Set(const cHeadMultiMem& in_head);
void LoopJump(int jump);
const cCPUMemory& GetMemory() const;
Modified: development/source/tools/tObjectFactory.h
===================================================================
--- development/source/tools/tObjectFactory.h 2006-06-03 02:25:55 UTC (rev 731)
+++ development/source/tools/tObjectFactory.h 2006-06-05 19:04:50 UTC (rev 732)
@@ -117,7 +117,7 @@
tListIterator<cString> names_it(names);
for (int i = 0; names_it.Next() != NULL; i++) {
- CreateObjectFunction func;
+ CreateObjectFunction func = NULL;
m_create_funcs.Find(*names_it.Get(), func);
objects[i] = func();
}
Modified: development/support/config/inst_set.smt
===================================================================
--- development/support/config/inst_set.smt 2006-06-03 02:25:55 UTC (rev 731)
+++ development/support/config/inst_set.smt 2006-06-05 19:04:50 UTC (rev 732)
@@ -45,4 +45,6 @@
#Net-Last 1 #42 ()
#Rotate-Left 1 #43 ()
#Rotate-Right 1 #44 ()
-
+#Call-Flow 1 #45 ()
+#Call-Label 1 #46 ()
+#Return 1 #47 ()
More information about the Avida-cvs
mailing list