diff options
| -rw-r--r-- | ice40/arch.cc | 30 | ||||
| -rw-r--r-- | ice40/arch.h | 5 | ||||
| -rw-r--r-- | ice40/pack.cc | 32 | ||||
| -rw-r--r-- | ice40/place_legaliser.cc | 1 | 
4 files changed, 37 insertions, 31 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc index 1c6dd6a5..a5c920bb 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -697,4 +697,34 @@ bool Arch::isGlobalNet(const NetInfo *net) const      return net->driver.cell != nullptr && net->driver.port == id_glb_buf_out;  } +// Assign arch arg info +void Arch::assignArchArgs() +{ +    for (auto &net : getCtx()->nets) { +        NetInfo *ni = net.second.get(); +        if (isGlobalNet(ni)) +            ni->is_global = true; +    } +    for (auto &cell : getCtx()->cells) { +        CellInfo *ci = cell.second.get(); +        ci->belType = belTypeFromId(ci->type); +        if (ci->type == id_icestorm_lc) { +            ci->lcInfo.dffEnable = bool_or_default(ci->params, id_dff_en); +            ci->lcInfo.negClk = bool_or_default(ci->params, id_neg_clk); +            ci->lcInfo.clk = get_net_or_empty(ci, id_clk); +            ci->lcInfo.cen = get_net_or_empty(ci, id_cen); +            ci->lcInfo.sr = get_net_or_empty(ci, id_sr); +            ci->lcInfo.inputCount = 0; +            if (get_net_or_empty(ci, id_i0)) +                ci->lcInfo.inputCount++; +            if (get_net_or_empty(ci, id_i1)) +                ci->lcInfo.inputCount++; +            if (get_net_or_empty(ci, id_i2)) +                ci->lcInfo.inputCount++; +            if (get_net_or_empty(ci, id_i3)) +                ci->lcInfo.inputCount++; +        } +    } +} +  NEXTPNR_NAMESPACE_END diff --git a/ice40/arch.h b/ice40/arch.h index 1c47e958..8821ded2 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -705,6 +705,11 @@ struct Arch : BaseCtx      // Helper function for above      bool logicCellsCompatible(const std::vector<const CellInfo *> &cells) const; +    // ------------------------------------------------- +    // Assign architecure-specific arguments to nets and cells, which must be called between packing or further +    // netlist modifications, and validity checks +    void assignArchArgs(); +      IdString id_glb_buf_out;      IdString id_icestorm_lc, id_sb_io, id_sb_gb;      IdString id_cen, id_clk, id_sr; diff --git a/ice40/pack.cc b/ice40/pack.cc index e656e596..6a6bdfaf 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -575,36 +575,6 @@ static void pack_special(Context *ctx)      }  } -// Assign arch arg info -static void assign_archargs(Context *ctx) -{ -    for (auto &net : ctx->nets) { -        NetInfo *ni = net.second.get(); -        if (ctx->isGlobalNet(ni)) -            ni->is_global = true; -    } -    for (auto &cell : ctx->cells) { -        CellInfo *ci = cell.second.get(); -        ci->belType = ctx->belTypeFromId(ci->type); -        if (is_lc(ctx, ci)) { -            ci->lcInfo.dffEnable = bool_or_default(ci->params, ctx->id("DFF_ENABLE")); -            ci->lcInfo.negClk = bool_or_default(ci->params, ctx->id("NEG_CLK")); -            ci->lcInfo.clk = get_net_or_empty(ci, ctx->id("CLK")); -            ci->lcInfo.cen = get_net_or_empty(ci, ctx->id("CEN")); -            ci->lcInfo.sr = get_net_or_empty(ci, ctx->id("SR")); -            ci->lcInfo.inputCount = 0; -            if (get_net_or_empty(ci, ctx->id("I0"))) -                ci->lcInfo.inputCount++; -            if (get_net_or_empty(ci, ctx->id("I1"))) -                ci->lcInfo.inputCount++; -            if (get_net_or_empty(ci, ctx->id("I2"))) -                ci->lcInfo.inputCount++; -            if (get_net_or_empty(ci, ctx->id("I3"))) -                ci->lcInfo.inputCount++; -        } -    } -} -  // Main pack function  bool Arch::pack()  { @@ -619,7 +589,7 @@ bool Arch::pack()          pack_carries(ctx);          pack_ram(ctx);          pack_special(ctx); -        assign_archargs(ctx); +        ctx->assignArchArgs();          log_info("Checksum: 0x%08x\n", ctx->checksum());          return true;      } catch (log_execution_error_exception) { diff --git a/ice40/place_legaliser.cc b/ice40/place_legaliser.cc index 5fffb4fb..ebcc0da7 100644 --- a/ice40/place_legaliser.cc +++ b/ice40/place_legaliser.cc @@ -127,6 +127,7 @@ class PlacementLegaliser          legalise_others();          legalise_logic_tiles();          bool replaced_cells = replace_cells(); +        ctx->assignArchArgs();          return legalised_carries && replaced_cells;      }  | 
