Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
This commit is contained in:
commit
9ebc879826
@ -47,12 +47,10 @@ DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
- Regex: '<.*>'
|
||||
Priority: 1
|
||||
- Regex: '.*'
|
||||
Priority: 2
|
||||
IndentCaseLabels: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
|
@ -18,4 +18,3 @@
|
||||
*/
|
||||
|
||||
#include "design.h"
|
||||
|
||||
|
@ -20,26 +20,27 @@
|
||||
#ifndef DESIGN_H
|
||||
#define DESIGN_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
// replace with proper IdString later
|
||||
typedef std::string IdString;
|
||||
|
||||
// replace with haslib later
|
||||
template<typename T> using pool = std::unordered_set<T>;
|
||||
template<typename T, typename U> using dict = std::unordered_map<T, U>;
|
||||
template <typename T> using pool = std::unordered_set<T>;
|
||||
template <typename T, typename U> using dict = std::unordered_map<T, U>;
|
||||
using std::vector;
|
||||
|
||||
struct GraphicElement
|
||||
{
|
||||
// This will control colour, and there should be separate
|
||||
// visibility controls in some cases also
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
// Wires entirely inside tiles, e.g. between switchbox and bels
|
||||
G_LOCAL_WIRES,
|
||||
// Standard inter-tile routing
|
||||
@ -55,7 +56,8 @@ struct GraphicElement
|
||||
G_TILE_MISC,
|
||||
} style;
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
G_LINE,
|
||||
G_BOX,
|
||||
G_CIRCLE,
|
||||
@ -116,12 +118,13 @@ struct Design
|
||||
{
|
||||
struct Chip chip;
|
||||
|
||||
Design(ChipArgs args) : chip(args) {
|
||||
Design(ChipArgs args) : chip(args)
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
dict<IdString, NetInfo*> nets;
|
||||
dict<IdString, CellInfo*> cells;
|
||||
dict<IdString, NetInfo *> nets;
|
||||
dict<IdString, CellInfo *> cells;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -21,9 +21,11 @@
|
||||
|
||||
#include "design.h"
|
||||
#include "chip.h"
|
||||
#include "pybindings.h"
|
||||
#include "emb.h"
|
||||
|
||||
// include after design.h/chip.h
|
||||
#include "pybindings.h"
|
||||
|
||||
// Required to determine concatenated module name (which differs for different archs)
|
||||
#define PASTER(x, y) x ## _ ## y
|
||||
#define EVALUATOR(x, y) PASTER(x,y)
|
||||
|
@ -19,6 +19,4 @@
|
||||
|
||||
#include "chip.h"
|
||||
|
||||
Chip::Chip(ChipArgs)
|
||||
{
|
||||
}
|
||||
Chip::Chip(ChipArgs) {}
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "design.h"
|
||||
#include "chip.h"
|
||||
|
||||
// include after design.h/chip.h
|
||||
#include "pybindings.h"
|
||||
|
||||
void arch_wrap_python() {
|
||||
|
@ -47,7 +47,9 @@ BelType belTypeFromId(IdString id)
|
||||
|
||||
IdString PortPinToId(PortPin type)
|
||||
{
|
||||
#define X(t) if (type == PIN_##t) return #t;
|
||||
#define X(t) \
|
||||
if (type == PIN_##t) \
|
||||
return #t;
|
||||
|
||||
X(IN_0)
|
||||
X(IN_1)
|
||||
@ -161,7 +163,9 @@ IdString PortPinToId(PortPin type)
|
||||
|
||||
PortPin PortPinFromId(IdString id)
|
||||
{
|
||||
#define X(t) if (id == #t) return PIN_##t;
|
||||
#define X(t) \
|
||||
if (id == #t) \
|
||||
return PIN_##t;
|
||||
|
||||
X(IN_0)
|
||||
X(IN_1)
|
||||
@ -401,15 +405,17 @@ vector<GraphicElement> Chip::getBelGraphics(BelId bel) const
|
||||
el.type = GraphicElement::G_BOX;
|
||||
el.x1 = chip_info.bel_data[bel.index].x + 0.1;
|
||||
el.x2 = chip_info.bel_data[bel.index].x + 0.9;
|
||||
el.y1 = chip_info.bel_data[bel.index].y + 0.10 + (chip_info.bel_data[bel.index].z) * (0.8/8);
|
||||
el.y2 = chip_info.bel_data[bel.index].y + 0.18 + (chip_info.bel_data[bel.index].z) * (0.8/8);
|
||||
el.y1 = chip_info.bel_data[bel.index].y + 0.10 +
|
||||
(chip_info.bel_data[bel.index].z) * (0.8 / 8);
|
||||
el.y2 = chip_info.bel_data[bel.index].y + 0.18 +
|
||||
(chip_info.bel_data[bel.index].z) * (0.8 / 8);
|
||||
el.z = 0;
|
||||
ret.push_back(el);
|
||||
}
|
||||
|
||||
if (bel_type == TYPE_SB_IO) {
|
||||
if (chip_info.bel_data[bel.index].x == 0 || chip_info.bel_data[bel.index].x == chip_info.width-1)
|
||||
{
|
||||
if (chip_info.bel_data[bel.index].x == 0 ||
|
||||
chip_info.bel_data[bel.index].x == chip_info.width - 1) {
|
||||
GraphicElement el;
|
||||
el.type = GraphicElement::G_BOX;
|
||||
el.x1 = chip_info.bel_data[bel.index].x + 0.1;
|
||||
@ -423,9 +429,7 @@ vector<GraphicElement> Chip::getBelGraphics(BelId bel) const
|
||||
}
|
||||
el.z = 0;
|
||||
ret.push_back(el);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GraphicElement el;
|
||||
el.type = GraphicElement::G_BOX;
|
||||
if (chip_info.bel_data[bel.index].z == 0) {
|
||||
@ -475,8 +479,7 @@ vector<GraphicElement> Chip::getFrameGraphics() const
|
||||
vector<GraphicElement> ret;
|
||||
|
||||
for (int x = 0; x <= chip_info.width; x++)
|
||||
for (int y = 0; y <= chip_info.height; y++)
|
||||
{
|
||||
for (int y = 0; y <= chip_info.height; y++) {
|
||||
GraphicElement el;
|
||||
el.type = GraphicElement::G_LINE;
|
||||
el.x1 = x - 0.05, el.x2 = x + 0.05, el.y1 = y, el.y2 = y, el.z = 0;
|
||||
|
131
ice40/chip.h
131
ice40/chip.h
@ -159,7 +159,6 @@ PortPin PortPinFromId(IdString id);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
|
||||
struct BelInfoPOD
|
||||
{
|
||||
const char *name;
|
||||
@ -213,9 +212,7 @@ struct BelId
|
||||
{
|
||||
int32_t index = -1;
|
||||
|
||||
bool nil() const {
|
||||
return index < 0;
|
||||
}
|
||||
bool nil() const { return index < 0; }
|
||||
|
||||
bool operator==(const BelId &other) const { return index == other.index; }
|
||||
bool operator!=(const BelId &other) const { return index != other.index; }
|
||||
@ -225,9 +222,7 @@ struct WireId
|
||||
{
|
||||
int32_t index = -1;
|
||||
|
||||
bool nil() const {
|
||||
return index < 0;
|
||||
}
|
||||
bool nil() const { return index < 0; }
|
||||
|
||||
bool operator==(const WireId &other) const { return index == other.index; }
|
||||
bool operator!=(const WireId &other) const { return index != other.index; }
|
||||
@ -237,9 +232,7 @@ struct PipId
|
||||
{
|
||||
int32_t index = -1;
|
||||
|
||||
bool nil() const {
|
||||
return index < 0;
|
||||
}
|
||||
bool nil() const { return index < 0; }
|
||||
|
||||
bool operator==(const PipId &other) const { return index == other.index; }
|
||||
bool operator!=(const PipId &other) const { return index != other.index; }
|
||||
@ -251,31 +244,30 @@ struct BelPin
|
||||
PortPin pin;
|
||||
};
|
||||
|
||||
namespace std
|
||||
namespace std {
|
||||
template <> struct hash<BelId>
|
||||
{
|
||||
template<> struct hash<BelId>
|
||||
{
|
||||
std::size_t operator()(const BelId &bel) const noexcept
|
||||
{
|
||||
return bel.index;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct hash<WireId>
|
||||
{
|
||||
template <> struct hash<WireId>
|
||||
{
|
||||
std::size_t operator()(const WireId &wire) const noexcept
|
||||
{
|
||||
return wire.index;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct hash<PipId>
|
||||
{
|
||||
template <> struct hash<PipId>
|
||||
{
|
||||
std::size_t operator()(const PipId &wire) const noexcept
|
||||
{
|
||||
return wire.index;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -285,9 +277,13 @@ struct BelIterator
|
||||
int cursor;
|
||||
|
||||
void operator++() { cursor++; }
|
||||
bool operator!=(const BelIterator &other) const { return cursor != other.cursor; }
|
||||
bool operator!=(const BelIterator &other) const
|
||||
{
|
||||
return cursor != other.cursor;
|
||||
}
|
||||
|
||||
BelId operator*() const {
|
||||
BelId operator*() const
|
||||
{
|
||||
BelId ret;
|
||||
ret.index = cursor;
|
||||
return ret;
|
||||
@ -308,9 +304,13 @@ struct BelPinIterator
|
||||
BelPortPOD *ptr = nullptr;
|
||||
|
||||
void operator++() { ptr++; }
|
||||
bool operator!=(const BelPinIterator &other) const { return ptr != other.ptr; }
|
||||
bool operator!=(const BelPinIterator &other) const
|
||||
{
|
||||
return ptr != other.ptr;
|
||||
}
|
||||
|
||||
BelPin operator*() const {
|
||||
BelPin operator*() const
|
||||
{
|
||||
BelPin ret;
|
||||
ret.bel.index = ptr->bel_index;
|
||||
ret.pin = ptr->port;
|
||||
@ -332,9 +332,13 @@ struct WireIterator
|
||||
int cursor = -1;
|
||||
|
||||
void operator++() { cursor++; }
|
||||
bool operator!=(const WireIterator &other) const { return cursor != other.cursor; }
|
||||
bool operator!=(const WireIterator &other) const
|
||||
{
|
||||
return cursor != other.cursor;
|
||||
}
|
||||
|
||||
WireId operator*() const {
|
||||
WireId operator*() const
|
||||
{
|
||||
WireId ret;
|
||||
ret.index = cursor;
|
||||
return ret;
|
||||
@ -355,9 +359,13 @@ struct AllPipIterator
|
||||
int cursor = -1;
|
||||
|
||||
void operator++() { cursor++; }
|
||||
bool operator!=(const AllPipIterator &other) const { return cursor != other.cursor; }
|
||||
bool operator!=(const AllPipIterator &other) const
|
||||
{
|
||||
return cursor != other.cursor;
|
||||
}
|
||||
|
||||
PipId operator*() const {
|
||||
PipId operator*() const
|
||||
{
|
||||
PipId ret;
|
||||
ret.index = cursor;
|
||||
return ret;
|
||||
@ -378,9 +386,13 @@ struct PipIterator
|
||||
int *cursor = nullptr;
|
||||
|
||||
void operator++() { cursor++; }
|
||||
bool operator!=(const PipIterator &other) const { return cursor != other.cursor; }
|
||||
bool operator!=(const PipIterator &other) const
|
||||
{
|
||||
return cursor != other.cursor;
|
||||
}
|
||||
|
||||
PipId operator*() const {
|
||||
PipId operator*() const
|
||||
{
|
||||
PipId ret;
|
||||
ret.index = *cursor;
|
||||
return ret;
|
||||
@ -398,7 +410,8 @@ struct PipRange
|
||||
|
||||
struct ChipArgs
|
||||
{
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
NONE,
|
||||
LP384,
|
||||
LP1K,
|
||||
@ -429,17 +442,11 @@ struct Chip
|
||||
return chip_info.bel_data[bel.index].name;
|
||||
}
|
||||
|
||||
void bindBel(BelId bel, IdString cell)
|
||||
{
|
||||
}
|
||||
void bindBel(BelId bel, IdString cell) {}
|
||||
|
||||
void unbindBel(BelId bel)
|
||||
{
|
||||
}
|
||||
void unbindBel(BelId bel) {}
|
||||
|
||||
bool checkBelAvail(BelId bel) const
|
||||
{
|
||||
}
|
||||
bool checkBelAvail(BelId bel) const {}
|
||||
|
||||
BelRange getBels() const
|
||||
{
|
||||
@ -452,7 +459,7 @@ struct Chip
|
||||
BelRange getBelsByType(BelType type) const
|
||||
{
|
||||
BelRange range;
|
||||
// FIXME
|
||||
// FIXME
|
||||
#if 0
|
||||
if (type == "TYPE_A") {
|
||||
range.b.cursor = bels_type_a_begin;
|
||||
@ -477,7 +484,8 @@ struct Chip
|
||||
assert(!wire.nil());
|
||||
|
||||
if (chip_info.wire_data[wire.index].bel_uphill.bel_index >= 0) {
|
||||
ret.bel.index = chip_info.wire_data[wire.index].bel_uphill.bel_index;
|
||||
ret.bel.index =
|
||||
chip_info.wire_data[wire.index].bel_uphill.bel_index;
|
||||
ret.pin = chip_info.wire_data[wire.index].bel_uphill.port;
|
||||
}
|
||||
|
||||
@ -489,7 +497,8 @@ struct Chip
|
||||
BelPinRange range;
|
||||
assert(!wire.nil());
|
||||
range.b.ptr = chip_info.wire_data[wire.index].bels_downhill;
|
||||
range.e.ptr = range.b.ptr + chip_info.wire_data[wire.index].num_bels_downhill;
|
||||
range.e.ptr =
|
||||
range.b.ptr + chip_info.wire_data[wire.index].num_bels_downhill;
|
||||
return range;
|
||||
}
|
||||
|
||||
@ -503,17 +512,11 @@ struct Chip
|
||||
return chip_info.wire_data[wire.index].name;
|
||||
}
|
||||
|
||||
void bindWire(WireId bel, IdString net)
|
||||
{
|
||||
}
|
||||
void bindWire(WireId bel, IdString net) {}
|
||||
|
||||
void unbindWire(WireId bel)
|
||||
{
|
||||
}
|
||||
void unbindWire(WireId bel) {}
|
||||
|
||||
bool checkWireAvail(WireId bel) const
|
||||
{
|
||||
}
|
||||
bool checkWireAvail(WireId bel) const {}
|
||||
|
||||
WireRange getWires() const
|
||||
{
|
||||
@ -530,22 +533,18 @@ struct Chip
|
||||
IdString getPipName(PipId pip) const
|
||||
{
|
||||
assert(!pip.nil());
|
||||
std::string src_name = chip_info.wire_data[chip_info.pip_data[pip.index].src].name;
|
||||
std::string dst_name = chip_info.wire_data[chip_info.pip_data[pip.index].dst].name;
|
||||
std::string src_name =
|
||||
chip_info.wire_data[chip_info.pip_data[pip.index].src].name;
|
||||
std::string dst_name =
|
||||
chip_info.wire_data[chip_info.pip_data[pip.index].dst].name;
|
||||
return src_name + "->" + dst_name;
|
||||
}
|
||||
|
||||
void bindPip(PipId bel, IdString net)
|
||||
{
|
||||
}
|
||||
void bindPip(PipId bel, IdString net) {}
|
||||
|
||||
void unbindPip(PipId bel)
|
||||
{
|
||||
}
|
||||
void unbindPip(PipId bel) {}
|
||||
|
||||
bool checkPipAvail(PipId bel) const
|
||||
{
|
||||
}
|
||||
bool checkPipAvail(PipId bel) const {}
|
||||
|
||||
AllPipRange getPips() const
|
||||
{
|
||||
@ -584,7 +583,8 @@ struct Chip
|
||||
PipRange range;
|
||||
assert(!wire.nil());
|
||||
range.b.cursor = chip_info.wire_data[wire.index].pips_downhill;
|
||||
range.e.cursor = range.b.cursor + chip_info.wire_data[wire.index].num_downhill;
|
||||
range.e.cursor =
|
||||
range.b.cursor + chip_info.wire_data[wire.index].num_downhill;
|
||||
return range;
|
||||
}
|
||||
|
||||
@ -593,7 +593,8 @@ struct Chip
|
||||
PipRange range;
|
||||
assert(!wire.nil());
|
||||
range.b.cursor = chip_info.wire_data[wire.index].pips_uphill;
|
||||
range.e.cursor = range.b.cursor + chip_info.wire_data[wire.index].num_uphill;
|
||||
range.e.cursor =
|
||||
range.b.cursor + chip_info.wire_data[wire.index].num_uphill;
|
||||
return range;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "design.h"
|
||||
#include "chip.h"
|
||||
|
||||
// include after design.h/chip.h
|
||||
#include "pybindings.h"
|
||||
|
||||
void arch_wrap_python() {
|
||||
|
Loading…
Reference in New Issue
Block a user