From b0a78de78f213d6cb169a22e38179c48f3dc02fc Mon Sep 17 00:00:00 2001 From: gatecat Date: Wed, 12 Apr 2023 17:16:49 +0200 Subject: fabulous: Support for configurable LUT size Signed-off-by: gatecat --- generic/viaduct/fabulous/fabulous.cc | 2 ++ generic/viaduct/fabulous/fasm.cc | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/generic/viaduct/fabulous/fabulous.cc b/generic/viaduct/fabulous/fabulous.cc index 6141974e..ed528b0b 100644 --- a/generic/viaduct/fabulous/fabulous.cc +++ b/generic/viaduct/fabulous/fabulous.cc @@ -48,6 +48,8 @@ struct FabulousImpl : ViaductAPI for (auto a : args) { if (a.first == "fasm") fasm_file = a.second; + else if (a.first == "lut_k") + cfg.clb.lut_k = std::stoi(a.second); else log_error("unrecognised fabulous option '%s'\n", a.first.c_str()); } diff --git a/generic/viaduct/fabulous/fasm.cc b/generic/viaduct/fabulous/fasm.cc index f1c0c648..0ec6f02d 100644 --- a/generic/viaduct/fabulous/fasm.cc +++ b/generic/viaduct/fabulous/fasm.cc @@ -99,7 +99,7 @@ struct FabFasmWriter { std::vector bits(width, false); for (int i = 0; i < width; i++) - bits[i] = (value & (1ULL << i)) != 0; + bits[i] = (value & (1ULL << unsigned(i))) != 0; write_vector(name, bits, invert); } // Write an int vector param @@ -124,7 +124,9 @@ struct FabFasmWriter uint64_t depermute_lut(const CellInfo *lut) { - uint64_t orig_init = int_or_default(lut->params, id_INIT, 0); + uint64_t orig_init = 0; + if (lut->params.count(id_INIT)) + orig_init = lut->params.at(id_INIT).as_int64(); std::vector> phys_to_log; phys_to_log.resize(cfg.clb.lut_k); for (unsigned i = 0; i < cfg.clb.lut_k; i++) { -- cgit v1.2.3