Hi Gabriel,

First, Ruby is a bit of a mess as far as circular dependencies go. Some of
this is historic, and some of it is inherent to the design. I'm not too
surprised you're running into this issue.

The SimObject initialization is documented here:
http://doxygen.gem5.org/release/current/classSimObject.html#details

Basically, after construction (which happens in m5.instantiate()), the
init() function is called on all SimObjects (in an arbitrary order). In
that init() function, you can have an object call "registerParent" or
something like that on its child to set up the pointers between parent and
child.

Here's an example in Ruby:
https://gem5.googlesource.com/public/gem5/+/refs/heads/stable/src/mem/ruby/network/Network.cc#62

Note that with Ruby, since almost everything has a pointer to the
RubySystem, it's pretty easy for either the parent or the child to set up
this connection. Again, the design is a bit of a mess, but it should be
relatively straightforward to do what you're trying to do.

Cheers,
Jason

On Tue, Apr 13, 2021 at 6:36 AM gabriel.busnot--- via gem5-users <
gem5-users@gem5.org> wrote:

> I am currently hacking my way through it using the NodeID (e.g,
> (A).version on python side) as a parameter of controller (B) so that I can
> basically write in (B)'s state machine :
>     MachineID proxiedController :=
> createMachineID(MachineType:<A_MACHINE_TYPE>, proxiedNodeID);
>
> It seems to work for now but I would like at least not to have
> MachineType:<A_MACHINE_TYPE> hardcoded in (B).
> Ideally, I would like to be able to get (A)'s MachineID dynamically when
> initializing (B) and use it as a constant for the rest of the simulation.
>
> I understand that it goes against the component-hierarchy-based
> implementation that instantiates components bottom up, relying on the
> absence of dependencies between a component and its parents.
> But, is there a way to perform some post-instanciation setup operations
> like with the [before_]end_of_elaboration() SystemC callbacks?
> _______________________________________________
> 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
>
_______________________________________________
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