Skip to content

Commit

Permalink
fix: re-format all files
Browse files Browse the repository at this point in the history
fix: clang-format BPWarm component

fix: clang-format CMPCache component

fix: clang-format Cache component

fix: clang-format CommonQEMU component

fix: clang-format Decoder component

fix: clang-format DecoupledFeederQEMU component

fix: clang-format FastCache component

fix: clang-format FastCMPCache component

fix: clang-format FastMemoryLoopBack component

fix: clang-format FetchAddressGenerate component

fix: clang-format MMU component

fix: clang-format MTManager component

fix: clang-format MagicBreakQEMU component

fix: clang-format MemoryLoopback component

fix: clang-format Network and Nic component

fix: clang-format SpatialPrefetcher component

fix: clang-format SplitDestinationMapper component

fix: clang-format TLBControllers component

fix: clang-format MemoryMap component

fix: clang-format TraceTrackerQEMU component

fix: clang-format uArch component

fix: clang-format uFetch component

fix: clang-format Dummy component

fix: clang-format basic core structure

fix: clang-format core/components structure

fix: clang-format core/debug structure

fix: clang-format core/stats structure

fix: clang-format core/perf structure

fix: clang-format core/aux_ structure

fix: clang-format core/boost structure

fix: clang-format core/debug/aux_ structure

fix: clang-format core/qemu structure

fix: clang-format core/target structure

fix: clang-format layout structure
  • Loading branch information
branylagaffe committed May 27, 2024
1 parent 38d56af commit 8cdfe5f
Show file tree
Hide file tree
Showing 356 changed files with 80,660 additions and 77,018 deletions.
377 changes: 185 additions & 192 deletions components/BPWarm/BPWarmImpl.cpp

Large diffs are not rendered by default.

309 changes: 150 additions & 159 deletions components/CMPCache/AbstractArray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,142 +46,134 @@
#ifndef _ABSTRACT_ARRAY_HPP
#define _ABSTRACT_ARRAY_HPP

#include <exception>
#include <iostream>
#include <limits.h>
#include <stdlib.h>

#include <boost/throw_exception.hpp>

#include <components/CMPCache/CMPCacheInfo.hpp>
#include <components/CMPCache/CacheState.hpp>
#include <core/debug/debug.hpp>
#include <core/target.hpp>
#include <core/types.hpp>

#include <components/CMPCache/CMPCacheInfo.hpp>
#include <components/CMPCache/CacheState.hpp>
#include <exception>
#include <iostream>
#include <limits.h>
#include <stdlib.h>

namespace nCMPCache {

typedef Flexus::SharedTypes::PhysicalMemoryAddress MemoryAddress;

typedef uint32_t BlockOffset;

class InvalidCacheAccessException : public std::exception {};
class InvalidCacheAccessException : public std::exception
{};

// The output of a cache lookup
// derived from counted_base so we work with intrusive_ptr
template <typename _State> class AbstractArrayLookupResult : public boost::counted_base {
public:
virtual ~AbstractArrayLookupResult() {
}
AbstractArrayLookupResult() {
}

virtual const _State &state(void) const = 0;
virtual bool setState(const _State &aNewState) = 0;
virtual void setProtected(bool val) = 0;
virtual bool isProtected() const = 0;
virtual void setPrefetched(bool val) = 0;
virtual void setLocked(bool val) = 0;

virtual bool hit(void) const = 0;
virtual bool miss(void) const = 0;
virtual bool found(void) const = 0;
virtual bool valid(void) const = 0;

virtual MemoryAddress blockAddress(void) const = 0;
template<typename _State>
class AbstractArrayLookupResult : public boost::counted_base
{
public:
virtual ~AbstractArrayLookupResult() {}
AbstractArrayLookupResult() {}

virtual const _State& state(void) const = 0;
virtual bool setState(const _State& aNewState) = 0;
virtual void setProtected(bool val) = 0;
virtual bool isProtected() const = 0;
virtual void setPrefetched(bool val) = 0;
virtual void setLocked(bool val) = 0;

virtual bool hit(void) const = 0;
virtual bool miss(void) const = 0;
virtual bool found(void) const = 0;
virtual bool valid(void) const = 0;

virtual MemoryAddress blockAddress(void) const = 0;

}; // class AbstractArrayLookupResult

template <typename _State> class AbstractArray {
public:
virtual ~AbstractArray() {
}
AbstractArray() {
}

typedef boost::intrusive_ptr<AbstractArrayLookupResult<_State>> LookupResult_p;

// Main array lookup function
virtual LookupResult_p operator[](const MemoryAddress &anAddress) = 0;

virtual LookupResult_p allocate(LookupResult_p lookup, const MemoryAddress &anAddress) = 0;

virtual bool recordAccess(LookupResult_p lookup) = 0;
virtual void invalidateBlock(LookupResult_p lookup) = 0;

// Checkpoint reading/writing functions
virtual bool saveState(std::ostream &s) = 0;
virtual bool loadState(std::istream &s, int32_t anIndex) = 0;

// Addressing helper functions
MemoryAddress blockAddress(MemoryAddress const &anAddress) const {
return MemoryAddress(anAddress & ~(blockOffsetMask));
}

BlockOffset blockOffset(MemoryAddress const &anAddress) const {
return BlockOffset(anAddress & blockOffsetMask);
}

virtual uint32_t freeEvictionResources() const {
return UINT_MAX;
}
virtual bool evictionResourcePressure() const {
return false;
}
virtual bool evictionResourcesAvailable() const {
return true;
}
virtual bool evictionResourcesEmpty() const {
return true;
}
virtual void reserveEvictionResource(int32_t n) {
}
virtual void unreserveEvictionResource(int32_t n) {
}
virtual std::pair<_State, MemoryAddress> getPreemptiveEviction() = 0;

virtual bool sameSet(MemoryAddress a, MemoryAddress b) {
return false;
}
virtual std::list<MemoryAddress> getSetTags(MemoryAddress addr) {
DBG_Assert(false, (<< "Derived class does not implement getSetTags() function."));
return std::list<MemoryAddress>();
}

virtual bool setAlmostFull(LookupResult_p lookup, MemoryAddress const &anAddress) const {
return true; // Default always returns true. Proper behaviour can be
// definied in derived classes when required
}

virtual bool lockedVictimAvailable(LookupResult_p lookup, MemoryAddress const &anAddress) const {
return false; // Default always returns false. Proper behaviour can be
// definied in derived classes when required
}

virtual bool victimAvailable(LookupResult_p lookup, MemoryAddress const &anAddress) const {
return false; // Default always returns false. Proper behaviour can be
// definied in derived classes when required
}

virtual LookupResult_p replaceLockedBlock(LookupResult_p lookup, MemoryAddress const &anAddress) {
DBG_Assert(false, (<< "Derived class does not implement replaceLockedBlock() function."));
return nullptr;
}
template<typename _State>
class AbstractArray
{
public:
virtual ~AbstractArray() {}
AbstractArray() {}

typedef boost::intrusive_ptr<AbstractArrayLookupResult<_State>> LookupResult_p;

virtual void setLockedThreshold(int32_t threshold) {
DBG_Assert(theLockedThreshold > 0);
theLockedThreshold = threshold;
}
// Main array lookup function
virtual LookupResult_p operator[](const MemoryAddress& anAddress) = 0;

virtual uint32_t globalCacheSets() {
DBG_Assert(false, (<< "Derived class does not implement globalCacheSets() function."));
return 0;
}
virtual LookupResult_p allocate(LookupResult_p lookup, const MemoryAddress& anAddress) = 0;

protected:
MemoryAddress blockOffsetMask;
int32_t theLockedThreshold;
virtual bool recordAccess(LookupResult_p lookup) = 0;
virtual void invalidateBlock(LookupResult_p lookup) = 0;

// Checkpoint reading/writing functions
virtual bool saveState(std::ostream& s) = 0;
virtual bool loadState(std::istream& s, int32_t anIndex) = 0;

// Addressing helper functions
MemoryAddress blockAddress(MemoryAddress const& anAddress) const
{
return MemoryAddress(anAddress & ~(blockOffsetMask));
}

BlockOffset blockOffset(MemoryAddress const& anAddress) const { return BlockOffset(anAddress & blockOffsetMask); }

virtual uint32_t freeEvictionResources() const { return UINT_MAX; }
virtual bool evictionResourcePressure() const { return false; }
virtual bool evictionResourcesAvailable() const { return true; }
virtual bool evictionResourcesEmpty() const { return true; }
virtual void reserveEvictionResource(int32_t n) {}
virtual void unreserveEvictionResource(int32_t n) {}
virtual std::pair<_State, MemoryAddress> getPreemptiveEviction() = 0;

virtual bool sameSet(MemoryAddress a, MemoryAddress b) { return false; }
virtual std::list<MemoryAddress> getSetTags(MemoryAddress addr)
{
DBG_Assert(false, (<< "Derived class does not implement getSetTags() function."));
return std::list<MemoryAddress>();
}

virtual bool setAlmostFull(LookupResult_p lookup, MemoryAddress const& anAddress) const
{
return true; // Default always returns true. Proper behaviour can be
// definied in derived classes when required
}

virtual bool lockedVictimAvailable(LookupResult_p lookup, MemoryAddress const& anAddress) const
{
return false; // Default always returns false. Proper behaviour can be
// definied in derived classes when required
}

virtual bool victimAvailable(LookupResult_p lookup, MemoryAddress const& anAddress) const
{
return false; // Default always returns false. Proper behaviour can be
// definied in derived classes when required
}

virtual LookupResult_p replaceLockedBlock(LookupResult_p lookup, MemoryAddress const& anAddress)
{
DBG_Assert(false, (<< "Derived class does not implement replaceLockedBlock() function."));
return nullptr;
}

virtual void setLockedThreshold(int32_t threshold)
{
DBG_Assert(theLockedThreshold > 0);
theLockedThreshold = threshold;
}

virtual uint32_t globalCacheSets()
{
DBG_Assert(false, (<< "Derived class does not implement globalCacheSets() function."));
return 0;
}

protected:
MemoryAddress blockOffsetMask;
int32_t theLockedThreshold;

}; // class AbstractArray

Expand All @@ -204,53 +196,52 @@ namespace nCMPCache {
* that describe a configuration appropriate for that type
*
*/
template <typename _State, const _State &_Default>
AbstractArray<_State> *constructArray(std::string &anArrayConfiguration, CMPCacheInfo &theInfo,
int32_t theBlockSize) {
std::string &args = anArrayConfiguration;

// First, extract the Name of the type of array to consruct
std::string::size_type loc = args.find(':', 0);
std::string name = args.substr(0, loc);
if (loc != std::string::npos) {
args = args.substr(loc + 1);
} else {
args = "";
}

// Now create a list of key,value pairs
std::list<std::pair<std::string, std::string>> arg_list;
std::string key;
std::string value;
std::string::size_type pos = 0;
do {
pos = args.find(':', 0);
std::string cur_arg = args.substr(0, pos);
std::string::size_type equal_pos = cur_arg.find('=', 0);
if (equal_pos == std::string::npos) {
key = cur_arg;
value = "1";
template<typename _State, const _State& _Default>
AbstractArray<_State>*
constructArray(std::string& anArrayConfiguration, CMPCacheInfo& theInfo, int32_t theBlockSize)
{
std::string& args = anArrayConfiguration;

// First, extract the Name of the type of array to consruct
std::string::size_type loc = args.find(':', 0);
std::string name = args.substr(0, loc);
if (loc != std::string::npos) {
args = args.substr(loc + 1);
} else {
key = cur_arg.substr(0, equal_pos);
value = cur_arg.substr(equal_pos + 1);
args = "";
}
arg_list.push_back(std::make_pair(key, value));

if (pos != std::string::npos) {
args = args.substr(pos + 1);
// Now create a list of key,value pairs
std::list<std::pair<std::string, std::string>> arg_list;
std::string key;
std::string value;
std::string::size_type pos = 0;
do {
pos = args.find(':', 0);
std::string cur_arg = args.substr(0, pos);
std::string::size_type equal_pos = cur_arg.find('=', 0);
if (equal_pos == std::string::npos) {
key = cur_arg;
value = "1";
} else {
key = cur_arg.substr(0, equal_pos);
value = cur_arg.substr(equal_pos + 1);
}
arg_list.push_back(std::make_pair(key, value));

if (pos != std::string::npos) { args = args.substr(pos + 1); }
} while (pos != std::string::npos);

// Now construct an array of the appropriate type
// BlockSize is always passed separately to avoid specifying it more than once
if (name == "std" || name == "Std" || name == "STD") {
return new StdArray<_State, _Default>(theInfo, theBlockSize, arg_list);
} else if (name == "RegionTracker" || name == "RT" || name == "rt") {
return new RTArray<_State, _Default>(theInfo, theBlockSize, arg_list);
}
} while (pos != std::string::npos);

// Now construct an array of the appropriate type
// BlockSize is always passed separately to avoid specifying it more than once
if (name == "std" || name == "Std" || name == "STD") {
return new StdArray<_State, _Default>(theInfo, theBlockSize, arg_list);
} else if (name == "RegionTracker" || name == "RT" || name == "rt") {
return new RTArray<_State, _Default>(theInfo, theBlockSize, arg_list);
}

DBG_Assert(false, (<< "Failed to create Instance of '" << name << "'"));
return nullptr;

DBG_Assert(false, (<< "Failed to create Instance of '" << name << "'"));
return nullptr;
}

}; // namespace nCMPCache
Expand Down
Loading

0 comments on commit 8cdfe5f

Please sign in to comment.