0

I'm new to verilog and I have following question,

package pkg;
   parameter WIDTH = 6;
endpackage

module mod1 #(parameter PAR = 10)(in1,clk,out1); 
   import pkg::*;
   localparam FOO = 10; 
   input in1,clk;
   output out1;
   assign out1 = in1;
endmodule
module mod2 (in1,clk,out1);
   logic a1[WIDTH:0];
endmodule

I have imported package pkg in module mod1 and can I use parameter WIDTH (defined in pkg) in module mod2as in above code?

I'm trying to understand the scopes of verilog. Can someone please explain this.

1 Answer 1

3

No. An import statement is only local to the block it appears in. Basically from the point it appears in the source, to the end word. In this case, the endmodule.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.