P4C
The P4 Compiler
Loading...
Searching...
No Matches
ActionData::ALUParameter Struct Reference

Public Member Functions

 ALUParameter (const Parameter *p, le_bitrange pb)
 
bool is_wrapped (PHV::Container cont) const
 
safe_vector< le_bitrangeslot_bits_brs (PHV::Container cont) const
 

Public Attributes

const Parameterparam
 
le_bitrange phv_bits
 
int right_shift
 

Friends

std::ostream & operator<< (std::ostream &out, const ALUParameter &p)
 

Member Function Documentation

◆ slot_bits_brs()

safe_vector< le_bitrange > ActionData::ALUParameter::slot_bits_brs ( PHV::Container cont) const

The bits used by this parameter in the action bus slot. Due to wrapped rotations in deposit-field, at most 2 ranges could be provided

The return value is supposed to be the low to high range of the read bits of the action data source. This leads to the following scenarios:

1. If the number of read bits < container.size()
    a. If the read bits are contiguous, a single bitrange [read_bit_lo..read_bit_hi].
    b. If the read bits are discontiguous, as it could be in a deposit-field where the
       action data is rotated around the boundary, then the following.  Let's say the write
       bits are from M..N, and the read bits are then discontiguous.  The read bits
       will be two ranges, A = [M + (container_size - right_shift), container size] and
       B = [0, N - right_shift - 1].  The vector will be { B, A }
  1. If the number of read bits == container.size() a. If the right_shift = 0, then it is a simple [0..container_size] b. If the right_shift != 0, then bits will be rotated, similar to scenario 1b. The vector needs to be in the same format { B , A } where A = [ M + (container_size - right_shift), container_size] and B = [0, N - right_shift - 1)], where M = 0 and N = container_size;