> However, consider this:
>
> input [31:0] x;
> input [5:0] shift;
> output [31:0] z;
> wire [63:0] y = {x, 31'b0};
> assign z = y >> (shift + 32);
>
> The shift+32 is cheap, because all you're really doing is inverting
> the high bit of the shift amount.  The only question is how much more
> expensive is a 64-bit shifter than a 32-bit shifter.

How does this compare to:

  z = shift[5] ? (y >> shift[4:0]) : (y << shift[4:0])

If you turned this into a switch statement you could also use the high bits of 
the shift count to select between arithmetic and logical shifts.

For the compiler size of things, or-ing a few high bits is as easy as negating 
the shift count.

Paul
_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)

Reply via email to