P4C
The P4 Compiler
Loading...
Searching...
No Matches
ActionData::MeterALU Class Reference

#include <action_format.h>

Inheritance diagram for ActionData::MeterALU:
[legend]

Public Member Functions

 MeterALU (cstring au, le_bitrange r)
 
void dbprint (std::ostream &out) const override
 
bool equiv_value (const Parameter *, bool check_cond=true) const override
 
bool from_p4_program () const override
 
const Parameterget_extended_param (uint32_t extension, const Parameter *) const override
 
bool is_next_bit_of_param (const Parameter *, bool) const override
 
cstring name () const override
 
bool only_one_overlap_solution () const override
 
const Parameteroverlap (const Parameter *ad, bool only_one_overlap_solution, le_bitrange *my_overlap, le_bitrange *ad_overlap) const override
 
le_bitrange range () const
 
int size () const override
 
const Parametersplit (int lo, int hi) const override
 
- Public Member Functions inherited from ActionData::Parameter
virtual bool can_merge (const Parameter *param) const
 
bool can_overlap_ranges (le_bitrange my_range, le_bitrange ad_range, le_bitrange &overlap, le_bitrange *my_overlap, le_bitrange *ad_overlap) const
 
cstring cond_name () const
 
bool equiv_cond (const Parameter *p) const
 
template<typename T >
bool is () const
 
bool is_cond_type (ModConditionally_t type) const
 
virtual bool is_subset_of (const Parameter *param) const
 
virtual const Parametermerge (const Parameter *param) const
 
void set_cond (const Parameter *p)
 
void set_cond (ModConditionally_t ct, cstring n)
 
template<typename T >
const T * to () const
 
- Public Member Functions inherited from P4::IHasDbPrint
void print () const
 

Additional Inherited Members

- Protected Attributes inherited from ActionData::Parameter
cstring _cond_name
 
ModConditionally_t _cond_type = NONE
 

Detailed Description

As in the name, this represents data that comes from the Meter/Stateful ALU directly, not meter color. LPF, WRED, and StatefulAlu operations directly write to the home row action bus when activated, and differ in meter color.

Similar to Meter Color, the position of the actual parameter is fixed in hardware on where the output will be appearing. However, because nothing besides the Meter ALU output is on that particular row, and is never packed with anything else, no padding is necessary.

See also
attached_output.cpp and create_meter_alu_RamSection for more details

Member Function Documentation

◆ dbprint()

void ActionData::MeterALU::dbprint ( std::ostream & out) const
inlineoverridevirtual

Implements ActionData::Parameter.

◆ equiv_value()

bool ActionData::MeterALU::equiv_value ( const Parameter * ad,
bool check_cond = true ) const
overridevirtual

Implements ActionData::Parameter.

◆ from_p4_program()

bool ActionData::MeterALU::from_p4_program ( ) const
inlineoverridevirtual

Implements ActionData::Parameter.

◆ get_extended_param()

const Parameter * ActionData::MeterALU::get_extended_param ( uint32_t extension,
const Parameter *  ) const
overridevirtual

Implements ActionData::Parameter.

◆ is_next_bit_of_param()

bool ActionData::MeterALU::is_next_bit_of_param ( const Parameter * ad,
bool  ) const
overridevirtual

Implements ActionData::Parameter.

◆ name()

cstring ActionData::MeterALU::name ( ) const
inlineoverridevirtual

Implements ActionData::Parameter.

◆ only_one_overlap_solution()

bool ActionData::MeterALU::only_one_overlap_solution ( ) const
inlineoverridevirtual

Implements ActionData::Parameter.

◆ overlap()

const Parameter * ActionData::MeterALU::overlap ( const Parameter * ad,
bool only_one_overlap_solution,
le_bitrange * my_overlap,
le_bitrange * ad_overlap ) const
overridevirtual

Each action in a table is mutually exclusive, thus random externs that are used in different actions can share the same bits in the immediate, as these bits will be mutually exclusive. Random externs used in the same actions can not overlap, in order to guarantee that each random bit is unique.

Previously checked before this pass is run, a random extern can only be used once per action, as the infrastucture cannot tell what bits are supposed to be shared, vs. what bits will be different.

Bits that are not headed directly to an ALU operation can be overlaid:

action a1() { f1 = random1.get(); f2 = random2.get(); }

where f1 and f2 are two 4 bit fields in different 8 bit containers. In this case, because the random numbers output byte by byte, each random number impact is actually 8 bits. But because each of these operands only use 4 bits, each random number can overlap with each other.

Because these bits can always overlap, just return the max size position

Implements ActionData::Parameter.

◆ size()

int ActionData::MeterALU::size ( ) const
inlineoverridevirtual

Implements ActionData::Parameter.

◆ split()

const Parameter * ActionData::MeterALU::split ( int lo,
int hi ) const
overridevirtual

Implements ActionData::Parameter.