# As gcc and clang share many flags, do the common parts here
main.Append(CCFLAGS=['-pipe'])
main.Append(CCFLAGS=['-fno-strict-aliasing'])
- # Enable -Wall and then disable the few warnings that we
- # consistently violate
- main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
+ # Enable -Wall and -Wextra and then disable the few warnings that
+ # we consistently violate
+ main.Append(CCFLAGS=['-Wall', '-Wundef', '-Wextra',
+ '-Wno-sign-compare', '-Wno-unused-parameter'])
# We always compile using C++11
main.Append(CXXFLAGS=['-std=c++11'])
- # Add selected sanity checks from -Wextra
- main.Append(CXXFLAGS=['-Wmissing-field-initializers',
- '-Woverloaded-virtual'])
else:
print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal,
print "Don't know what compiler options to use for your compiler."
print 'Error: Unable to determine clang version.'
Exit(1)
- # clang has a few additional warnings that we disable,
- # tautological comparisons are allowed due to unsigned integers
- # being compared to constants that happen to be 0, and extraneous
+ # clang has a few additional warnings that we disable, extraneous
# parantheses are allowed due to Ruby's printing of the AST,
# finally self assignments are allowed as the generated CPU code
# is relying on this
- main.Append(CCFLAGS=['-Wno-tautological-compare',
- '-Wno-parentheses',
+ main.Append(CCFLAGS=['-Wno-parentheses',
'-Wno-self-assign',
# Some versions of libstdc++ (4.8?) seem to
# use struct hash and class hash
# If we are using clang, there are more flags to disable
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
# the wrapper
m4env = main.Clone()
if m4env['GCC']:
- m4env.Append(CCFLAGS=['-Wno-pointer-sign'])
- if compareVersions(m4env['GCC_VERSION'], '4.6') >= 0:
- m4env.Append(CCFLAGS=['-Wno-unused-but-set-variable',
- '-Wno-implicit-function-declaration'])
+ m4env.Append(CCFLAGS=['-Wno-pointer-sign',
+ '-Wno-unused-but-set-variable',
+ '-Wno-implicit-function-declaration',
+ '-Wno-override-init'])
if m4env['CLANG']:
m4env.Append(CCFLAGS=['-Wno-initializer-overrides', '-Wno-pointer-sign'])
# clang defaults to c99 (while gcc defaults to gnu89) and there is a
main.Prepend(CPPPATH=Dir('./include'))
nomali = main.Clone()
+nomali.Append(CCFLAGS=['-Wno-ignored-qualifiers'])
nomali_sources = [
"lib/gpu.cc",
# the SWIG generated code
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']:
# Depending on the SWIG version, we also need to supress
# warnings about uninitialized variables and missing field
swig_env.Append(CCFLAGS=['-Wno-uninitialized',
'-Wno-missing-field-initializers',
'-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
# and the command-line option before adding the compiler and
new_env.Append(LINKFLAGS='-fsanitize=undefined')
if env['CLANG']:
- swig_env.Append(CCFLAGS=[
- # Some versions of SWIG can return uninitialized values
- '-Wno-sometimes-uninitialized',
- # Register storage is requested in a lot of places in
- # SWIG-generated code.
- '-Wno-deprecated-register',
- ])
+ swig_env.Append(CCFLAGS=['-Wno-sometimes-uninitialized',
+ '-Wno-deprecated-register',
+ '-Wno-tautological-compare'])
# All supported clang versions have support for UBSan, so if
# asked to use it, append the compiler and linker flags.
namespace AlphaISA {
-typedef const Addr FaultVect;
+typedef Addr FaultVect;
class AlphaFault : public FaultBase
{
inline Addr PteAddr(Addr a) { return (a & PteMask) << PteShift; }
// 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
inline bool IsK0Seg(Addr a) { return K0SegBase <= a && a <= K0SegEnd; }
namespace ArmISA
{
-typedef const Addr FaultOffset;
+typedef Addr FaultOffset;
class ArmFault : public FaultBase
{
// We deliberately extend both the Cluster ID and CPU ID fields to allow
// for simulation of larger systems
assert((0 <= tc->cpuId()) && (tc->cpuId() < 256));
- assert((0 <= tc->socketId()) && (tc->socketId() < 65536));
+ assert(tc->socketId() < 65536);
if (arm_sys->multiThread) {
return 0x80000000 | // multiprocessor extensions available
tc->contextId();
namespace MipsISA
{
-typedef const Addr FaultVect;
+typedef Addr FaultVect;
enum ExcCode {
// A dummy value to use when the code isn't defined or doesn't matter.
0x3: decode OP_LO {
format DspHiLoOp {
0x2: shilo({{
- if (sext<6>(HILOSA) < 0) {
+ if ((int64_t)sext<6>(HILOSA) < 0) {
dspac = (uint64_t)dspac <<
-sext<6>(HILOSA);
} else {
}
}});
0x3: shilov({{
- if (sext<6>(Rs_sw<5:0>) < 0) {
+ if ((int64_t)sext<6>(Rs_sw<5:0>) < 0) {
dspac = (uint64_t)dspac <<
-sext<6>(Rs_sw<5:0>);
} else {
}});
0x43: FpUnimpl::fmovq_fcc1();
0x45: fmovrslez({{
- if (Rs1 <= 0)
+ if ((int64_t)Rs1 <= 0)
Frds = Frs2s;
else
Frds = Frds;
}});
0x46: fmovrdlez({{
- if (Rs1 <= 0)
+ if ((int64_t)Rs1 <= 0)
Frd = Frs2;
else
Frd = Frd;
}});
0x57: FpUnimpl::fcmpeq();
0x65: fmovrslz({{
- if (Rs1 < 0)
+ if ((int64_t)Rs1 < 0)
Frds = Frs2s;
else
Frds = Frds;
}});
0x66: fmovrdlz({{
- if (Rs1 < 0)
+ if ((int64_t)Rs1 < 0)
Frd = Frs2;
else
Frd = Frd;
}});
0xC3: FpUnimpl::fmovq_fcc3();
0xC5: fmovrsgz({{
- if (Rs1 > 0)
+ if ((int64_t)Rs1 > 0)
Frds = Frs2s;
else
Frds = Frds;
}});
0xC6: fmovrdgz({{
- if (Rs1 > 0)
+ if ((int64_t)Rs1 > 0)
Frd = Frs2;
else
Frd = Frd;
}});
0xC7: FpUnimpl::fmovrqgz();
0xE5: fmovrsgez({{
- if (Rs1 >= 0)
+ if ((int64_t)Rs1 >= 0)
Frds = Frs2s;
else
Frds = Frds;
}});
0xE6: fmovrdgez({{
- if (Rs1 >= 0)
+ if ((int64_t)Rs1 >= 0)
Frd = Frs2;
else
Frd = Frd;
"Bitfield ranges must be specified as <msb, lsb>");
public:
- operator const uint64_t () const
+ operator uint64_t () const
{
return this->getBits(first, last);
}
class BitfieldWO : public Bitfield<first, last>
{
private:
- operator const uint64_t () const;
+ operator uint64_t () const;
public:
using Bitfield<first, last>::operator=;
class SignedBitfield : public BitfieldBase<Type>
{
public:
- operator const int64_t () const
+ operator int64_t () const
{
return sext<first - last + 1>(this->getBits(first, last));
}
class SignedBitfieldWO : public SignedBitfield<first, last>
{
private:
- operator const int64_t () const;
+ operator int64_t () const;
public:
using SignedBitfield<first, last>::operator=;
//do so.
#define EndSubBitUnion(name) \
}; \
- inline operator const __DataType () const \
+ inline operator __DataType () const \
{ return __data; } \
\
- inline const __DataType operator = (const __DataType & _data) \
+ inline __DataType operator = (const __DataType & _data) \
{ return __data = _data;} \
} name;
void pcState(const TheISA::PCState &val) { pc = val; }
/** 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. */
- const Addr nextInstAddr() const { return pc.nextInstAddr(); }
+ Addr nextInstAddr() const { return pc.nextInstAddr(); }
/**Read the micro PC of this instruction. */
- const Addr microPC() const { return pc.microPC(); }
+ Addr microPC() const { return pc.microPC(); }
bool readPredicate()
{
/**
* Read the counter's value.
*/
- const uint8_t read() const
+ uint8_t read() const
{ return counter; }
private:
if (own_reg_dep == reg_dep) {
// If register dependency is found, make it zero and return true
own_reg_dep = 0;
+ assert(numRegDep > 0);
--numRegDep;
- assert(numRegDep >= 0);
DPRINTFR(TraceCPUData, "\tFor %lli: Marking register dependency %lli "
"done.\n", seqNum, reg_dep);
return true;
if (own_rob_dep == rob_dep) {
// If the rob dependency is found, make it zero and return true
own_rob_dep = 0;
+ assert(numRobDep > 0);
--numRobDep;
- assert(numRobDep >= 0);
DPRINTFR(TraceCPUData, "\tFor %lli: Marking ROB dependency %lli "
"done.\n", seqNum, rob_dep);
return true;
}
/** 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
class PixelPump : public BasePixelPump
void clearInterrupts(uint16_t ints) { setInterrupts(rawInt & ~ints, imsc); }
/** 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 */
EventWrapper<Pl011, &Pl011::generateInterrupt> intEvent;
packet->length = data_len;
memcpy(packet->data, data, data_len);
+ assert(buffer_offset >= data_len + sizeof(uint32_t));
buffer_offset -= data_len + sizeof(uint32_t);
- assert(buffer_offset >= 0);
if (buffer_offset > 0) {
memmove(buffer, data + data_len, buffer_offset);
data_len = ntohl(*(uint32_t *)buffer);
/* configuration register */
enum ConfigurationRegisters {
+ CFGR_ZERO = 0x00000000,
CFGR_LNKSTS = 0x80000000,
CFGR_SPDSTS = 0x60000000,
CFGR_SPDSTS1 = 0x40000000,
SPDSTS_POLARITY(int lnksts)
{
return (CFGR_SPDSTS1 | CFGR_SPDSTS0 | CFGR_DUPSTS |
- (lnksts ? CFGR_LNKSTS : 0));
+ (lnksts ? CFGR_LNKSTS : CFGR_ZERO));
}
#endif /* __DEV_NS_GIGE_REG_H__ */
unsigned
reserve(unsigned len = 0)
{
+ assert(avail() >= len);
_reserved += len;
- assert(avail() >= 0);
return _reserved;
}
{
Addr accessAddr = pkt->getAddr() - iobManAddr;
- if (accessAddr >= IntManAddr && accessAddr < IntManAddr + IntManSize) {
+ assert(IntManAddr == 0);
+ if (accessAddr < IntManAddr + IntManSize) {
int index = (accessAddr - IntManAddr) >> 3;
uint64_t data = intMan[index].cpu << 8 | intMan[index].vector << 0;
pkt->set(data);
int index;
uint64_t data;
- if (accessAddr >= IntManAddr && accessAddr < IntManAddr + IntManSize) {
+ assert(IntManAddr == 0);
+ if (accessAddr < IntManAddr + IntManSize) {
index = (accessAddr - IntManAddr) >> 3;
data = pkt->get<uint64_t>();
intMan[index].cpu = bits(data,12,8);
if (data_fd < 0)
panic("Terminal not properly attached.\n");
- size_t ret;
+ ssize_t ret;
do {
ret = ::read(data_fd, buf, len);
} while (ret == -1 && errno == EINTR);
bool isPrint() const { return testCmdAttrib(IsPrint); }
bool isFlush() const { return testCmdAttrib(IsFlush); }
- const Command
+ Command
responseCommand() const
{
return commandInfo[cmd].response;
* bit 3 - read-write | read-only
*/
enum MappingFlags : uint32_t {
+ Zero = 0,
Clobber = 1,
NotPresent = 2,
Uncacheable = 4,
void
setPhys(Addr paddr, unsigned size, Flags flags, MasterID mid, Tick time)
{
- assert(size >= 0);
_paddr = paddr;
_size = size;
_time = time;
void init();
const Params *params() const { return (const Params *)_params; }
- const NodeID getVersion() const { return m_machineID.getNum(); }
- const MachineType getType() const { return m_machineID.getType(); }
+ NodeID getVersion() const { return m_machineID.getNum(); }
+ MachineType getType() const { return m_machineID.getType(); }
void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; }
Tick delta = curTime - m_LastEnqueueTime;
m_DelayedTicks += delta;
}
- const Tick getDelayedTicks() const {return m_DelayedTicks;}
+ Tick getDelayedTicks() const {return m_DelayedTicks;}
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; }
uint64_t getMsgCounter() const { return m_msg_counter; }
// getBank returns an integer that is unique for each
// bank across this memory controller.
-const int
+int
RubyMemoryControl::getBank(const Addr addr) const
{
int dimm = (addr >> m_dimm_bit_0) & (m_dimms_per_channel - 1);
+ bank;
}
-const int
+int
RubyMemoryControl::getRank(const Addr addr) const
{
int bank = getBank(addr);
// getRank returns an integer that is unique for each rank
// and independent of individual bank.
-const int
+int
RubyMemoryControl::getRank(int bank) const
{
int rank = (bank / m_banks_per_rank);
}
// Not used!
-const int
+int
RubyMemoryControl::getChannel(const Addr addr) const
{
assert(false);
}
// Not used!
-const int
+int
RubyMemoryControl::getRow(const Addr addr) const
{
assert(false);
void print(std::ostream& out) const override;
void regStats() override;
- const int getBank(const Addr addr) const;
- const int getRank(const Addr addr) const;
+ int getBank(const Addr addr) const;
+ int getRank(const Addr addr) const;
// not used in Ruby memory controller
- const int getChannel(const Addr addr) const;
- const int getRow(const Addr addr) const;
+ int getChannel(const Addr addr) const;
+ int getRow(const Addr addr) const;
//added by SS
int getBanksPerRank() { return m_banks_per_rank; };
private:
void enqueueToDirectory(MemoryNode *req, Cycles latency);
- const int getRank(int bank) const;
+ int getRank(int bank) const;
bool queueReady(int bank);
void issueRequest(int bank);
bool issueRefresh(int bank);
SimpleMemory *getPhysMem() { return m_phys_mem; }
Cycles getStartCycle() { return m_start_cycle; }
- const bool getAccessBackingStore() { return m_access_backing_store; }
+ bool getAccessBackingStore() { return m_access_backing_store; }
// Public Methods
Profiler*
{
int npages = divCeil(size, (int64_t)PageBytes);
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
Process::map(Addr vaddr, Addr paddr, int size, bool cacheable)
{
pTable->map(vaddr, paddr, size,
- cacheable ? 0 : PageTableBase::Uncacheable);
+ cacheable ? PageTableBase::Zero : PageTableBase::Uncacheable);
return true;
}
Tick repeat = 0);
const std::string getCause() const { return cause; }
- const int getCode() const { return code; }
+ int getCode() const { return code; }
void process(); // process event
LocalSimLoopExitEvent(const std::string &_cause, int c, Tick repeat = 0);
const std::string getCause() const { return cause; }
- const int getCode() const { return code; }
+ int getCode() const { return code; }
void process() override; // process event
void setCount(int _count) { count = _count; }
- const int getCount() const { return count; }
+ int getCount() const { return count; }
};
//