One way to do it is just to add those definitions to
src/python/m5/params.py.  Given that EthernetAddr is already there it
doesn't seem unreasonable to put the things you want in there (though I'd
think you'd want separate IPAddress, IPNetMask, and IPAddressAndPort param
types or something like that).  There are lots of examples in there to
follow.

The system wasn't designed with adding param types outside of that file in
mind, but it seems like a reasonable thing that should be allowed.  At the
same time, in this particular case it seems easier just to have you put
those types in there than to figure out how to make this work.  The downside
of doing it in an EXTRAS directory is then if anyone else ever wants to use
those types it would be an additional dependency and be harder for them to
reference.

Steve

On Sun, Nov 7, 2010 at 9:46 PM, Gabriel Michael Black <[email protected]
> wrote:

> Is there a way to define custom parameter types, particularly from an
> EXTRAS directory? I want to define an IPAddress type (or similar) which
> takes input in the form "a.b.c.d/n" (netmask) or "a.b.c.d" (plain IP) or
> "a.b.c.d:p" (with port) or something along those lines. I see we have an
> EthernetAddress type, but it looks like that's a MAC address and not an IP
> address. I would also appreciate suggestions on how to organize those
> hypothetical parameter types since an IP with netmask wouldn't be used in
> the same places as an IP with a port, even though they're fairly similar.
>
> Gabe
>
> _______________________________________________
> m5-dev mailing list
> [email protected]
> http://m5sim.org/mailman/listinfo/m5-dev
>
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to