Hi Javed,

Please, see my comments inline.

Best,
Gabriel

Javed Osmany wrote:
> Hello
> 
> Trying to understand the following:
> 
> So in example config scripts I see the following:
> 
>         system = System() // Is this then instantiating the default overall 
> system ??
This is pretty much it, yes.
> 
> Now, I understand that there are two types of memory system, namely classic 
> and Ruby.
Yes.
> 
> And then if "-ruby" is specified on the command line, the script Ruby.py is
> called.
> Within Ruby.py, the function creat_system() is called and in Ruby.py (lines 
> 193 - 194), we
> have the code
> 
>        system.ruby = Ruby.System() // Is this then instantiating the Ruby 
> memory system
> within the overall System() ??
Here it gets a bit more technical but you are right.
Let me detail a little bit more what is going on.
BTW, Not sure which version of gem5 you have but I don't have a dot between 
Ruby and System and I believe that you should not have one either.

system, which is an instance of the System python class, is what is called a 
SimObject.
The SimObject python class, which System inherits from, gives special 
capabilities.
The most important one is to be able to build a SimObject tree by asigning 
SimObjects to other SimObjetcs attributes.
For instance, with A, B, C and D being SimObject instances, one can write:
    A.b = B; B.c = c; A.d = d // Builds the SimObject tree [A->B->C ; A->D]

The SimObject tree that you have before calling m5.instantiate will define the 
order in which the C++ version of each SimObject will be constructed.
You basically go from the leafs to the root of the SimObject tree so that all 
parameters are valid in each C++ SimObject constructor.
Then, the init method of each C++ SimObject is called in a non-specified order 
in order to perform extra operations that cannot take place in the constructor.

In the present case, an instance of the SimObject "RubySystem" is being 
assigned to the ruby attribute of system (which also is a SimObject).
system initially has no ruby attribute but because we are assigning a 
SimObject, magic happens behind the scene and a new attribute "ruby" is 
dynamically added. Notice that you could use any attribute name instead of ruby.
In a nutshell, yes, our new RubySystem is now "physically" part of the overall 
System.

>        ruby                = system.ruby     // This is then just an alias ??
Yes, this is a local alias: system.ruby could be used instead of ruby in the 
rest of the function.
> 
> 
> Thanks in advance.
> J.Osmany
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to