Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

variable or constant error

Altera_Forum
Honored Contributor II
1,470 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_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
Altera_Forum
Honored Contributor II
746 Views

correction: :( is :

0 Kudos
Altera_Forum
Honored Contributor II
746 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
Reply