Verilog 中的可综合算术移位

Synthesizable arithmetic shift in Verilog

我最近在 Whosebug 上遇到了 this answer

With Verilog, once you take a part-select, the result is unsigned. Use the $signed system task on the part select to make it signed.

这个方法是否可综合(即系统任务$signed

如果它不可综合,是否有不同的方法来对像 a <= a>>>2 这样的变量执行算术移位(这应该给出 a 除以 4 时的商)。

当然是可以合成的。您的特定工具是否支持它是另一个问题。

您还可以在 SystemVerilog 中使用强制转换。

res = signed'(registers[0][0]) >>> 2;