# BRAM access by HLS IP and PYNQ

**URL:** <https://discuss.pynq.io/t/bram-access-by-hls-ip-and-pynq/5478>\
**Category:** Support\
**Created:** [April 13, 2023, 12:41pm UTC](https://discuss.pynq.io/t/bram-access-by-hls-ip-and-pynq/5478 "2023-04-13T12:41:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Willy](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/willy/32/3440_2.png) [@Willy](https://discuss.pynq.io/u/Willy)\
**Post date:** [April 13, 2023, 12:41pm UTC](https://discuss.pynq.io/t/bram-access-by-hls-ip-and-pynq/5478/1 "2023-04-13T12:41:27Z")

</div>

PYNQ version: 2.7  
Hi all,  
I’m trying to do the exercise about the BRAM.

1. Create HLS IP which copy the data of A array (m\_axi) to B array (located in BRAM)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/d/d4b80fc6a4ecde983a5f29d1ffa6e8c61253f9a8.png)
2. Create Vivado project and add above IP with BRAM generator and controller (for PS CPU access)  
Block design:  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/b/b58dfed799c6a3e99a77f2caf7b8de0d9be05ad4.png)  
Address Editor:  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/c/c20fde8e1b4e179424a8aa8ec8eddd9bda063272.png)
3. Create Python code on PYNQ-Z2 and process following steps:  
(1) Instance IPs (read\_romcode\_0 and axi\_bram\_ctrl\_0)  
(2) Allocate input\_buffer and initial it with test pattern  
(3) Use IP axi\_bram\_ctrl\_0 mmio function (write, read) to initial BRAM.  
(4) Configure IP read\_romcode\_0 source address (input\_buffer), and trigger ap\_start (offset 0x00[0] = 1)  
(5) Use IP axi\_bram\_ctrl\_0 mmio read to check the context of BRAM after read\_romcode\_0 move the data.  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/3/3392118ecd04ece2654aed916e486bdd21d05b20.png)

In my expected, the result should be the same in the step 2 and 5. (read\_romcode\_0 move the input\_buffer data into BRAM).  
But the result is strange, the IP seems move the data with a different start base. (I suppose they should use the base 0). Does any one can help to answer? thanks!!

 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/5/5d74349ae71a72592a303f01b5e53c15b7dd0f54.png)

---

<div class="post-metadata">

**Author:** ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)\
**Post date:** [April 14, 2023, 1:04pm UTC](https://discuss.pynq.io/t/bram-access-by-hls-ip-and-pynq/5478/2 "2023-04-14T13:04:42Z")

</div>

I don’t see anything obvious wrong. I see you have marked some of the interfaces for debug. I’ve suggest you check these interfaces to get a better idea about what is happening.  
There are a few different things that could be happening that are masked if you can only see the final output.  
For example, it looks like 0xcd0 is being written to address zero. The writes may start correctly at address zero, but then loop back to 0x0 for some reason. Checking the transactions should make the issue more obvious.

Cathal

---

<div class="post-metadata">

**Author:** ![Willy](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/willy/32/3440_2.png) [@Willy](https://discuss.pynq.io/u/Willy)\
**Post date:** [April 17, 2023, 3:06am UTC](https://discuss.pynq.io/t/bram-access-by-hls-ip-and-pynq/5478/3 "2023-04-17T03:06:26Z")

</div>

@cathalmccabe Thanks for your reply.  
I use ILA to check the transaction, but address & data are corrected, and also the result in the PS is also corrected. It’ a amazing…  
I guess the root cause may due to the PYNQ board restart…anyway, the problem is gone. thanks~

 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/c/c989e0868c188380ddb09249f24d5927b7583f80.png)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/b/b13af6c0406aaddfb66f5ea28f323857681cb624.png)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/a/a30755d355d249c5e6090998579e498e3e334448.png)

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/system/32/2_2.png) [@system](https://discuss.pynq.io/u/system)\
**Post date:** [April 20, 2023, 3:07am UTC](https://discuss.pynq.io/t/bram-access-by-hls-ip-and-pynq/5478/4 "2023-04-20T03:07:03Z")

</div>

Closed on April 20, 2023, 3:07am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
