我有以下代码:
module rotate
(
input wire [5:0] index,// tells how many bits to rotate
input [31:0] a,output [31:0] b
);
我想为左旋转实现此assign语句:
assign b = {a[32-index-1 : 0],a[31: 32-index] ;
..
..
..
endmodule
由于在仿真期间会评估导线/逻辑信号,因此上述分配将不起作用。我无法使用参数。
我尝试将导线转换为整数,然后进行赋值,但仍然无法正常工作。
int i1 = index ;
assign assign b[i1] = a[i1] ; // this worked
assign b[i1-1 : 0] = a[i1-1 : 0] ; //not worked
我在always_comb内使用for循环实现,但我想要一种更简单的方法,例如串联操作等。
请以适当的方式提供帮助。