Missing files

This commit is contained in:
Eddie Hung 2018-12-07 22:23:15 +00:00
parent 550271b338
commit cadafffbec
4 changed files with 30 additions and 26 deletions

View File

@ -285,48 +285,48 @@ void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_l
lc->params[ctx->id("DFF_ENABLE")] = "1";
std::string config = dff->type.str(ctx).substr(2);
auto citer = config.begin();
replace_port(dff, ctx->id("C"), lc, ctx->id("CLK"));
replace_port(dff, id_C, lc, id_CLK);
if (citer != config.end()) {
auto gnd_net = ctx->nets.at(ctx->id("$PACKER_GND_NET")).get();
if (*citer == 'S') {
citer++;
if (get_net_or_empty(dff, ctx->id("S")) != gnd_net) {
lc->params[ctx->id("SR")] = "SRHIGH";
if (get_net_or_empty(dff, id_S) != gnd_net) {
lc->params[id_SR] = "SRHIGH";
lc->params[ctx->id("SYNC_ATTR")] = "SYNC";
replace_port(dff, ctx->id("S"), lc, ctx->id("SR"));
replace_port(dff, id_S, lc, id_SR);
}
else
disconnect_port(ctx, dff, ctx->id("S"));
disconnect_port(ctx, dff, id_S);
} else if (*citer == 'R') {
citer++;
if (get_net_or_empty(dff, ctx->id("R")) != gnd_net) {
lc->params[ctx->id("SR")] = "SRLOW";
if (get_net_or_empty(dff, id_R) != gnd_net) {
lc->params[id_SR] = "SRLOW";
lc->params[ctx->id("SYNC_ATTR")] = "SYNC";
replace_port(dff, ctx->id("R"), lc, ctx->id("SR"));
replace_port(dff, id_R, lc, id_SR);
}
else
disconnect_port(ctx, dff, ctx->id("R"));
disconnect_port(ctx, dff, id_R);
} else if (*citer == 'C') {
citer++;
if (get_net_or_empty(dff, ctx->id("CLR")) != gnd_net) {
lc->params[ctx->id("SR")] = "SRLOW";
if (get_net_or_empty(dff, id_CLR) != gnd_net) {
lc->params[id_SR] = "SRLOW";
lc->params[ctx->id("SYNC_ATTR")] = "ASYNC";
replace_port(dff, ctx->id("CLR"), lc, ctx->id("SR"));
replace_port(dff, id_CLR, lc, id_SR);
}
else
disconnect_port(ctx, dff, ctx->id("CLR"));
disconnect_port(ctx, dff, id_CLR);
} else {
NPNR_ASSERT(*citer == 'P');
citer++;
if (get_net_or_empty(dff, ctx->id("PRE")) != gnd_net) {
lc->params[ctx->id("SR")] = "SRHIGH";
if (get_net_or_empty(dff, id_PRE) != gnd_net) {
lc->params[id_SR] = "SRHIGH";
lc->params[ctx->id("SYNC_ATTR")] = "ASYNC";
replace_port(dff, ctx->id("PRE"), lc, ctx->id("SR"));
replace_port(dff, id_PRE, lc, id_SR);
}
else
disconnect_port(ctx, dff, ctx->id("PRE"));
disconnect_port(ctx, dff, id_PRE);
}
}
@ -410,14 +410,14 @@ bool is_clock_port(const BaseCtx *ctx, const PortRef &port)
if (port.cell == nullptr)
return false;
if (is_ff(ctx, port.cell))
return port.port == ctx->id("C");
return port.port == id_C;
if (port.cell->type == ctx->id("ICESTORM_LC"))
return port.port == ctx->id("CLK");
return port.port == id_CLK;
if (is_ram(ctx, port.cell) || port.cell->type == ctx->id("ICESTORM_RAM"))
return port.port == ctx->id("RCLK") || port.port == ctx->id("WCLK") || port.port == ctx->id("RCLKN") ||
port.port == ctx->id("WCLKN");
if (is_sb_mac16(ctx, port.cell) || port.cell->type == ctx->id("ICESTORM_DSP"))
return port.port == ctx->id("CLK");
return port.port == id_CLK;
return false;
}
@ -426,9 +426,9 @@ bool is_reset_port(const BaseCtx *ctx, const PortRef &port)
if (port.cell == nullptr)
return false;
if (is_ff(ctx, port.cell))
return port.port == ctx->id("R") || port.port == ctx->id("S");
return port.port == id_R || port.port == id_S;
if (port.cell->type == ctx->id("ICESTORM_LC"))
return port.port == ctx->id("SR");
return port.port == id_SR;
if (is_sb_mac16(ctx, port.cell) || port.cell->type == ctx->id("ICESTORM_DSP"))
return port.port == ctx->id("IRSTTOP") || port.port == ctx->id("IRSTBOT") || port.port == ctx->id("ORSTTOP") ||
port.port == ctx->id("ORSTBOT");
@ -442,7 +442,7 @@ bool is_enable_port(const BaseCtx *ctx, const PortRef &port)
if (is_ff(ctx, port.cell))
return port.port == ctx->id("E");
if (port.cell->type == ctx->id("ICESTORM_LC"))
return port.port == ctx->id("CEN");
return port.port == id_CEN;
// FIXME
// if (is_sb_mac16(ctx, port.cell) || port.cell->type == ctx->id("ICESTORM_DSP"))
// return port.port == ctx->id("CE");

View File

@ -14,6 +14,10 @@ X(COUT)
X(CEN)
X(CLK)
X(SR)
X(S)
X(R)
X(PRE)
X(CLR)
X(MASK_0)
X(MASK_1)

View File

@ -309,7 +309,7 @@ static void set_net_constant(const Context *ctx, NetInfo *orig, NetInfo *constne
!constval) {
uc->ports[user.port].net = nullptr;
} else if ((is_sb_mac16(ctx, uc) || uc->type == ctx->id("ICESTORM_DSP")) &&
(user.port != ctx->id("CLK") &&
(user.port != id_CLK &&
((constval && user.port == ctx->id("CE")) || (!constval && user.port != ctx->id("CE"))))) {
uc->ports[user.port].net = nullptr;
} else if (is_ram(ctx, uc) && !constval && user.port != ctx->id("RCLK") && user.port != ctx->id("RCLKN") &&

View File

@ -178,8 +178,8 @@ DesignSharedPtr create_torc_design(const Context *ctx)
if (cell.second->lcInfo.negClk)
instPtr->setConfig("CLKINV", "", "CLK_B");
if (get_net_or_empty(cell.second.get(), ctx->id("SR"))) {
instPtr->setConfig(setting + "SR", "", cell.second->params.at(ctx->id("SR")));
if (get_net_or_empty(cell.second.get(), id_SR)) {
instPtr->setConfig(setting + "SR", "", cell.second->params.at(id_SR));
instPtr->setConfig("SYNC_ATTR", "", cell.second->params.at(ctx->id("SYNC_ATTR")));
instPtr->setConfig("SRUSEDMUX", "", "IN");
}