Memory in task

N

nezhate

Guest
Hi all,
I'm writing a testbench that uses multiples tasks for verification.
One of them has memory as input. it must read data from an external
file. When I run this, I get this error:
"Illegal reference to memory
cannot assign unpacked type to packed type".
I understand that when task executes, it make a local copy of its
inputs. This is as if we wrote mem_a=mem_b. In this way for memories,
we must use index to assign element by element , ie:
while index>0
mem_a[index]=mem_b[index];
what should I do in this case?
The code I use is like this:

module tesbench
.....
.....
parameter filedata="/my_home/data.txt";
reg [m-1:0] mem_b [31:0];
.....
$readmemb(filedata,mem_b);
......
task verification ();
input a;
input b;
input [m-1:0] mem_a [31:0];
.....
.....
endtask
endmodule
 
Hi,
Maybe a silly question - why do you want to pass the whole memory as
input to the task? Why not refer to it within the task and given the
scoping rules, that would be visible anyway?

Regards
Ajeetha, CVC
www.noveldv.com
 
On Mar 26, 5:10 pm, "Ajeetha (www.noveldv.com)" <ajee...@gmail.com>
wrote:
Hi,
Maybe a silly question - why do you want to pass the whole memory as
input to the task? Why not refer to it within the task and given the
scoping rules, that would be visible anyway?

Regards
Ajeetha, CVCwww.noveldv.com
Because in my testbench I have to verify the outputed data from my
design and compare them with those readen from an external file. for
this I wrote a task.
The outputed data is grouped in a bus of 64 bits. After each 8 bits
(from this bus) form an output signal. To verify, I must call to this
task 8 times in my testbench (this is what i want to do).
I already tested the case of reading memory out of task, it is
working, but doing this need to replicate the same code 8 times.(this
is what i want not to do).
I think that replicate a bloc of code is not a good style of
programming!
Thanks for your help.
 

Welcome to EDABoard.com

Sponsor

Back
Top