EmbDev.net

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


von Sean Zheng (Guest)


Rate this post
0 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
0 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
0 useful
not useful
It is called parameter
module Sample #(parameter Width=8) (input wire [Width-1:0] DataIn)

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

von Sean Zheng (Guest)


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

von Sean Zheng (Guest)


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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.