Hi Lluc, First, in my_mem.hh you need to include "params/MyMemory.hh". Second, you should not redeclare the params that are already in the parent class, as this will cause problems.
Good luck, Andreas On 08/03/2013 16:02, "Lluc Alvarez Marti" <[email protected]> wrote: >Hi! > >I'm trying to create a MyMemory class that is a subclass of the >SimpleMemory class in order to have a new kind of memory with additional >features. Unfortunately, I'm having some troubles, I hope someone can >help me. This is basically what I've done: > >1) I've added a my_mem.hh in src/mem that declares the class as >follows: > > #include "mem/simple_mem.hh" > class MyMemory : public SimpleMemory > { > public: > MyMemory(const MyMemoryParams *p); > virtual ~MyMemory() {} > int extension; > } > >2) I've added the corresponding my_mem.cc in src/mem that contains the >following: > > #include "mem/my_mem.hh" > MyMemory::MyMemory(cont MyMemoryParams *p) : SimpleMemory(p) { >extension = 1; } > MyMemory* MyMemoryParams::create() { return new MyMemory(this); } > >3) I've added a MyMemory.py in src/mem that contains the following: > > from m5.params import * > from SimpleMemory import * > class MyMemory(SimpleMemory): > type = 'MyMemory' > cxx_header = "mem/my_mem.hh" > port = SlavePort("Slave ports") > latency = Param.Latency('30ns', "Request to response latency") > latency_var = Param.Latency('0ns', "Request to response latency >variance") > bandwidth = Param.MemoryBandwidth('12.8GB/s',"Combined read and >write bandwidth") > >4) I've added the following lines in src/mem/SConscript: > > SimObject('MyMemory.py') > Source('my_mem.cc') > >5) I've tried to use it modifying the configs/examples/se.py, changing >the following: > > - physmem = SimpleMemory(range=AddrRange("512MB")) > + physmem = MyMemory(range=AddrRange("512MB")) > > >The problem I'm having is that, when I compile, I get an error saying >that MyMemoryParams does not exist: > > build/X86/mem/my_mem.hh:66:23: error: 'MyMemoryParams' does not name >a type. > >Can anybody help me on trying to figure out what is happening? I'm >basically trying to mimic the way the SimpleMemory class is declared to >declare the MyMemory class, am I doing something wrong? I've been unable >to find anything related to the declaration of the SimpleMemoryParams, I >guess it's the python system that generates it by itself, but fore some >reason it's not doing it for the MyMemoryParams... > >Any kind help is appreciated. > >Thanks in advance, > >Lluc > >WARNING / LEGAL TEXT: This message is intended only for the use of the >individual or entity to which it is addressed and may contain >information which is privileged, confidential, proprietary, or exempt >from disclosure under applicable law. If you are not the intended >recipient or the person responsible for delivering the message to the >intended recipient, you are strictly prohibited from disclosing, >distributing, copying, or in any way using this message. If you have >received this communication in error, please notify the sender and >destroy and delete any copies you may have received. > >http://www.bsc.es/disclaimer >_______________________________________________ >gem5-users mailing list >[email protected] >http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users > -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. _______________________________________________ gem5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
