1

I am doing a project using DE1-SoC (FPGA + ARM cortex A9). You can see a part of the design (Qsys, platform designer) here

An on chip memory (RAM, image_memory) is being mastered by two different masters. One of the masters is well known h2f_lw_axi_master (provided by the Quartus Prime software to make the ARM and FPGA data exchange possible) and the other one zpc_1 is a custom master block that I designed.

The basic idea in this project is that after the FPGA is configured, one should be able to write data to the on chip memory and zpc_1 reads the content of the memory and works on it.

The length of each word is 512 bits (64bytes) and there are 1200 words (so address assigned starts from 0x0002_0000 and ends at 0x0003_2bff, enough space for 76800 = (512 * 1200) /8 bytes. The hps uses uint512_t (from boost library of c++) type data to write and zpc_1 has readdata width of 512 bits. The addresses are assigned with respect to h2f_lw_axi_master.

I have two questions related to this system.

1. Should the address for reading data in zpc_1 HDL code start from 0x20000 offset and increment by 0x40 (64) at each cycle to read the data word by word? (or any other method)

2. The zpc_1 is being able to read the first word and continuously working according to the instructions in first word, what might be the reason?

If you need additional information to answer the question and/or question is not clear enough to understand, do not hesitate to ask about more information (comment).

ANMOSI
  • 141
  • 4
  • The answer to question one depends on two things that are not clear from your question: What is the Avalon bus width (ie, bit width of `writedata`/`readdata`) and what is the unit each address represents (by default its bye addressable, but it can be changed by changing the `addressUnits` property of the bus)? Im not sure what you are asking in the second question. – Unn Sep 13 '18 at 17:02
  • @Unn The readdata width is 512 bits, and I did not change the addressUnits property. Now it is byte addressable, to make sure I checked it with small test ram block it worked. – ANMOSI Sep 14 '18 at 05:04
  • @Unn I mean according to verilog code of zpc_1, it should be able to shift address and read content of each word one after another ('address<=address + 1;' or 'address<=address + 64' checked both and got same result, only reads the first word of memory continuously, never shifts to different one). – ANMOSI Sep 14 '18 at 05:13
  • You will need to increment the address on the bus by 64, not by 1; you will need to post some of the code for your `zpc_1` module to see why it is not reading more than the first 512-bit word from RAM. (`address <= address + 'd64` should be correct) – Unn Sep 14 '18 at 17:10
  • @Unn Thanks for your efforts, the problem was solved. Used Dual port RAM, the problem was solved. And made the addressing as you said. – ANMOSI Sep 18 '18 at 05:48

1 Answers1

1

The problem was when one of the masters was interacting with the slave, the slave did not properly allow the other one (in the protocol there is a signal called 'waitrequest', I was not using that signal properly, when I used it that signal properly, the slave was always sending waitrequest which helped me to debug the problem as well).

Tried dual port RAM as shown here and modified the component by properly using the 'waitrequest' signal and everything started working properly.

Now the answers:

Q1: Should the address for reading data in zpc_1 HDL code start from 0x20000 offset and increment by 0x40 (64) at each cycle to read the data word by word? (or any other method)

A1: You can define another address offset with respect to the custom master component as you want, and start reading from that address offset (I used 0x00000000 as in the picture ). The address should increment by 0x40 (64) at each cycle to read the data word by word as @Unn commented.

Q2: The zpc_1 is being able to read the first word and continuously working according to the instructions in first word, what might be the reason?

A2: The reason is the slave (Single port RAM) was not able to respond correctly to both masters at the same time through single port, replacing it with dual port RAM solves the problem.

ANMOSI
  • 141
  • 4