EmbDev.net

Forum: FPGA, VHDL & Verilog usage of parameters in size spec ?


von Vivek M. (Company: Student) (vivekm12004)


Rate this post
useful
not useful
Hi,

This is a query on Verilog usage. If this is not the appropriate forum
for this type of query, please ignore this request.

Can I use parameters as part of the size specification for a sized
number ? My simulator (gplcver), gives error. e.g. :-
***
parameter DATA_WIDTH = 8;

// o/p to external bus
assign data = (CS && !WR) ? data_out : DATA_WIDTH'bz;
***

I wish to avoid `defines in verilog source.

-- Thanks, V

von Hans (Guest)


Rate this post
useful
not useful
Hi,

just use
1
{DATA_WIDTH{1'bz}}
instead of
1
DATA_WIDTH'bz
This will replicate the 1'bz the number of times specified by the 
parameter.

von Vivek M. (Company: Student) (vivekm12004)


Rate this post
useful
not useful
Thanks Hans ! I have made a note of the replication operator.
-- V

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.