P
parag_paul@hotmail.com
Guest
PLease look at the verilog below,
What should be the value of b in the funcitno call,
m1.foo()
it is a hierarchial reference, According to LRM , the default value
should be resolved from the subroutine where the function is declared.
module M1;
parameter int a = 5;
function void foo(int b = a); //CASE 1
//function void foo(int b = M2.a); //CASE 2
//function void foo(int b = M3.a); //CASE 3
$display(b);
endfunction
endmodule
module M2;
parameter int a = 10;
M1 m1();
initial m1.foo();
endmodule
module M3;
parameter int a = 20;
endmodule
What should be the value of b in the funcitno call,
m1.foo()
it is a hierarchial reference, According to LRM , the default value
should be resolved from the subroutine where the function is declared.
module M1;
parameter int a = 5;
function void foo(int b = a); //CASE 1
//function void foo(int b = M2.a); //CASE 2
//function void foo(int b = M3.a); //CASE 3
$display(b);
endfunction
endmodule
module M2;
parameter int a = 10;
M1 m1();
initial m1.foo();
endmodule
module M3;
parameter int a = 20;
endmodule