Add "nextpnr-ice40 --tmfuzz"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
c4e544856a
commit
2da90889ef
@ -161,6 +161,7 @@ struct Router
|
||||
std::unordered_map<WireId, delay_t> src_wires;
|
||||
src_wires[src_wire] = 0;
|
||||
route(src_wires, dst_wire);
|
||||
routedOkay = visited.count(dst_wire);
|
||||
}
|
||||
|
||||
Router(Context *ctx, IdString net_name, bool ripup = false,
|
||||
@ -526,4 +527,13 @@ bool route_design(Context *ctx)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool get_actual_route_delay(Context *ctx, WireId src_wire, WireId dst_wire,
|
||||
delay_t &delay)
|
||||
{
|
||||
Router router(ctx, src_wire, dst_wire);
|
||||
if (router.routedOkay)
|
||||
delay = router.visited.at(dst_wire).delay;
|
||||
return router.routedOkay;
|
||||
}
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
@ -25,6 +25,8 @@
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
extern bool route_design(Context *ctx);
|
||||
extern bool get_actual_route_delay(Context *ctx, WireId src_wire,
|
||||
WireId dst_wire, delay_t &delay);
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
||||
|
@ -86,6 +86,7 @@ int main(int argc, char *argv[])
|
||||
options.add_options()("seed", po::value<int>(),
|
||||
"seed value for random number generator");
|
||||
options.add_options()("version,V", "show version");
|
||||
options.add_options()("tmfuzz", "run path delay estimate fuzzer");
|
||||
options.add_options()("lp384", "set device type to iCE40LP384");
|
||||
options.add_options()("lp1k", "set device type to iCE40LP1K");
|
||||
options.add_options()("lp8k", "set device type to iCE40LP8K");
|
||||
@ -220,6 +221,45 @@ int main(int argc, char *argv[])
|
||||
std::cout << "</svg>\n";
|
||||
}
|
||||
|
||||
if (vm.count("tmfuzz")) {
|
||||
std::vector<WireId> src_wires, dst_wires;
|
||||
|
||||
for (auto w : ctx.getWires())
|
||||
src_wires.push_back(w);
|
||||
|
||||
for (auto b : ctx.getBels()) {
|
||||
if (ctx.getBelType(b) == TYPE_ICESTORM_LC) {
|
||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_I0));
|
||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_I1));
|
||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_I2));
|
||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_I3));
|
||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_CEN));
|
||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_CIN));
|
||||
}
|
||||
if (ctx.getBelType(b) == TYPE_SB_IO) {
|
||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_D_OUT_0));
|
||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_OUTPUT_ENABLE));
|
||||
}
|
||||
}
|
||||
|
||||
ctx.shuffle(src_wires);
|
||||
ctx.shuffle(dst_wires);
|
||||
|
||||
for (int i = 0; i < int(src_wires.size()) && i < int(dst_wires.size());
|
||||
i++) {
|
||||
delay_t actual_delay;
|
||||
if (!get_actual_route_delay(&ctx, src_wires[i], dst_wires[i],
|
||||
actual_delay))
|
||||
continue;
|
||||
printf("%s %s %.3f %.3f\n",
|
||||
ctx.getWireName(src_wires[i]).c_str(&ctx),
|
||||
ctx.getWireName(dst_wires[i]).c_str(&ctx),
|
||||
ctx.getDelayNS(actual_delay),
|
||||
ctx.getDelayNS(
|
||||
ctx.estimateDelay(src_wires[i], dst_wires[i])));
|
||||
}
|
||||
}
|
||||
|
||||
if (vm.count("json")) {
|
||||
std::string filename = vm["json"].as<std::string>();
|
||||
std::istream *f = new std::ifstream(filename);
|
||||
|
Loading…
Reference in New Issue
Block a user