parametrized instantiation problem

Status
Not open for further replies.

seyaleli

Newbie level 4
Joined
Dec 5, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,335
Hi guys.

I have a parametrized counter for which I want to input a constant load value

of 0 (the input port's name is count_load). I tried using the replication operator

in order to produce a parametrized ($clog2(MAX_TOKEN+1)) number of 0's for
the input,

but my modelsim 6.6 seems to refuse with an error message:

near "'b": syntax error, unexpected "BASE", expecting ',' or '}

the counter's instantiation looks like this:

gp_counter #(.COUNTER_WIDTH($clog2(MAX_TOKEN+1)))
PACKET_COUNTER (.clk(clk),.a_resetn(a_resetn), .syn_resetn(syn_resetn || resetn_packet_counter),
.count_load({($clog2(MAX_TOKEN+1))'b0}),
.count_out(packet_bits),
.next(packet_count_en),.load(1'b0),.mode(2'b01));

does anyone has a clue why the above fails to compile? and how can I

apply constant inputs to a parametrized module?

Thanks in advance,

Eyal.
 

does {($f(x)){1'b0}} work?
 

$clog2(MAX_TOKEN) didn't work... modelsim refuses to recognize a
constant / function as a repetition factor. Am I right? The only way of
creating a repeating number of bits is by specifically writing the value?

meaning: 4'b0 = 0000 ; // works fine

but,

parameter rrr=4;
rrr'b4 gives an error (and not the expected 0000).

Can anyone help?
 

does {($f(x)){1'b0}} work?
 

It actually did!

Thanks a bunch!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…