Adhamzhon Shukurov
Adhamzhon Shukurov

Reputation: 713

Send bits of image to an HDL produced RAM block that is embedded in FPGA

I have got an FPGA SoC board (DE1-SoC-MTL2). The SoC is combination of Altera's (now Intel FPGA) Cyclone V FPGA and ARM Cortex A9, they are connected to each other and can interchange data using AMBA network. Using a tool called Platform Designer (formerly Qsys), it is possible to assign addresses to HDL created blocks which makes it possible to control blocks in FPGA part from ARM Cortex A9 processor.

In short, I have a Linux system which can interchange data with FPGA using the assigned base addresses.

I have a binary image (black and white, 1-bit) which has size of 300x1200 and I have to store it in a built in FPGA RAM. For that purpose I designed a RAM that has 1200 words of 304 bits (I am not allowed to make it 300 because it has to be multiple of 8, because address assignation is limited to byte). Say RAM address starts from 0x0000 and ends at 0xB220. What should I do to store the image in that RAM such that each 300 bit width information is stored in each word of the RAM? (I can use C, C++ (Qt creator) for that, I want to click only a button from GUI to store the image there)

Upvotes: 1

Views: 166

Answers (1)

Adhamzhon Shukurov
Adhamzhon Shukurov

Reputation: 713

I was able to solve the problem, so I will try to answer my own question.

304 bit wording was not possible to be able to communicate with the rest of the system that use AMBA interconnect. I was forced to design a RAM which has word size of powers of 2 (minimum 8 bit), so I chose 512 bit as my word length. I filled the unused part (bit numbers of each word from 301 to 512) with zeros (I could have used them but makes my HDL algorithm more complex).

As @John Moon suggested in comments I used mmap() first and wrote 32 bit a time. To write 32 bit word at a given address, I used base + offset address (as @Eugene Sh. suggested), and to be able to use data in the memory using my custom architecture, I made the RAM dual port. Now everything is working fine.

Upvotes: 1

Related Questions