2018-06-30 02:36:34 +08:00
|
|
|
/*
|
|
|
|
* nextpnr -- Next Generation Place and Route
|
|
|
|
*
|
2021-06-09 20:09:08 +08:00
|
|
|
* Copyright (C) 2018 Claire Xenia Wolf <claire@yosyshq.com>
|
2018-06-30 02:36:34 +08:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-03-13 05:09:44 +08:00
|
|
|
#ifndef ICE40_ARCHDEFS_H
|
|
|
|
#define ICE40_ARCHDEFS_H
|
|
|
|
|
2021-04-28 21:49:26 +08:00
|
|
|
#include "base_clusterinfo.h"
|
2021-06-01 23:12:57 +08:00
|
|
|
#include "hashlib.h"
|
2021-03-13 05:09:44 +08:00
|
|
|
#include "idstring.h"
|
|
|
|
#include "nextpnr_namespaces.h"
|
2018-06-30 02:36:34 +08:00
|
|
|
|
|
|
|
NEXTPNR_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
typedef int delay_t;
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2019-12-27 18:32:23 +08:00
|
|
|
// https://bugreports.qt.io/browse/QTBUG-80789
|
|
|
|
|
|
|
|
#ifndef Q_MOC_RUN
|
2018-08-08 23:01:18 +08:00
|
|
|
enum ConstIds
|
2018-06-30 02:36:34 +08:00
|
|
|
{
|
2018-08-08 23:01:18 +08:00
|
|
|
ID_NONE
|
|
|
|
#define X(t) , ID_##t
|
|
|
|
#include "constids.inc"
|
|
|
|
#undef X
|
2018-06-30 02:36:34 +08:00
|
|
|
};
|
|
|
|
|
2018-08-08 23:01:18 +08:00
|
|
|
#define X(t) static constexpr auto id_##t = IdString(ID_##t);
|
|
|
|
#include "constids.inc"
|
2018-06-30 02:36:34 +08:00
|
|
|
#undef X
|
2019-12-27 18:32:23 +08:00
|
|
|
#endif
|
2018-06-30 02:36:34 +08:00
|
|
|
|
|
|
|
struct BelId
|
|
|
|
{
|
|
|
|
int32_t index = -1;
|
|
|
|
|
|
|
|
bool operator==(const BelId &other) const { return index == other.index; }
|
|
|
|
bool operator!=(const BelId &other) const { return index != other.index; }
|
2018-11-13 12:03:46 +08:00
|
|
|
bool operator<(const BelId &other) const { return index < other.index; }
|
2021-06-01 23:12:57 +08:00
|
|
|
unsigned int hash() const { return index; }
|
2018-06-30 02:36:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct WireId
|
|
|
|
{
|
|
|
|
int32_t index = -1;
|
|
|
|
|
|
|
|
bool operator==(const WireId &other) const { return index == other.index; }
|
|
|
|
bool operator!=(const WireId &other) const { return index != other.index; }
|
2018-11-13 12:03:46 +08:00
|
|
|
bool operator<(const WireId &other) const { return index < other.index; }
|
2021-06-01 23:12:57 +08:00
|
|
|
unsigned int hash() const { return index; }
|
2018-06-30 02:36:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PipId
|
|
|
|
{
|
|
|
|
int32_t index = -1;
|
|
|
|
|
|
|
|
bool operator==(const PipId &other) const { return index == other.index; }
|
|
|
|
bool operator!=(const PipId &other) const { return index != other.index; }
|
2018-11-13 12:03:46 +08:00
|
|
|
bool operator<(const PipId &other) const { return index < other.index; }
|
2021-06-01 23:12:57 +08:00
|
|
|
unsigned int hash() const { return index; }
|
2018-06-30 02:36:34 +08:00
|
|
|
};
|
|
|
|
|
2018-07-12 23:22:29 +08:00
|
|
|
struct GroupId
|
|
|
|
{
|
2018-07-13 04:04:13 +08:00
|
|
|
enum : int8_t
|
|
|
|
{
|
2018-07-12 23:22:29 +08:00
|
|
|
TYPE_NONE,
|
|
|
|
TYPE_FRAME,
|
|
|
|
TYPE_MAIN_SW,
|
|
|
|
TYPE_LOCAL_SW,
|
|
|
|
TYPE_LC0_SW,
|
|
|
|
TYPE_LC1_SW,
|
|
|
|
TYPE_LC2_SW,
|
|
|
|
TYPE_LC3_SW,
|
|
|
|
TYPE_LC4_SW,
|
|
|
|
TYPE_LC5_SW,
|
|
|
|
TYPE_LC6_SW,
|
|
|
|
TYPE_LC7_SW
|
|
|
|
} type = TYPE_NONE;
|
|
|
|
int8_t x = 0, y = 0;
|
|
|
|
|
|
|
|
bool operator==(const GroupId &other) const { return (type == other.type) && (x == other.x) && (y == other.y); }
|
2022-10-17 16:19:51 +08:00
|
|
|
bool operator!=(const GroupId &other) const { return (type != other.type) || (x != other.x) || (y != other.y); }
|
2021-06-01 23:12:57 +08:00
|
|
|
unsigned int hash() const { return mkhash(mkhash(x, y), int(type)); }
|
2018-07-12 23:22:29 +08:00
|
|
|
};
|
|
|
|
|
2018-07-11 20:03:23 +08:00
|
|
|
struct DecalId
|
|
|
|
{
|
2018-07-13 04:04:13 +08:00
|
|
|
enum : int8_t
|
|
|
|
{
|
2018-07-12 23:22:29 +08:00
|
|
|
TYPE_NONE,
|
|
|
|
TYPE_BEL,
|
|
|
|
TYPE_WIRE,
|
|
|
|
TYPE_PIP,
|
|
|
|
TYPE_GROUP
|
|
|
|
} type = TYPE_NONE;
|
|
|
|
int32_t index = -1;
|
2018-07-13 20:29:03 +08:00
|
|
|
bool active = false;
|
2018-07-12 23:22:29 +08:00
|
|
|
|
|
|
|
bool operator==(const DecalId &other) const { return (type == other.type) && (index == other.index); }
|
|
|
|
bool operator!=(const DecalId &other) const { return (type != other.type) || (index != other.index); }
|
2021-06-01 23:12:57 +08:00
|
|
|
unsigned int hash() const { return mkhash(index, int(type)); }
|
2018-07-11 20:03:23 +08:00
|
|
|
};
|
|
|
|
|
2018-07-18 18:12:05 +08:00
|
|
|
struct ArchNetInfo
|
|
|
|
{
|
|
|
|
bool is_global = false;
|
2018-07-20 17:36:32 +08:00
|
|
|
bool is_reset = false, is_enable = false;
|
2018-07-18 18:12:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct NetInfo;
|
|
|
|
|
2021-04-28 21:49:26 +08:00
|
|
|
struct ArchCellInfo : BaseClusterInfo
|
2018-07-18 18:12:05 +08:00
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2018-08-03 23:37:59 +08:00
|
|
|
bool dffEnable;
|
|
|
|
bool carryEnable;
|
|
|
|
bool negClk;
|
2018-07-18 18:12:05 +08:00
|
|
|
int inputCount;
|
2022-03-28 21:06:09 +08:00
|
|
|
unsigned lutInputMask;
|
2018-07-18 18:12:05 +08:00
|
|
|
const NetInfo *clk, *cen, *sr;
|
|
|
|
} lcInfo;
|
2018-09-24 22:14:28 +08:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool lvds;
|
2018-11-17 20:04:14 +08:00
|
|
|
bool global;
|
2019-01-08 01:18:40 +08:00
|
|
|
bool negtrig;
|
|
|
|
int pintype;
|
2018-09-24 22:14:28 +08:00
|
|
|
// TODO: clk packing checks...
|
|
|
|
} ioInfo;
|
2018-11-19 08:57:47 +08:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool forPadIn;
|
|
|
|
} gbInfo;
|
2019-06-10 17:30:01 +08:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool ledCurConnected;
|
|
|
|
} ledInfo;
|
2018-07-18 18:12:05 +08:00
|
|
|
};
|
|
|
|
};
|
2018-07-18 02:04:49 +08:00
|
|
|
|
2021-02-05 19:36:19 +08:00
|
|
|
typedef IdString BelBucketId;
|
2021-04-28 21:49:26 +08:00
|
|
|
typedef IdString ClusterId;
|
2021-01-29 11:24:00 +08:00
|
|
|
|
2018-06-30 02:36:34 +08:00
|
|
|
NEXTPNR_NAMESPACE_END
|
|
|
|
|
2021-03-13 05:09:44 +08:00
|
|
|
#endif /* ICE40_ARCHDEFS_H */
|