Sanity Checks on TimeBuffers and Wires:
- Is your time buffer declared to be big enough?
- Are you grabbing a wire outside of the range of the timebuffer?
- Did you declare the size of your "insts" array to be large enough?

Looks like you have a leftover instruction in your TimeBuffer that you are
overwriting, causing it to be deleted. These are refcnted pointers so
hopefully you arent deleting these instructions yourself because you'll get
a double-delete problem.

How about print out if there is a valid instruction in the timebuffer before
you overwrite the slot. Then you can see what instruction is trying to be
deleted:
   overwrite_inst = toTGUnitDecode->insts[
toTGUnitDecode->size];
   DPRINTF(MyFlags, "Writing to index:%i. Instruction there is [sn:%i], now
I'm writing [sn:%i]\n", toTGUnitDecode->size, (overwrite_inst) ?
overwrite_inst->seqNum : -1, instruction->seqNum);
   toTGUnitDecode->insts[toTGUnitDecode->size++] = instruction;


On Mon, May 9, 2011 at 12:44 AM, Andrea Pellegrini <[email protected]>wrote:

>
> Hi all,
> I am using m5 to implement a DataFlow-like architecture.
> I am having a weird Segmentation Fault when I insert an instruction in a
> wire. I can send a bunch of instructions before this one with no problem,
> and after a little bit I get a Segmentation Fault.
> This is part of the code that I am using, and the function that generates
> the error (RefCounted::decref()).
>
> In my design I store a bunch of instructions (usually a Basic Block) in a
> wire and move them to the next pipeline stage. I advance the Queue when the
> next stage receives and stores the instructions in its own local buffer, is
> there anything else I need to do?
>
> Thanks!
> -Andrea
>
>
> Code that causes Segmentation Fault (fetch_impl.hh):
>
>    //tg_units[index_tg_unit]->getFetchQueue()->insts[toDecode->size++] =
> instruction;
>    //toDecode->insts[toDecode->size++] = instruction;
>    typename TimeBuffer<FetchStruct>::wire toTGUnitDecode =
> tg_units[index_tg_unit]->getOutputWire();
>    toTGUnitDecode->insts[toTGUnitDecode->size++] = instruction; // <- This
> function breaks
>
>
>
> -----------------------------------------------------------
> Output:
>
> ...
> FullO3CPU: Ticking main, FullO3CPU.
>  301000: system.cpu.fetch: Running stage.
>  301000: system.cpu.fetch: Attempting to fetch from [tid:0]
>  301000: system.cpu.fetch: [tid:0]: Adding instructions to queue to decode.
>  301000: system.cpu.fetch: [tid:0]: Instruction PC 0x409a73 (0) created
> [sn:95].
>  301000: system.cpu.fetch: [tid:0]: Instruction is:   ADD_R_I : limm   t1,
> 0x8
>  301000: system.cpu.fetch: [tid:0]: Instruction PC 0x409a73 (1) created
> [sn:96].
>  301000: system.cpu.fetch: [tid:0]: Instruction is:   ADD_R_I : add   rdi,
> rdi, t1
> Segmentation fault
>
> -----------------------------------------------------------
>
> Function that breaks:
>
> 28 RefCounted::decref() refcnt.hh:51 0x000000000040a8cc
>
> Code:
>
> void decref() { if (--count <= 0) delete this; }
> _______________________________________________
> m5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
>



-- 
- Korey
_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

Reply via email to