conversion for package-scoped tasks, functions, and typenames

This commit is contained in:
Zachary Snow
2019-04-24 04:01:33 -04:00
parent bc23aebc55
commit 2d003c6ded
5 changed files with 54 additions and 12 deletions
+16
View File
@@ -6,6 +6,18 @@ package B;
localparam FOO = -37;
localparam BAR = -97;
endpackage
package C;
typedef logic [3:0] pack_t;
endpackage
package D;
function C::pack_t pack;
input logic x;
pack = {$bits(C::pack_t){x}};
endfunction
endpackage
package E;
import D::*;
endpackage
module top;
import A::FOO;
import B::BAR;
@@ -16,5 +28,9 @@ module top;
$display(B::BAR);
$display(FOO);
$display(BAR);
$display("%d", D::pack(0));
$display("%d", D::pack(1));
$display("%d", E::pack(0));
$display("%d", E::pack(1));
end
endmodule
+12
View File
@@ -5,6 +5,14 @@ module top;
localparam B_BAR = -97;
localparam FOO = 37;
localparam BAR = -97;
function [3:0] D_pack;
input reg x;
D_pack = {4{x}};
endfunction
function [3:0] E_pack;
input reg x;
E_pack = {4{x}};
endfunction
initial begin
$display(A_FOO);
$display(A_BAR);
@@ -12,5 +20,9 @@ module top;
$display(B_BAR);
$display(FOO);
$display(BAR);
$display("%d", D_pack(0));
$display("%d", D_pack(1));
$display("%d", E_pack(0));
$display("%d", E_pack(1));
end
endmodule