02-21-2020 10:21 AM - edited 02-21-2020 10:30 AM
Hi all,
This is a general query regarding how read/write operations can be done in Verilog to a particular memory location. For example, I write some data to a memory address say 0x500 using memcopy in C. Now my hardware design wants to read data from this location. How can I write a Verilog snippet in Vivado to get the data from the specified location (which I can also hardcode in the hardware design)? In this case, we can assume that there is always some data written to that specific address and I just want the hardware to read the data so I can do some processing with it.
Bit of background: I am using a ZCU104 board and Vivado 2019.1 and Petalinux 2019.1 to run an application. The application I am running consists of hardware design and a software interface to communicate with that design. I am writing some value to a memory address as I mentioned using the software application. Now when the software interacts with the hardware design, I want that design to be able to do its functionalities along with reading the data from that specific address which is already known to us.
I tried looking this up but did not find any suitable answers which match my query. Any help and suggestions will be highly appreciated. Thank You!
06-26-2020 05:14 AM
No, that's not it at all. This user wants to write to memory with the PS, and read it from the PL.
You'll have a couple of problems.
Once you've kicked the data out of the cache, and placed it into a locked address where it won't move, then I have two resources you might find valuable to get you the next step of the way. The first describes how to write to a physical memory location, and the second how to build a simple and basic AXI master, something you'll need to read from PS memory from the PL.
Hope that gets you closer, but there's still a way to go to a full answer.
Dan
06-26-2020 05:07 AM
Hi @maju42 ,
Here's a sample code on how to read data from a .txt file and write it into memory.
module example; integer i; reg [7:0] mem [0 : 7]; //8 x 8 Memory declaration initial $readmemb(“file.txt”, mem); // readmemb for binary data and //readmemh for hex data initial for (i=0; i<=7; i= i + 1) $display(“Value at location %d is =%b”, i, mem[i]); endmodule
Hope this helps.
Thanks and Regards,
Ansari Hunen
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
06-26-2020 05:14 AM
No, that's not it at all. This user wants to write to memory with the PS, and read it from the PL.
You'll have a couple of problems.
Once you've kicked the data out of the cache, and placed it into a locked address where it won't move, then I have two resources you might find valuable to get you the next step of the way. The first describes how to write to a physical memory location, and the second how to build a simple and basic AXI master, something you'll need to read from PS memory from the PL.
Hope that gets you closer, but there's still a way to go to a full answer.
Dan
06-26-2020 01:03 PM
@dgisselq That is right. I had followed the same link you provided to create a simple AXI master to read a value from memory.