text
stringlengths
0
207k
4'b0101: bytes_in_transfer = 10'b0000100000;
4'b0110: bytes_in_transfer = 10'b0001000000;
4'b0111: bytes_in_transfer = 10'b0010000000;
4'b1000: bytes_in_transfer = 10'b0100000000;
4'b1001: bytes_in_transfer = 10'b1000000000;
default: bytes_in_transfer = 10'b0000000001;
endcase
endfunction
// ------------------------------------------------------------
// Pseudo-field Parameters
//
// The width adapter widens the data and byteenable fields in the
// output packet, thus changing the output packet format. By using
// pseudo-fields, we can avoid remapping each individual field to
// the output, which is a non-scalable solution.
//
// How? Assume the packet format is { FIRST, byteen, MID, data, LAST },
// where byteen and data positions are interchangeable. FIRST, MID and
// LAST are pseudo-fields that represent the collection of fields in
// those positions.
//
// Not all the pseudo-fields may exist for a given packet format. A
// non-existent field has reversed indices, so we have to be careful
// when using them.
// ------------------------------------------------------------
localparam IN_FIRST_L = 0,
IN_FIRST_H = min(IN_PKT_BYTEEN_L, IN_PKT_DATA_L) - 1,
IN_MID_L = min(IN_PKT_DATA_H, IN_PKT_BYTEEN_H) + 1,
IN_MID_H = max(IN_PKT_DATA_L, IN_PKT_BYTEEN_L) - 1,
IN_LAST_L = max(IN_PKT_BYTEEN_H, IN_PKT_DATA_H) + 1,
IN_LAST_H = IN_ST_DATA_W - 1,
FIRST_EXISTS = (IN_FIRST_H >= IN_FIRST_L),
MID_EXISTS = (IN_MID_H >= IN_MID_L),
LAST_EXISTS = (IN_LAST_H >= IN_LAST_L),
FIRST_W = IN_FIRST_H - IN_FIRST_L + 1,
MID_W = IN_MID_H - IN_MID_L + 1,
LAST_W = IN_LAST_H - IN_LAST_L + 1,
// -------------------------------------------------
// We cannot split the output map into generate blocks as we
// do for the inputs because address and size are mapped over
// the pseudo-fields. We ensure that the indices are always
// legal, even if the field is unused later on.
OUT_FIRST_L = 0,
OUT_FIRST_H = FIRST_EXISTS ?
min(OUT_PKT_BYTEEN_L, OUT_PKT_DATA_L) - 1 :
OUT_FIRST_L,
OUT_MID_L = min(OUT_PKT_DATA_H, OUT_PKT_BYTEEN_H) + 1,
OUT_MID_H = MID_EXISTS ?
max(OUT_PKT_DATA_L, OUT_PKT_BYTEEN_L) - 1 :
OUT_MID_L,
OUT_LAST_L = max(OUT_PKT_BYTEEN_H, OUT_PKT_DATA_H) + 1,
OUT_LAST_H = LAST_EXISTS ?
OUT_ST_DATA_W - 1 :
OUT_LAST_L;
// ------------------------------------------------------------
// Signals
// ------------------------------------------------------------
reg [BURST_SIZE_W-1:0] in_size_field;
reg [IN_DATA_W-1:0] in_data_field;
reg [IN_BYTEEN_W-1:0] in_byteen_field;
reg [ADDRESS_W-1:0] in_address_field;
reg [ADDRESS_W-1:0] address_from_packet;
reg [BYTE_CNT_W-1:0] in_byte_cnt_field;
reg [BWRAP_W-1:0] in_burstwrap_field;
reg [RESPONSE_STATUS_W-1:0] in_response_status_field;
reg in_cmpr_read;
reg in_lock_field;
reg [BURST_TYPE_W-1:0] in_burst_type_field;
reg [BYTE_CNT_W-1:0] quantized_byte_cnt_field;
reg [BURST_SIZE_W-1:0] out_size_field;
reg [OUT_DATA_W-1:0] out_data_field;
reg [OUT_BYTEEN_W-1:0] out_byteen_field;
reg [ADDRESS_W-1:0] out_address_field;
reg out_cmpr_read;
reg [BYTE_CNT_W-1:0] out_byte_cnt_field;
reg out_lock_field;
reg [BURST_TYPE_W-1:0] out_burst_type_field;
reg [RESPONSE_STATUS_W-1:0] out_response_status_field;
reg [FIRST_W-1:0] in_first_field;
reg [FIRST_W-1:0] out_first_field;
reg [MID_W-1:0] in_mid_field;
reg [MID_W-1:0] out_mid_field;
reg [LAST_W-1:0] in_last_field;
reg [LAST_W-1:0] out_last_field;
reg [WIDE_DATA-1:0] data_reg;
reg [WIDE_NUMSYMBOLS-1:0] byteen_reg;
reg [ADDRESS_W-1:0] address_reg;
reg [BYTE_CNT_W-1:0] byte_cnt_reg;
reg use_reg;