EmbDev.net

Forum: FPGA, VHDL & Verilog Does Verilog have generic map like VHDL?


von Sean Zheng (Guest)


Rate this post
useful
not useful
I am a beginner of Verilog. I am trying to build an N-bit-comparator. 
But I found no information for any generic map. I know in VHDL I can do

generic (N: integer:=4);

so that I can modify bits when I want to use this block.

If there is anything in Verilog that is similar to generic map in VHDL, 
it will help save me lots of work.

von Tim (Guest)


Rate this post
useful
not useful
googled: verilog generic

http://www.asic-world.com/verilog/para_modules1.html

sufficient explaination for you?

von Lattice User (Guest)


Rate this post
useful
not useful
It is called parameter
1
module Sample #(parameter Width=8) (input wire [Width-1:0] DataIn)

Instanziated it is like this:
1
wire [11:0] Data;
2
Sample #(.Width(12)) InstanceName (.DataIn( Data ));

von Sean Zheng (Guest)


Rate this post
useful
not useful
Thank you! My problem's solved now!

von Sean Zheng (Guest)


Rate this post
useful
not useful
@Lattice, Thank you! Now I understand very clear!

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.