Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
737 Views

variable or constant error

i faced a problem neither to use constant nor variable. 

 

If i use integer then there will be a error([ocount_as and ocount_s are not constant) on this code:out_reg[i] = out_pin_in[ocount_ascount_s];

 

if i use the parameter then there will be a error (value must not be assigned to nonvariable "icount_e"

 

Can anyone tell me that what kind of data types should be declared?

Thanks

 

Pieces of the code as below:

 

integer icount_s, icount_e, icount_as;

 

always @ (reset or trans or out_pin_in or out_reg)

begin

ocount_s = 0;

ocount_e = n;

ocount_as = 7;

 

if (reset)

begin

for (i=0; i<8; i =i+1)

out_reg[i] = 0;

end

else if (trans) 

begin

for (i=0; i<8; i= i+1)

if (ocount_e >= 8)

begin

out_reg[i] = out_pin_in[ocount_ascount_s];

ocount_e = ocount_e - 8;

ocount_s = ocount_s +8;

ocount_as = ocount_as + 8;

end

 

else if (ocount_e ==0)

out_reg[i] = 0;

 

else

begin 

for (j=0; j<8; j= j+1)

if (ocount_e> 0)

begin

out_reg[i][j] = out_pin_in[n-ocount_e];

ocount_e = ocount_e -1;

end

else 

begin

out_reg[i][j] =0;

end

ocount_e =0;

end

end

 

else

for (i=0; i <8; i=i+1)

begin

out_reg[i] = out_reg[i];

end

 

end

0 Kudos
2 Replies
Highlighted
Valued Contributor III
13 Views

correction: :( is :

0 Kudos
Highlighted
Valued Contributor III
13 Views

i faced a problem neither to use constant nor variable.  

 

If i use integer then there will be a error([ocount_as and ocount_s are not constant) on this code:out_reg[i] = out_pin_in[ocount_ashttp://www.alteraforum.com/images/smilies/redface.gif count_s]

 

if i use the parameter then there will be a error (value must not be assigned to nonvariable "icount_e" 

 

Can anyone tell me that what kind of data types should be declared? 

Thanks 

 

Pieces of the code is attached:
0 Kudos