From: Eddie Hung Date: Thu, 1 Aug 2019 17:00:49 +0000 (-0700) Subject: CO is sign extension only if signed multiplier X-Git-Tag: working-ls180~1039^2~285 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c54a39069d1f536da7a830fa2fa504bc72c20c18;p=yosys.git CO is sign extension only if signed multiplier --- diff --git a/passes/pmgen/ice40_dsp.cc b/passes/pmgen/ice40_dsp.cc index 00794ca0d..f88cd62dd 100644 --- a/passes/pmgen/ice40_dsp.cc +++ b/passes/pmgen/ice40_dsp.cc @@ -147,7 +147,12 @@ void create_ice40_dsp(ice40_dsp_pm &pm) int O_width = GetSize(O); if (O_width == 33) { log_assert(st.addAB); - cell->setPort("\\CO", O[-1]); + // If we have a signed multiply-add, then perform sign extension + // TODO: Need to check CD[31:16] is sign extension of CD[15:0]? + if (st.addAB->getParam("\\A_SIGNED").as_bool() && st.addAB->getParam("\\B_SIGNED").as_bool()) + pm.module->connect(O[-1], O[-2]); + else + cell->setPort("\\CO", O[-1]); O.remove(O_width-1); } else