mirror of
https://github.com/zachjs/sv2v.git
synced 2026-08-30 09:28:12 +02:00
support for struct type parameters
- param type conversion properly supports deferred param type resolution - fixed struct conversion incomplete Subroutine traversal - struct conversion excludes param types from conversion - parameters are defaulted to have integer type
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// TODO Add support for parameters without default values.
|
||||
module Module #(parameter type T, parameter N = 1);
|
||||
T t;
|
||||
type(t.a) x;
|
||||
type(t.b) y;
|
||||
initial begin
|
||||
$display("$bits(T)=", $bits(T));
|
||||
$display("$bits(t)=", $bits(t));
|
||||
$display("$bits(t.a)=", $bits(t.a));
|
||||
$display("$bits(t.b)=", $bits(t.b));
|
||||
$display("$bits(x)=", $bits(x));
|
||||
$display("$bits(y)=", $bits(y));
|
||||
$display("$bits(N)=", $bits(N));
|
||||
$display("N=", N);
|
||||
end
|
||||
endmodule
|
||||
module top;
|
||||
typedef struct packed {
|
||||
logic a;
|
||||
logic [2] b;
|
||||
} Struct1;
|
||||
typedef struct packed {
|
||||
logic [5] a;
|
||||
Struct1 b;
|
||||
logic [2] c;
|
||||
logic d;
|
||||
} Struct2;
|
||||
Module #(Struct1, $bits(Struct1)) m1();
|
||||
Module #(Struct2, $bits(Struct2)) m2();
|
||||
endmodule
|
||||
@@ -0,0 +1,28 @@
|
||||
module Module1 #(parameter N = 1);
|
||||
initial begin
|
||||
$display("$bits(T)=", 3);
|
||||
$display("$bits(t)=", 3);
|
||||
$display("$bits(t.a)=", 1);
|
||||
$display("$bits(t.b)=", 2);
|
||||
$display("$bits(x)=", 1);
|
||||
$display("$bits(y)=", 2);
|
||||
$display("$bits(N)=", 32);
|
||||
$display("N=", N);
|
||||
end
|
||||
endmodule
|
||||
module Module2 #(parameter N = 1);
|
||||
initial begin
|
||||
$display("$bits(T)=", 11);
|
||||
$display("$bits(t)=", 11);
|
||||
$display("$bits(t.a)=", 5);
|
||||
$display("$bits(t.b)=", 3);
|
||||
$display("$bits(x)=", 5);
|
||||
$display("$bits(y)=", 3);
|
||||
$display("$bits(N)=", 32);
|
||||
$display("N=", N);
|
||||
end
|
||||
endmodule
|
||||
module top;
|
||||
Module1 #(3) m1();
|
||||
Module2 #(11) m2();
|
||||
endmodule
|
||||
Reference in New Issue
Block a user