After some tinkering I discovered that currently synthesis doesn’t infer the MULT18x18 block in the DSP. As pointed out from Apicula’s Matrix channel, it is actually supported, but not yet “plugged in” during the synthesis.
So, here’s my initial attempt at enabling the MULT36x36, MULT18x18 and MULT9x9 cells, which is one small step further. Though there are still some issues left:
Is the approach valid and dsp techmapping is done at proper location? (I initially struggled a lot because I initially tried inserting the techmap lookup after synth -run coarse step, but that failed to find the cells)
How to get techmap lookup select the optimal (ie smallest applicable) cell for it. Right now it selects 36x36 for 16 bit multiplication instead of 18x18.
Having a quick look at the existing synth_nexus pass, it seems they infer DSPs during the latter part of the coarse step (I think the important part is to run before alumacc gets called). It also looks like they set the min width for the larger DSPs to be greater than the max width for the smaller size:
I’m guessing this prevents using (e.g.) 36x36 if it would have fit in an 18x18. I would also suggest using the same variable name as the flag, i.e. either if ("-dsp") dsp=true, or if("-nodsp")nodsp=true, rather than if("-dsp") nodsp=false. synth_ice40 gives an example for using -dsp.