clangformat
Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
parent
fcdaf3f86c
commit
9b51c6e337
@ -35,7 +35,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
template <typename T> class array2d
|
template <typename T> class array2d
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
array2d() : m_width(0), m_height(0), m_size(0), data(nullptr){};
|
array2d() : m_width(0), m_height(0), m_size(0), data(nullptr) {};
|
||||||
array2d(int width, int height) : m_width(width), m_height(height), m_size(width * height)
|
array2d(int width, int height) : m_width(width), m_height(height), m_size(width * height)
|
||||||
{
|
{
|
||||||
data = new T[m_width * m_height]();
|
data = new T[m_width * m_height]();
|
||||||
@ -88,7 +88,7 @@ template <typename T> class array2d
|
|||||||
~array2d() { delete[] data; }
|
~array2d() { delete[] data; }
|
||||||
struct entry
|
struct entry
|
||||||
{
|
{
|
||||||
entry(int x, int y, T &value) : x(x), y(y), value(value){};
|
entry(int x, int y, T &value) : x(x), y(y), value(value) {};
|
||||||
int x, y;
|
int x, y;
|
||||||
T &value;
|
T &value;
|
||||||
};
|
};
|
||||||
@ -119,7 +119,7 @@ template <typename T> class array2d
|
|||||||
inline bool operator==(const iterator &other) const { return other.x == x && other.y == y; }
|
inline bool operator==(const iterator &other) const { return other.x == x && other.y == y; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
iterator(int x, int y, array2d<T> &base) : x(x), y(y), base(&base){};
|
iterator(int x, int y, array2d<T> &base) : x(x), y(y), base(&base) {};
|
||||||
int x, y;
|
int x, y;
|
||||||
array2d<T> *base;
|
array2d<T> *base;
|
||||||
friend class array2d;
|
friend class array2d;
|
||||||
|
@ -443,7 +443,7 @@ template <typename R> struct BaseArch : ArchAPI<R>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Flow methods
|
// Flow methods
|
||||||
virtual void assignArchInfo() override{};
|
virtual void assignArchInfo() override {};
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
// These structures are used to provide default implementations of bel/wire/pip binding. Arches might want to
|
// These structures are used to provide default implementations of bel/wire/pip binding. Arches might want to
|
||||||
|
@ -417,7 +417,7 @@ void Context::check() const
|
|||||||
namespace {
|
namespace {
|
||||||
struct FixupHierarchyWorker
|
struct FixupHierarchyWorker
|
||||||
{
|
{
|
||||||
FixupHierarchyWorker(Context *ctx) : ctx(ctx){};
|
FixupHierarchyWorker(Context *ctx) : ctx(ctx) {};
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ template <typename T> struct store_index
|
|||||||
{
|
{
|
||||||
int32_t m_index = -1;
|
int32_t m_index = -1;
|
||||||
store_index() = default;
|
store_index() = default;
|
||||||
explicit store_index(int32_t index) : m_index(index){};
|
explicit store_index(int32_t index) : m_index(index) {};
|
||||||
int32_t idx() const { return m_index; }
|
int32_t idx() const { return m_index; }
|
||||||
void set(int32_t index) { m_index = index; }
|
void set(int32_t index) { m_index = index; }
|
||||||
bool empty() const { return m_index == -1; }
|
bool empty() const { return m_index == -1; }
|
||||||
@ -64,7 +64,7 @@ template <typename T> class indexed_store
|
|||||||
friend class indexed_store<T>;
|
friend class indexed_store<T>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
slot() : next_free(std::numeric_limits<int32_t>::max()), active(false){};
|
slot() : next_free(std::numeric_limits<int32_t>::max()), active(false) {};
|
||||||
slot(slot &&other) : next_free(other.next_free), active(other.active)
|
slot(slot &&other) : next_free(other.next_free), active(other.active)
|
||||||
{
|
{
|
||||||
if (active)
|
if (active)
|
||||||
@ -180,7 +180,7 @@ template <typename T> class indexed_store
|
|||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
iterator(indexed_store *base, int32_t index) : base(base), index(index){};
|
iterator(indexed_store *base, int32_t index) : base(base), index(index) {};
|
||||||
inline bool operator!=(const iterator &other) const { return other.index != index; }
|
inline bool operator!=(const iterator &other) const { return other.index != index; }
|
||||||
inline bool operator==(const iterator &other) const { return other.index == index; }
|
inline bool operator==(const iterator &other) const { return other.index == index; }
|
||||||
inline iterator operator++()
|
inline iterator operator++()
|
||||||
@ -217,7 +217,7 @@ template <typename T> class indexed_store
|
|||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const_iterator(const indexed_store *base, int32_t index) : base(base), index(index){};
|
const_iterator(const indexed_store *base, int32_t index) : base(base), index(index) {};
|
||||||
inline bool operator!=(const const_iterator &other) const { return other.index != index; }
|
inline bool operator!=(const const_iterator &other) const { return other.index != index; }
|
||||||
inline bool operator==(const const_iterator &other) const { return other.index == index; }
|
inline bool operator==(const const_iterator &other) const { return other.index == index; }
|
||||||
inline const_iterator operator++()
|
inline const_iterator operator++()
|
||||||
@ -249,7 +249,7 @@ template <typename T> class indexed_store
|
|||||||
|
|
||||||
template <typename S> struct enumerated_item
|
template <typename S> struct enumerated_item
|
||||||
{
|
{
|
||||||
enumerated_item(int32_t index, T &value) : index(index), value(value){};
|
enumerated_item(int32_t index, T &value) : index(index), value(value) {};
|
||||||
store_index<std::remove_cv_t<S>> index;
|
store_index<std::remove_cv_t<S>> index;
|
||||||
S &value;
|
S &value;
|
||||||
};
|
};
|
||||||
@ -260,7 +260,7 @@ template <typename T> class indexed_store
|
|||||||
It base;
|
It base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enumerated_iterator(const It &base) : base(base){};
|
enumerated_iterator(const It &base) : base(base) {};
|
||||||
inline bool operator!=(const enumerated_iterator<It, S> &other) const { return other.base != base; }
|
inline bool operator!=(const enumerated_iterator<It, S> &other) const { return other.base != base; }
|
||||||
inline bool operator==(const enumerated_iterator<It, S> &other) const { return other.base == base; }
|
inline bool operator==(const enumerated_iterator<It, S> &other) const { return other.base == base; }
|
||||||
inline enumerated_iterator<It, S> operator++()
|
inline enumerated_iterator<It, S> operator++()
|
||||||
@ -279,7 +279,7 @@ template <typename T> class indexed_store
|
|||||||
|
|
||||||
template <typename It, typename S> struct enumerated_range
|
template <typename It, typename S> struct enumerated_range
|
||||||
{
|
{
|
||||||
enumerated_range(const It &begin, const It &end) : m_begin(begin), m_end(end){};
|
enumerated_range(const It &begin, const It &end) : m_begin(begin), m_end(end) {};
|
||||||
enumerated_iterator<It, S> m_begin, m_end;
|
enumerated_iterator<It, S> m_begin, m_end;
|
||||||
enumerated_iterator<It, S> begin() { return m_begin; }
|
enumerated_iterator<It, S> begin() { return m_begin; }
|
||||||
enumerated_iterator<It, S> end() { return m_end; }
|
enumerated_iterator<It, S> end() { return m_end; }
|
||||||
|
@ -78,9 +78,9 @@ struct GraphicElement
|
|||||||
|
|
||||||
float x1 = 0, y1 = 0, x2 = 0, y2 = 0, z = 0;
|
float x1 = 0, y1 = 0, x2 = 0, y2 = 0, z = 0;
|
||||||
std::string text;
|
std::string text;
|
||||||
GraphicElement(){};
|
GraphicElement() {};
|
||||||
GraphicElement(type_t type, style_t style, float x1, float y1, float x2, float y2, float z)
|
GraphicElement(type_t type, style_t style, float x1, float y1, float x2, float y2, float z)
|
||||||
: type(type), style(style), x1(x1), y1(y1), x2(x2), y2(y2), z(z){};
|
: type(type), style(style), x1(x1), y1(y1), x2(x2), y2(y2), z(z) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Loc
|
struct Loc
|
||||||
@ -100,7 +100,7 @@ struct BoundingBox
|
|||||||
int x0 = -1, y0 = -1, x1 = -1, y1 = -1;
|
int x0 = -1, y0 = -1, x1 = -1, y1 = -1;
|
||||||
|
|
||||||
BoundingBox() {}
|
BoundingBox() {}
|
||||||
BoundingBox(int x0, int y0, int x1, int y1) : x0(x0), y0(y0), x1(x1), y1(y1){};
|
BoundingBox(int x0, int y0, int x1, int y1) : x0(x0), y0(y0), x1(x1), y1(y1) {};
|
||||||
|
|
||||||
int distance(Loc loc) const
|
int distance(Loc loc) const
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ inline bool is_zero_delay(delay_t delay)
|
|||||||
// minimum and maximum delay
|
// minimum and maximum delay
|
||||||
struct DelayPair
|
struct DelayPair
|
||||||
{
|
{
|
||||||
DelayPair() : min_delay(0), max_delay(0){};
|
DelayPair() : min_delay(0), max_delay(0) {};
|
||||||
explicit DelayPair(delay_t delay) : min_delay(delay), max_delay(delay) {}
|
explicit DelayPair(delay_t delay) : min_delay(delay), max_delay(delay) {}
|
||||||
DelayPair(delay_t min_delay, delay_t max_delay) : min_delay(min_delay), max_delay(max_delay) {}
|
DelayPair(delay_t min_delay, delay_t max_delay) : min_delay(min_delay), max_delay(max_delay) {}
|
||||||
delay_t minDelay() const { return min_delay; }
|
delay_t minDelay() const { return min_delay; }
|
||||||
@ -287,7 +287,7 @@ struct PseudoCell
|
|||||||
virtual bool getDelay(IdString fromPort, IdString toPort, DelayQuad &delay) const = 0;
|
virtual bool getDelay(IdString fromPort, IdString toPort, DelayQuad &delay) const = 0;
|
||||||
virtual TimingPortClass getPortTimingClass(IdString port, int &clockInfoCount) const = 0;
|
virtual TimingPortClass getPortTimingClass(IdString port, int &clockInfoCount) const = 0;
|
||||||
virtual TimingClockingInfo getPortClockingInfo(IdString port, int index) const = 0;
|
virtual TimingClockingInfo getPortClockingInfo(IdString port, int index) const = 0;
|
||||||
virtual ~PseudoCell(){};
|
virtual ~PseudoCell() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RegionPlug : PseudoCell
|
struct RegionPlug : PseudoCell
|
||||||
|
@ -76,8 +76,8 @@ A pair that doesn't automatically become a tuple
|
|||||||
*/
|
*/
|
||||||
template <typename Ta, typename Tb> struct iter_pair
|
template <typename Ta, typename Tb> struct iter_pair
|
||||||
{
|
{
|
||||||
iter_pair(){};
|
iter_pair() {};
|
||||||
iter_pair(const Ta &first, const Tb &second) : first(first), second(second){};
|
iter_pair(const Ta &first, const Tb &second) : first(first), second(second) {};
|
||||||
Ta first;
|
Ta first;
|
||||||
Tb second;
|
Tb second;
|
||||||
};
|
};
|
||||||
|
@ -56,7 +56,7 @@ template <typename T, std::size_t N> class SSOArray
|
|||||||
const T *begin() const { return data(); }
|
const T *begin() const { return data(); }
|
||||||
const T *end() const { return data() + m_size; }
|
const T *end() const { return data() + m_size; }
|
||||||
|
|
||||||
SSOArray() : m_size(0){};
|
SSOArray() : m_size(0) {};
|
||||||
|
|
||||||
SSOArray(std::size_t size, const T &init = T()) : m_size(size)
|
SSOArray(std::size_t size, const T &init = T()) : m_size(size)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ struct SVGWriter
|
|||||||
std::ostream &out;
|
std::ostream &out;
|
||||||
float scale = 500.0;
|
float scale = 500.0;
|
||||||
bool hide_inactive = false;
|
bool hide_inactive = false;
|
||||||
SVGWriter(const Context *ctx, std::ostream &out) : ctx(ctx), out(out){};
|
SVGWriter(const Context *ctx, std::ostream &out) : ctx(ctx), out(out) {};
|
||||||
const char *get_stroke_colour(GraphicElement::style_t style)
|
const char *get_stroke_colour(GraphicElement::style_t style)
|
||||||
{
|
{
|
||||||
switch (style) {
|
switch (style) {
|
||||||
|
@ -27,8 +27,8 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
struct CellPortKey
|
struct CellPortKey
|
||||||
{
|
{
|
||||||
CellPortKey(){};
|
CellPortKey() {};
|
||||||
CellPortKey(IdString cell, IdString port) : cell(cell), port(port){};
|
CellPortKey(IdString cell, IdString port) : cell(cell), port(port) {};
|
||||||
explicit CellPortKey(const PortRef &pr)
|
explicit CellPortKey(const PortRef &pr)
|
||||||
{
|
{
|
||||||
NPNR_ASSERT(pr.cell != nullptr);
|
NPNR_ASSERT(pr.cell != nullptr);
|
||||||
@ -49,7 +49,7 @@ struct ClockDomainKey
|
|||||||
{
|
{
|
||||||
IdString clock;
|
IdString clock;
|
||||||
ClockEdge edge;
|
ClockEdge edge;
|
||||||
ClockDomainKey(IdString clock_net, ClockEdge edge) : clock(clock_net), edge(edge){};
|
ClockDomainKey(IdString clock_net, ClockEdge edge) : clock(clock_net), edge(edge) {};
|
||||||
// probably also need something here to deal with constraints
|
// probably also need something here to deal with constraints
|
||||||
inline bool is_async() const { return clock == IdString(); }
|
inline bool is_async() const { return clock == IdString(); }
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ typedef int domain_id_t;
|
|||||||
struct ClockDomainPairKey
|
struct ClockDomainPairKey
|
||||||
{
|
{
|
||||||
domain_id_t launch, capture;
|
domain_id_t launch, capture;
|
||||||
ClockDomainPairKey(domain_id_t launch, domain_id_t capture) : launch(launch), capture(capture){};
|
ClockDomainPairKey(domain_id_t launch, domain_id_t capture) : launch(launch), capture(capture) {};
|
||||||
inline bool operator==(const ClockDomainPairKey &other) const
|
inline bool operator==(const ClockDomainPairKey &other) const
|
||||||
{
|
{
|
||||||
return (launch == other.launch) && (capture == other.capture);
|
return (launch == other.launch) && (capture == other.capture);
|
||||||
@ -183,9 +183,9 @@ struct TimingAnalyser
|
|||||||
ClockEdge edge;
|
ClockEdge edge;
|
||||||
|
|
||||||
CellArc(ArcType type, IdString other_port, DelayQuad value)
|
CellArc(ArcType type, IdString other_port, DelayQuad value)
|
||||||
: type(type), other_port(other_port), value(value), edge(RISING_EDGE){};
|
: type(type), other_port(other_port), value(value), edge(RISING_EDGE) {};
|
||||||
CellArc(ArcType type, IdString other_port, DelayQuad value, ClockEdge edge)
|
CellArc(ArcType type, IdString other_port, DelayQuad value, ClockEdge edge)
|
||||||
: type(type), other_port(other_port), value(value), edge(edge){};
|
: type(type), other_port(other_port), value(value), edge(edge) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Timing data for every cell port
|
// Timing data for every cell port
|
||||||
@ -209,7 +209,7 @@ struct TimingAnalyser
|
|||||||
|
|
||||||
struct PerDomain
|
struct PerDomain
|
||||||
{
|
{
|
||||||
PerDomain(ClockDomainKey key) : key(key){};
|
PerDomain(ClockDomainKey key) : key(key) {};
|
||||||
ClockDomainKey key;
|
ClockDomainKey key;
|
||||||
// these are pairs (signal port; clock port)
|
// these are pairs (signal port; clock port)
|
||||||
std::vector<std::pair<CellPortKey, IdString>> startpoints, endpoints;
|
std::vector<std::pair<CellPortKey, IdString>> startpoints, endpoints;
|
||||||
@ -217,7 +217,7 @@ struct TimingAnalyser
|
|||||||
|
|
||||||
struct PerDomainPair
|
struct PerDomainPair
|
||||||
{
|
{
|
||||||
PerDomainPair(ClockDomainPairKey key) : key(key){};
|
PerDomainPair(ClockDomainPairKey key) : key(key) {};
|
||||||
ClockDomainPairKey key;
|
ClockDomainPairKey key;
|
||||||
DelayPair period{0};
|
DelayPair period{0};
|
||||||
delay_t worst_setup_slack, worst_hold_slack;
|
delay_t worst_setup_slack, worst_hold_slack;
|
||||||
|
@ -112,10 +112,10 @@ bool boolstr_or_default(const dict<KeyType, Property> &ct, const KeyType &key, b
|
|||||||
return def;
|
return def;
|
||||||
if (!found->second.is_string)
|
if (!found->second.is_string)
|
||||||
bool(found->second.as_int64());
|
bool(found->second.as_int64());
|
||||||
const char* str = found->second.as_string().c_str();
|
const char *str = found->second.as_string().c_str();
|
||||||
if(!strcmp(str, "0") || !strcasecmp(str, "false"))
|
if (!strcmp(str, "0") || !strcasecmp(str, "false"))
|
||||||
return false;
|
return false;
|
||||||
else if(!strcmp(str, "1") || !strcasecmp(str, "true"))
|
else if (!strcmp(str, "1") || !strcasecmp(str, "true"))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
log_error("Expecting bool-compatible value but got '%s'.\n", found->second.as_string().c_str());
|
log_error("Expecting bool-compatible value but got '%s'.\n", found->second.as_string().c_str());
|
||||||
@ -125,20 +125,18 @@ bool boolstr_or_default(const dict<KeyType, Property> &ct, const KeyType &key, b
|
|||||||
// Get a vector of bool from a map-style container, returning default if value is not found
|
// Get a vector of bool from a map-style container, returning default if value is not found
|
||||||
// Also tolerate string representation of vector for interoperability purposes
|
// Also tolerate string representation of vector for interoperability purposes
|
||||||
template <typename KeyType>
|
template <typename KeyType>
|
||||||
bool boolvec_populate(const dict<KeyType, Property> &ct, const KeyType &key, std::vector<bool>& vec)
|
bool boolvec_populate(const dict<KeyType, Property> &ct, const KeyType &key, std::vector<bool> &vec)
|
||||||
{
|
{
|
||||||
auto found = ct.find(key);
|
auto found = ct.find(key);
|
||||||
if (found == ct.end())
|
if (found == ct.end())
|
||||||
return false;
|
return false;
|
||||||
if (!found->second.is_string)
|
if (!found->second.is_string) {
|
||||||
{
|
|
||||||
size_t val = found->second.as_int64();
|
size_t val = found->second.as_int64();
|
||||||
for (size_t i = 0; i < vec.size(); ++i, val>>=1) {
|
for (size_t i = 0; i < vec.size(); ++i, val >>= 1) {
|
||||||
vec[i] = (val & 0x1) != 0;
|
vec[i] = (val & 0x1) != 0;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
const std::string &str = found->second.as_string();
|
||||||
const std::string& str = found->second.as_string();
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (auto it = str.crbegin(); it != str.crend() && i < vec.size(); ++i, ++it) {
|
for (auto it = str.crbegin(); it != str.crend() && i < vec.size(); ++i, ++it) {
|
||||||
vec[i] = *it == '1';
|
vec[i] = *it == '1';
|
||||||
@ -255,7 +253,7 @@ template <typename T, typename C = std::less<T>> struct TopoSort
|
|||||||
template <typename T> struct reversed_range_t
|
template <typename T> struct reversed_range_t
|
||||||
{
|
{
|
||||||
T &obj;
|
T &obj;
|
||||||
explicit reversed_range_t(T &obj) : obj(obj){};
|
explicit reversed_range_t(T &obj) : obj(obj) {};
|
||||||
auto begin() { return obj.rbegin(); }
|
auto begin() { return obj.rbegin(); }
|
||||||
auto end() { return obj.rend(); }
|
auto end() { return obj.rend(); }
|
||||||
};
|
};
|
||||||
|
@ -85,7 +85,7 @@ struct NetBB
|
|||||||
struct DetailPlacerState
|
struct DetailPlacerState
|
||||||
{
|
{
|
||||||
explicit DetailPlacerState(Context *ctx, DetailPlaceCfg &cfg)
|
explicit DetailPlacerState(Context *ctx, DetailPlaceCfg &cfg)
|
||||||
: ctx(ctx), base_cfg(cfg), bels(ctx, false, 64), tmg(ctx){};
|
: ctx(ctx), base_cfg(cfg), bels(ctx, false, 64), tmg(ctx) {};
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
DetailPlaceCfg &base_cfg;
|
DetailPlaceCfg &base_cfg;
|
||||||
FastBels bels;
|
FastBels bels;
|
||||||
@ -196,7 +196,7 @@ struct DetailPlacerThreadState
|
|||||||
std::vector<std::pair<int, store_index<PortRef>>> timing_changed_arcs;
|
std::vector<std::pair<int, store_index<PortRef>>> timing_changed_arcs;
|
||||||
std::vector<double> new_timing_costs;
|
std::vector<double> new_timing_costs;
|
||||||
|
|
||||||
DetailPlacerThreadState(Context *ctx, DetailPlacerState &g, int idx) : ctx(ctx), g(g), idx(idx){};
|
DetailPlacerThreadState(Context *ctx, DetailPlacerState &g, int idx) : ctx(ctx), g(g), idx(idx) {};
|
||||||
void set_partition(const PlacePartition &part);
|
void set_partition(const PlacePartition &part);
|
||||||
void setup_initial_state();
|
void setup_initial_state();
|
||||||
bool bounds_check(BelId bel);
|
bool bounds_check(BelId bel);
|
||||||
|
@ -37,7 +37,7 @@ namespace {
|
|||||||
|
|
||||||
struct GlobalState : DetailPlacerState
|
struct GlobalState : DetailPlacerState
|
||||||
{
|
{
|
||||||
explicit GlobalState(Context *ctx, ParallelRefineCfg cfg) : DetailPlacerState(ctx, this->cfg), cfg(cfg){};
|
explicit GlobalState(Context *ctx, ParallelRefineCfg cfg) : DetailPlacerState(ctx, this->cfg), cfg(cfg) {};
|
||||||
|
|
||||||
dict<ClusterId, std::vector<CellInfo *>> cluster2cells;
|
dict<ClusterId, std::vector<CellInfo *>> cluster2cells;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ struct GlobalState : DetailPlacerState
|
|||||||
|
|
||||||
struct ThreadState : DetailPlacerThreadState
|
struct ThreadState : DetailPlacerThreadState
|
||||||
{
|
{
|
||||||
ThreadState(Context *ctx, GlobalState &g, int idx) : DetailPlacerThreadState(ctx, g, idx), g(g){};
|
ThreadState(Context *ctx, GlobalState &g, int idx) : DetailPlacerThreadState(ctx, g, idx), g(g) {};
|
||||||
// Total made and accepted moved
|
// Total made and accepted moved
|
||||||
GlobalState &g;
|
GlobalState &g;
|
||||||
int n_move = 0, n_accept = 0;
|
int n_move = 0, n_accept = 0;
|
||||||
|
@ -115,9 +115,9 @@ class ConstraintLegaliseWorker
|
|||||||
class IncreasingDiameterSearch
|
class IncreasingDiameterSearch
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IncreasingDiameterSearch() : start(0), min(0), max(-1){};
|
IncreasingDiameterSearch() : start(0), min(0), max(-1) {};
|
||||||
IncreasingDiameterSearch(int x) : start(x), min(x), max(x){};
|
IncreasingDiameterSearch(int x) : start(x), min(x), max(x) {};
|
||||||
IncreasingDiameterSearch(int start, int min, int max) : start(start), min(min), max(max){};
|
IncreasingDiameterSearch(int start, int min, int max) : start(start), min(min), max(max) {};
|
||||||
bool done() const { return (diameter > (max - min)); };
|
bool done() const { return (diameter > (max - min)); };
|
||||||
int get() const
|
int get() const
|
||||||
{
|
{
|
||||||
|
@ -319,20 +319,20 @@ class HeAPPlacer
|
|||||||
ctx->bindBel(bel, cell, strength);
|
ctx->bindBel(bel, cell, strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find and display all errors to help in finding the root cause of issues
|
// Find and display all errors to help in finding the root cause of issues
|
||||||
unsigned num_errors = 0;
|
unsigned num_errors = 0;
|
||||||
for (auto &cell : ctx->cells) {
|
for (auto &cell : ctx->cells) {
|
||||||
if (cell.second->isPseudo())
|
if (cell.second->isPseudo())
|
||||||
continue;
|
continue;
|
||||||
if (cell.second->bel == BelId()) {
|
if (cell.second->bel == BelId()) {
|
||||||
log_nonfatal_error("Found unbound cell '%s' of type '%s'\n", cell.first.c_str(ctx), cell.second->type.c_str(ctx));
|
log_nonfatal_error("Found unbound cell '%s' of type '%s'\n", cell.first.c_str(ctx),
|
||||||
|
cell.second->type.c_str(ctx));
|
||||||
num_errors++;
|
num_errors++;
|
||||||
}
|
} else if (ctx->getBoundBelCell(cell.second->bel) != cell.second.get()) {
|
||||||
else if (ctx->getBoundBelCell(cell.second->bel) != cell.second.get()) {
|
log_nonfatal_error("Found mismatched binding for '%s' or type '%s'\n", cell.first.c_str(ctx),
|
||||||
log_nonfatal_error("Found mismatched binding for '%s' or type '%s'\n", cell.first.c_str(ctx), cell.second->type.c_str(ctx));
|
cell.second->type.c_str(ctx));
|
||||||
num_errors++;
|
num_errors++;
|
||||||
}
|
} else if (ctx->debug)
|
||||||
else if (ctx->debug)
|
|
||||||
log_info("AP soln: %s -> %s\n", cell.first.c_str(ctx), ctx->nameOfBel(cell.second->bel));
|
log_info("AP soln: %s -> %s\n", cell.first.c_str(ctx), ctx->nameOfBel(cell.second->bel));
|
||||||
}
|
}
|
||||||
if (num_errors > 0) {
|
if (num_errors > 0) {
|
||||||
@ -899,7 +899,8 @@ class HeAPPlacer
|
|||||||
|
|
||||||
while (!placed) {
|
while (!placed) {
|
||||||
if (cfg.cell_placement_timeout > 0 && total_iters_for_cell > cfg.cell_placement_timeout)
|
if (cfg.cell_placement_timeout > 0 && total_iters_for_cell > cfg.cell_placement_timeout)
|
||||||
log_error("Unable to find legal placement for cell '%s' of type '%s' after %d attempts, check constraints and "
|
log_error("Unable to find legal placement for cell '%s' of type '%s' after %d attempts, check "
|
||||||
|
"constraints and "
|
||||||
"utilisation. Use `--placer-heap-cell-placement-timeout` to change the number of "
|
"utilisation. Use `--placer-heap-cell-placement-timeout` to change the number of "
|
||||||
"attempts.\n",
|
"attempts.\n",
|
||||||
ctx->nameOf(ci), ci->type.c_str(ctx), total_iters_for_cell);
|
ctx->nameOf(ci), ci->type.c_str(ctx), total_iters_for_cell);
|
||||||
|
@ -105,7 +105,7 @@ struct ConcreteCell
|
|||||||
|
|
||||||
struct ClusterGroupKey
|
struct ClusterGroupKey
|
||||||
{
|
{
|
||||||
ClusterGroupKey(int dx = 0, int dy = 0, int group = -1) : dx(dx), dy(dy), group(group){};
|
ClusterGroupKey(int dx = 0, int dy = 0, int group = -1) : dx(dx), dy(dy), group(group) {};
|
||||||
bool operator==(const ClusterGroupKey &other) const
|
bool operator==(const ClusterGroupKey &other) const
|
||||||
{
|
{
|
||||||
return dx == other.dx && dy == other.dy && group == other.group;
|
return dx == other.dx && dy == other.dy && group == other.group;
|
||||||
@ -155,7 +155,7 @@ struct PlacerNet
|
|||||||
#ifdef NPNR_DISABLE_THREADS
|
#ifdef NPNR_DISABLE_THREADS
|
||||||
struct ThreadPool
|
struct ThreadPool
|
||||||
{
|
{
|
||||||
ThreadPool(int){};
|
ThreadPool(int) {};
|
||||||
|
|
||||||
void run(int N, std::function<void(int)> func)
|
void run(int N, std::function<void(int)> func)
|
||||||
{
|
{
|
||||||
|
@ -27,8 +27,8 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
struct StaticRect
|
struct StaticRect
|
||||||
{
|
{
|
||||||
StaticRect() : w(0), h(0){};
|
StaticRect() : w(0), h(0) {};
|
||||||
StaticRect(float w, float h) : w(w), h(h){};
|
StaticRect(float w, float h) : w(w), h(h) {};
|
||||||
float w, h;
|
float w, h;
|
||||||
float area() const { return w * h; }
|
float area() const { return w * h; }
|
||||||
};
|
};
|
||||||
|
@ -36,9 +36,9 @@ enum class Axis
|
|||||||
|
|
||||||
struct RealPair
|
struct RealPair
|
||||||
{
|
{
|
||||||
RealPair() : x(0), y(0){};
|
RealPair() : x(0), y(0) {};
|
||||||
RealPair(float x, float y) : x(x), y(y){};
|
RealPair(float x, float y) : x(x), y(y) {};
|
||||||
explicit RealPair(Loc l, float bias = 0.0f) : x(l.x + bias), y(l.y + bias){};
|
explicit RealPair(Loc l, float bias = 0.0f) : x(l.x + bias), y(l.y + bias) {};
|
||||||
float x, y;
|
float x, y;
|
||||||
RealPair &operator+=(const RealPair &other)
|
RealPair &operator+=(const RealPair &other)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
class TimingOptimiser
|
class TimingOptimiser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TimingOptimiser(Context *ctx, TimingOptCfg cfg) : ctx(ctx), cfg(cfg), tmg(ctx){};
|
TimingOptimiser(Context *ctx, TimingOptCfg cfg) : ctx(ctx), cfg(cfg), tmg(ctx) {};
|
||||||
bool optimise()
|
bool optimise()
|
||||||
{
|
{
|
||||||
log_info("Running timing-driven placement optimisation...\n");
|
log_info("Running timing-driven placement optimisation...\n");
|
||||||
|
@ -241,7 +241,7 @@ struct Router2
|
|||||||
{
|
{
|
||||||
|
|
||||||
explicit QueuedWire(int wire = -1, WireScore score = WireScore{}, int randtag = 0)
|
explicit QueuedWire(int wire = -1, WireScore score = WireScore{}, int randtag = 0)
|
||||||
: wire(wire), score(score), randtag(randtag){};
|
: wire(wire), score(score), randtag(randtag) {};
|
||||||
|
|
||||||
int wire;
|
int wire;
|
||||||
WireScore score;
|
WireScore score;
|
||||||
|
@ -55,9 +55,9 @@ NPNR_PACKED_STRUCT(struct LocationPOD { int16_t x, y; });
|
|||||||
struct Location
|
struct Location
|
||||||
{
|
{
|
||||||
int16_t x = -1, y = -1;
|
int16_t x = -1, y = -1;
|
||||||
Location() : x(-1), y(-1){};
|
Location() : x(-1), y(-1) {};
|
||||||
Location(int16_t x, int16_t y) : x(x), y(y){};
|
Location(int16_t x, int16_t y) : x(x), y(y) {};
|
||||||
Location(const LocationPOD &pod) : x(pod.x), y(pod.y){};
|
Location(const LocationPOD &pod) : x(pod.x), y(pod.y) {};
|
||||||
|
|
||||||
bool operator==(const Location &other) const { return x == other.x && y == other.y; }
|
bool operator==(const Location &other) const { return x == other.x && y == other.y; }
|
||||||
bool operator!=(const Location &other) const { return x != other.x || y != other.y; }
|
bool operator!=(const Location &other) const { return x != other.x || y != other.y; }
|
||||||
|
@ -49,7 +49,7 @@ void config_empty_lfe5um5g_85f(ChipConfig &cc);
|
|||||||
namespace {
|
namespace {
|
||||||
struct ECP5Bitgen
|
struct ECP5Bitgen
|
||||||
{
|
{
|
||||||
explicit ECP5Bitgen(Context *ctx) : ctx(ctx){};
|
explicit ECP5Bitgen(Context *ctx) : ctx(ctx) {};
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
ChipConfig cc;
|
ChipConfig cc;
|
||||||
std::string get_trellis_wirename(Location loc, WireId wire)
|
std::string get_trellis_wirename(Location loc, WireId wire)
|
||||||
|
@ -53,7 +53,7 @@ static bool net_is_constant(const Context *ctx, NetInfo *net, bool &value)
|
|||||||
class Ecp5Packer
|
class Ecp5Packer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Ecp5Packer(Context *ctx) : ctx(ctx){};
|
Ecp5Packer(Context *ctx) : ctx(ctx) {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Process the contents of packed_cells and new_cells
|
// Process the contents of packed_cells and new_cells
|
||||||
|
@ -32,7 +32,7 @@ using namespace json11;
|
|||||||
struct JsonFrontendImpl
|
struct JsonFrontendImpl
|
||||||
{
|
{
|
||||||
// See specification in frontend_base.h
|
// See specification in frontend_base.h
|
||||||
JsonFrontendImpl(Json &root) : root(root){};
|
JsonFrontendImpl(Json &root) : root(root) {};
|
||||||
Json &root;
|
Json &root;
|
||||||
typedef const Json &ModuleDataType;
|
typedef const Json &ModuleDataType;
|
||||||
typedef const Json &ModulePortDataType;
|
typedef const Json &ModulePortDataType;
|
||||||
|
@ -115,14 +115,14 @@ template <typename TId> struct linear_range
|
|||||||
{
|
{
|
||||||
struct iterator
|
struct iterator
|
||||||
{
|
{
|
||||||
explicit iterator(int32_t index) : index(index){};
|
explicit iterator(int32_t index) : index(index) {};
|
||||||
int32_t index;
|
int32_t index;
|
||||||
bool operator==(const iterator &other) const { return index == other.index; }
|
bool operator==(const iterator &other) const { return index == other.index; }
|
||||||
bool operator!=(const iterator &other) const { return index != other.index; }
|
bool operator!=(const iterator &other) const { return index != other.index; }
|
||||||
void operator++() { ++index; }
|
void operator++() { ++index; }
|
||||||
TId operator*() const { return TId(index); }
|
TId operator*() const { return TId(index); }
|
||||||
};
|
};
|
||||||
explicit linear_range(int32_t size) : size(size){};
|
explicit linear_range(int32_t size) : size(size) {};
|
||||||
int32_t size;
|
int32_t size;
|
||||||
iterator begin() const { return iterator(0); }
|
iterator begin() const { return iterator(0); }
|
||||||
iterator end() const { return iterator(size); }
|
iterator end() const { return iterator(size); }
|
||||||
|
@ -30,8 +30,8 @@ typedef float delay_t;
|
|||||||
|
|
||||||
struct BelId
|
struct BelId
|
||||||
{
|
{
|
||||||
BelId() : index(-1){};
|
BelId() : index(-1) {};
|
||||||
explicit BelId(int32_t index) : index(index){};
|
explicit BelId(int32_t index) : index(index) {};
|
||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
|
|
||||||
bool operator==(const BelId &other) const { return index == other.index; }
|
bool operator==(const BelId &other) const { return index == other.index; }
|
||||||
@ -42,8 +42,8 @@ struct BelId
|
|||||||
|
|
||||||
struct WireId
|
struct WireId
|
||||||
{
|
{
|
||||||
WireId() : index(-1){};
|
WireId() : index(-1) {};
|
||||||
explicit WireId(int32_t index) : index(index){};
|
explicit WireId(int32_t index) : index(index) {};
|
||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
|
|
||||||
bool operator==(const WireId &other) const { return index == other.index; }
|
bool operator==(const WireId &other) const { return index == other.index; }
|
||||||
@ -54,8 +54,8 @@ struct WireId
|
|||||||
|
|
||||||
struct PipId
|
struct PipId
|
||||||
{
|
{
|
||||||
PipId() : index(-1){};
|
PipId() : index(-1) {};
|
||||||
explicit PipId(int32_t index) : index(index){};
|
explicit PipId(int32_t index) : index(index) {};
|
||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
|
|
||||||
bool operator==(const PipId &other) const { return index == other.index; }
|
bool operator==(const PipId &other) const { return index == other.index; }
|
||||||
@ -68,8 +68,8 @@ struct DecalId
|
|||||||
{
|
{
|
||||||
IdStringList name;
|
IdStringList name;
|
||||||
bool active = false;
|
bool active = false;
|
||||||
DecalId() : name(), active(false){};
|
DecalId() : name(), active(false) {};
|
||||||
DecalId(IdStringList name, bool active) : name(name), active(active){};
|
DecalId(IdStringList name, bool active) : name(name), active(active) {};
|
||||||
bool operator==(const DecalId &other) const { return name == other.name && active == other.active; }
|
bool operator==(const DecalId &other) const { return name == other.name && active == other.active; }
|
||||||
bool operator!=(const DecalId &other) const { return name != other.name || active != other.active; }
|
bool operator!=(const DecalId &other) const { return name != other.name || active != other.active; }
|
||||||
unsigned int hash() const { return mkhash(name.hash(), active); }
|
unsigned int hash() const { return mkhash(name.hash(), active); }
|
||||||
|
@ -31,9 +31,9 @@ class GenericCommandHandler : public CommandHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericCommandHandler(int argc, char **argv);
|
GenericCommandHandler(int argc, char **argv);
|
||||||
virtual ~GenericCommandHandler(){};
|
virtual ~GenericCommandHandler() {};
|
||||||
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
||||||
void setupArchContext(Context *ctx) override{};
|
void setupArchContext(Context *ctx) override {};
|
||||||
void customBitstream(Context *ctx) override;
|
void customBitstream(Context *ctx) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -32,7 +32,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
namespace {
|
namespace {
|
||||||
struct ExampleImpl : ViaductAPI
|
struct ExampleImpl : ViaductAPI
|
||||||
{
|
{
|
||||||
~ExampleImpl(){};
|
~ExampleImpl() {};
|
||||||
void init(Context *ctx) override
|
void init(Context *ctx) override
|
||||||
{
|
{
|
||||||
init_uarch_constids(ctx);
|
init_uarch_constids(ctx);
|
||||||
@ -321,7 +321,7 @@ struct ExampleImpl : ViaductAPI
|
|||||||
|
|
||||||
struct ExampleArch : ViaductArch
|
struct ExampleArch : ViaductArch
|
||||||
{
|
{
|
||||||
ExampleArch() : ViaductArch("example"){};
|
ExampleArch() : ViaductArch("example") {};
|
||||||
std::unique_ptr<ViaductAPI> create(const dict<std::string, std::string> &args)
|
std::unique_ptr<ViaductAPI> create(const dict<std::string, std::string> &args)
|
||||||
{
|
{
|
||||||
return std::make_unique<ExampleImpl>();
|
return std::make_unique<ExampleImpl>();
|
||||||
|
@ -36,9 +36,9 @@ struct parser_view
|
|||||||
{
|
{
|
||||||
char *m_ptr;
|
char *m_ptr;
|
||||||
size_t m_length;
|
size_t m_length;
|
||||||
parser_view() : m_ptr(nullptr), m_length(0){};
|
parser_view() : m_ptr(nullptr), m_length(0) {};
|
||||||
explicit parser_view(std::string &str) : m_ptr(&(str[0])), m_length(str.size()){};
|
explicit parser_view(std::string &str) : m_ptr(&(str[0])), m_length(str.size()) {};
|
||||||
parser_view(char *ptr, size_t length) : m_ptr(ptr), m_length(length){};
|
parser_view(char *ptr, size_t length) : m_ptr(ptr), m_length(length) {};
|
||||||
|
|
||||||
static constexpr size_t npos = std::numeric_limits<size_t>::max();
|
static constexpr size_t npos = std::numeric_limits<size_t>::max();
|
||||||
char operator[](size_t idx)
|
char operator[](size_t idx)
|
||||||
@ -151,7 +151,7 @@ struct parser_view
|
|||||||
|
|
||||||
struct CsvParser
|
struct CsvParser
|
||||||
{
|
{
|
||||||
explicit CsvParser(std::istream &in) : in(in){};
|
explicit CsvParser(std::istream &in) : in(in) {};
|
||||||
std::istream ∈
|
std::istream ∈
|
||||||
std::string buf;
|
std::string buf;
|
||||||
parser_view view;
|
parser_view view;
|
||||||
|
@ -55,7 +55,7 @@ struct FabulousImpl : ViaductAPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~FabulousImpl(){};
|
~FabulousImpl() {};
|
||||||
void init(Context *ctx) override
|
void init(Context *ctx) override
|
||||||
{
|
{
|
||||||
init_uarch_constids(ctx);
|
init_uarch_constids(ctx);
|
||||||
@ -666,7 +666,7 @@ struct FabulousImpl : ViaductAPI
|
|||||||
|
|
||||||
struct FabulousArch : ViaductArch
|
struct FabulousArch : ViaductArch
|
||||||
{
|
{
|
||||||
FabulousArch() : ViaductArch("fabulous"){};
|
FabulousArch() : ViaductArch("fabulous") {};
|
||||||
std::unique_ptr<ViaductAPI> create(const dict<std::string, std::string> &args)
|
std::unique_ptr<ViaductAPI> create(const dict<std::string, std::string> &args)
|
||||||
{
|
{
|
||||||
return std::make_unique<FabulousImpl>(args);
|
return std::make_unique<FabulousImpl>(args);
|
||||||
|
@ -33,8 +33,8 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
// validity checking code
|
// validity checking code
|
||||||
struct ControlSig
|
struct ControlSig
|
||||||
{
|
{
|
||||||
ControlSig() : net(), invert(false){};
|
ControlSig() : net(), invert(false) {};
|
||||||
ControlSig(IdString net, bool invert) : net(net), invert(invert){};
|
ControlSig(IdString net, bool invert) : net(net), invert(invert) {};
|
||||||
IdString net;
|
IdString net;
|
||||||
bool invert;
|
bool invert;
|
||||||
bool operator==(const ControlSig &other) const { return net == other.net && invert == other.invert; }
|
bool operator==(const ControlSig &other) const { return net == other.net && invert == other.invert; }
|
||||||
@ -110,7 +110,7 @@ struct BlockTracker
|
|||||||
const FabricConfig &cfg;
|
const FabricConfig &cfg;
|
||||||
std::vector<BelFlags> bel_data;
|
std::vector<BelFlags> bel_data;
|
||||||
|
|
||||||
BlockTracker(Context *ctx, const FabricConfig &cfg) : ctx(ctx), cfg(cfg){};
|
BlockTracker(Context *ctx, const FabricConfig &cfg) : ctx(ctx), cfg(cfg) {};
|
||||||
void set_bel_type(BelId bel, BelFlags::BlockType block, BelFlags::FuncType func, uint8_t index);
|
void set_bel_type(BelId bel, BelFlags::BlockType block, BelFlags::FuncType func, uint8_t index);
|
||||||
void update_bel(BelId bel, CellInfo *old_cell, CellInfo *new_cell);
|
void update_bel(BelId bel, CellInfo *old_cell, CellInfo *new_cell);
|
||||||
struct TileData
|
struct TileData
|
||||||
|
@ -33,7 +33,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
namespace {
|
namespace {
|
||||||
struct OkamiImpl : ViaductAPI
|
struct OkamiImpl : ViaductAPI
|
||||||
{
|
{
|
||||||
~OkamiImpl(){};
|
~OkamiImpl() {};
|
||||||
void init(Context *ctx) override
|
void init(Context *ctx) override
|
||||||
{
|
{
|
||||||
init_uarch_constids(ctx);
|
init_uarch_constids(ctx);
|
||||||
@ -534,7 +534,7 @@ struct OkamiImpl : ViaductAPI
|
|||||||
|
|
||||||
struct OkamiArch : ViaductArch
|
struct OkamiArch : ViaductArch
|
||||||
{
|
{
|
||||||
OkamiArch() : ViaductArch("okami"){};
|
OkamiArch() : ViaductArch("okami") {};
|
||||||
std::unique_ptr<ViaductAPI> create(const dict<std::string, std::string> &args)
|
std::unique_ptr<ViaductAPI> create(const dict<std::string, std::string> &args)
|
||||||
{
|
{
|
||||||
return std::make_unique<OkamiImpl>();
|
return std::make_unique<OkamiImpl>();
|
||||||
|
@ -86,14 +86,14 @@ struct ViaductAPI
|
|||||||
virtual BoundingBox getRouteBoundingBox(WireId src, WireId dst) const;
|
virtual BoundingBox getRouteBoundingBox(WireId src, WireId dst) const;
|
||||||
|
|
||||||
// --- Flow hooks ---
|
// --- Flow hooks ---
|
||||||
virtual void pack(){}; // replaces the pack function
|
virtual void pack() {}; // replaces the pack function
|
||||||
// Called before and after main placement and routing
|
// Called before and after main placement and routing
|
||||||
virtual void prePlace(){};
|
virtual void prePlace() {};
|
||||||
virtual void postPlace(){};
|
virtual void postPlace() {};
|
||||||
virtual void preRoute(){};
|
virtual void preRoute() {};
|
||||||
virtual void postRoute(){};
|
virtual void postRoute() {};
|
||||||
|
|
||||||
virtual ~ViaductAPI(){};
|
virtual ~ViaductAPI() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ViaductArch
|
struct ViaductArch
|
||||||
@ -103,7 +103,7 @@ struct ViaductArch
|
|||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
ViaductArch(const std::string &name);
|
ViaductArch(const std::string &name);
|
||||||
~ViaductArch(){};
|
~ViaductArch() {};
|
||||||
virtual std::unique_ptr<ViaductAPI> create(const dict<std::string, std::string> &args) = 0;
|
virtual std::unique_ptr<ViaductAPI> create(const dict<std::string, std::string> &args) = 0;
|
||||||
|
|
||||||
static std::string list();
|
static std::string list();
|
||||||
|
@ -36,10 +36,10 @@ viaduct_helpers provides some features for building up arches using the viaduct
|
|||||||
// Used to configure various generic pack functions
|
// Used to configure various generic pack functions
|
||||||
struct CellTypePort
|
struct CellTypePort
|
||||||
{
|
{
|
||||||
CellTypePort() : cell_type(), port(){};
|
CellTypePort() : cell_type(), port() {};
|
||||||
CellTypePort(IdString cell_type, IdString port) : cell_type(cell_type), port(port){};
|
CellTypePort(IdString cell_type, IdString port) : cell_type(cell_type), port(port) {};
|
||||||
explicit CellTypePort(const PortRef &net_port)
|
explicit CellTypePort(const PortRef &net_port)
|
||||||
: cell_type(net_port.cell ? net_port.cell->type : IdString()), port(net_port.port){};
|
: cell_type(net_port.cell ? net_port.cell->type : IdString()), port(net_port.port) {};
|
||||||
inline bool operator==(const CellTypePort &other) const
|
inline bool operator==(const CellTypePort &other) const
|
||||||
{
|
{
|
||||||
return cell_type == other.cell_type && port == other.port;
|
return cell_type == other.cell_type && port == other.port;
|
||||||
@ -54,7 +54,7 @@ struct CellTypePort
|
|||||||
|
|
||||||
struct ViaductHelpers
|
struct ViaductHelpers
|
||||||
{
|
{
|
||||||
ViaductHelpers(){};
|
ViaductHelpers() {};
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
void init(Context *ctx) { this->ctx = ctx; }
|
void init(Context *ctx) { this->ctx = ctx; }
|
||||||
// IdStringList components for x and y locations
|
// IdStringList components for x and y locations
|
||||||
|
@ -34,9 +34,9 @@ class GowinCommandHandler : public CommandHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GowinCommandHandler(int argc, char **argv);
|
GowinCommandHandler(int argc, char **argv);
|
||||||
virtual ~GowinCommandHandler(){};
|
virtual ~GowinCommandHandler() {};
|
||||||
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
||||||
void setupArchContext(Context *ctx) override{};
|
void setupArchContext(Context *ctx) override {};
|
||||||
void customAfterLoad(Context *ctx) override;
|
void customAfterLoad(Context *ctx) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -58,8 +58,8 @@ class BaseMainWindow : public QMainWindow
|
|||||||
void disableActions();
|
void disableActions();
|
||||||
void enableDisableDecals();
|
void enableDisableDecals();
|
||||||
|
|
||||||
virtual void onDisableActions(){};
|
virtual void onDisableActions() {};
|
||||||
virtual void onUpdateActions(){};
|
virtual void onUpdateActions() {};
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void writeInfo(std::string text);
|
void writeInfo(std::string text);
|
||||||
|
@ -264,20 +264,20 @@ template <typename CoordinateT, typename ElementT> class QuadTreeNode
|
|||||||
splitx_ = (bound_.x1_ - bound_.x0_) / 2 + bound_.x0_;
|
splitx_ = (bound_.x1_ - bound_.x0_) / 2 + bound_.x0_;
|
||||||
splity_ = (bound_.y1_ - bound_.y0_) / 2 + bound_.y0_;
|
splity_ = (bound_.y1_ - bound_.y0_) / 2 + bound_.y0_;
|
||||||
// Create the new children.
|
// Create the new children.
|
||||||
children_ = decltype(children_)(new QuadTreeNode<CoordinateT, ElementT>[4] {
|
children_ = decltype(children_)(new QuadTreeNode<CoordinateT, ElementT>[4]{
|
||||||
// Note: not using [NW] = QuadTreeNode because that seems to
|
// Note: not using [NW] = QuadTreeNode because that seems to
|
||||||
// crash g++ 7.3.0.
|
// crash g++ 7.3.0.
|
||||||
/* NW */ QuadTreeNode<CoordinateT, ElementT>(BoundingBox(bound_.x0_, bound_.y0_, splitx_, splity_),
|
/* NW */ QuadTreeNode<CoordinateT, ElementT>(BoundingBox(bound_.x0_, bound_.y0_, splitx_, splity_),
|
||||||
depth_ + 1, max_elems_),
|
depth_ + 1, max_elems_),
|
||||||
/* NE */
|
/* NE */
|
||||||
QuadTreeNode<CoordinateT, ElementT>(BoundingBox(splitx_, bound_.y0_, bound_.x1_, splity_),
|
QuadTreeNode<CoordinateT, ElementT>(BoundingBox(splitx_, bound_.y0_, bound_.x1_, splity_),
|
||||||
depth_ + 1, max_elems_),
|
depth_ + 1, max_elems_),
|
||||||
/* SW */
|
/* SW */
|
||||||
QuadTreeNode<CoordinateT, ElementT>(BoundingBox(bound_.x0_, splity_, splitx_, bound_.y1_),
|
QuadTreeNode<CoordinateT, ElementT>(BoundingBox(bound_.x0_, splity_, splitx_, bound_.y1_),
|
||||||
depth_ + 1, max_elems_),
|
depth_ + 1, max_elems_),
|
||||||
/* SE */
|
/* SE */
|
||||||
QuadTreeNode<CoordinateT, ElementT>(BoundingBox(splitx_, splity_, bound_.x1_, bound_.y1_),
|
QuadTreeNode<CoordinateT, ElementT>(BoundingBox(splitx_, splity_, bound_.x1_, bound_.y1_),
|
||||||
depth_ + 1, max_elems_),
|
depth_ + 1, max_elems_),
|
||||||
});
|
});
|
||||||
// Move all elements to where they belong.
|
// Move all elements to where they belong.
|
||||||
auto it = elems_.begin();
|
auto it = elems_.begin();
|
||||||
|
@ -387,13 +387,12 @@ bool Arch::lookup_cell_delay(int type_idx, IdString from_port, IdString to_port,
|
|||||||
{
|
{
|
||||||
NPNR_ASSERT(type_idx != -1);
|
NPNR_ASSERT(type_idx != -1);
|
||||||
const auto &ct = speed_grade->cell_types[type_idx];
|
const auto &ct = speed_grade->cell_types[type_idx];
|
||||||
int to_pin_idx = db_binary_search(
|
int to_pin_idx = db_binary_search(ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, to_port.index);
|
||||||
ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, to_port.index);
|
|
||||||
if (to_pin_idx == -1)
|
if (to_pin_idx == -1)
|
||||||
return false;
|
return false;
|
||||||
const auto &tp = ct.pins[to_pin_idx];
|
const auto &tp = ct.pins[to_pin_idx];
|
||||||
int arc_idx = db_binary_search(
|
int arc_idx =
|
||||||
tp.comb_arcs, [](const CellPinCombArcPOD &arc) { return arc.input; }, from_port.index);
|
db_binary_search(tp.comb_arcs, [](const CellPinCombArcPOD &arc) { return arc.input; }, from_port.index);
|
||||||
if (arc_idx == -1)
|
if (arc_idx == -1)
|
||||||
return false;
|
return false;
|
||||||
delay = DelayQuad(tp.comb_arcs[arc_idx].delay.fast_min, tp.comb_arcs[arc_idx].delay.slow_max);
|
delay = DelayQuad(tp.comb_arcs[arc_idx].delay.fast_min, tp.comb_arcs[arc_idx].delay.slow_max);
|
||||||
@ -404,8 +403,7 @@ const RelSlice<CellPinRegArcPOD> *Arch::lookup_cell_seq_timings(int type_idx, Id
|
|||||||
{
|
{
|
||||||
NPNR_ASSERT(type_idx != -1);
|
NPNR_ASSERT(type_idx != -1);
|
||||||
const auto &ct = speed_grade->cell_types[type_idx];
|
const auto &ct = speed_grade->cell_types[type_idx];
|
||||||
int pin_idx = db_binary_search(
|
int pin_idx = db_binary_search(ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, port.index);
|
||||||
ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, port.index);
|
|
||||||
if (pin_idx == -1)
|
if (pin_idx == -1)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return &ct.pins[pin_idx].reg_arcs;
|
return &ct.pins[pin_idx].reg_arcs;
|
||||||
@ -416,8 +414,7 @@ TimingPortClass Arch::lookup_port_tmg_type(int type_idx, IdString port, PortType
|
|||||||
|
|
||||||
NPNR_ASSERT(type_idx != -1);
|
NPNR_ASSERT(type_idx != -1);
|
||||||
const auto &ct = speed_grade->cell_types[type_idx];
|
const auto &ct = speed_grade->cell_types[type_idx];
|
||||||
int pin_idx = db_binary_search(
|
int pin_idx = db_binary_search(ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, port.index);
|
||||||
ct.pins, [](const CellPinTimingPOD &pd) { return pd.pin; }, port.index);
|
|
||||||
if (pin_idx == -1)
|
if (pin_idx == -1)
|
||||||
return (dir == PORT_OUT) ? TMG_IGNORE : TMG_COMB_INPUT;
|
return (dir == PORT_OUT) ? TMG_IGNORE : TMG_COMB_INPUT;
|
||||||
auto &pin = ct.pins[pin_idx];
|
auto &pin = ct.pins[pin_idx];
|
||||||
|
@ -178,7 +178,7 @@ struct TileWireIterator
|
|||||||
int cursor;
|
int cursor;
|
||||||
|
|
||||||
TileWireIterator(const ChipInfoPOD *chip, WireId base, int node_shape, int cursor)
|
TileWireIterator(const ChipInfoPOD *chip, WireId base, int node_shape, int cursor)
|
||||||
: chip(chip), base(base), node_shape(node_shape), cursor(cursor){};
|
: chip(chip), base(base), node_shape(node_shape), cursor(cursor) {};
|
||||||
|
|
||||||
void operator++() { cursor++; }
|
void operator++() { cursor++; }
|
||||||
bool operator!=(const TileWireIterator &other) const { return cursor != other.cursor; }
|
bool operator!=(const TileWireIterator &other) const { return cursor != other.cursor; }
|
||||||
@ -210,7 +210,7 @@ struct TileWireRange
|
|||||||
};
|
};
|
||||||
|
|
||||||
// is not nodal
|
// is not nodal
|
||||||
explicit TileWireRange(WireId w) : b(nullptr, w, -1, 0), e(nullptr, w, -1, 1){};
|
explicit TileWireRange(WireId w) : b(nullptr, w, -1, 0), e(nullptr, w, -1, 1) {};
|
||||||
|
|
||||||
TileWireIterator b, e;
|
TileWireIterator b, e;
|
||||||
TileWireIterator begin() const { return b; }
|
TileWireIterator begin() const { return b; }
|
||||||
@ -223,7 +223,7 @@ struct WireIterator
|
|||||||
int cursor_tile = 0;
|
int cursor_tile = 0;
|
||||||
int cursor_index = -1;
|
int cursor_index = -1;
|
||||||
|
|
||||||
WireIterator(const ChipInfoPOD *chip, int tile, int index) : chip(chip), cursor_tile(tile), cursor_index(index){};
|
WireIterator(const ChipInfoPOD *chip, int tile, int index) : chip(chip), cursor_tile(tile), cursor_index(index) {};
|
||||||
|
|
||||||
WireIterator operator++()
|
WireIterator operator++()
|
||||||
{
|
{
|
||||||
@ -287,7 +287,7 @@ template <RelSlice<int32_t> TileWireDataPOD::*ptr> struct UpdownhillPipIterator
|
|||||||
int cursor = -1;
|
int cursor = -1;
|
||||||
|
|
||||||
UpdownhillPipIterator(const ChipInfoPOD *chip, TileWireIterator twi, TileWireIterator twi_end, int cursor)
|
UpdownhillPipIterator(const ChipInfoPOD *chip, TileWireIterator twi, TileWireIterator twi_end, int cursor)
|
||||||
: chip(chip), twi(twi), twi_end(twi_end), cursor(cursor){};
|
: chip(chip), twi(twi), twi_end(twi_end), cursor(cursor) {};
|
||||||
|
|
||||||
void operator++()
|
void operator++()
|
||||||
{
|
{
|
||||||
@ -339,7 +339,7 @@ struct BelPinIterator
|
|||||||
int cursor = -1;
|
int cursor = -1;
|
||||||
|
|
||||||
BelPinIterator(const ChipInfoPOD *chip, TileWireIterator twi, TileWireIterator twi_end, int cursor)
|
BelPinIterator(const ChipInfoPOD *chip, TileWireIterator twi, TileWireIterator twi_end, int cursor)
|
||||||
: chip(chip), twi(twi), twi_end(twi_end), cursor(cursor){};
|
: chip(chip), twi(twi), twi_end(twi_end), cursor(cursor) {};
|
||||||
|
|
||||||
void operator++()
|
void operator++()
|
||||||
{
|
{
|
||||||
@ -418,7 +418,7 @@ struct Arch : BaseArch<ArchRanges>
|
|||||||
{
|
{
|
||||||
ArchArgs args;
|
ArchArgs args;
|
||||||
Arch(ArchArgs args);
|
Arch(ArchArgs args);
|
||||||
~Arch(){};
|
~Arch() {};
|
||||||
|
|
||||||
void load_chipdb(const std::string &path);
|
void load_chipdb(const std::string &path);
|
||||||
void set_speed_grade(const std::string &speed);
|
void set_speed_grade(const std::string &speed);
|
||||||
|
@ -39,7 +39,7 @@ struct BelId
|
|||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
|
|
||||||
BelId() = default;
|
BelId() = default;
|
||||||
BelId(int32_t tile, int32_t index) : tile(tile), index(index){};
|
BelId(int32_t tile, int32_t index) : tile(tile), index(index) {};
|
||||||
|
|
||||||
bool operator==(const BelId &other) const { return tile == other.tile && index == other.index; }
|
bool operator==(const BelId &other) const { return tile == other.tile && index == other.index; }
|
||||||
bool operator!=(const BelId &other) const { return tile != other.tile || index != other.index; }
|
bool operator!=(const BelId &other) const { return tile != other.tile || index != other.index; }
|
||||||
@ -56,7 +56,7 @@ struct WireId
|
|||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
|
|
||||||
WireId() = default;
|
WireId() = default;
|
||||||
WireId(int32_t tile, int32_t index) : tile(tile), index(index){};
|
WireId(int32_t tile, int32_t index) : tile(tile), index(index) {};
|
||||||
|
|
||||||
bool operator==(const WireId &other) const { return tile == other.tile && index == other.index; }
|
bool operator==(const WireId &other) const { return tile == other.tile && index == other.index; }
|
||||||
bool operator!=(const WireId &other) const { return tile != other.tile || index != other.index; }
|
bool operator!=(const WireId &other) const { return tile != other.tile || index != other.index; }
|
||||||
@ -74,7 +74,7 @@ struct PipId
|
|||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
|
|
||||||
PipId() = default;
|
PipId() = default;
|
||||||
PipId(int32_t tile, int32_t index) : tile(tile), index(index){};
|
PipId(int32_t tile, int32_t index) : tile(tile), index(index) {};
|
||||||
|
|
||||||
bool operator==(const PipId &other) const { return tile == other.tile && index == other.index; }
|
bool operator==(const PipId &other) const { return tile == other.tile && index == other.index; }
|
||||||
bool operator!=(const PipId &other) const { return tile != other.tile || index != other.index; }
|
bool operator!=(const PipId &other) const { return tile != other.tile || index != other.index; }
|
||||||
|
@ -106,17 +106,17 @@ struct HimbaechelAPI
|
|||||||
virtual bool getClusterPlacement(ClusterId cluster, BelId root_bel,
|
virtual bool getClusterPlacement(ClusterId cluster, BelId root_bel,
|
||||||
std::vector<std::pair<CellInfo *, BelId>> &placement) const;
|
std::vector<std::pair<CellInfo *, BelId>> &placement) const;
|
||||||
// --- Flow hooks ---
|
// --- Flow hooks ---
|
||||||
virtual void pack(){}; // replaces the pack function
|
virtual void pack() {}; // replaces the pack function
|
||||||
// Called before and after main placement and routing
|
// Called before and after main placement and routing
|
||||||
virtual void prePlace(){};
|
virtual void prePlace() {};
|
||||||
virtual void postPlace(){};
|
virtual void postPlace() {};
|
||||||
virtual void preRoute(){};
|
virtual void preRoute() {};
|
||||||
virtual void postRoute(){};
|
virtual void postRoute() {};
|
||||||
|
|
||||||
// For custom placer configuration
|
// For custom placer configuration
|
||||||
virtual void configurePlacerHeap(PlacerHeapCfg &cfg){};
|
virtual void configurePlacerHeap(PlacerHeapCfg &cfg) {};
|
||||||
|
|
||||||
virtual ~HimbaechelAPI(){};
|
virtual ~HimbaechelAPI() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HimbaechelArch
|
struct HimbaechelArch
|
||||||
@ -126,7 +126,7 @@ struct HimbaechelArch
|
|||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
HimbaechelArch(const std::string &name);
|
HimbaechelArch(const std::string &name);
|
||||||
~HimbaechelArch(){};
|
~HimbaechelArch() {};
|
||||||
virtual bool match_device(const std::string &device) = 0;
|
virtual bool match_device(const std::string &device) = 0;
|
||||||
virtual std::unique_ptr<HimbaechelAPI> create(const std::string &device,
|
virtual std::unique_ptr<HimbaechelAPI> create(const std::string &device,
|
||||||
const dict<std::string, std::string> &args) = 0;
|
const dict<std::string, std::string> &args) = 0;
|
||||||
|
@ -36,10 +36,10 @@ himbaechel_helpers provides some features for building up arches using the himb
|
|||||||
// Used to configure various generic pack functions
|
// Used to configure various generic pack functions
|
||||||
struct CellTypePort
|
struct CellTypePort
|
||||||
{
|
{
|
||||||
CellTypePort() : cell_type(), port(){};
|
CellTypePort() : cell_type(), port() {};
|
||||||
CellTypePort(IdString cell_type, IdString port) : cell_type(cell_type), port(port){};
|
CellTypePort(IdString cell_type, IdString port) : cell_type(cell_type), port(port) {};
|
||||||
explicit CellTypePort(const PortRef &net_port)
|
explicit CellTypePort(const PortRef &net_port)
|
||||||
: cell_type(net_port.cell ? net_port.cell->type : IdString()), port(net_port.port){};
|
: cell_type(net_port.cell ? net_port.cell->type : IdString()), port(net_port.port) {};
|
||||||
inline bool operator==(const CellTypePort &other) const
|
inline bool operator==(const CellTypePort &other) const
|
||||||
{
|
{
|
||||||
return cell_type == other.cell_type && port == other.port;
|
return cell_type == other.cell_type && port == other.port;
|
||||||
@ -54,7 +54,7 @@ struct CellTypePort
|
|||||||
|
|
||||||
struct HimbaechelHelpers
|
struct HimbaechelHelpers
|
||||||
{
|
{
|
||||||
HimbaechelHelpers(){};
|
HimbaechelHelpers() {};
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
void init(Context *ctx) { this->ctx = ctx; }
|
void init(Context *ctx) { this->ctx = ctx; }
|
||||||
// Common packing functions
|
// Common packing functions
|
||||||
|
@ -31,7 +31,7 @@ class HimbaechelCommandHandler : public CommandHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HimbaechelCommandHandler(int argc, char **argv);
|
HimbaechelCommandHandler(int argc, char **argv);
|
||||||
virtual ~HimbaechelCommandHandler(){};
|
virtual ~HimbaechelCommandHandler() {};
|
||||||
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
||||||
void setupArchContext(Context *ctx) override;
|
void setupArchContext(Context *ctx) override;
|
||||||
void customBitstream(Context *ctx) override;
|
void customBitstream(Context *ctx) override;
|
||||||
|
@ -36,7 +36,7 @@ struct ExampleImpl : HimbaechelAPI
|
|||||||
|
|
||||||
static constexpr int K = 4;
|
static constexpr int K = 4;
|
||||||
|
|
||||||
~ExampleImpl(){};
|
~ExampleImpl() {};
|
||||||
void init_database(Arch *arch) override
|
void init_database(Arch *arch) override
|
||||||
{
|
{
|
||||||
init_uarch_constids(arch);
|
init_uarch_constids(arch);
|
||||||
@ -139,7 +139,7 @@ struct ExampleImpl : HimbaechelAPI
|
|||||||
|
|
||||||
struct ExampleArch : HimbaechelArch
|
struct ExampleArch : HimbaechelArch
|
||||||
{
|
{
|
||||||
ExampleArch() : HimbaechelArch("example"){};
|
ExampleArch() : HimbaechelArch("example") {};
|
||||||
bool match_device(const std::string &device) override { return device == "EXAMPLE"; }
|
bool match_device(const std::string &device) override { return device == "EXAMPLE"; }
|
||||||
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args)
|
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ struct GowinCstReader
|
|||||||
Context *ctx;
|
Context *ctx;
|
||||||
std::istream ∈
|
std::istream ∈
|
||||||
|
|
||||||
GowinCstReader(Context *ctx, std::istream &in) : ctx(ctx), in(in){};
|
GowinCstReader(Context *ctx, std::istream &in) : ctx(ctx), in(in) {};
|
||||||
|
|
||||||
const PadInfoPOD *pinLookup(const PadInfoPOD *list, const size_t len, const IdString idx)
|
const PadInfoPOD *pinLookup(const PadInfoPOD *list, const size_t len, const IdString idx)
|
||||||
{
|
{
|
||||||
|
@ -340,8 +340,7 @@ struct GowinGlobalRouter
|
|||||||
src = ctx->getBelPinWire(driver.cell->bel, driver.port);
|
src = ctx->getBelPinWire(driver.cell->bel, driver.port);
|
||||||
}
|
}
|
||||||
|
|
||||||
RouteResult route_result = route_direct_net(
|
RouteResult route_result = route_direct_net(net, [&](PipId pip) { return global_DQCE_pip_filter(pip); }, src);
|
||||||
net, [&](PipId pip) { return global_DQCE_pip_filter(pip); }, src);
|
|
||||||
if (route_result == NOT_ROUTED) {
|
if (route_result == NOT_ROUTED) {
|
||||||
log_error("Can't route the %s network.\n", ctx->nameOf(net));
|
log_error("Can't route the %s network.\n", ctx->nameOf(net));
|
||||||
}
|
}
|
||||||
@ -418,8 +417,7 @@ struct GowinGlobalRouter
|
|||||||
src = ctx->getBelPinWire(driver.cell->bel, driver.port);
|
src = ctx->getBelPinWire(driver.cell->bel, driver.port);
|
||||||
}
|
}
|
||||||
|
|
||||||
RouteResult route_result = route_direct_net(
|
RouteResult route_result = route_direct_net(net, [&](PipId pip) { return global_DCS_pip_filter(pip); }, src);
|
||||||
net, [&](PipId pip) { return global_DCS_pip_filter(pip); }, src);
|
|
||||||
if (route_result == NOT_ROUTED) {
|
if (route_result == NOT_ROUTED) {
|
||||||
log_error("Can't route the %s network.\n", ctx->nameOf(net));
|
log_error("Can't route the %s network.\n", ctx->nameOf(net));
|
||||||
}
|
}
|
||||||
@ -506,8 +504,7 @@ struct GowinGlobalRouter
|
|||||||
WireId src = ctx->getBelPinWire(driver.cell->bel, port);
|
WireId src = ctx->getBelPinWire(driver.cell->bel, port);
|
||||||
|
|
||||||
std::vector<PipId> path;
|
std::vector<PipId> path;
|
||||||
RouteResult route_result = route_direct_net(
|
RouteResult route_result = route_direct_net(net, [&](PipId pip) { return global_pip_filter(pip); }, src, &path);
|
||||||
net, [&](PipId pip) { return global_pip_filter(pip); }, src, &path);
|
|
||||||
if (route_result == NOT_ROUTED) {
|
if (route_result == NOT_ROUTED) {
|
||||||
log_error("Can't route the %s network.\n", ctx->nameOf(net));
|
log_error("Can't route the %s network.\n", ctx->nameOf(net));
|
||||||
}
|
}
|
||||||
@ -571,8 +568,7 @@ struct GowinGlobalRouter
|
|||||||
NetInfo *net_before_buf = buf_ci->getPort(id_I);
|
NetInfo *net_before_buf = buf_ci->getPort(id_I);
|
||||||
NPNR_ASSERT(net_before_buf != nullptr);
|
NPNR_ASSERT(net_before_buf != nullptr);
|
||||||
|
|
||||||
RouteResult route_result = route_direct_net(
|
RouteResult route_result = route_direct_net(net, [&](PipId pip) { return global_pip_filter(pip); }, src);
|
||||||
net, [&](PipId pip) { return global_pip_filter(pip); }, src);
|
|
||||||
if (route_result == NOT_ROUTED || route_result == ROUTED_PARTIALLY) {
|
if (route_result == NOT_ROUTED || route_result == ROUTED_PARTIALLY) {
|
||||||
log_error("Can't route the %s net. It might be worth removing the BUFG buffer flag.\n", ctx->nameOf(net));
|
log_error("Can't route the %s net. It might be worth removing the BUFG buffer flag.\n", ctx->nameOf(net));
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace {
|
|||||||
struct GowinImpl : HimbaechelAPI
|
struct GowinImpl : HimbaechelAPI
|
||||||
{
|
{
|
||||||
|
|
||||||
~GowinImpl(){};
|
~GowinImpl() {};
|
||||||
void init_database(Arch *arch) override;
|
void init_database(Arch *arch) override;
|
||||||
void init(Context *ctx) override;
|
void init(Context *ctx) override;
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ struct GowinImpl : HimbaechelAPI
|
|||||||
|
|
||||||
struct GowinArch : HimbaechelArch
|
struct GowinArch : HimbaechelArch
|
||||||
{
|
{
|
||||||
GowinArch() : HimbaechelArch("gowin"){};
|
GowinArch() : HimbaechelArch("gowin") {};
|
||||||
|
|
||||||
bool match_device(const std::string &device) override { return device.size() > 2 && device.substr(0, 2) == "GW"; }
|
bool match_device(const std::string &device) override { return device.size() > 2 && device.substr(0, 2) == "GW"; }
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ class ChainConstrainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChainConstrainer(Context *ctx) : ctx(ctx){};
|
ChainConstrainer(Context *ctx) : ctx(ctx) {};
|
||||||
void constrain_chains() { process_carries(); }
|
void constrain_chains() { process_carries(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class Ice40CommandHandler : public CommandHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Ice40CommandHandler(int argc, char **argv);
|
Ice40CommandHandler(int argc, char **argv);
|
||||||
virtual ~Ice40CommandHandler(){};
|
virtual ~Ice40CommandHandler() {};
|
||||||
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
||||||
void setupArchContext(Context *ctx) override;
|
void setupArchContext(Context *ctx) override;
|
||||||
void validate() override;
|
void validate() override;
|
||||||
|
@ -55,9 +55,9 @@ NPNR_PACKED_STRUCT(struct LocationPOD { int16_t x, y; });
|
|||||||
struct Location
|
struct Location
|
||||||
{
|
{
|
||||||
int16_t x = -1, y = -1;
|
int16_t x = -1, y = -1;
|
||||||
Location() : x(-1), y(-1){};
|
Location() : x(-1), y(-1) {};
|
||||||
Location(int16_t x, int16_t y) : x(x), y(y){};
|
Location(int16_t x, int16_t y) : x(x), y(y) {};
|
||||||
Location(const LocationPOD &pod) : x(pod.x), y(pod.y){};
|
Location(const LocationPOD &pod) : x(pod.x), y(pod.y) {};
|
||||||
|
|
||||||
bool operator==(const Location &other) const { return x == other.x && y == other.y; }
|
bool operator==(const Location &other) const { return x == other.x && y == other.y; }
|
||||||
bool operator!=(const Location &other) const { return x != other.x || y != other.y; }
|
bool operator!=(const Location &other) const { return x != other.x || y != other.y; }
|
||||||
|
@ -52,7 +52,7 @@ void config_empty_lcmxo3_9400(ChipConfig &cc);
|
|||||||
namespace {
|
namespace {
|
||||||
struct MachXO2Bitgen
|
struct MachXO2Bitgen
|
||||||
{
|
{
|
||||||
explicit MachXO2Bitgen(Context *ctx) : ctx(ctx){};
|
explicit MachXO2Bitgen(Context *ctx) : ctx(ctx) {};
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
ChipConfig cc;
|
ChipConfig cc;
|
||||||
// Convert an absolute wire name to a relative Trellis one
|
// Convert an absolute wire name to a relative Trellis one
|
||||||
|
@ -30,7 +30,7 @@ struct MachxoGlobalRouter
|
|||||||
{
|
{
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
|
|
||||||
MachxoGlobalRouter(Context *ctx) : ctx(ctx){};
|
MachxoGlobalRouter(Context *ctx) : ctx(ctx) {};
|
||||||
|
|
||||||
// When routing globals; we allow global->local for some tricky cases but never local->local
|
// When routing globals; we allow global->local for some tricky cases but never local->local
|
||||||
bool global_pip_filter(PipId pip) const
|
bool global_pip_filter(PipId pip) const
|
||||||
|
@ -33,9 +33,9 @@ class MachXO2CommandHandler : public CommandHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MachXO2CommandHandler(int argc, char **argv);
|
MachXO2CommandHandler(int argc, char **argv);
|
||||||
virtual ~MachXO2CommandHandler(){};
|
virtual ~MachXO2CommandHandler() {};
|
||||||
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
||||||
void setupArchContext(Context *ctx) override{};
|
void setupArchContext(Context *ctx) override {};
|
||||||
void customAfterLoad(Context *ctx) override;
|
void customAfterLoad(Context *ctx) override;
|
||||||
void customBitstream(Context *ctx) override;
|
void customBitstream(Context *ctx) override;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ static bool is_nextpnr_iob(Context *ctx, CellInfo *cell)
|
|||||||
class MachXO2Packer
|
class MachXO2Packer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MachXO2Packer(Context *ctx) : ctx(ctx){};
|
MachXO2Packer(Context *ctx) : ctx(ctx) {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Process the contents of packed_cells and new_cells
|
// Process the contents of packed_cells and new_cells
|
||||||
|
@ -133,7 +133,7 @@ struct UpDownhillPipIterator
|
|||||||
bool is_uphill;
|
bool is_uphill;
|
||||||
|
|
||||||
UpDownhillPipIterator(WireVecIterator base, WireId other_wire, bool is_uphill)
|
UpDownhillPipIterator(WireVecIterator base, WireId other_wire, bool is_uphill)
|
||||||
: base(base), other_wire(other_wire), is_uphill(is_uphill){};
|
: base(base), other_wire(other_wire), is_uphill(is_uphill) {};
|
||||||
|
|
||||||
bool operator!=(const UpDownhillPipIterator &other) { return base != other.base; }
|
bool operator!=(const UpDownhillPipIterator &other) { return base != other.base; }
|
||||||
UpDownhillPipIterator operator++()
|
UpDownhillPipIterator operator++()
|
||||||
@ -155,7 +155,7 @@ struct UpDownhillPipRange
|
|||||||
UpDownhillPipIterator b, e;
|
UpDownhillPipIterator b, e;
|
||||||
|
|
||||||
UpDownhillPipRange(const std::vector<WireId> &v, WireId other_wire, bool is_uphill)
|
UpDownhillPipRange(const std::vector<WireId> &v, WireId other_wire, bool is_uphill)
|
||||||
: b(v.begin(), other_wire, is_uphill), e(v.end(), other_wire, is_uphill){};
|
: b(v.begin(), other_wire, is_uphill), e(v.end(), other_wire, is_uphill) {};
|
||||||
|
|
||||||
UpDownhillPipIterator begin() const { return b; }
|
UpDownhillPipIterator begin() const { return b; }
|
||||||
UpDownhillPipIterator end() const { return e; }
|
UpDownhillPipIterator end() const { return e; }
|
||||||
@ -170,7 +170,7 @@ struct AllPipIterator
|
|||||||
int uphill_idx;
|
int uphill_idx;
|
||||||
|
|
||||||
AllPipIterator(WireMapIterator base, WireMapIterator end, int uphill_idx)
|
AllPipIterator(WireMapIterator base, WireMapIterator end, int uphill_idx)
|
||||||
: base(base), end(end), uphill_idx(uphill_idx){};
|
: base(base), end(end), uphill_idx(uphill_idx) {};
|
||||||
|
|
||||||
bool operator!=(const AllPipIterator &other) { return base != other.base || uphill_idx != other.uphill_idx; }
|
bool operator!=(const AllPipIterator &other) { return base != other.base || uphill_idx != other.uphill_idx; }
|
||||||
AllPipIterator operator++()
|
AllPipIterator operator++()
|
||||||
@ -212,12 +212,12 @@ struct AllPipRange
|
|||||||
// This transforms a map to a range of keys, used as the wire iterator
|
// This transforms a map to a range of keys, used as the wire iterator
|
||||||
template <typename T> struct key_range
|
template <typename T> struct key_range
|
||||||
{
|
{
|
||||||
key_range(const T &t) : b(t.begin()), e(t.end()){};
|
key_range(const T &t) : b(t.begin()), e(t.end()) {};
|
||||||
typename T::const_iterator b, e;
|
typename T::const_iterator b, e;
|
||||||
|
|
||||||
struct xformed_iterator : public T::const_iterator
|
struct xformed_iterator : public T::const_iterator
|
||||||
{
|
{
|
||||||
explicit xformed_iterator(typename T::const_iterator base) : T::const_iterator(base){};
|
explicit xformed_iterator(typename T::const_iterator base) : T::const_iterator(base) {};
|
||||||
typename T::key_type operator*() { return this->T::const_iterator::operator*().first; }
|
typename T::key_type operator*() { return this->T::const_iterator::operator*().first; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ static constexpr auto invalid_rnode = std::numeric_limits<CycloneV::rnode_t>::ma
|
|||||||
struct WireId
|
struct WireId
|
||||||
{
|
{
|
||||||
WireId() = default;
|
WireId() = default;
|
||||||
explicit WireId(CycloneV::rnode_t node) : node(node){};
|
explicit WireId(CycloneV::rnode_t node) : node(node) {};
|
||||||
CycloneV::rnode_t node = invalid_rnode;
|
CycloneV::rnode_t node = invalid_rnode;
|
||||||
|
|
||||||
// Wires created by nextpnr have rnode type >= 128
|
// Wires created by nextpnr have rnode type >= 128
|
||||||
@ -112,7 +112,7 @@ struct WireId
|
|||||||
struct PipId
|
struct PipId
|
||||||
{
|
{
|
||||||
PipId() = default;
|
PipId() = default;
|
||||||
PipId(CycloneV::rnode_t src, CycloneV::rnode_t dst) : src(src), dst(dst){};
|
PipId(CycloneV::rnode_t src, CycloneV::rnode_t dst) : src(src), dst(dst) {};
|
||||||
CycloneV::rnode_t src = invalid_rnode, dst = invalid_rnode;
|
CycloneV::rnode_t src = invalid_rnode, dst = invalid_rnode;
|
||||||
|
|
||||||
bool operator==(const PipId &other) const { return src == other.src && dst == other.dst; }
|
bool operator==(const PipId &other) const { return src == other.src && dst == other.dst; }
|
||||||
|
@ -26,7 +26,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
namespace {
|
namespace {
|
||||||
struct MistralBitgen
|
struct MistralBitgen
|
||||||
{
|
{
|
||||||
MistralBitgen(Context *ctx) : ctx(ctx), cv(ctx->cyclonev){};
|
MistralBitgen(Context *ctx) : ctx(ctx), cv(ctx->cyclonev) {};
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
CycloneV *cv;
|
CycloneV *cv;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ struct MistralGlobalRouter
|
|||||||
{
|
{
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
|
|
||||||
MistralGlobalRouter(Context *ctx) : ctx(ctx){};
|
MistralGlobalRouter(Context *ctx) : ctx(ctx) {};
|
||||||
|
|
||||||
// When routing globals; we allow global->local for some tricky cases but never local->local
|
// When routing globals; we allow global->local for some tricky cases but never local->local
|
||||||
bool global_pip_filter(PipId pip) const
|
bool global_pip_filter(PipId pip) const
|
||||||
|
@ -32,9 +32,9 @@ class MistralCommandHandler : public CommandHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MistralCommandHandler(int argc, char **argv);
|
MistralCommandHandler(int argc, char **argv);
|
||||||
virtual ~MistralCommandHandler(){};
|
virtual ~MistralCommandHandler() {};
|
||||||
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
||||||
void setupArchContext(Context *ctx) override{};
|
void setupArchContext(Context *ctx) override {};
|
||||||
void customBitstream(Context *ctx) override;
|
void customBitstream(Context *ctx) override;
|
||||||
void customAfterLoad(Context *ctx) override;
|
void customAfterLoad(Context *ctx) override;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
namespace {
|
namespace {
|
||||||
struct MistralPacker
|
struct MistralPacker
|
||||||
{
|
{
|
||||||
MistralPacker(Context *ctx) : ctx(ctx){};
|
MistralPacker(Context *ctx) : ctx(ctx) {};
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
|
|
||||||
NetInfo *gnd_net, *vcc_net;
|
NetInfo *gnd_net, *vcc_net;
|
||||||
|
@ -78,7 +78,7 @@ struct QsfParser
|
|||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
|
|
||||||
QsfParser(const std::string &buf, Context *ctx) : buf(buf), ctx(ctx){};
|
QsfParser(const std::string &buf, Context *ctx) : buf(buf), ctx(ctx) {};
|
||||||
|
|
||||||
inline bool eof() const { return pos == int(buf.size()); }
|
inline bool eof() const { return pos == int(buf.size()); }
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ struct BelId
|
|||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
|
|
||||||
BelId() = default;
|
BelId() = default;
|
||||||
inline BelId(int32_t tile, int32_t index) : tile(tile), index(index){};
|
inline BelId(int32_t tile, int32_t index) : tile(tile), index(index) {};
|
||||||
|
|
||||||
bool operator==(const BelId &other) const { return tile == other.tile && index == other.index; }
|
bool operator==(const BelId &other) const { return tile == other.tile && index == other.index; }
|
||||||
bool operator!=(const BelId &other) const { return tile != other.tile || index != other.index; }
|
bool operator!=(const BelId &other) const { return tile != other.tile || index != other.index; }
|
||||||
@ -71,7 +71,7 @@ struct WireId
|
|||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
|
|
||||||
WireId() = default;
|
WireId() = default;
|
||||||
inline WireId(int32_t tile, int32_t index) : tile(tile), index(index){};
|
inline WireId(int32_t tile, int32_t index) : tile(tile), index(index) {};
|
||||||
|
|
||||||
bool operator==(const WireId &other) const { return tile == other.tile && index == other.index; }
|
bool operator==(const WireId &other) const { return tile == other.tile && index == other.index; }
|
||||||
bool operator!=(const WireId &other) const { return tile != other.tile || index != other.index; }
|
bool operator!=(const WireId &other) const { return tile != other.tile || index != other.index; }
|
||||||
@ -89,7 +89,7 @@ struct PipId
|
|||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
|
|
||||||
PipId() = default;
|
PipId() = default;
|
||||||
inline PipId(int32_t tile, int32_t index) : tile(tile), index(index){};
|
inline PipId(int32_t tile, int32_t index) : tile(tile), index(index) {};
|
||||||
|
|
||||||
bool operator==(const PipId &other) const { return tile == other.tile && index == other.index; }
|
bool operator==(const PipId &other) const { return tile == other.tile && index == other.index; }
|
||||||
bool operator!=(const PipId &other) const { return tile != other.tile || index != other.index; }
|
bool operator!=(const PipId &other) const { return tile != other.tile || index != other.index; }
|
||||||
|
@ -42,7 +42,7 @@ struct NexusGlobalRouter
|
|||||||
{
|
{
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
|
|
||||||
NexusGlobalRouter(Context *ctx) : ctx(ctx){};
|
NexusGlobalRouter(Context *ctx) : ctx(ctx) {};
|
||||||
|
|
||||||
// When routing globals; we allow global->local for some tricky cases but never local->local
|
// When routing globals; we allow global->local for some tricky cases but never local->local
|
||||||
bool global_pip_filter(PipId pip) const
|
bool global_pip_filter(PipId pip) const
|
||||||
|
@ -32,9 +32,9 @@ class NexusCommandHandler : public CommandHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NexusCommandHandler(int argc, char **argv);
|
NexusCommandHandler(int argc, char **argv);
|
||||||
virtual ~NexusCommandHandler(){};
|
virtual ~NexusCommandHandler() {};
|
||||||
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
|
||||||
void setupArchContext(Context *ctx) override{};
|
void setupArchContext(Context *ctx) override {};
|
||||||
void customBitstream(Context *ctx) override;
|
void customBitstream(Context *ctx) override;
|
||||||
void customAfterLoad(Context *ctx) override;
|
void customAfterLoad(Context *ctx) override;
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ struct TCLEntity
|
|||||||
|
|
||||||
struct TCLValue
|
struct TCLValue
|
||||||
{
|
{
|
||||||
TCLValue(const std::string &s) : is_string(true), str(s){};
|
TCLValue(const std::string &s) : is_string(true), str(s) {};
|
||||||
TCLValue(const std::vector<TCLEntity> &l) : is_string(false), list(l){};
|
TCLValue(const std::vector<TCLEntity> &l) : is_string(false), list(l) {};
|
||||||
|
|
||||||
bool is_string;
|
bool is_string;
|
||||||
std::string str; // simple string value
|
std::string str; // simple string value
|
||||||
@ -102,7 +102,7 @@ struct PDCParser
|
|||||||
int lineno = 1;
|
int lineno = 1;
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
|
|
||||||
PDCParser(const std::string &buf, Context *ctx) : buf(buf), ctx(ctx){};
|
PDCParser(const std::string &buf, Context *ctx) : buf(buf), ctx(ctx) {};
|
||||||
|
|
||||||
inline bool eof() const { return pos == int(buf.size()); }
|
inline bool eof() const { return pos == int(buf.size()); }
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ struct NexusPostPlaceOpt
|
|||||||
Context *ctx;
|
Context *ctx;
|
||||||
TimingAnalyser tmg;
|
TimingAnalyser tmg;
|
||||||
|
|
||||||
NexusPostPlaceOpt(Context *ctx) : ctx(ctx), tmg(ctx){};
|
NexusPostPlaceOpt(Context *ctx) : ctx(ctx), tmg(ctx) {};
|
||||||
|
|
||||||
inline bool is_constrained(CellInfo *cell) { return cell->cluster != ClusterId(); }
|
inline bool is_constrained(CellInfo *cell) { return cell->cluster != ClusterId(); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user