Move helper routines
This commit is contained in:
parent
69ad2b87f0
commit
f3e098bbde
@ -448,4 +448,89 @@ const Loc ng_ultra_place_xfifo[] =
|
|||||||
// {+1, 0, 28}, REQ2
|
// {+1, 0, 28}, REQ2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loc getNextLocInDSPChain(const NgUltraImpl *impl, Loc loc)
|
||||||
|
{
|
||||||
|
BelId bel = impl->ctx->getBelByLocation(loc);
|
||||||
|
BelId dsp = impl->dsp_cascade.at(bel);
|
||||||
|
return impl->ctx->getBelLocation(dsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Loc getNextLocInCYChain(Loc loc)
|
||||||
|
{
|
||||||
|
int section = (loc.x % 4 - 1 + 3 * (loc.y % 4)) * 4 + loc.z - BEL_CY_Z;
|
||||||
|
Loc result = ng_ultra_place_cy_map[section];
|
||||||
|
result.x += loc.x;
|
||||||
|
result.y += loc.y;
|
||||||
|
result.z += loc.z;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loc getCYFE(Loc root, int pos)
|
||||||
|
{
|
||||||
|
int p[] = { 2-1, 25-1, 10-1, 17-1 };
|
||||||
|
int cy = root.z - BEL_CY_Z;
|
||||||
|
Loc result;
|
||||||
|
result.x = root.x;
|
||||||
|
result.y = root.y;
|
||||||
|
result.z = p[pos] + cy * 2;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loc getXLUTFE(Loc root, int pos)
|
||||||
|
{
|
||||||
|
Loc result;
|
||||||
|
result.x = root.x;
|
||||||
|
result.y = root.y;
|
||||||
|
result.z = root.z - BEL_XLUT_Z + 8 * pos;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loc getXRFFE(Loc root, int pos)
|
||||||
|
{
|
||||||
|
Loc result = ng_ultra_place_xrf[pos];
|
||||||
|
if (root.z == BEL_XRF_Z) {
|
||||||
|
// XRF1
|
||||||
|
result.x += root.x;
|
||||||
|
} else {
|
||||||
|
// RF1 or RF2
|
||||||
|
result.x = root.x + ((root.z == BEL_RF_Z) ? -1 : +1);
|
||||||
|
}
|
||||||
|
result.y = root.y;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loc getCDCFE(Loc root, int pos)
|
||||||
|
{
|
||||||
|
Loc result;
|
||||||
|
if (root.z == BEL_CDC_Z) {
|
||||||
|
result = ng_ultra_place_cdc1[pos];
|
||||||
|
} else if (root.z == BEL_CDC_Z+1) {
|
||||||
|
result = ng_ultra_place_cdc2[pos];
|
||||||
|
} else if (root.z == BEL_XCDC_Z) {
|
||||||
|
result = ng_ultra_place_xcdc[pos];
|
||||||
|
} else {
|
||||||
|
log_error("Trying to place CDC on wrong location.\n");
|
||||||
|
}
|
||||||
|
result.x += root.x;
|
||||||
|
result.y = root.y;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loc getFIFOFE(Loc root, int pos)
|
||||||
|
{
|
||||||
|
Loc result;
|
||||||
|
if (root.z == BEL_FIFO_Z) {
|
||||||
|
result = ng_ultra_place_fifo1[pos];
|
||||||
|
} else if (root.z == BEL_FIFO_Z+1) {
|
||||||
|
result = ng_ultra_place_fifo2[pos];
|
||||||
|
} else if (root.z == BEL_XFIFO_Z) {
|
||||||
|
result = ng_ultra_place_xfifo[pos];
|
||||||
|
} else {
|
||||||
|
log_error("Trying to place CDC on wrong location.\n");
|
||||||
|
}
|
||||||
|
result.x += root.x;
|
||||||
|
result.y = root.y;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -18,20 +18,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
#include "ng_ultra.h"
|
||||||
|
|
||||||
#ifndef NG_ULTRA_LOCATION_MAP_H
|
#ifndef NG_ULTRA_LOCATION_MAP_H
|
||||||
#define NG_ULTRA_LOCATION_MAP_H
|
#define NG_ULTRA_LOCATION_MAP_H
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
extern const Loc ng_ultra_place_cy_map[];
|
Loc getNextLocInDSPChain(const NgUltraImpl *impl, Loc loc);
|
||||||
extern const Loc ng_ultra_place_xrf[];
|
Loc getNextLocInCYChain(Loc loc);
|
||||||
extern const Loc ng_ultra_place_cdc1[];
|
Loc getCYFE(Loc root, int pos);
|
||||||
extern const Loc ng_ultra_place_cdc2[];
|
Loc getXLUTFE(Loc root, int pos);
|
||||||
extern const Loc ng_ultra_place_xcdc[];
|
Loc getXRFFE(Loc root, int pos);
|
||||||
extern const Loc ng_ultra_place_fifo1[];
|
Loc getCDCFE(Loc root, int pos);
|
||||||
extern const Loc ng_ultra_place_fifo2[];
|
Loc getFIFOFE(Loc root, int pos);
|
||||||
extern const Loc ng_ultra_place_xfifo[];
|
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
@ -587,91 +587,6 @@ bool NgUltraImpl::isValidBelForCellType(IdString cell_type, BelId bel) const
|
|||||||
return (bel_type == cell_type);
|
return (bel_type == cell_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Loc getNextLocInDSPChain(const NgUltraImpl *impl, Loc loc)
|
|
||||||
{
|
|
||||||
BelId bel = impl->ctx->getBelByLocation(loc);
|
|
||||||
BelId dsp = impl->dsp_cascade.at(bel);
|
|
||||||
return impl->ctx->getBelLocation(dsp);
|
|
||||||
}
|
|
||||||
|
|
||||||
Loc getNextLocInCYChain(Loc loc)
|
|
||||||
{
|
|
||||||
int section = (loc.x % 4 - 1 + 3 * (loc.y % 4)) * 4 + loc.z - BEL_CY_Z;
|
|
||||||
Loc result = ng_ultra_place_cy_map[section];
|
|
||||||
result.x += loc.x;
|
|
||||||
result.y += loc.y;
|
|
||||||
result.z += loc.z;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Loc getCYFE(Loc root, int pos)
|
|
||||||
{
|
|
||||||
int p[] = { 2-1, 25-1, 10-1, 17-1 };
|
|
||||||
int cy = root.z - BEL_CY_Z;
|
|
||||||
Loc result;
|
|
||||||
result.x = root.x;
|
|
||||||
result.y = root.y;
|
|
||||||
result.z = p[pos] + cy * 2;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Loc getXLUTFE(Loc root, int pos)
|
|
||||||
{
|
|
||||||
Loc result;
|
|
||||||
result.x = root.x;
|
|
||||||
result.y = root.y;
|
|
||||||
result.z = root.z - BEL_XLUT_Z + 8 * pos;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Loc getXRFFE(Loc root, int pos)
|
|
||||||
{
|
|
||||||
Loc result = ng_ultra_place_xrf[pos];
|
|
||||||
if (root.z == BEL_XRF_Z) {
|
|
||||||
// XRF1
|
|
||||||
result.x += root.x;
|
|
||||||
} else {
|
|
||||||
// RF1 or RF2
|
|
||||||
result.x = root.x + ((root.z == BEL_RF_Z) ? -1 : +1);
|
|
||||||
}
|
|
||||||
result.y = root.y;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Loc getCDCFE(Loc root, int pos)
|
|
||||||
{
|
|
||||||
Loc result;
|
|
||||||
if (root.z == BEL_CDC_Z) {
|
|
||||||
result = ng_ultra_place_cdc1[pos];
|
|
||||||
} else if (root.z == BEL_CDC_Z+1) {
|
|
||||||
result = ng_ultra_place_cdc2[pos];
|
|
||||||
} else if (root.z == BEL_XCDC_Z) {
|
|
||||||
result = ng_ultra_place_xcdc[pos];
|
|
||||||
} else {
|
|
||||||
log_error("Trying to place CDC on wrong location.\n");
|
|
||||||
}
|
|
||||||
result.x += root.x;
|
|
||||||
result.y = root.y;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Loc getFIFOFE(Loc root, int pos)
|
|
||||||
{
|
|
||||||
Loc result;
|
|
||||||
if (root.z == BEL_FIFO_Z) {
|
|
||||||
result = ng_ultra_place_fifo1[pos];
|
|
||||||
} else if (root.z == BEL_FIFO_Z+1) {
|
|
||||||
result = ng_ultra_place_fifo2[pos];
|
|
||||||
} else if (root.z == BEL_XFIFO_Z) {
|
|
||||||
result = ng_ultra_place_xfifo[pos];
|
|
||||||
} else {
|
|
||||||
log_error("Trying to place CDC on wrong location.\n");
|
|
||||||
}
|
|
||||||
result.x += root.x;
|
|
||||||
result.y = root.y;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NgUltraImpl::getChildPlacement(const BaseClusterInfo *cluster, Loc root_loc,
|
bool NgUltraImpl::getChildPlacement(const BaseClusterInfo *cluster, Loc root_loc,
|
||||||
std::vector<std::pair<CellInfo *, BelId>> &placement) const
|
std::vector<std::pair<CellInfo *, BelId>> &placement) const
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user