Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

avalon mm byte enable

In the project we are currently working on, we want to read and write pixels to external DDR SDRAM.

We need to be able to use byte-mask / byte-enable bits to not overwrite some previously written good

pixels, for writes that are not aligned.

Now, I just recently learned that the Altera mm-interface does not support arbitrary byte enable masks,

it only supports:

(from www.altera.com/literature/manual/mnl_avalon_spec.pdf page 15)

The following values are legal for a 32-bit slave:

1111 writes full 32 bits

0011 writes lower 2 bytes

1100 writes upper 2 bytes

0001 writes byte 0 only

0010 writes byte 1 only

0100 writes byte 2 only

1000 writes byte 3 only

The point I am getting at is this:

I have 8, 16, and 24 bit pixel data I would like to write to an arbitrary byte-address. In order to do this

with Avalon right now, I must read a complete aligned data word,

modify only the data I am interested in, then write the full word back to main memory.

If my mm data width is 32 bit and I want to write only the top two bytes,

I can't use the byte mask 1100, according to the above.

Is there any trick to handling this, without having to read the full data word,

modify the desired bytes, then write the full thing back?

Can the mm-master data port that is controlling the mm-slave port on the DDR controller

be made smaller DDR controller's native width, and thus cause all addresses to be aligned? In other

words, if I want to write 8 bit words, can I address the memory in this fashion, and bypass the need for

write enables all together?

What is the reason for not supporting arbitrary byte-enable patterns, when they are inherently supported by external SDRAM?

14 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    On reads the master most likely asserts all the byte enables and filters out the extra data that returns. So if you read from 0 followed by 2 I would expect two 16-bit reads for each access by the master. So for the read at address 0 I would expect word 0 and 1 to be read from the slave and the master will ignore the upper 16-bits that returns. Likewise for the read at address 2 I would expect word 0 and 1 to be accessed again only the lower 16-bits will be thrown out. I hope that made sense, this is usually easier to show using pictures.....

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hi, i have the same problem of the first user:

    write RGB pixel data (24 bit) in memory.

    my custom master data width is 128 bit like the memory controller.

    can i write for example 3 pixel (so not a power of two) using the byteenable?

    how can i do that?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    That is not supported but if you aligned your pixels to 4 byte boundaries it will probably work. That said I would just waste some memory and just store your pixels as 32 bit data. Then your master can access multiple pixels without having to worry about unsupportted byte enables. If you look at the video NEEK designs you'll see this achieved with the streaming ARGB to RGB (or whatever it is called)

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you, this is the solution I've already found. Now in have a frame reader and it wrote a writer component too with same data format. I looked at your sgdma too ..impressive work!