`define within a for loop

R

ric

Guest
Hi

Perhapps someone can help me with an annoying problem I encounterd
when I
was trying to change variable within a for loop using `define.

Here is the loop :
*********************************************
initial
begin
wait (x0==3'b100);
for (n= 17; n>= 0; n=n-1)
begin
`define W_BLOCK n
for (o=0; o<=6; o=o+1)
begin
`define W_POSITION o
w =
canceller_model.canceller_top.ec_0.echo_(`W_BLOCK).ec_addend_gen.w(`W_POSITION)
;
$fdisplay(w_ec_rpt,"%d",w);
end
end
end
*********************************************
when I vlog it using modelsim , I get message " near ".": expecting:
';' "

My purpose is to get the co-efficients when debug , but there are too
many paths there(fortunately they are named orderly : echo_0 , echo_1
, etc.) so I think that I can use for loop and `define to change path
and output the co-efficients .

I notice that when using defined value(eg. `W_BLOCK) separately , it
does change with the for loop , but it wouldn't work when put in the
path . I don't know what happens here , do I miss something ? Can you
give me another way to do this ?

Thanks in advance !
 

Welcome to EDABoard.com

Sponsor

Back
Top