Hey everyone. 

I have one last question regarding the BRAM. For my application I need an 
address width of 32, but I get the error that  the maximum allowable address 
width is 16. Is there away around this problem or a way to get the BRAM to use 
an address width of 32? 

Thanks for the help!

Heystek 

> On 25 Nov 2021, at 21:28, Dan Werthimer <d...@ssl.berkeley.edu> wrote:
> 
> 
> hi morag. 
> 
> thanks for helping everyone.
> 
> best wishes,
> 
> dan
> 
> 
> 
> 
> On Thu, Nov 25, 2021 at 11:25 AM Morag Brown <mbr...@sarao.ac.za 
> <mailto:mbr...@sarao.ac.za>> wrote:
> Happy to help :)
> 
> On Thu, Nov 25, 2021 at 9:19 PM Heystek Grobler <heystekgrob...@gmail.com 
> <mailto:heystekgrob...@gmail.com>> wrote:
> Hey Morag! 
> 
> Know I understand! 
> 
> It is working. 
> 
> <Screenshot 2021-11-25 at 21.18.00.png>
> 
> Thank you so much for the help!!! 
> 
> Heystek 
> 
>> On 25 Nov 2021, at 21:08, Morag Brown <mbr...@sarao.ac.za 
>> <mailto:mbr...@sarao.ac.za>> wrote:
>> 
>> Hi Heystek,
>> 
>> Great!
>> 
>> I think Jack mentioned in an earlier email that the maximum number that can 
>> be represented by a <32,31> fixed point system is 1 - 2^-31. Reducing the 
>> magnitude of your sinusoid so that the peak value is below this maximum 
>> would work. Or alternatively, scaling your values by an amount less than 
>> 2^31 would have the same effect.
>> 
>> Morag
>> 
>> On Thu, Nov 25, 2021 at 8:59 PM Heystek Grobler <heystekgrob...@gmail.com 
>> <mailto:heystekgrob...@gmail.com>> wrote:
>> Hey Morag
>> 
>> That worked! 
>> 
>> When I read the packed sine wave from the BRAM, unpack it and plot it, I get 
>> this:
>> 
>> <Screenshot 2021-11-25 at 20.56.16.png>
>> 
>> I assume there is one data point that is causing problems at 1 or -1 that is 
>> overflowing? Any idea how I can fix that? 
>> 
>> Heystek 
>> 
>>> On 25 Nov 2021, at 20:22, Morag Brown <mbr...@sarao.ac.za 
>>> <mailto:mbr...@sarao.ac.za>> wrote:
>>> 
>>> Hi Heystek,
>>> 
>>> You would need to increase the BRAM depth to one that can store all your 
>>> data - currently, because the address width is 10, it can only store 2^10 
>>> (1024) points and you're trying to write 6020. So you would need to 
>>> increase the address width to an appropriate size. 
>>> 
>>> Morag
>>> 
>>> On Thu, Nov 25, 2021 at 8:05 PM Heystek Grobler <heystekgrob...@gmail.com 
>>> <mailto:heystekgrob...@gmail.com>> wrote:
>>> Hey Morag
>>> 
>>> The BRAM has an address width 10 and a data width of 32. 
>>> 
>>> Should I increase it?
>>> 
>>> Heystek 
>>> 
>>>> On 25 Nov 2021, at 19:52, Morag Brown <mbr...@sarao.ac.za 
>>>> <mailto:mbr...@sarao.ac.za>> wrote:
>>>> 
>>>> Hi Heystek,
>>>> 
>>>> How big is the BRAM in your design? Does it have enough space to 
>>>> accommodate the amount of data you're trying to write to it?
>>>> 
>>>> Morag
>>>> 
>>>> On Thu, Nov 25, 2021 at 6:59 PM Heystek Grobler <heystekgrob...@gmail.com 
>>>> <mailto:heystekgrob...@gmail.com>> wrote:
>>>> Hey Morag and Jack
>>>> 
>>>> Thank you for the suggestions. 
>>>> 
>>>> I played around a little bit. if I create the sine wave the same as you 
>>>> Morag, then it works. I am able to write it to the bram, read it back from 
>>>> the bram, unpack it and get the same signal back. As soon as I use the 
>>>> sine wave that I require for my application, then it breaks again. 
>>>> 
>>>> Here is what I achieved using your sine wave Morag (ps iI changed my 
>>>> design to 32 bit):
>>>> 
>>>> <Screenshot 2021-11-25 at 18.49.04.png>
>>>> 
>>>> 
>>>> <Screenshot 2021-11-25 at 18.49.34.png>
>>>> 
>>>> <Screenshot 2021-11-25 at 18.49.58.png>
>>>> 
>>>> When I use my sign wave, then it does not work:
>>>> 
>>>> <Screenshot 2021-11-25 at 18.55.45.png>
>>>> 
>>>> <Screenshot 2021-11-25 at 18.56.02.png>
>>>> 
>>>> <Screenshot 2021-11-25 at 18.56.14.png>
>>>> 
>>>> <Screenshot 2021-11-25 at 18.56.43.png>
>>>> 
>>>> The only thing that changed is the sine wave. is there something that I am 
>>>> missing? 
>>>> 
>>>> Thanks for the help! I really appreciate it! 
>>>> 
>>>> Heystek 
>>>> 
>>>> 
>>>>> On 25 Nov 2021, at 14:57, Morag Brown <mbr...@sarao.ac.za 
>>>>> <mailto:mbr...@sarao.ac.za>> wrote:
>>>>> 
>>>>> I think that's because the functions used in both In[15] and In[16] do 
>>>>> the same thing. See the screenshots below to see what I mean. So you 
>>>>> construct the raw bytes data in In[15] and then try to pack that as an 
>>>>> integer in In]16}, which won't work because struct.pack('>i',A_y) expects 
>>>>> data of type int while you're actually giving it data of type bytes. To 
>>>>> pack the data using struct.pack() you would need to pass it an int (or 
>>>>> array of ints and tell it how many points you're packing). I think 
>>>>> (someone please correct me if I'm wrong) that you only need to do one or 
>>>>> the other to get the correct raw data to be written to BRAM.
>>>>> 
>>>>> <Screenshot from 2021-11-25 14-55-29.png>
>>>>> <Screenshot from 2021-11-25 14-55-39.png>
>>>>> 
>>>>> I also see you're scaling up by 2^31, but I think your BRAM is data width 
>>>>> is 16 bits, so you'd likely want to scale by 2^15?
>>>>> 
>>>>> Morag
>>>>> 
>>>>> On Thu, Nov 25, 2021 at 12:46 PM Heystek Grobler 
>>>>> <heystekgrob...@gmail.com <mailto:heystekgrob...@gmail.com>> wrote:
>>>>> Hey Jack and Morag
>>>>> 
>>>>> thank you for the advice and help! i am still getting errors and is 
>>>>> stuck. Below is the new errors:
>>>>> 
>>>>> <Screenshot 2021-11-25 at 12.41.43.png>
>>>>> 
>>>>> <Screenshot 2021-11-25 at 12.42.53.png>
>>>>> 
>>>>> I have also attached the new script I am working on. 
>>>>> 
>>>>> Could it be that I am generating the sine wave incorrectly? I have about 
>>>>> 600 000 000 points that I am working with. 
>>>>> 
>>>>> I keep getting “cannot convert argument to integer when running 
>>>>> struct.pack.
>>>>> 
>>>>> Thanks for the help!
>>>>> 
>>>>> Heystek 
>>>>> 
>>>>> 
>>>>>> On 23 Nov 2021, at 14:31, Jack Hickish <jackhick...@gmail.com 
>>>>>> <mailto:jackhick...@gmail.com>> wrote:
>>>>>> 
>>>>>> Hi Heystek,
>>>>>> 
>>>>>> Assuming your BRAM is set for 32-bit wide, you probably want to be 
>>>>>> writing the values with 31 bits below the binary point -- i.e. 
>>>>>> normalized to the range [-1, 1)  (aka simulink FIx32_31). In this case 
>>>>>> the packed values would be:
>>>>>> 
>>>>>> struct.pack('>i', int(floating_point_sine_value * 2**31))
>>>>>> 
>>>>>> Though, be careful, because +1.0 isn't included in this number 
>>>>>> representation (the maximum is 1 - 2**-31) , so you might want to 
>>>>>> include some saturation logic (or scale up by a value less than 2**31).
>>>>>> 
>>>>>> For what it's worth, you can pack an entire numpy array with: 
>>>>>> floating_point_numpy_array.astype('>i').tobytes() ,which saves looping 
>>>>>> and appending to a binary string.
>>>>>> 
>>>>>> Does that help?
>>>>>> 
>>>>>> Cheers
>>>>>> Jack
>>>>>> 
>>>>>> On Mon, 22 Nov 2021 at 18:10, Heystek Grobler <heystekgrob...@gmail.com 
>>>>>> <mailto:heystekgrob...@gmail.com>> wrote:
>>>>>> Hey Jack
>>>>>> 
>>>>>> I am also well thank you. We are starting to go back to the observatory 
>>>>>> (HartRAO) again. 
>>>>>> 
>>>>>> Here is  a snippets of the python code that I am using as well as my 
>>>>>> simulink design:
>>>>>> 
>>>>>> The first nipped is where I create the sine wave:
>>>>>> 
>>>>>> The second snipped is where I plot the sine wave:
>>>>>> 
>>>>>> 
>>>>>> The third snipped is where I pack the sine wave array:
>>>>>> 
>>>>>> 
>>>>>> The fourth snipped is where I write the packed data to the BRAM:
>>>>>> 
>>>>>> 
>>>>>> Snipped 5 is where I want to use the sine wave and cosine wave:
>>>>>> 
>>>>>> 
>>>>>> But to check that it is working, I have created the simple design in 
>>>>>> snipped 6:
>>>>>> 
>>>>>> 
>>>>>> I have also attached my simulink design and python script. 
>>>>>> 
>>>>>> Thank you for the help! 
>>>>>> 
>>>>>> Heystek 
>>>>>> 
>>>>>> 
>>>>>>> On 22 Nov 2021, at 18:55, Jack Hickish <jackhick...@gmail.com 
>>>>>>> <mailto:jackhick...@gmail.com>> wrote:
>>>>>>> 
>>>>>>> Hi Heystek,
>>>>>>> 
>>>>>>> All good here (in London), Thanks. Hope things are going ok with you 
>>>>>>> too!
>>>>>>> 
>>>>>>> I've taken this back on list for the benefit of others. Do you have:
>>>>>>> 
>>>>>>> a) a snippet of some python code which you're using at the moment
>>>>>>> b) A Simulink snippet of the BRAM you're trying to write to, indicating 
>>>>>>> how the bram is configured and how its data are being used?
>>>>>>> 
>>>>>>> Cheers
>>>>>>> Jack
>>>>>>> 
>>>>>>> On Mon, 22 Nov 2021 at 16:52, Heystek Grobler <heystekgrob...@gmail.com 
>>>>>>> <mailto:heystekgrob...@gmail.com>> wrote:
>>>>>>> Hey Jack
>>>>>>> 
>>>>>>> How are you? It has been a while since we last spoke. 
>>>>>>> 
>>>>>>> I am really struggling to pack data into binary format for my design. I 
>>>>>>> was wondering if you have time if you can please help me with it. I 
>>>>>>> have no clue if what i am doing is correct and there is no one around 
>>>>>>> me with the knowledge to help me. 
>>>>>>> 
>>>>>>> All that I want to do is too pack a sine wave that I already generated, 
>>>>>>> and write it to a BRAM. 
>>>>>>> 
>>>>>>> I hope to hear from you soon!
>>>>>>> 
>>>>>>> Heystek 
>>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google Groups 
>>>>> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>>> email to casper+unsubscr...@lists.berkeley.edu 
>>>>> <mailto:casper+unsubscr...@lists.berkeley.edu>.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/8791F6EA-204B-4BCC-B0DC-3CAD3D928A05%40gmail.com
>>>>>  
>>>>> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/8791F6EA-204B-4BCC-B0DC-3CAD3D928A05%40gmail.com?utm_medium=email&utm_source=footer>.
>>>>> 
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google Groups 
>>>>> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>>> email to casper+unsubscr...@lists.berkeley.edu 
>>>>> <mailto:casper+unsubscr...@lists.berkeley.edu>.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TdWxe-sOF31vMDZxPbO37UwQFLTVHhJwbuZqXpwE6Gbsw%40mail.gmail.com
>>>>>  
>>>>> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TdWxe-sOF31vMDZxPbO37UwQFLTVHhJwbuZqXpwE6Gbsw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>>> 
>>>> 
>>>> -- 
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>> email to casper+unsubscr...@lists.berkeley.edu 
>>>> <mailto:casper+unsubscr...@lists.berkeley.edu>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/5B9A4F5B-4F61-4CF6-AC06-6BD3432B11AB%40gmail.com
>>>>  
>>>> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/5B9A4F5B-4F61-4CF6-AC06-6BD3432B11AB%40gmail.com?utm_medium=email&utm_source=footer>.
>>>> 
>>>> -- 
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>> email to casper+unsubscr...@lists.berkeley.edu 
>>>> <mailto:casper+unsubscr...@lists.berkeley.edu>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TfPZw9xvQbrTbB0Vyq%2BnQwpeFaeBLy9zG0D2Hi%2BqtHd_w%40mail.gmail.com
>>>>  
>>>> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TfPZw9xvQbrTbB0Vyq%2BnQwpeFaeBLy9zG0D2Hi%2BqtHd_w%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>> 
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to casper+unsubscr...@lists.berkeley.edu 
>>> <mailto:casper+unsubscr...@lists.berkeley.edu>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/7268EAFF-680E-4659-AF96-727243B0E5F4%40gmail.com
>>>  
>>> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/7268EAFF-680E-4659-AF96-727243B0E5F4%40gmail.com?utm_medium=email&utm_source=footer>.
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to casper+unsubscr...@lists.berkeley.edu 
>>> <mailto:casper+unsubscr...@lists.berkeley.edu>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TcAoOWf9%2BU5Xv2w63hx7F6ANtEjoR5F5-AQa0HPMGTW_Q%40mail.gmail.com
>>>  
>>> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TcAoOWf9%2BU5Xv2w63hx7F6ANtEjoR5F5-AQa0HPMGTW_Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to casper+unsubscr...@lists.berkeley.edu 
>> <mailto:casper+unsubscr...@lists.berkeley.edu>.
>> To view this discussion on the web visit 
>> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/D1705232-7ECB-45BD-9A98-FEC8D137B451%40gmail.com
>>  
>> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/D1705232-7ECB-45BD-9A98-FEC8D137B451%40gmail.com?utm_medium=email&utm_source=footer>.
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to casper+unsubscr...@lists.berkeley.edu 
>> <mailto:casper+unsubscr...@lists.berkeley.edu>.
>> To view this discussion on the web visit 
>> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TeJ2SyBmp6FgrZtHV34xOV%2BPnMDzuBhyaWv8i8yryN9SA%40mail.gmail.com
>>  
>> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TeJ2SyBmp6FgrZtHV34xOV%2BPnMDzuBhyaWv8i8yryN9SA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to casper+unsubscr...@lists.berkeley.edu 
> <mailto:casper+unsubscr...@lists.berkeley.edu>.
> To view this discussion on the web visit 
> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/B769016F-1125-4EA8-AE89-A315B5883813%40gmail.com
>  
> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/B769016F-1125-4EA8-AE89-A315B5883813%40gmail.com?utm_medium=email&utm_source=footer>.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "casper@lists.berkeley.edu <mailto:casper@lists.berkeley.edu>" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to casper+unsubscr...@lists.berkeley.edu 
> <mailto:casper+unsubscr...@lists.berkeley.edu>.
> To view this discussion on the web visit 
> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TcwYdDqKAP4NEyw4MU7ZJ27GiVzKnBQza_pTVjzF49zMg%40mail.gmail.com
>  
> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGH-0TcwYdDqKAP4NEyw4MU7ZJ27GiVzKnBQza_pTVjzF49zMg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "casper@lists.berkeley.edu" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to casper+unsubscr...@lists.berkeley.edu 
> <mailto:casper+unsubscr...@lists.berkeley.edu>.
> To view this discussion on the web visit 
> https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGHS_vG%2BzLYUSO5RdS_PcyBG0dGD1248cHEPJfPhdG34H6qg1w%40mail.gmail.com
>  
> <https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGHS_vG%2BzLYUSO5RdS_PcyBG0dGD1248cHEPJfPhdG34H6qg1w%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"casper@lists.berkeley.edu" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to casper+unsubscr...@lists.berkeley.edu.
To view this discussion on the web visit 
https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/1D989754-2D5F-4508-90B0-85B6841DFFB9%40gmail.com.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to