changeset 6b0f8306704b in /z/repo/m5 details: http://repo.m5sim.org/m5?cmd=changeset;node=6b0f8306704b description: Fix a bunch of bugs I introduced when I changed the flags stuff for packets. I did some of the flags and assertions wrong. Thanks to Brad Beckmann for pointing this out. I should have run the opt regressions instead of the fast. I also screwed up some of the logical functions in the Flags class.
diffstat: 3 files changed, 5 insertions(+), 4 deletions(-) src/base/flags.hh | 4 ++-- src/mem/packet.hh | 4 ++-- src/mem/request.hh | 1 + diffs (144 lines): diff -r 342cbc20a188 -r 6b0f8306704b src/arch/alpha/isa/mem.isa --- a/src/arch/alpha/isa/mem.isa Thu Nov 13 23:30:37 2008 -0800 +++ b/src/arch/alpha/isa/mem.isa Fri Nov 14 04:55:30 2008 -0800 @@ -678,7 +678,7 @@ if mem_flags: mem_flags = [ 'Request::%s' % flag for flag in mem_flags ] - s = '\n\tmemAccessFlags.reset(' + string.join(mem_flags, '|') + ');' + s = '\n\tmemAccessFlags = ' + string.join(mem_flags, '|') + ';' iop.constructor += s memacc_iop.constructor += s diff -r 342cbc20a188 -r 6b0f8306704b src/arch/mips/isa/formats/util.isa --- a/src/arch/mips/isa/formats/util.isa Thu Nov 13 23:30:37 2008 -0800 +++ b/src/arch/mips/isa/formats/util.isa Fri Nov 14 04:55:30 2008 -0800 @@ -62,7 +62,7 @@ if mem_flags: mem_flags = [ 'Request::%s' % flag for flag in mem_flags ] - s = '\n\tmemAccessFlags.reset(' + string.join(mem_flags, '|') + ');' + s = '\n\tmemAccessFlags = ' + string.join(mem_flags, '|') + ';' iop.constructor += s memacc_iop.constructor += s diff -r 342cbc20a188 -r 6b0f8306704b src/base/flags.hh --- a/src/base/flags.hh Thu Nov 13 23:30:37 2008 -0800 +++ b/src/base/flags.hh Fri Nov 14 04:55:30 2008 -0800 @@ -61,16 +61,14 @@ bool any() const { return _flags; } bool any(Type flags) const { return (_flags & flags); } - bool all() const { return (~_flags); } - bool all(Type flags) const { return (_flags & flags) != flags; } + bool all() const { return !(~_flags); } + bool all(Type flags) const { return (_flags & flags) == flags; } bool none() const { return _flags == 0; } bool none(Type flags) const { return (_flags & flags) == 0; } - bool exact(Type flags) const { return _flags = flags; } void clear() { _flags = 0; } void clear(Type flags) { _flags &= ~flags; } - void reset(Type flags) { _flags = flags;} void set(Type flags) { _flags |= flags; } - void set(Type f, bool val) { _flags = (_flags & f) | (val ? f : 0); } + void set(Type f, bool val) { _flags = (_flags & ~f) | (val ? f : 0); } void update(Type flags, Type mask) { diff -r 342cbc20a188 -r 6b0f8306704b src/mem/packet.hh --- a/src/mem/packet.hh Thu Nov 13 23:30:37 2008 -0800 +++ b/src/mem/packet.hh Fri Nov 14 04:55:30 2008 -0800 @@ -461,9 +461,12 @@ * supplied. */ Packet(Request *_req, MemCmd _cmd, NodeID _dest) - : cmd(_cmd), req(_req), data(NULL), addr(_req->paddr), - size(_req->size), dest(_dest), time(curTick), senderState(NULL) + : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), + addr(_req->paddr), size(_req->size), dest(_dest), time(curTick), + senderState(NULL) { + if (req->flags.any(Request::VALID_PADDR)) + flags.set(VALID_ADDR|VALID_SIZE); } /** @@ -472,10 +475,12 @@ * req. this allows for overriding the size/addr of the req. */ Packet(Request *_req, MemCmd _cmd, NodeID _dest, int _blkSize) - : cmd(_cmd), req(_req), data(NULL), + : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), dest(_dest), time(curTick), senderState(NULL) { + if (req->flags.any(Request::VALID_PADDR)) + flags.set(VALID_ADDR|VALID_SIZE); } /** @@ -544,13 +549,10 @@ assert(isRequest()); origCmd = cmd; cmd = cmd.responseCommand(); - if (flags.any(VALID_SRC)) { - dest = src; - flags.set(VALID_DST); - flags.clear(VALID_SRC); - } else { - flags.clear(VALID_DST); - } + + dest = src; + flags.set(VALID_DST, flags.any(VALID_SRC)); + flags.clear(VALID_SRC); } void @@ -690,7 +692,6 @@ if (flags.any(ARRAY_DATA)) delete [] data; else if (flags.any(DYNAMIC_DATA)) - delete data; flags.clear(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA); @@ -702,11 +703,13 @@ allocate() { if (data) { - assert(flags.none(STATIC_DATA|DYNAMIC_DATA)); - } else { - flags.set(DYNAMIC_DATA|ARRAY_DATA); - data = new uint8_t[getSize()]; + assert(flags.any(STATIC_DATA|DYNAMIC_DATA)); + return; } + + assert(flags.none(STATIC_DATA|DYNAMIC_DATA)); + flags.set(DYNAMIC_DATA|ARRAY_DATA); + data = new uint8_t[getSize()]; } diff -r 342cbc20a188 -r 6b0f8306704b src/mem/request.hh --- a/src/mem/request.hh Thu Nov 13 23:30:37 2008 -0800 +++ b/src/mem/request.hh Fri Nov 14 04:55:30 2008 -0800 @@ -53,6 +53,8 @@ class Request : public FastAlloc { + friend class Packet; + public: typedef uint32_t FlagsType; typedef ::Flags<FlagsType> Flags; @@ -455,8 +457,6 @@ return false; } - - friend class Packet; }; #endif // __MEM_REQUEST_HH__ _______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev