This is what Im looking for.
My input file contains elements of any width say 2 bytes or 4 bytes wide.
i.e it could look like
D0D1
D2D3
.
.
.
DnDn-1
or
D3D2D1D0
D7D6D5D4
.
.
.
I should pass this file to a task say
task (filename, memory_width);
readfile(filename, queue).
→ The readfile task loads the queue with file contents.
From the queue, based on the memory width, i should
assign the byte lanes accordingly to the memory.
That is,
If the memory width is 2 bytes (bit [15:0] mem [8191:0])
I should assign D1 to [15:8] mem[0] and D0 to [7:0] mem[0].
If the width is 4, i should assign like
D3 to [31:24] mem[0]. D2 to [23:16] mem[0] D1 to [15:0] mem[0] and D0 to [7:0] mem[0].
Ideally, i would like to use a single task for this.