FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal


Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-29-2003, 06:36 PM
Posts: n/a
Default Re: Verilog-2001 parameter declarations

>I'm trying to use Verilog-2001 style module port declarations and have
>a parameter defined as well. See my example:
>module my_module (
> output [WIDTH-1:0] my_output,
> input [WIDTH-1:0] my_input
>parameter WIDTH = 1;
>assign my_output = my_input;
>I can't figure out where to put the parameter declaration to get rid
>of the syntax errors that are being reported (using VCS 7.0). Can
>parameters be declared when defining ports in this manner?

Here's how:
module my_module
#(parameter WIDTH = 8) // 0 -> full board, 1 -> 1 mem unit
output [WIDTH-1:0] my_output,
input [WIDTH-1:0] my_input

assign my_output = my_input;

endmodule // my_module

// For instantiation:
#(.WIDTH (8))
( // output
.my_output (data_out[7:0]),
.my_input (data_in[7:0])
Ben Cohen Publisher, Trainer, Consultant (310) 721-4830
http://www.vhdlcohen.com/ [email protected]
Author of following textbooks:
* Using PSL/SUGAR with Verilog and VHDL
Guide to Property Specification Language for ABV, 2003 isbn 0-9705394-4-4
* Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn
* Component Design by Example ", 2001 isbn 0-9705394-0-1
* VHDL Coding Styles and Methodologies, 2nd Edition, 1999 isbn 0-7923-8474-1
* VHDL Answers to Frequently Asked Questions, 2nd Edition, isbn 0-7923-8115

Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved