add slice bels
This commit is contained in:
parent
15d0533474
commit
8607adb476
@ -28,12 +28,13 @@ else()
|
|||||||
set(device_bba chipdb/chipdb-${device}.bba)
|
set(device_bba chipdb/chipdb-${device}.bba)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${device_bba}
|
OUTPUT ${device_bba}
|
||||||
COMMAND ${GOWIN_BBA_EXECUTABLE} -d ${device} -o ${device_bba}.new
|
COMMAND ${GOWIN_BBA_EXECUTABLE} -d ${device} -i ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc -o ${device_bba}.new
|
||||||
# atomically update
|
# atomically update
|
||||||
COMMAND ${CMAKE_COMMAND} -E rename ${device_bba}.new ${device_bba}
|
COMMAND ${CMAKE_COMMAND} -E rename ${device_bba}.new ${device_bba}
|
||||||
DEPENDS
|
DEPENDS
|
||||||
${GOWIN_BBA_EXECUTABLE}
|
${GOWIN_BBA_EXECUTABLE}
|
||||||
${PREVIOUS_CHIPDB_TARGET}
|
${PREVIOUS_CHIPDB_TARGET}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/constids.inc
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
list(APPEND all_device_bbas ${device_bba})
|
list(APPEND all_device_bbas ${device_bba})
|
||||||
if(SERIALIZE_CHIPDBS)
|
if(SERIALIZE_CHIPDBS)
|
||||||
|
@ -55,6 +55,7 @@ BelInfo &Arch::bel_info(IdString bel)
|
|||||||
|
|
||||||
void Arch::addWire(IdString name, IdString type, int x, int y)
|
void Arch::addWire(IdString name, IdString type, int x, int y)
|
||||||
{
|
{
|
||||||
|
//std::cout << name.str(this) << std::endl;
|
||||||
NPNR_ASSERT(wires.count(name) == 0);
|
NPNR_ASSERT(wires.count(name) == 0);
|
||||||
WireInfo &wi = wires[name];
|
WireInfo &wi = wires[name];
|
||||||
wi.name = name;
|
wi.name = name;
|
||||||
@ -329,6 +330,7 @@ Arch::Arch(ArchArgs args) : args(args)
|
|||||||
int row = i/db->cols;
|
int row = i/db->cols;
|
||||||
int col = i%db->cols;
|
int col = i%db->cols;
|
||||||
const TilePOD* tile = db->grid[i].get();
|
const TilePOD* tile = db->grid[i].get();
|
||||||
|
// setup pips
|
||||||
for(unsigned int j=0; j < tile->num_pips; j++) {
|
for(unsigned int j=0; j < tile->num_pips; j++) {
|
||||||
const PairPOD pip = tile->pips[j];
|
const PairPOD pip = tile->pips[j];
|
||||||
IdString gdestname = wireToGlobal(row, col, db, pip.dest_id);
|
IdString gdestname = wireToGlobal(row, col, db, pip.dest_id);
|
||||||
@ -343,12 +345,85 @@ Arch::Arch(ArchArgs args) : args(args)
|
|||||||
IdString gsrcname = wireToGlobal(row, col, db, pip.src_id);
|
IdString gsrcname = wireToGlobal(row, col, db, pip.src_id);
|
||||||
if(wires.count(gsrcname) == 0) addWire(gsrcname, pip.src_id, col, row);
|
if(wires.count(gsrcname) == 0) addWire(gsrcname, pip.src_id, col, row);
|
||||||
}
|
}
|
||||||
|
for(unsigned int j=0; j<tile->num_bels; j++) {
|
||||||
|
const BelsPOD *bel = &tile->bels[j];
|
||||||
|
char buf[32];
|
||||||
|
IdString belname;
|
||||||
|
IdString wirename;
|
||||||
|
int z = 0;
|
||||||
|
bool dff = true;
|
||||||
|
switch (static_cast<ConstIds>(bel->type_id))
|
||||||
|
{
|
||||||
|
// fall through the ++
|
||||||
|
case ID_LUT7:
|
||||||
|
z++;
|
||||||
|
dff = false;
|
||||||
|
case ID_LUT6:
|
||||||
|
z++;
|
||||||
|
dff = false;
|
||||||
|
case ID_LUT5:
|
||||||
|
z++;
|
||||||
|
case ID_LUT4:
|
||||||
|
z++;
|
||||||
|
case ID_LUT3:
|
||||||
|
z++;
|
||||||
|
case ID_LUT2:
|
||||||
|
z++;
|
||||||
|
case ID_LUT1:
|
||||||
|
z++;
|
||||||
|
case ID_LUT0:
|
||||||
|
//common LUT+DFF code
|
||||||
|
snprintf(buf, 32, "R%dC%d_SLICE%d", row+1, col+1, z);
|
||||||
|
belname = id(buf);
|
||||||
|
addBel(belname, id_SLICE, Loc(col, row, z), false);
|
||||||
|
snprintf(buf, 32, "R%dC%d_F%d", row+1, col+1, z);
|
||||||
|
wirename = id(buf);
|
||||||
|
addBelOutput(belname, id_F, wirename);
|
||||||
|
snprintf(buf, 32, "R%dC%d_A%d", row+1, col+1, z);
|
||||||
|
wirename = id(buf);
|
||||||
|
addBelInput(belname, id_A, wirename);
|
||||||
|
snprintf(buf, 32, "R%dC%d_B%d", row+1, col+1, z);
|
||||||
|
wirename = id(buf);
|
||||||
|
addBelInput(belname, id_B, wirename);
|
||||||
|
snprintf(buf, 32, "R%dC%d_C%d", row+1, col+1, z);
|
||||||
|
wirename = id(buf);
|
||||||
|
addBelInput(belname, id_C, wirename);
|
||||||
|
snprintf(buf, 32, "R%dC%d_D%d", row+1, col+1, z);
|
||||||
|
wirename = id(buf);
|
||||||
|
addBelInput(belname, id_D, wirename);
|
||||||
|
if(dff) {
|
||||||
|
snprintf(buf, 32, "R%dC%d_CLK%d", row+1, col+1, z/2);
|
||||||
|
wirename = id(buf);
|
||||||
|
addBelInput(belname, id_CLK, wirename);
|
||||||
|
snprintf(buf, 32, "R%dC%d_LSR%d", row+1, col+1, z/2);
|
||||||
|
wirename = id(buf);
|
||||||
|
addBelInput(belname, id_LSR, wirename);
|
||||||
|
snprintf(buf, 32, "R%dC%d_CE%d", row+1, col+1, z/2);
|
||||||
|
wirename = id(buf);
|
||||||
|
addBelInput(belname, id_CE, wirename);
|
||||||
|
snprintf(buf, 32, "R%dC%d_Q%d", row+1, col+1, z);
|
||||||
|
wirename = id(buf);
|
||||||
|
addBelOutput(belname, id_Q, wirename);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Dummy for empty decals
|
// Dummy for empty decals
|
||||||
decal_graphics[IdString()];
|
decal_graphics[IdString()];
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdString::initialize_arch(const BaseCtx *ctx) {}
|
void IdString::initialize_arch(const BaseCtx *ctx)
|
||||||
|
{
|
||||||
|
#define X(t) initialize_add(ctx, #t, ID_##t);
|
||||||
|
#include "constids.inc"
|
||||||
|
#undef X
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -46,6 +46,20 @@ struct DelayInfo
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef Q_MOC_RUN
|
||||||
|
enum ConstIds
|
||||||
|
{
|
||||||
|
ID_NONE
|
||||||
|
#define X(t) , ID_##t
|
||||||
|
#include "constids.inc"
|
||||||
|
#undef X
|
||||||
|
};
|
||||||
|
|
||||||
|
#define X(t) static constexpr auto id_##t = IdString(ID_##t);
|
||||||
|
#include "constids.inc"
|
||||||
|
#undef X
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef IdString BelId;
|
typedef IdString BelId;
|
||||||
typedef IdString WireId;
|
typedef IdString WireId;
|
||||||
typedef IdString PipId;
|
typedef IdString PipId;
|
||||||
|
342
gowin/constids.inc
Normal file
342
gowin/constids.inc
Normal file
@ -0,0 +1,342 @@
|
|||||||
|
X(A0)
|
||||||
|
X(B0)
|
||||||
|
X(C0)
|
||||||
|
X(D0)
|
||||||
|
X(A1)
|
||||||
|
X(B1)
|
||||||
|
X(C1)
|
||||||
|
X(D1)
|
||||||
|
X(A2)
|
||||||
|
X(B2)
|
||||||
|
X(C2)
|
||||||
|
X(D2)
|
||||||
|
X(A3)
|
||||||
|
X(B3)
|
||||||
|
X(C3)
|
||||||
|
X(D3)
|
||||||
|
X(A4)
|
||||||
|
X(B4)
|
||||||
|
X(C4)
|
||||||
|
X(D4)
|
||||||
|
X(A5)
|
||||||
|
X(B5)
|
||||||
|
X(C5)
|
||||||
|
X(D5)
|
||||||
|
X(A6)
|
||||||
|
X(B6)
|
||||||
|
X(C6)
|
||||||
|
X(D6)
|
||||||
|
X(A7)
|
||||||
|
X(B7)
|
||||||
|
X(C7)
|
||||||
|
X(D7)
|
||||||
|
X(F0)
|
||||||
|
X(F1)
|
||||||
|
X(F2)
|
||||||
|
X(F3)
|
||||||
|
X(F4)
|
||||||
|
X(F5)
|
||||||
|
X(F6)
|
||||||
|
X(F7)
|
||||||
|
X(Q0)
|
||||||
|
X(Q1)
|
||||||
|
X(Q2)
|
||||||
|
X(Q3)
|
||||||
|
X(Q4)
|
||||||
|
X(Q5)
|
||||||
|
X(Q6)
|
||||||
|
X(Q7)
|
||||||
|
X(OF0)
|
||||||
|
X(OF1)
|
||||||
|
X(OF2)
|
||||||
|
X(OF3)
|
||||||
|
X(OF4)
|
||||||
|
X(OF5)
|
||||||
|
X(OF6)
|
||||||
|
X(OF7)
|
||||||
|
X(X01)
|
||||||
|
X(X02)
|
||||||
|
X(X03)
|
||||||
|
X(X04)
|
||||||
|
X(X05)
|
||||||
|
X(X06)
|
||||||
|
X(X07)
|
||||||
|
X(X08)
|
||||||
|
X(N100)
|
||||||
|
X(SN10)
|
||||||
|
X(SN20)
|
||||||
|
X(N130)
|
||||||
|
X(S100)
|
||||||
|
X(S130)
|
||||||
|
X(E100)
|
||||||
|
X(EW10)
|
||||||
|
X(EW20)
|
||||||
|
X(E130)
|
||||||
|
X(W100)
|
||||||
|
X(W130)
|
||||||
|
X(N200)
|
||||||
|
X(N210)
|
||||||
|
X(N220)
|
||||||
|
X(N230)
|
||||||
|
X(N240)
|
||||||
|
X(N250)
|
||||||
|
X(N260)
|
||||||
|
X(N270)
|
||||||
|
X(S200)
|
||||||
|
X(S210)
|
||||||
|
X(S220)
|
||||||
|
X(S230)
|
||||||
|
X(S240)
|
||||||
|
X(S250)
|
||||||
|
X(S260)
|
||||||
|
X(S270)
|
||||||
|
X(E200)
|
||||||
|
X(E210)
|
||||||
|
X(E220)
|
||||||
|
X(E230)
|
||||||
|
X(E240)
|
||||||
|
X(E250)
|
||||||
|
X(E260)
|
||||||
|
X(E270)
|
||||||
|
X(W200)
|
||||||
|
X(W210)
|
||||||
|
X(W220)
|
||||||
|
X(W230)
|
||||||
|
X(W240)
|
||||||
|
X(W250)
|
||||||
|
X(W260)
|
||||||
|
X(W270)
|
||||||
|
X(N800)
|
||||||
|
X(N810)
|
||||||
|
X(N820)
|
||||||
|
X(N830)
|
||||||
|
X(S800)
|
||||||
|
X(S810)
|
||||||
|
X(S820)
|
||||||
|
X(S830)
|
||||||
|
X(E800)
|
||||||
|
X(E810)
|
||||||
|
X(E820)
|
||||||
|
X(E830)
|
||||||
|
X(W800)
|
||||||
|
X(W810)
|
||||||
|
X(W820)
|
||||||
|
X(W830)
|
||||||
|
X(CLK0)
|
||||||
|
X(CLK1)
|
||||||
|
X(CLK2)
|
||||||
|
X(LSR0)
|
||||||
|
X(LSR1)
|
||||||
|
X(LSR2)
|
||||||
|
X(CE0)
|
||||||
|
X(CE1)
|
||||||
|
X(CE2)
|
||||||
|
X(SEL0)
|
||||||
|
X(SEL1)
|
||||||
|
X(SEL2)
|
||||||
|
X(SEL3)
|
||||||
|
X(SEL4)
|
||||||
|
X(SEL5)
|
||||||
|
X(SEL6)
|
||||||
|
X(SEL7)
|
||||||
|
X(N101)
|
||||||
|
X(N131)
|
||||||
|
X(S101)
|
||||||
|
X(S131)
|
||||||
|
X(E101)
|
||||||
|
X(E131)
|
||||||
|
X(W101)
|
||||||
|
X(W131)
|
||||||
|
X(N201)
|
||||||
|
X(N211)
|
||||||
|
X(N221)
|
||||||
|
X(N231)
|
||||||
|
X(N241)
|
||||||
|
X(N251)
|
||||||
|
X(N261)
|
||||||
|
X(N271)
|
||||||
|
X(S201)
|
||||||
|
X(S211)
|
||||||
|
X(S221)
|
||||||
|
X(S231)
|
||||||
|
X(S241)
|
||||||
|
X(S251)
|
||||||
|
X(S261)
|
||||||
|
X(S271)
|
||||||
|
X(E201)
|
||||||
|
X(E211)
|
||||||
|
X(E221)
|
||||||
|
X(E231)
|
||||||
|
X(E241)
|
||||||
|
X(E251)
|
||||||
|
X(E261)
|
||||||
|
X(E271)
|
||||||
|
X(W201)
|
||||||
|
X(W211)
|
||||||
|
X(W221)
|
||||||
|
X(W231)
|
||||||
|
X(W241)
|
||||||
|
X(W251)
|
||||||
|
X(W261)
|
||||||
|
X(W271)
|
||||||
|
X(N202)
|
||||||
|
X(N212)
|
||||||
|
X(N222)
|
||||||
|
X(N232)
|
||||||
|
X(N242)
|
||||||
|
X(N252)
|
||||||
|
X(N262)
|
||||||
|
X(N272)
|
||||||
|
X(S202)
|
||||||
|
X(S212)
|
||||||
|
X(S222)
|
||||||
|
X(S232)
|
||||||
|
X(S242)
|
||||||
|
X(S252)
|
||||||
|
X(S262)
|
||||||
|
X(S272)
|
||||||
|
X(E202)
|
||||||
|
X(E212)
|
||||||
|
X(E222)
|
||||||
|
X(E232)
|
||||||
|
X(E242)
|
||||||
|
X(E252)
|
||||||
|
X(E262)
|
||||||
|
X(E272)
|
||||||
|
X(W202)
|
||||||
|
X(W212)
|
||||||
|
X(W222)
|
||||||
|
X(W232)
|
||||||
|
X(W242)
|
||||||
|
X(W252)
|
||||||
|
X(W262)
|
||||||
|
X(W272)
|
||||||
|
X(N804)
|
||||||
|
X(N814)
|
||||||
|
X(N824)
|
||||||
|
X(N834)
|
||||||
|
X(S804)
|
||||||
|
X(S814)
|
||||||
|
X(S824)
|
||||||
|
X(S834)
|
||||||
|
X(E804)
|
||||||
|
X(E814)
|
||||||
|
X(E824)
|
||||||
|
X(E834)
|
||||||
|
X(W804)
|
||||||
|
X(W814)
|
||||||
|
X(W824)
|
||||||
|
X(W834)
|
||||||
|
X(N808)
|
||||||
|
X(N818)
|
||||||
|
X(N828)
|
||||||
|
X(N838)
|
||||||
|
X(S808)
|
||||||
|
X(S818)
|
||||||
|
X(S828)
|
||||||
|
X(S838)
|
||||||
|
X(E808)
|
||||||
|
X(E818)
|
||||||
|
X(E828)
|
||||||
|
X(E838)
|
||||||
|
X(W808)
|
||||||
|
X(W818)
|
||||||
|
X(W828)
|
||||||
|
X(W838)
|
||||||
|
X(E110)
|
||||||
|
X(W110)
|
||||||
|
X(E120)
|
||||||
|
X(W120)
|
||||||
|
X(S110)
|
||||||
|
X(N110)
|
||||||
|
X(S120)
|
||||||
|
X(N120)
|
||||||
|
X(E111)
|
||||||
|
X(W111)
|
||||||
|
X(E121)
|
||||||
|
X(W121)
|
||||||
|
X(S111)
|
||||||
|
X(N111)
|
||||||
|
X(S121)
|
||||||
|
X(N121)
|
||||||
|
X(LB01)
|
||||||
|
X(LB11)
|
||||||
|
X(LB21)
|
||||||
|
X(LB31)
|
||||||
|
X(LB41)
|
||||||
|
X(LB51)
|
||||||
|
X(LB61)
|
||||||
|
X(LB71)
|
||||||
|
X(GB00)
|
||||||
|
X(GB10)
|
||||||
|
X(GB20)
|
||||||
|
X(GB30)
|
||||||
|
X(GB40)
|
||||||
|
X(GB50)
|
||||||
|
X(GB60)
|
||||||
|
X(GB70)
|
||||||
|
X(VCC)
|
||||||
|
X(VSS)
|
||||||
|
X(LT00)
|
||||||
|
X(LT10)
|
||||||
|
X(LT20)
|
||||||
|
X(LT30)
|
||||||
|
X(LT02)
|
||||||
|
X(LT13)
|
||||||
|
X(LT01)
|
||||||
|
X(LT04)
|
||||||
|
X(LBO0)
|
||||||
|
X(LBO1)
|
||||||
|
X(SS00)
|
||||||
|
X(SS40)
|
||||||
|
X(GT00)
|
||||||
|
X(GT10)
|
||||||
|
X(GBO0)
|
||||||
|
X(GBO1)
|
||||||
|
X(DI0)
|
||||||
|
X(DI1)
|
||||||
|
X(DI2)
|
||||||
|
X(DI3)
|
||||||
|
X(DI4)
|
||||||
|
X(DI5)
|
||||||
|
X(DI6)
|
||||||
|
X(DI7)
|
||||||
|
X(CIN0)
|
||||||
|
X(CIN1)
|
||||||
|
X(CIN2)
|
||||||
|
X(CIN3)
|
||||||
|
X(CIN4)
|
||||||
|
X(CIN5)
|
||||||
|
X(COUT0)
|
||||||
|
X(COUT1)
|
||||||
|
X(COUT2)
|
||||||
|
X(COUT3)
|
||||||
|
X(COUT4)
|
||||||
|
X(COUT5)
|
||||||
|
// slice items
|
||||||
|
X(SLICE)
|
||||||
|
X(CLK)
|
||||||
|
X(LSR)
|
||||||
|
X(CE)
|
||||||
|
X(Q)
|
||||||
|
X(F)
|
||||||
|
X(A)
|
||||||
|
X(B)
|
||||||
|
X(C)
|
||||||
|
X(D)
|
||||||
|
// bels
|
||||||
|
X(DFF0)
|
||||||
|
X(DFF1)
|
||||||
|
X(DFF2)
|
||||||
|
X(DFF3)
|
||||||
|
X(DFF4)
|
||||||
|
X(DFF5)
|
||||||
|
|
||||||
|
X(LUT0)
|
||||||
|
X(LUT1)
|
||||||
|
X(LUT2)
|
||||||
|
X(LUT3)
|
||||||
|
X(LUT4)
|
||||||
|
X(LUT5)
|
||||||
|
X(LUT6)
|
||||||
|
X(LUT7)
|
Loading…
Reference in New Issue
Block a user