mistral: emit compressed bitstreams by default

nextpnr-mistral defaulted to UNCOMPRESSED RBFs (--compress-rbf opted in
to compression). An uncompressed bitstream configures the device (the
socfpga FPGA manager reports 'operating'), but on the FPGA-manager load
path it leaves user IO non-functional — verified on a DE10-Nano/MiSTer:
an uncompressed single-LED design stays dark, the byte-identical
compressed encoding lights it. Quartus also emits compressed.

OPT_B already tracked the compression choice in-tree (the compressed
branch set the same OPT_B value Quartus uses), so this is purely a
default flip: read a new 'uncompressed_rbf' opt-out instead of a
'compress_rbf' opt-in. --compress-rbf is kept as a deprecated no-op;
--uncompressed-rbf restores the old behaviour for debugging.

Verified: regenerating a design with no flags now produces bytes
identical to a bitstream confirmed working on silicon.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
John Fabienke 2026-06-13 07:57:31 +02:00
parent 32324500c4
commit 515eacf55a
3 changed files with 18 additions and 3 deletions

View File

@ -60,7 +60,15 @@ struct MistralBitgen
void options()
{
if (!ctx->setting<bool>("compress_rbf", false)) {
// Cyclone V bitstreams may be emitted compressed or uncompressed.
// We default to COMPRESSED. An uncompressed bitstream still
// configures the device (the FPGA manager reports "operating"),
// but on the socfpga FPGA-manager load path (verified on a
// DE10-Nano / MiSTer) it leaves user IO non-functional; the
// compressed encoding matches Quartus output and works on
// silicon. OPT_B carries the compression-format flag in the
// header and must track the chosen encoding.
if (ctx->setting<bool>("uncompressed_rbf", false)) {
cv->opt_b_set(CycloneV::COMPRESSION_DIS, true);
cv->opt_r_set(CycloneV::OPT_B, 0xffffff40adffffffULL);
} else

View File

@ -109,6 +109,7 @@ X(CFG_DBITS)
X(clkout)
X(clkout1)
X(compress_rbf)
X(uncompressed_rbf)
X(oscena)
X(placer)
X(router)

View File

@ -49,7 +49,10 @@ po::options_description MistralCommandHandler::getArchOptions()
specific.add_options()("device", po::value<std::string>(), "device name (e.g. 5CSEBA6U23I7)");
specific.add_options()("qsf", po::value<std::string>(), "path to QSF constraints file");
specific.add_options()("rbf", po::value<std::string>(), "RBF bitstream to write");
specific.add_options()("compress-rbf", "generate compressed bitstream");
specific.add_options()("uncompressed-rbf",
"emit an uncompressed bitstream (default is compressed; uncompressed "
"configures the device but may leave IO non-functional on some loaders)");
specific.add_options()("compress-rbf", "deprecated, no-op: compressed output is now the default");
return specific;
}
@ -79,8 +82,11 @@ std::unique_ptr<Context> MistralCommandHandler::createContext(dict<std::string,
}
chipArgs.device = vm["device"].as<std::string>();
auto ctx = std::unique_ptr<Context>(new Context(chipArgs));
if (vm.count("uncompressed-rbf"))
ctx->settings[id_uncompressed_rbf] = Property::State::S1;
if (vm.count("compress-rbf"))
ctx->settings[id_compress_rbf] = Property::State::S1;
log_warning("--compress-rbf is deprecated and has no effect; compressed output is now the "
"default (pass --uncompressed-rbf to opt out).\n");
return ctx;
}