> Hey, quick python simobject question. I'm thinking of creating an > object file symobject type for various reasons, but I want to make it so > it can still be instantiated with a string parameter. So in other words, > I still want to be able to say process.executable = "foo", but then for > process.executable to be an ObjectFile simobject which constructs itself > around that string parameter. It all sounds very plausible, but since > there's some fancy magic going on with the SimObject stuff I thought > rather than flounder around trying to get it to work I'd just ask what > the prescribed approach is. Is there a straightforward way to do that?
Why exactly do you want it to be a SimObject? Could it just be a special parameter type? I actually have some code for special file parameter types depending on exactly what you're trying to do, it may be of use to you. All that said, if you do want it to be a SimObject, but do some special parameter handling for it, I'm pretty sure it could be done, but I'd have to think about how. My guess is that we'd have to do some cleaning up of the ParamDesc.convert. Perhaps simply implementing a convert() function on SimObject and then overriding it on your special FileType of simObject. In all honesty, I'll admit that this code is pretty messy and the code is somewhat all over the place. A first step would probably be to document (maybe in the form of a sequence diagram or something like that), exactly how SimObjects are defined and instantiated. The problem with the code right now is that we're using the same mechanism to do both things (python class instantiation), so the code is a bit intertwined. I think we could do a much better job than we have and it would make things less opaque. Nate _______________________________________________ m5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/m5-dev
