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).