![]() |
P4C
The P4 Compiler
|
Classes | |
struct | Slot |
Public Member Functions | |
virtual void | alloc_field (Table *, ActionBusSource src, unsigned offset, unsigned sizes_needed) |
void | do_alloc (Table *tbl, ActionBusSource src, unsigned use, int lobyte, int bytes, unsigned offset) |
int | find (const ActionBusSource &src, int lo, int hi, int size, int pos=-1, int *len=0) |
int | find (const char *name, int lo, int hi, int size, int *len=0) |
int | find (const char *name, TableOutputModifier mod, int lo, int hi, int size, int *len=0) |
find an action bus slot that contains the requested thing. | |
int | find (const std::string &name, int lo, int hi, int size, int *len=0) |
int | find (const std::string &name, TableOutputModifier mod, int lo, int hi, int size, int *len=0) |
int | find (Table *attached, TableOutputModifier mod, int lo, int hi, int size, int *len=0) |
void | need_alloc (Table *tbl, const ActionBusSource &src, unsigned lo, unsigned hi, unsigned size) |
void | need_alloc (Table *tbl, Table *attached, TableOutputModifier mod, unsigned lo, unsigned hi, unsigned size) |
void | pass1 (Table *tbl) |
void | pass2 (Table *tbl) |
void | pass3 (Table *tbl) |
unsigned | size () |
auto | slots () const |
template<class REGS> | |
void | write_action_regs (REGS ®s, Table *tbl, int homerow, unsigned action_slice) |
template<class REGS> | |
void | write_immed_regs (REGS ®s, Table *tbl) |
Static Public Member Functions | |
static std::unique_ptr< ActionBus > | create () |
static std::unique_ptr< ActionBus > | create (Table *, VECTOR(pair_t) &) |
static int | find (Stage *stage, ActionBusSource src, int lo, int hi, int size, int *len=0) |
Public Attributes | |
int | lineno |
Static Public Attributes | |
static const unsigned | size_masks [8] = {7, 7, 15, 15, 31, 31, 31, 31} |
Protected Member Functions | |
ActionBus (Table *, VECTOR(pair_t) &) | |
bool | check_atcam_sharing (Table *tbl1, Table *tbl2) |
bool | check_slot_sharing (ActionBus::Slot &slot, bitvec &action_bus) |
int | find_free (Table *tbl, unsigned min, unsigned max, unsigned step, unsigned lobyte, unsigned bytes) |
int | find_merge (Table *tbl, int offset, int bytes, int use) |
void | setup_slot (int lineno, Table *tbl, const char *name, unsigned idx, ActionBusSource src, unsigned sz, unsigned off) |
Static Protected Member Functions | |
static bool | compatible (const ActionBusSource &a, unsigned a_off, const ActionBusSource &b, unsigned b_off) |
Protected Attributes | |
std::vector< std::array< unsigned, ACTION_HV_XBAR_SLICES > > | action_hv_slice_use |
ordered_map< unsigned, Slot > | by_byte |
bitvec | byte_use |
ordered_map< ActionBusSource, ordered_map< unsigned, unsigned > > | need_place |
Friends | |
std::ostream & | operator<< (std::ostream &out, const ActionBus &a) |
std::ostream & | operator<< (std::ostream &out, const Slot &sl) |
int ActionBus::find | ( | const char * | name, |
TableOutputModifier | mod, | ||
int | lo, | ||
int | hi, | ||
int | size, | ||
int * | len = 0 ) |
find an action bus slot that contains the requested thing.
ActionBus::find
Overloads allow looking for different kinds of things – a Format::Field, a HashDistribution, a RandomNumberGen, or something by name (generally a table output).
f | a Format::Field to look for |
name | named slot to look for – generally a table output, but may be a field |
hd | a HashDistribution to look for |
rng | a RandomNumberGen to look for |
lo,hi | range of bits in the thing specified by the first arg |
size | bitmask of needed size classes – 3 bits that denote need for a 8/16/32 bit actionbus slot. Generally will only have 1 bit set, but might be 0. |
|
protected |
find_free – find a free slot on the action output bus for some data. Looks through bytes in the range min..max for a free space where we can put 'bytes' bytes from an action input bus starting at 'lobyte'. 'step' is an optimization to only check every step bytes as we know alignment restrictions mean those are the only possible aligned spots
|
protected |
find_merge – find any adjacent/overlapping data on the action input bus that means the data at 'offset' actually already on the action output bus offset offset (in bits) on the action input bus of the data we're interested in bytes how many bytes of data on the action input bus use bitmask of the sizes of phv that need to access this on the action output bus