scons: Enable -Wextra by default

Make best use of the compiler, and enable -Wextra as well as
-Wall. There are a few issues that had to be resolved, but they are
all trivial.
This commit is contained in:
Andreas Hansson 2016-01-11 05:52:20 -05:00
parent 7661f1c2bf
commit 12eb034378
33 changed files with 80 additions and 87 deletions

View file

@ -554,14 +554,12 @@ if main['GCC'] or main['CLANG']:
# As gcc and clang share many flags, do the common parts here # As gcc and clang share many flags, do the common parts here
main.Append(CCFLAGS=['-pipe']) main.Append(CCFLAGS=['-pipe'])
main.Append(CCFLAGS=['-fno-strict-aliasing']) main.Append(CCFLAGS=['-fno-strict-aliasing'])
# Enable -Wall and then disable the few warnings that we # Enable -Wall and -Wextra and then disable the few warnings that
# consistently violate # we consistently violate
main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef']) main.Append(CCFLAGS=['-Wall', '-Wundef', '-Wextra',
'-Wno-sign-compare', '-Wno-unused-parameter'])
# We always compile using C++11 # We always compile using C++11
main.Append(CXXFLAGS=['-std=c++11']) main.Append(CXXFLAGS=['-std=c++11'])
# Add selected sanity checks from -Wextra
main.Append(CXXFLAGS=['-Wmissing-field-initializers',
'-Woverloaded-virtual'])
else: else:
print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal, print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal,
print "Don't know what compiler options to use for your compiler." print "Don't know what compiler options to use for your compiler."
@ -656,14 +654,11 @@ elif main['CLANG']:
print 'Error: Unable to determine clang version.' print 'Error: Unable to determine clang version.'
Exit(1) Exit(1)
# clang has a few additional warnings that we disable, # clang has a few additional warnings that we disable, extraneous
# tautological comparisons are allowed due to unsigned integers
# being compared to constants that happen to be 0, and extraneous
# parantheses are allowed due to Ruby's printing of the AST, # parantheses are allowed due to Ruby's printing of the AST,
# finally self assignments are allowed as the generated CPU code # finally self assignments are allowed as the generated CPU code
# is relying on this # is relying on this
main.Append(CCFLAGS=['-Wno-tautological-compare', main.Append(CCFLAGS=['-Wno-parentheses',
'-Wno-parentheses',
'-Wno-self-assign', '-Wno-self-assign',
# Some versions of libstdc++ (4.8?) seem to # Some versions of libstdc++ (4.8?) seem to
# use struct hash and class hash # use struct hash and class hash

View file

@ -77,7 +77,8 @@ dramenv.Append(CCFLAGS=['-Wno-unused-value'])
# If we are using clang, there are more flags to disable # If we are using clang, there are more flags to disable
if main['CLANG']: if main['CLANG']:
dramenv.Append(CCFLAGS=['-Wno-unused-private-field']) dramenv.Append(CCFLAGS=['-Wno-unused-private-field',
'-Wno-tautological-undefined-compare'])
# Tell DRAMSim2 to not store any data as this is already covered by # Tell DRAMSim2 to not store any data as this is already covered by
# the wrapper # the wrapper

View file

@ -93,10 +93,10 @@ ElfFile('libelf_msize.c')
m4env = main.Clone() m4env = main.Clone()
if m4env['GCC']: if m4env['GCC']:
m4env.Append(CCFLAGS=['-Wno-pointer-sign']) m4env.Append(CCFLAGS=['-Wno-pointer-sign',
if compareVersions(m4env['GCC_VERSION'], '4.6') >= 0: '-Wno-unused-but-set-variable',
m4env.Append(CCFLAGS=['-Wno-unused-but-set-variable', '-Wno-implicit-function-declaration',
'-Wno-implicit-function-declaration']) '-Wno-override-init'])
if m4env['CLANG']: if m4env['CLANG']:
m4env.Append(CCFLAGS=['-Wno-initializer-overrides', '-Wno-pointer-sign']) m4env.Append(CCFLAGS=['-Wno-initializer-overrides', '-Wno-pointer-sign'])
# clang defaults to c99 (while gcc defaults to gnu89) and there is a # clang defaults to c99 (while gcc defaults to gnu89) and there is a

View file

@ -42,6 +42,7 @@ Import('main')
main.Prepend(CPPPATH=Dir('./include')) main.Prepend(CPPPATH=Dir('./include'))
nomali = main.Clone() nomali = main.Clone()
nomali.Append(CCFLAGS=['-Wno-ignored-qualifiers'])
nomali_sources = [ nomali_sources = [
"lib/gpu.cc", "lib/gpu.cc",

View file

@ -1018,11 +1018,6 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
# the SWIG generated code # the SWIG generated code
swig_env.Append(CCFLAGS=['-Wno-unused-label', '-Wno-unused-value']) swig_env.Append(CCFLAGS=['-Wno-unused-label', '-Wno-unused-value'])
# Add additional warnings here that should not be applied to
# the SWIG generated code
new_env.Append(CXXFLAGS=['-Wmissing-declarations',
'-Wdelete-non-virtual-dtor'])
if env['GCC']: if env['GCC']:
# Depending on the SWIG version, we also need to supress # Depending on the SWIG version, we also need to supress
# warnings about uninitialized variables and missing field # warnings about uninitialized variables and missing field
@ -1030,7 +1025,8 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
swig_env.Append(CCFLAGS=['-Wno-uninitialized', swig_env.Append(CCFLAGS=['-Wno-uninitialized',
'-Wno-missing-field-initializers', '-Wno-missing-field-initializers',
'-Wno-unused-but-set-variable', '-Wno-unused-but-set-variable',
'-Wno-maybe-uninitialized']) '-Wno-maybe-uninitialized',
'-Wno-type-limits'])
# Only gcc >= 4.9 supports UBSan, so check both the version # Only gcc >= 4.9 supports UBSan, so check both the version
# and the command-line option before adding the compiler and # and the command-line option before adding the compiler and
@ -1041,13 +1037,9 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
new_env.Append(LINKFLAGS='-fsanitize=undefined') new_env.Append(LINKFLAGS='-fsanitize=undefined')
if env['CLANG']: if env['CLANG']:
swig_env.Append(CCFLAGS=[ swig_env.Append(CCFLAGS=['-Wno-sometimes-uninitialized',
# Some versions of SWIG can return uninitialized values '-Wno-deprecated-register',
'-Wno-sometimes-uninitialized', '-Wno-tautological-compare'])
# Register storage is requested in a lot of places in
# SWIG-generated code.
'-Wno-deprecated-register',
])
# All supported clang versions have support for UBSan, so if # All supported clang versions have support for UBSan, so if
# asked to use it, append the compiler and linker flags. # asked to use it, append the compiler and linker flags.

View file

@ -40,7 +40,7 @@
namespace AlphaISA { namespace AlphaISA {
typedef const Addr FaultVect; typedef Addr FaultVect;
class AlphaFault : public FaultBase class AlphaFault : public FaultBase
{ {

View file

@ -78,7 +78,7 @@ inline void startupCPU(ThreadContext *tc, int cpuId)
inline Addr PteAddr(Addr a) { return (a & PteMask) << PteShift; } inline Addr PteAddr(Addr a) { return (a & PteMask) << PteShift; }
// User Virtual // User Virtual
inline bool IsUSeg(Addr a) { return USegBase <= a && a <= USegEnd; } inline bool IsUSeg(Addr a) { assert(USegBase == 0); return a <= USegEnd; }
// Kernel Direct Mapped // Kernel Direct Mapped
inline bool IsK0Seg(Addr a) { return K0SegBase <= a && a <= K0SegEnd; } inline bool IsK0Seg(Addr a) { return K0SegBase <= a && a <= K0SegEnd; }

View file

@ -58,7 +58,7 @@
namespace ArmISA namespace ArmISA
{ {
typedef const Addr FaultOffset; typedef Addr FaultOffset;
class ArmFault : public FaultBase class ArmFault : public FaultBase
{ {

View file

@ -209,7 +209,7 @@ getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
// We deliberately extend both the Cluster ID and CPU ID fields to allow // We deliberately extend both the Cluster ID and CPU ID fields to allow
// for simulation of larger systems // for simulation of larger systems
assert((0 <= tc->cpuId()) && (tc->cpuId() < 256)); assert((0 <= tc->cpuId()) && (tc->cpuId() < 256));
assert((0 <= tc->socketId()) && (tc->socketId() < 65536)); assert(tc->socketId() < 65536);
if (arm_sys->multiThread) { if (arm_sys->multiThread) {
return 0x80000000 | // multiprocessor extensions available return 0x80000000 | // multiprocessor extensions available
tc->contextId(); tc->contextId();

View file

@ -45,7 +45,7 @@
namespace MipsISA namespace MipsISA
{ {
typedef const Addr FaultVect; typedef Addr FaultVect;
enum ExcCode { enum ExcCode {
// A dummy value to use when the code isn't defined or doesn't matter. // A dummy value to use when the code isn't defined or doesn't matter.

View file

@ -2404,7 +2404,7 @@ decode OPCODE_HI default Unknown::unknown() {
0x3: decode OP_LO { 0x3: decode OP_LO {
format DspHiLoOp { format DspHiLoOp {
0x2: shilo({{ 0x2: shilo({{
if (sext<6>(HILOSA) < 0) { if ((int64_t)sext<6>(HILOSA) < 0) {
dspac = (uint64_t)dspac << dspac = (uint64_t)dspac <<
-sext<6>(HILOSA); -sext<6>(HILOSA);
} else { } else {
@ -2413,7 +2413,7 @@ decode OPCODE_HI default Unknown::unknown() {
} }
}}); }});
0x3: shilov({{ 0x3: shilov({{
if (sext<6>(Rs_sw<5:0>) < 0) { if ((int64_t)sext<6>(Rs_sw<5:0>) < 0) {
dspac = (uint64_t)dspac << dspac = (uint64_t)dspac <<
-sext<6>(Rs_sw<5:0>); -sext<6>(Rs_sw<5:0>);
} else { } else {

View file

@ -669,13 +669,13 @@ decode OP default Unknown::unknown()
}}); }});
0x43: FpUnimpl::fmovq_fcc1(); 0x43: FpUnimpl::fmovq_fcc1();
0x45: fmovrslez({{ 0x45: fmovrslez({{
if (Rs1 <= 0) if ((int64_t)Rs1 <= 0)
Frds = Frs2s; Frds = Frs2s;
else else
Frds = Frds; Frds = Frds;
}}); }});
0x46: fmovrdlez({{ 0x46: fmovrdlez({{
if (Rs1 <= 0) if ((int64_t)Rs1 <= 0)
Frd = Frs2; Frd = Frs2;
else else
Frd = Frd; Frd = Frd;
@ -740,13 +740,13 @@ decode OP default Unknown::unknown()
}}); }});
0x57: FpUnimpl::fcmpeq(); 0x57: FpUnimpl::fcmpeq();
0x65: fmovrslz({{ 0x65: fmovrslz({{
if (Rs1 < 0) if ((int64_t)Rs1 < 0)
Frds = Frs2s; Frds = Frs2s;
else else
Frds = Frds; Frds = Frds;
}}); }});
0x66: fmovrdlz({{ 0x66: fmovrdlz({{
if (Rs1 < 0) if ((int64_t)Rs1 < 0)
Frd = Frs2; Frd = Frs2;
else else
Frd = Frd; Frd = Frd;
@ -792,26 +792,26 @@ decode OP default Unknown::unknown()
}}); }});
0xC3: FpUnimpl::fmovq_fcc3(); 0xC3: FpUnimpl::fmovq_fcc3();
0xC5: fmovrsgz({{ 0xC5: fmovrsgz({{
if (Rs1 > 0) if ((int64_t)Rs1 > 0)
Frds = Frs2s; Frds = Frs2s;
else else
Frds = Frds; Frds = Frds;
}}); }});
0xC6: fmovrdgz({{ 0xC6: fmovrdgz({{
if (Rs1 > 0) if ((int64_t)Rs1 > 0)
Frd = Frs2; Frd = Frs2;
else else
Frd = Frd; Frd = Frd;
}}); }});
0xC7: FpUnimpl::fmovrqgz(); 0xC7: FpUnimpl::fmovrqgz();
0xE5: fmovrsgez({{ 0xE5: fmovrsgez({{
if (Rs1 >= 0) if ((int64_t)Rs1 >= 0)
Frds = Frs2s; Frds = Frs2s;
else else
Frds = Frds; Frds = Frds;
}}); }});
0xE6: fmovrdgez({{ 0xE6: fmovrdgez({{
if (Rs1 >= 0) if ((int64_t)Rs1 >= 0)
Frd = Frs2; Frd = Frs2;
else else
Frd = Frd; Frd = Frd;

View file

@ -89,7 +89,7 @@ namespace BitfieldBackend
"Bitfield ranges must be specified as <msb, lsb>"); "Bitfield ranges must be specified as <msb, lsb>");
public: public:
operator const uint64_t () const operator uint64_t () const
{ {
return this->getBits(first, last); return this->getBits(first, last);
} }
@ -129,7 +129,7 @@ namespace BitfieldBackend
class BitfieldWO : public Bitfield<first, last> class BitfieldWO : public Bitfield<first, last>
{ {
private: private:
operator const uint64_t () const; operator uint64_t () const;
public: public:
using Bitfield<first, last>::operator=; using Bitfield<first, last>::operator=;
@ -148,7 +148,7 @@ namespace BitfieldBackend
class SignedBitfield : public BitfieldBase<Type> class SignedBitfield : public BitfieldBase<Type>
{ {
public: public:
operator const int64_t () const operator int64_t () const
{ {
return sext<first - last + 1>(this->getBits(first, last)); return sext<first - last + 1>(this->getBits(first, last));
} }
@ -188,7 +188,7 @@ namespace BitfieldBackend
class SignedBitfieldWO : public SignedBitfield<first, last> class SignedBitfieldWO : public SignedBitfield<first, last>
{ {
private: private:
operator const int64_t () const; operator int64_t () const;
public: public:
using SignedBitfield<first, last>::operator=; using SignedBitfield<first, last>::operator=;
@ -304,10 +304,10 @@ namespace BitfieldBackend
//do so. //do so.
#define EndSubBitUnion(name) \ #define EndSubBitUnion(name) \
}; \ }; \
inline operator const __DataType () const \ inline operator __DataType () const \
{ return __data; } \ { return __data; } \
\ \
inline const __DataType operator = (const __DataType & _data) \ inline __DataType operator = (const __DataType & _data) \
{ return __data = _data;} \ { return __data = _data;} \
} name; } name;

View file

@ -793,13 +793,13 @@ class BaseDynInst : public ExecContext, public RefCounted
void pcState(const TheISA::PCState &val) { pc = val; } void pcState(const TheISA::PCState &val) { pc = val; }
/** Read the PC of this instruction. */ /** Read the PC of this instruction. */
const Addr instAddr() const { return pc.instAddr(); } Addr instAddr() const { return pc.instAddr(); }
/** Read the PC of the next instruction. */ /** Read the PC of the next instruction. */
const Addr nextInstAddr() const { return pc.nextInstAddr(); } Addr nextInstAddr() const { return pc.nextInstAddr(); }
/**Read the micro PC of this instruction. */ /**Read the micro PC of this instruction. */
const Addr microPC() const { return pc.microPC(); } Addr microPC() const { return pc.microPC(); }
bool readPredicate() bool readPredicate()
{ {

View file

@ -105,7 +105,7 @@ class SatCounter
/** /**
* Read the counter's value. * Read the counter's value.
*/ */
const uint8_t read() const uint8_t read() const
{ return counter; } { return counter; }
private: private:

View file

@ -1337,8 +1337,8 @@ TraceCPU::ElasticDataGen::GraphNode::removeRegDep(NodeSeqNum reg_dep)
if (own_reg_dep == reg_dep) { if (own_reg_dep == reg_dep) {
// If register dependency is found, make it zero and return true // If register dependency is found, make it zero and return true
own_reg_dep = 0; own_reg_dep = 0;
assert(numRegDep > 0);
--numRegDep; --numRegDep;
assert(numRegDep >= 0);
DPRINTFR(TraceCPUData, "\tFor %lli: Marking register dependency %lli " DPRINTFR(TraceCPUData, "\tFor %lli: Marking register dependency %lli "
"done.\n", seqNum, reg_dep); "done.\n", seqNum, reg_dep);
return true; return true;
@ -1356,8 +1356,8 @@ TraceCPU::ElasticDataGen::GraphNode::removeRobDep(NodeSeqNum rob_dep)
if (own_rob_dep == rob_dep) { if (own_rob_dep == rob_dep) {
// If the rob dependency is found, make it zero and return true // If the rob dependency is found, make it zero and return true
own_rob_dep = 0; own_rob_dep = 0;
assert(numRobDep > 0);
--numRobDep; --numRobDep;
assert(numRobDep >= 0);
DPRINTFR(TraceCPUData, "\tFor %lli: Marking ROB dependency %lli " DPRINTFR(TraceCPUData, "\tFor %lli: Marking ROB dependency %lli "
"done.\n", seqNum, rob_dep); "done.\n", seqNum, rob_dep);
return true; return true;

View file

@ -316,7 +316,7 @@ class HDLcd: public AmbaDmaDevice
} }
/** Masked interrupt status register */ /** Masked interrupt status register */
const uint32_t intStatus() const { return int_rawstat & int_mask; } uint32_t intStatus() const { return int_rawstat & int_mask; }
protected: // Pixel output protected: // Pixel output
class PixelPump : public BasePixelPump class PixelPump : public BasePixelPump

View file

@ -110,7 +110,7 @@ class Pl011 : public Uart, public AmbaDevice
void clearInterrupts(uint16_t ints) { setInterrupts(rawInt & ~ints, imsc); } void clearInterrupts(uint16_t ints) { setInterrupts(rawInt & ~ints, imsc); }
/** Masked interrupt status register */ /** Masked interrupt status register */
const inline uint16_t maskInt() const { return rawInt & imsc; } inline uint16_t maskInt() const { return rawInt & imsc; }
/** Wrapper to create an event out of the thing */ /** Wrapper to create an event out of the thing */
EventWrapper<Pl011, &Pl011::generateInterrupt> intEvent; EventWrapper<Pl011, &Pl011::generateInterrupt> intEvent;

View file

@ -241,8 +241,8 @@ EtherTap::process(int revent)
packet->length = data_len; packet->length = data_len;
memcpy(packet->data, data, data_len); memcpy(packet->data, data, data_len);
assert(buffer_offset >= data_len + sizeof(uint32_t));
buffer_offset -= data_len + sizeof(uint32_t); buffer_offset -= data_len + sizeof(uint32_t);
assert(buffer_offset >= 0);
if (buffer_offset > 0) { if (buffer_offset > 0) {
memmove(buffer, data + data_len, buffer_offset); memmove(buffer, data + data_len, buffer_offset);
data_len = ntohl(*(uint32_t *)buffer); data_len = ntohl(*(uint32_t *)buffer);

View file

@ -93,6 +93,7 @@ enum ChipCommandRegister {
/* configuration register */ /* configuration register */
enum ConfigurationRegisters { enum ConfigurationRegisters {
CFGR_ZERO = 0x00000000,
CFGR_LNKSTS = 0x80000000, CFGR_LNKSTS = 0x80000000,
CFGR_SPDSTS = 0x60000000, CFGR_SPDSTS = 0x60000000,
CFGR_SPDSTS1 = 0x40000000, CFGR_SPDSTS1 = 0x40000000,
@ -395,7 +396,7 @@ static inline int
SPDSTS_POLARITY(int lnksts) SPDSTS_POLARITY(int lnksts)
{ {
return (CFGR_SPDSTS1 | CFGR_SPDSTS0 | CFGR_DUPSTS | return (CFGR_SPDSTS1 | CFGR_SPDSTS0 | CFGR_DUPSTS |
(lnksts ? CFGR_LNKSTS : 0)); (lnksts ? CFGR_LNKSTS : CFGR_ZERO));
} }
#endif /* __DEV_NS_GIGE_REG_H__ */ #endif /* __DEV_NS_GIGE_REG_H__ */

View file

@ -106,8 +106,8 @@ class PacketFifo
unsigned unsigned
reserve(unsigned len = 0) reserve(unsigned len = 0)
{ {
assert(avail() >= len);
_reserved += len; _reserved += len;
assert(avail() >= 0);
return _reserved; return _reserved;
} }

View file

@ -91,7 +91,8 @@ Iob::readIob(PacketPtr pkt)
{ {
Addr accessAddr = pkt->getAddr() - iobManAddr; Addr accessAddr = pkt->getAddr() - iobManAddr;
if (accessAddr >= IntManAddr && accessAddr < IntManAddr + IntManSize) { assert(IntManAddr == 0);
if (accessAddr < IntManAddr + IntManSize) {
int index = (accessAddr - IntManAddr) >> 3; int index = (accessAddr - IntManAddr) >> 3;
uint64_t data = intMan[index].cpu << 8 | intMan[index].vector << 0; uint64_t data = intMan[index].cpu << 8 | intMan[index].vector << 0;
pkt->set(data); pkt->set(data);
@ -186,7 +187,8 @@ Iob::writeIob(PacketPtr pkt)
int index; int index;
uint64_t data; uint64_t data;
if (accessAddr >= IntManAddr && accessAddr < IntManAddr + IntManSize) { assert(IntManAddr == 0);
if (accessAddr < IntManAddr + IntManSize) {
index = (accessAddr - IntManAddr) >> 3; index = (accessAddr - IntManAddr) >> 3;
data = pkt->get<uint64_t>(); data = pkt->get<uint64_t>();
intMan[index].cpu = bits(data,12,8); intMan[index].cpu = bits(data,12,8);

View file

@ -249,7 +249,7 @@ Terminal::read(uint8_t *buf, size_t len)
if (data_fd < 0) if (data_fd < 0)
panic("Terminal not properly attached.\n"); panic("Terminal not properly attached.\n");
size_t ret; ssize_t ret;
do { do {
ret = ::read(data_fd, buf, len); ret = ::read(data_fd, buf, len);
} while (ret == -1 && errno == EINTR); } while (ret == -1 && errno == EINTR);

View file

@ -215,7 +215,7 @@ class MemCmd
bool isPrint() const { return testCmdAttrib(IsPrint); } bool isPrint() const { return testCmdAttrib(IsPrint); }
bool isFlush() const { return testCmdAttrib(IsFlush); } bool isFlush() const { return testCmdAttrib(IsFlush); }
const Command Command
responseCommand() const responseCommand() const
{ {
return commandInfo[cmd].response; return commandInfo[cmd].response;

View file

@ -93,6 +93,7 @@ class PageTableBase : public Serializable
* bit 3 - read-write | read-only * bit 3 - read-write | read-only
*/ */
enum MappingFlags : uint32_t { enum MappingFlags : uint32_t {
Zero = 0,
Clobber = 1, Clobber = 1,
NotPresent = 2, NotPresent = 2,
Uncacheable = 4, Uncacheable = 4,

View file

@ -234,7 +234,6 @@ class Request
void void
setPhys(Addr paddr, unsigned size, Flags flags, MasterID mid, Tick time) setPhys(Addr paddr, unsigned size, Flags flags, MasterID mid, Tick time)
{ {
assert(size >= 0);
_paddr = paddr; _paddr = paddr;
_size = size; _size = size;
_time = time; _time = time;

View file

@ -65,8 +65,8 @@ class AbstractController : public MemObject, public Consumer
void init(); void init();
const Params *params() const { return (const Params *)_params; } const Params *params() const { return (const Params *)_params; }
const NodeID getVersion() const { return m_machineID.getNum(); } NodeID getVersion() const { return m_machineID.getNum(); }
const MachineType getType() const { return m_machineID.getType(); } MachineType getType() const { return m_machineID.getType(); }
void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; } void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; }

View file

@ -83,12 +83,12 @@ class Message
Tick delta = curTime - m_LastEnqueueTime; Tick delta = curTime - m_LastEnqueueTime;
m_DelayedTicks += delta; m_DelayedTicks += delta;
} }
const Tick getDelayedTicks() const {return m_DelayedTicks;} Tick getDelayedTicks() const {return m_DelayedTicks;}
void setLastEnqueueTime(const Tick& time) { m_LastEnqueueTime = time; } void setLastEnqueueTime(const Tick& time) { m_LastEnqueueTime = time; }
const Tick getLastEnqueueTime() const {return m_LastEnqueueTime;} Tick getLastEnqueueTime() const {return m_LastEnqueueTime;}
const Tick& getTime() const { return m_time; } Tick getTime() const { return m_time; }
void setMsgCounter(uint64_t c) { m_msg_counter = c; } void setMsgCounter(uint64_t c) { m_msg_counter = c; }
uint64_t getMsgCounter() const { return m_msg_counter; } uint64_t getMsgCounter() const { return m_msg_counter; }

View file

@ -342,7 +342,7 @@ RubyMemoryControl::enqueueToDirectory(MemoryNode *req, Cycles latency)
// getBank returns an integer that is unique for each // getBank returns an integer that is unique for each
// bank across this memory controller. // bank across this memory controller.
const int int
RubyMemoryControl::getBank(const Addr addr) const RubyMemoryControl::getBank(const Addr addr) const
{ {
int dimm = (addr >> m_dimm_bit_0) & (m_dimms_per_channel - 1); int dimm = (addr >> m_dimm_bit_0) & (m_dimms_per_channel - 1);
@ -353,7 +353,7 @@ RubyMemoryControl::getBank(const Addr addr) const
+ bank; + bank;
} }
const int int
RubyMemoryControl::getRank(const Addr addr) const RubyMemoryControl::getRank(const Addr addr) const
{ {
int bank = getBank(addr); int bank = getBank(addr);
@ -364,7 +364,7 @@ RubyMemoryControl::getRank(const Addr addr) const
// getRank returns an integer that is unique for each rank // getRank returns an integer that is unique for each rank
// and independent of individual bank. // and independent of individual bank.
const int int
RubyMemoryControl::getRank(int bank) const RubyMemoryControl::getRank(int bank) const
{ {
int rank = (bank / m_banks_per_rank); int rank = (bank / m_banks_per_rank);
@ -373,7 +373,7 @@ RubyMemoryControl::getRank(int bank) const
} }
// Not used! // Not used!
const int int
RubyMemoryControl::getChannel(const Addr addr) const RubyMemoryControl::getChannel(const Addr addr) const
{ {
assert(false); assert(false);
@ -381,7 +381,7 @@ RubyMemoryControl::getChannel(const Addr addr) const
} }
// Not used! // Not used!
const int int
RubyMemoryControl::getRow(const Addr addr) const RubyMemoryControl::getRow(const Addr addr) const
{ {
assert(false); assert(false);

View file

@ -75,12 +75,12 @@ class RubyMemoryControl : public AbstractMemory, public Consumer
void print(std::ostream& out) const override; void print(std::ostream& out) const override;
void regStats() override; void regStats() override;
const int getBank(const Addr addr) const; int getBank(const Addr addr) const;
const int getRank(const Addr addr) const; int getRank(const Addr addr) const;
// not used in Ruby memory controller // not used in Ruby memory controller
const int getChannel(const Addr addr) const; int getChannel(const Addr addr) const;
const int getRow(const Addr addr) const; int getRow(const Addr addr) const;
//added by SS //added by SS
int getBanksPerRank() { return m_banks_per_rank; }; int getBanksPerRank() { return m_banks_per_rank; };
@ -92,7 +92,7 @@ class RubyMemoryControl : public AbstractMemory, public Consumer
private: private:
void enqueueToDirectory(MemoryNode *req, Cycles latency); void enqueueToDirectory(MemoryNode *req, Cycles latency);
const int getRank(int bank) const; int getRank(int bank) const;
bool queueReady(int bank); bool queueReady(int bank);
void issueRequest(int bank); void issueRequest(int bank);
bool issueRefresh(int bank); bool issueRefresh(int bank);

View file

@ -79,7 +79,7 @@ class RubySystem : public ClockedObject
SimpleMemory *getPhysMem() { return m_phys_mem; } SimpleMemory *getPhysMem() { return m_phys_mem; }
Cycles getStartCycle() { return m_start_cycle; } Cycles getStartCycle() { return m_start_cycle; }
const bool getAccessBackingStore() { return m_access_backing_store; } bool getAccessBackingStore() { return m_access_backing_store; }
// Public Methods // Public Methods
Profiler* Profiler*

View file

@ -290,7 +290,8 @@ Process::allocateMem(Addr vaddr, int64_t size, bool clobber)
{ {
int npages = divCeil(size, (int64_t)PageBytes); int npages = divCeil(size, (int64_t)PageBytes);
Addr paddr = system->allocPhysPages(npages); Addr paddr = system->allocPhysPages(npages);
pTable->map(vaddr, paddr, size, clobber ? PageTableBase::Clobber : 0); pTable->map(vaddr, paddr, size,
clobber ? PageTableBase::Clobber : PageTableBase::Zero);
} }
bool bool
@ -454,7 +455,7 @@ bool
Process::map(Addr vaddr, Addr paddr, int size, bool cacheable) Process::map(Addr vaddr, Addr paddr, int size, bool cacheable)
{ {
pTable->map(vaddr, paddr, size, pTable->map(vaddr, paddr, size,
cacheable ? 0 : PageTableBase::Uncacheable); cacheable ? PageTableBase::Zero : PageTableBase::Uncacheable);
return true; return true;
} }

View file

@ -66,7 +66,7 @@ class GlobalSimLoopExitEvent : public GlobalEvent
Tick repeat = 0); Tick repeat = 0);
const std::string getCause() const { return cause; } const std::string getCause() const { return cause; }
const int getCode() const { return code; } int getCode() const { return code; }
void process(); // process event void process(); // process event
@ -86,7 +86,7 @@ class LocalSimLoopExitEvent : public Event
LocalSimLoopExitEvent(const std::string &_cause, int c, Tick repeat = 0); LocalSimLoopExitEvent(const std::string &_cause, int c, Tick repeat = 0);
const std::string getCause() const { return cause; } const std::string getCause() const { return cause; }
const int getCode() const { return code; } int getCode() const { return code; }
void process() override; // process event void process() override; // process event
@ -111,7 +111,7 @@ class CountedDrainEvent : public Event
void setCount(int _count) { count = _count; } void setCount(int _count) { count = _count; }
const int getCount() const { return count; } int getCount() const { return count; }
}; };
// //