0
\$\begingroup\$

The steaming interface (for example the Avalon ST)

input logic data[255:0] in_data; // a 256 bits input stream data

The local signals of data like this:

logic[255:0] bit_data;           // local signal for the input data

I have business messages with max length = 1500 bytes (12000 bits)

So I have to model an integer for representing the message length in BIT:

logic[13:0] msg_bit_len; // 14 bits unsigned int with max value = 16383

If I model the data with BYTE based:

typedef logic[7:0] logic8x32_t [31:0]; // a 32 bytes structure

logic[7:0] byte_data [31:0]; // local signal for the input data
byte_data = logic8x32_t'(in_data);

with BYTE based I can model msg_byte_len (max = 1500) with lesser number of bits.

logic[10:0] msg_byte_len; // 11 bits unsigned integer with max value = 2047

In this case 3 bits are saved comparing to BIT based.

It sounds good but I am afraid if there exist any issue with byte base design (for example, the incoming data are not in completed byte).

Please advise.

\$\endgroup\$
  • 1
    \$\begingroup\$ Designing messages that way makes the life of people much harder that work with them on ordinary processors \$\endgroup\$ – PlasmaHH Aug 31 '18 at 6:01
  • 1
    \$\begingroup\$ Either way, you are comparing the same number of bits. "Saving 3 bits" on your counter, i would argue, is a big ol' "don't care" when compared to what makes logical sense and is easiest to design. BTW, aren't ethernet fields on byte boundaries? When would you have a valid message that wasn't a "complete byte"? \$\endgroup\$ – CapnJJ Sep 4 '18 at 19:29
0
\$\begingroup\$

It depends, for example:

  • if you models a work over MII, you need to represent a packet as a stream of consecutive nibbles, nibble = a half of 8-bit byte = 4 bit;
  • if you models it over GMII, you can represent a packet as a stream of consecutive octets directly, octet = 8-bit byte;
  • etc...

If you models a work over a wide (N x 8 in the case you shown) parallel bus, such a bus must contain masking signals (N in the case of 8-bit byte) to speak out which byte(s) on the bus contain(s) information during a transfer cycle and which do(es) not.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.