"DW" <dave_...@hotmail.com> wrote in message
news:cbc8t5$4oa$1$830f...@news.demon.co.uk...
The Verilog language does not require a constant for the shift count. If
your tools aren't allowing it, complain to your vendor or get new tools.
I would expect a reasonable synthesis tool to allow it also, and produce
a barrel shifter (possibly optimized into something simpler depending on
the situation).
Note that calling >>> a "signed shift" is something of a misnomer. It
will perform an arithmetic shift (i.e. extending the sign bit) if the
expression being shifted is signed. It will perform a logical shift
(i.e. shifting in zeroes) if the expression being shifted is unsigned.
In other words, >>> works the way >> works in C.
The older >> always did a logical shift, even for a signed value, and
had to be left that way for backward compatibility. So if you want an
arithmetic shift, use >>>, but also make sure that the value being shifted
is signed.
For a left shift, there is no difference between << and <<<.