mirror of
https://github.com/zachjs/sv2v.git
synced 2026-09-01 01:56:23 +02:00
fix premature conversion of casts containing dimension queries
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package P;
|
||||
function automatic logic [7:0] f(input logic [2:0] p);
|
||||
logic [7:0] r;
|
||||
r = '0;
|
||||
r[p+:2] = '1;
|
||||
return r;
|
||||
endfunction
|
||||
endpackage
|
||||
|
||||
module top;
|
||||
logic [2:0] p;
|
||||
logic [7:0] q;
|
||||
assign q = P::f(p);
|
||||
initial begin
|
||||
$monitor("%0d, p=%b q=%b", $time, p, q);
|
||||
#1 p = 0;
|
||||
while (p != 7)
|
||||
#1 p = p + 1;
|
||||
end
|
||||
endmodule
|
||||
@@ -0,0 +1,18 @@
|
||||
module top;
|
||||
function automatic [7:0] f;
|
||||
input [2:0] p;
|
||||
begin
|
||||
f = 7'b0;
|
||||
f[p+:2] = 2'b11;
|
||||
end
|
||||
endfunction
|
||||
reg [2:0] p;
|
||||
wire [7:0] q;
|
||||
assign q = f(p);
|
||||
initial begin
|
||||
$monitor("%0d, p=%b q=%b", $time, p, q);
|
||||
#1 p = 0;
|
||||
while (p != 7)
|
||||
#1 p = p + 1;
|
||||
end
|
||||
endmodule
|
||||
Reference in New Issue
Block a user