int cores[];
for(int i=0; i<no_cores; i++)begin
cores[i]=i;
end
Syntax error at for
Syntax error at <
Syntax error at ++
Syntax error at end
I don know where I’m going wrong. Shud I allocate memory using malloc func?
int cores[];
for(int i=0; i<no_cores; i++)begin
cores[i]=i;
end
Syntax error at for
Syntax error at <
Syntax error at ++
Syntax error at end
I don know where I’m going wrong. Shud I allocate memory using malloc func?
In reply to Ammu4392:
Did you forget to do something like this before assigning the values?
cores=new[10];
In reply to ningyangverificationacademy:
IF I do that I get a error stating syntax error at new
cores = new[10];
In reply to Ammu4392:
Post more of your code here then.
In reply to ningyangverificationacademy:
int no_cores = 8;
rand int no_of_transactions;
int no_of_transactions_max = 10;
int no_of_transactions_min = 1;
int cores[];
cores = new[no_cores];
for(int i=0; i<no_cores; i++)begin
cores[i]=i;
end
In reply to Ammu4392:
These statements should be in some function or task.
cores = new[no_cores];
for(int i=0; i
cores=new[no_cores] is procedural code; it can’t hang around with variable declarations.
class myclass;
rand int no_of_transactions;
int no_cores = 8;
int no_of_transactions_max = 10;
int no_of_transactions_min = 1;
int cores;
function void init_memory();
cores = new[no_cores]; // <---- my new home!
endfunction
endclass
In reply to Ammu4392:
compare to this
In reply to bmorris:
Why shud we have a function for that?
In reply to ningyangverificationacademy:
why shud those statements be include inside a function?
In reply to Ammu4392:
cores=new[no_cores] is a function call; it has to be called by another function or task.
In reply to bmorris:
oh okay. thank u :)
In reply to Ammu4392:
In addition, the assignment should be done either in