> The issue is essentially that the System inherits from MemObject, and placing > a system = Param.System(...) in MemObject creates a cycle. params/System.hh > ends up including MemObject.hh and vice versa. I have tried a number of > permutations of forward declarations etc using the cxx_predecls vs swig_decls > for the System/MemObject but not managed to solve it so far. It is starting > to look pretty nasty, but I will keep on going and see if I can solve the > circular dependency this creates in a decent way. The standard way of doing this is to break the cycle in C++. The reason you have a cycle (I believe) is that System has the physmem parameter and the memories parameter which are both PhysicalMemory objects which are in turn MemObjects. So, to do this the standard way, you'd put the system = Param.System stuff into MemObject and remove the physmem and memories parameters from System. Then in C++ during the constructor of PhysicalMemory, you'd call params()->system->registerPhysicalMemory (you'd have to write that function). The only hangup I see is that physmem is only one of potentially many PhysicalMemory Objects, so to make this work, you'd probably have to add a boolean parameter to PhysicalMemory that's like system_memory so that one object would get written back.
It may just be better to allow cycles and enforce a more rigorous split between the constructors and init() (which I've wanted to do for a long time), but that's a much more complicated fix. Something else that would be possible and would make things easier for this sort of thing would be to add support for traversing the object tree in C++. It probably wouldn't be all that difficult. Nate _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
