changeset 9bbcb643f303 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=9bbcb643f303
description:
        Automated merge with ssh://m5sim.org//repo/m5

diffstat:

3 files changed, 15 insertions(+), 57 deletions(-)
src/mem/ruby/config/cfg.rb       |   15 +++++++---
src/mem/ruby/libruby.cc          |   53 --------------------------------------
src/mem/ruby/system/Sequencer.cc |    4 ++

diffs (130 lines):

diff -r 75d4aaf7dd54 -r 9bbcb643f303 src/mem/ruby/config/cfg.rb
--- a/src/mem/ruby/config/cfg.rb        Tue Jul 21 01:09:05 2009 -0700
+++ b/src/mem/ruby/config/cfg.rb        Tue Jul 21 21:27:54 2009 -0500
@@ -100,9 +100,11 @@
   end
 
   def self.printConstructors()
+    str = ""
     @@all_objs.each { |obj|
-      print obj.cppClassName, " ", obj.obj_name, " ",obj.argv,"\n"
+      str += obj.cppClassName + " " + obj.obj_name + " " + obj.argv + "\n"
     }
+    return str
   end
   def self.all()
     @@all_objs
@@ -215,7 +217,7 @@
     EOS
   end
 
-  def self.generateConfig()
+  def self.getConfig()
     # get current time for random seed if set to "rand"
     if @@params[:random_seed] == "rand"
       t = Time.now
@@ -224,13 +226,18 @@
     if ! @@params[:random_seed].is_a?(Integer)
       raise TypeException
     end
-    print "System sys0 ",argv,"\n"
+    str = "System sys0 "+argv+"\n"
     LibRubyObject.all.each { |obj|
       if obj.is_a?(SetAssociativeCache)
         obj.calculateLatency
       end
     }
-    LibRubyObject.printConstructors
+    str += LibRubyObject.printConstructors
+    return str
+  end
+
+  def self.generateConfig()
+    puts getConfig
   end
 
   def self.printIfacePorts()
diff -r 75d4aaf7dd54 -r 9bbcb643f303 src/mem/ruby/libruby.cc
--- a/src/mem/ruby/libruby.cc   Tue Jul 21 01:09:05 2009 -0700
+++ b/src/mem/ruby/libruby.cc   Tue Jul 21 21:27:54 2009 -0500
@@ -88,58 +88,7 @@
 
 void libruby_init(const char* cfg_filename)
 {
-  stringstream cfg_output;
-
-  // first we execute the Ruby-lang configuration script
-  int fd[2];
-  int pid;
-  if (pipe(fd) == -1) {
-    perror("Error Creating Pipe");
-    exit(EXIT_FAILURE);
-  }
-
-  pid = fork();
-  if (pid == -1){
-    perror("Error forking");
-    exit(EXIT_FAILURE);
-  }
-
-  if (!pid) {
-    // child
-    close(fd[0]); // close the read end of the pipe
-    // replace stdout with the write pipe
-    if (dup2(fd[1], STDOUT_FILENO) == -1) {
-      perror("Error redirecting stdout");
-      exit(EXIT_FAILURE);
-    }
-    if (execlp("ruby", "ruby", "-I", GEMS_ROOT "/ruby/config",
-               GEMS_ROOT "/ruby/config/print_cfg.rb", "-r", cfg_filename, 
NULL)) {
-      perror("execlp");
-      exit(EXIT_FAILURE);
-    }
-  } else {
-    close(fd[1]);
-
-    int child_status;
-    if (wait(&child_status) == -1) {
-      perror("wait");
-      exit(EXIT_FAILURE);
-    }
-    if (child_status != EXIT_SUCCESS) {
-      exit(EXIT_FAILURE);
-    }
-
-    char buf[100];
-    int bytes_read;
-    while( (bytes_read = read(fd[0], buf, 100)) > 0 ) {
-      for (int i=0;i<bytes_read;i++) {
-        //      cout << buf[i];
-        cfg_output << buf[i];
-      }
-    }
-    assert(bytes_read == 0);
-    close(fd[0]);
-  }
+  ifstream cfg_output(cfg_filename);
 
   vector<RubyObjConf> * sys_conf = new vector<RubyObjConf>;
 
diff -r 75d4aaf7dd54 -r 9bbcb643f303 src/mem/ruby/system/Sequencer.cc
--- a/src/mem/ruby/system/Sequencer.cc  Tue Jul 21 01:09:05 2009 -0700
+++ b/src/mem/ruby/system/Sequencer.cc  Tue Jul 21 21:27:54 2009 -0500
@@ -285,6 +285,7 @@
   removeRequest(request);
 
   assert((request->ruby_request.type == RubyRequestType_LD) ||
+        (request->ruby_request.type == RubyRequestType_RMW_Read) ||
          (request->ruby_request.type == RubyRequestType_IFETCH));
 
   hitCallback(request, data);
@@ -328,7 +329,8 @@
   // update the data
   if (ruby_request.data != NULL) {
     if ((type == RubyRequestType_LD) ||
-        (type == RubyRequestType_IFETCH)) {
+        (type == RubyRequestType_IFETCH) ||
+        (type == RubyRequestType_RMW_Read)) {
       memcpy(ruby_request.data, data.getData(request_address.getOffset(), 
ruby_request.len), ruby_request.len);
     } else {
       data.setData(ruby_request.data, request_address.getOffset(), 
ruby_request.len);
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to