mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-09-02 22:48:43 +02:00
Check that it is possible to reference a package scoped identifier that has the same name as a local identifier, but is a different kind of identifier. * A variable or function identifier from a package scope if it is a type identifier in the current scope * A type identifier from a package scope if it is a non-type identifier in the current scope Signed-off-by: Lars-Peter Clausen <[email protected]>
31 lines
588 B
Verilog
31 lines
588 B
Verilog
// Check that it is possible to reference a package scoped function, even if
|
|
// there is a type identifier of the same name in the current scope.
|
|
|
|
bit failed = 1'b0;
|
|
|
|
`define check(expr, val) \
|
|
if (expr !== val) begin \
|
|
$display("FAILED: %s, expected %0d, got %0d", `"expr`", val, expr); \
|
|
failed = 1'b1; \
|
|
end
|
|
|
|
package P;
|
|
function integer T(integer x);
|
|
return x + 1;
|
|
endfunction
|
|
endpackage
|
|
|
|
module test;
|
|
typedef integer T;
|
|
initial begin
|
|
integer x;
|
|
|
|
x = P::T(10);
|
|
`check(x, 11)
|
|
|
|
if (!failed) begin
|
|
$display("PASSED");
|
|
end
|
|
end
|
|
endmodule
|