From 1031b824b975cec999c37cabc8c05c485a4ae5ca Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 24 Feb 2012 11:43:53 -0500 Subject: MEM: Move port creation to the memory object(s) construction This patch moves all port creation from the getPort method to be consistently done in the MemObject's constructor. This is possible thanks to the Swig interface passing the length of the vector ports. Previously there was a mix of: 1) creating the ports as members (at object construction time) and using getPort for the name resolution, or 2) dynamically creating the ports in the getPort call. This is now uniform. Furthermore, objects that would not be complete without a port have these ports as members rather than having pointers to dynamically allocated ports. This patch also enables an elaboration-time enumeration of all the ports in the system which can be used to determine the masterId. --- src/dev/x86/intdev.hh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/dev/x86/intdev.hh') diff --git a/src/dev/x86/intdev.hh b/src/dev/x86/intdev.hh index 05b4d12a1..5549df637 100644 --- a/src/dev/x86/intdev.hh +++ b/src/dev/x86/intdev.hh @@ -84,17 +84,12 @@ class IntDev TriggerIntMessage message, bool timing); }; - IntPort * intPort; + IntPort intPort; public: - IntDev(MemObject * parent, Tick latency = 0) + IntDev(MemObject * parent, Tick latency = 0) : + intPort(parent->name() + ".int_master", parent, this, latency) { - if (parent != NULL) { - intPort = new IntPort(parent->name() + ".int_master", - parent, this, latency); - } else { - intPort = NULL; - } } virtual ~IntDev() -- cgit v1.2.3