From 0345b6e803bef9bf63eb6a862f96b3b1dded857a Mon Sep 17 00:00:00 2001 From: Aritz Erkiaga <38228836+aerkiaga@users.noreply.github.com> Date: Wed, 1 Jan 2025 13:05:54 +0100 Subject: [PATCH] Fix gowin ALU SUB mode ports (#1407) --- himbaechel/uarch/gowin/pack.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/himbaechel/uarch/gowin/pack.cc b/himbaechel/uarch/gowin/pack.cc index e820bd16..21f9c2ea 100644 --- a/himbaechel/uarch/gowin/pack.cc +++ b/himbaechel/uarch/gowin/pack.cc @@ -1423,6 +1423,12 @@ struct GowinPacker ci->renamePort(id_I0, id_I3); ci->renamePort(id_I2, id_I0); } + // XXX mode 1 - SUB + else if (ci->params.at(id_ALU_MODE).as_int64() == 1) { + ci->renamePort(id_I3, id_I2); + ci->renamePort(id_I1, id_I3); + ci->renamePort(id_I2, id_I1); + } // XXX I2 is pin C which must be set to 1 for all ALU modes except MUL // we use only mode 2 ADDSUB so create and connect this pin ci->addInput(id_I2);