A
alan
Guest
I need to implement a (synthesizable) variable-width rotate.
My first instinct is to do something like:
module barrel_rotate
#(parameter
width_sel = 3,
//localparam
width = 1 << width_sel)
(
input [width-1:0] in,
input [width_sel-1:0] shift,
output [width-1:0] out);
wire [width*2-1:0] internal = {in, in};
wire [width-1:0] out = internal >> shift;
endmodule
Is this correct? Simulation suggests it works, but is it
synthesizable?
Or is my gut feeling - that my client's synthesizer is what I should
be asking anyway - correct? In short, for new enough synthesizers, it
will be synthesizable, but for old synthesizers it won't?
And then there's this implementation:
http://groups.google.com/group/comp.lang.verilog/browse_thread/thread/45e1696a42e6e856/09b7e32f0ce9e982?lnk=gst&q=barrel+shifter&rnum=2#09b7e32f0ce9e982
It's for an arithmetic shifter, but the pattern of how to transform it
to a logical shifter is obvious enough.
If my code above won't synthesize on my client's synthesizer, how do I
go about transforming it to the form in the post I linked above, while
retaining the variable-width parameter? Generate statements? Perl,
if my client's synth tool is that sucky???
My first instinct is to do something like:
module barrel_rotate
#(parameter
width_sel = 3,
//localparam
width = 1 << width_sel)
(
input [width-1:0] in,
input [width_sel-1:0] shift,
output [width-1:0] out);
wire [width*2-1:0] internal = {in, in};
wire [width-1:0] out = internal >> shift;
endmodule
Is this correct? Simulation suggests it works, but is it
synthesizable?
Or is my gut feeling - that my client's synthesizer is what I should
be asking anyway - correct? In short, for new enough synthesizers, it
will be synthesizable, but for old synthesizers it won't?
And then there's this implementation:
http://groups.google.com/group/comp.lang.verilog/browse_thread/thread/45e1696a42e6e856/09b7e32f0ce9e982?lnk=gst&q=barrel+shifter&rnum=2#09b7e32f0ce9e982
It's for an arithmetic shifter, but the pattern of how to transform it
to a logical shifter is obvious enough.
If my code above won't synthesize on my client's synthesizer, how do I
go about transforming it to the form in the post I linked above, while
retaining the variable-width parameter? Generate statements? Perl,
if my client's synth tool is that sucky???