What does the cacheable parameter do in allocate function?

I was working on a project that read message from a text file, encrypted it, wrote it to a file and then decrypted it back. I used the allocate function with the cacheable parameter set to True. That design worked partially, sometimes worked and sometimes didn’t. I then removed the cacheable parameter and the design worked.

Currently I am working with the VDMA IP. Now when I set the cacheable parameter to False, I get the following message on the serial terminal.

Alignment trap: not handling instruction f8513b03 at [<af922c0a>]
8<--- cut here ---
Unhandled fault: alignment exception (0x011) at 0xaad11003
pgd = d12b415c
[aad11003] *pgd=14f66831, *pte=16900703, *ppte=16900e33

This design only works when the cacheable parameter is True.

I want to know what is going on here. Why is it that sometimes it is required and sometimes its not?

Where does it allocate the buffer when cacheable is set to True and also when it is False?
I have read the buffer is allocated on the L2 cache when True and on the DDR when False. I’m not sure.

I also read about the flush and invalidate functions, from here.. But I have not seen any examples that made use of these functions when cacheable is True, Resizer example. Is it handled automatically?

Also in pynq.buffer.allocate(shape, dtype=‘u4’, target=None, **kwargs), the description for the target parameter reads,

The target determines where the buffer gets allocated

If None then the currently active device is used
If a Device is specified then the main memory

What is the currently active device and Device? Is Device an object of the Device class?

1 Like

Hi @abitofmaya,

There’s a discussion about cacheable here