English 中文(简体)
Are you allowed to have a module identifier be the same as the module type in Verilog?
原标题:

For example

module top
    debouncer debouncer(...);
endmodule

module debouncer
...
endmodule

Can I instantiate a debouncer as "debouncer" in the top module, or is that illegal?

最佳回答

Yes, it is legal for a module instance name to match the module name in Verilog, and it is quite common to do so when you only need one instance of a module. But, you could have quickly verified that for yourself by simply compiling your file with your favorite simulator. The following is legal syntax and compiles for me:

module top;
    debouncer debouncer();
endmodule

module debouncer;
endmodule
问题回答

暂无回答




相关问题
How to NOT use while() loops in verilog (for synthesis)?

I ve gotten in the habit of developing a lot testbenches and use for() and while() loops for testing purpose. Thats fine. The problem is that I ve taken this habit over to coding for circuits which ...

Displaying the Verilog parameter name

I am using the parameter keyword to define a state, i.e., RESET = 5 b00000. If I want to use $display to print out the state name instead of the binary representation, or display the state name in my ...

verilog modelsim fpga

Sorry for Newbish question. I am trying to learn about FPGA programming. Before I spend $1K on a FPGA board: if I just want to learn Verilog, can I run it entirely in Modelsim? (I realize there are ...

Assigning wires deep in a nested set of modules

I have a wire that is about 4 levels deep and I really don t want the hassle of having to propagate it up the hierarchy. Is there any way to assign the wire using some sort of referencing? I know I ...

schematic for verilog code that adds three inputs

What does the schematic looks like for the following verilog code? module mystery2(s, c, x, y, z); input x, y, z; output s, c; assign {c, s} = x + y + z; endmodule I know that {c, s} means ...

wire equation in verilog [closed]

If say I have the following wire set-ups, is the wire assignment all valid? wire[3:1] w; wire w1; wire [1:0] w2; A) w1 = w[2]; B) w2 = w[1:0]; C) w2 = w[1:2]; I am guessing that everything is ...

How to wire two modules in Verilog?

I have written two modules DLatch and RSLatch and i want to write verilog code to join those two.

热门标签