Forum Discussion

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

PCI Express Avalon-ST Valid Data Bytes

I am trying to interpret doc: "Stratix V Hard IP for PCI Express User Guide."

Specifically, when using a 256 bit Avalon-ST interface, I wish to determine which of the 32 bytes contain valid data.

On the last cycle, when rx_st_eop is true, rx_st_empty[1:0] indicates:

rx_st_empty = 0, rx_st_data[255:0] contains valid data

rx_st_empty = 1, rx_st_data[191:0] contains valid data

rx_st_empty = 2, rx_st_data[127:0] contains valid data

rx_st_empty = 3, rx_st_data[63:0] contains valid data

But this does not narrow down validity to one byte but rather to an eight byte group.

In the TLP header there are three fields that might be relevant, but these are not explained in the documentation:

"First BE" and "Last BE" are four bit fields. Might these somehow be used to point to the first and last valid bytes in the first and last 256 bit group of data. Since these are 4 bit fields, they could only used to select 1 of 16 bytes, not 1 of the 32 bytes in 256 bits. Might "First BE" and "Last BE" be used in conjunction with rx_st_empty?

The TLP header also contains a 10 bit "Length" field and other fields that are not explained, but, mainly I am interested in determining data validity to the byte level.

Thank you,

Matthew

5 Replies

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

    I was told by altera support that it is usually safer to use the TLP fields rather than the signals that come out of the cores. First BE and Last BE indeed do tell you what bytes are valid. You also need to know what the address is, because the First BE applies to the start address, and last BE applies to the end address - remember that PCIe works in 32 bit long words.

    The PCIe spec is not written by altera, so they dont explain how the headers work. I suggest getting the mindshare PCIe book, as it explains all aspects of PCIe (it is also recommended by altera support). It explains all fields in the header and how to use them.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your reply. I've used Mindshare books in the past. I'll check it out.

    There is, in Altera's documentation, mention of deprecated signals rx_st_be[31:0] that used to be used for the purpose of determining byte validity. Altera's doc says that the same information can be obtained by "decoding the FBE and LBE fields in the TLP header." However, as I pointed out, the First BE and Last BE fields in the header are only 4 bits, so, unlike with deprecated rx_st_be, I don't see how one can use FBE and LBE to determine the validity of 32 bytes.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I just found the answer. The "First BE" (and "Last BE") bits map one-to-one with the validity of the bytes in the first (and last) DWORD of the packet. Bit0==1 says if byte 0 is valid. Bit1==1 says that byte 1 is valid, etc.

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

    Yes.

    Also be aware that for read/writes of 1 Dword, only the first BE is used.