Page 1 of 1

memwrite does not work

PostPosted:
by Guest
Hi Eli,

I happen to have this strange error writing to the address memory after I use an newly customzied IP.

When do this `memwrite /dev/xillybus_mymem_32 2 150`
I get `Failed to seek: Invalid argument`
And no value can be written into the memory.

If I write address 0, it does not show me the error, but still no value can be written into the memory.

hexdump show every value is 00, no matter how you use memwrite

hexdump -C -v -n 32 /dev/xillybus_thr_32
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|

Do you have any clu that how this can happen?

Best,
Chongxi

Re: memwrite does not work

PostPosted:
by support
Hello,

Not only do I have a clue, but the clue is documented in the Xillybus host application programming guide for Linux or Windows, section 6.1, "Seekable streams", saying:

For streams which are accessed as 16-bit or 32-bit words in the FPGA, the address given to lseek() must be a multiple of 2 or 4, respectively. The address presented to
the application logic in the FPGA is maintained at all times as the stream’s I/O position (initially as given to lseek() ) divided by 2 or 4, respectively.


I suppose that you ran memwrite without modifying it. As such, it writes one byte. The word granularity is 4 bytes. Since the write didn't reach a four-byte boundary, nothing was written. So please update memwrite to work with 4-byte words, both regarding the seeks and the amount of data it writes. And it will work like a charm.

Regards,
Eli

Re: memwrite does not work

PostPosted:
by Guest
You are right. Cool, I write a python interface for this type of memory map based on xillybus. This is very interesting. Thanks Eli!