P4C
The P4 Compiler
Loading...
Searching...
No Matches
ActionDataBus Struct Referenceabstract

#include <action_data_bus.h>

Inheritance diagram for ActionDataBus:
[legend]

Classes

struct  FullShare
 
struct  Loc
 
struct  Use
 

Public Types

enum  loc_alg_t {
  FIND_NORMAL , FIND_LOWER , FIND_FULL , FIND_IMMED_UPPER ,
  FIND_FULL_HALF , FIND_FULL_BYTE
}
 

Public Member Functions

virtual bool alloc_action_data_bus (const IR::MAU::Table *tbl, const ActionData::Format::Use *use, TableResourceAlloc &alloc)=0
 
virtual bool alloc_action_data_bus (const IR::MAU::Table *tbl, const MeterALU::Format::Use *use, TableResourceAlloc &alloc)=0
 
virtual void clear ()
 
virtual void update (const IR::MAU::Table *tbl)
 
virtual void update (cstring name, const TableResourceAlloc *alloc, const IR::MAU::Table *tbl)
 
virtual void update (cstring name, const Use &alloc)
 
virtual void update (cstring name, const Use::ReservedSpace &rs)=0
 
virtual void update_action_data (cstring name, const TableResourceAlloc *alloc, const IR::MAU::Table *tbl)
 
virtual void update_meter (cstring name, const TableResourceAlloc *alloc, const IR::MAU::Table *tbl)
 

Static Public Member Functions

static ActionDataBuscreate ()
 
static int getAdbSize ()
 

Protected Attributes

ordered_map< const IR::MAU::AttachedMemory *, const Use & > allocated_attached
 
ordered_map< cstring, const Use & > reduction_or_mapping
 

Friends

std::ostream & operator<< (std::ostream &out, const ActionDataBus &adb)
 

Detailed Description

Algorithm for the allocation of the action data bus. The action data bus is broken into 3 parts, a BYTE, HALF, and FULL region. The byte and half regions are mutually exclusive, while the full region shares places with the byte and half region. There are 32 outputs for each type of container region. The bytes 0-31 are for the byte region, bytes 32-95 are for the half region, and all 128 bytes are for the full regions. Because actions within the same table are mutually exclusive, FULLs can potentially share locations with BYTES and HALFs on the action data bus.

The version of the algorithm updates the tables that have been previously allocated. It then attempts to allocate the BYTES and HALVES. Then the algorithm checks to see if the regions can be shared, and if not, allocates a separate byte.

The rules for allocation are set by the uArch on section 5.2.5.1/6.2.5.1 on the Action Data Bus. The section is titled Action Output HV Xbar Programming, under the section Action Output HV Xbar(s) in the Section RAM Array. The bytes are broken into 16 byte regions and bytes in particular offsets of the action data table have to be allocated contiguously within these 16 byte regions. The constraints are better detailed over the alloc_bytes, alloc_halves, and alloc_fulls function calls.

For immediate actions, the constraints are detailed in the uArch in section 5.4.4.2/6.4.4.2. The section is titled Immediate Action Data, under Address Distribution, under Match Central. Unlike for action data tables, which are broken up into 8 16 byte muxes, there are only 3 muxes for each immediate section. There is a byte by byte mux between bytes 0-15, a half-word mux between bytes 16-63, and a full word mux between bytes 64-128. These muxes can only have one input per immediate word. Immediate allocation on the action bus occurs on a mod 4 post-shift in match central.

The constraints are similar to action data tables in that regions of the immediate data must be contiguously allocated within a 16 byte region of the action data bus. With immediate action data, the input allocation must be 4 byte contiguous.

Member Enumeration Documentation

◆ loc_alg_t

Location Algorithm: For finding an allocation within the correct type region

Member Function Documentation

◆ alloc_action_data_bus() [1/2]

virtual bool ActionDataBus::alloc_action_data_bus ( const IR::MAU::Table * tbl,
const ActionData::Format::Use * use,
TableResourceAlloc & alloc )
pure virtual

Implemented in Tofino::ActionDataBus.

◆ alloc_action_data_bus() [2/2]

virtual bool ActionDataBus::alloc_action_data_bus ( const IR::MAU::Table * tbl,
const MeterALU::Format::Use * use,
TableResourceAlloc & alloc )
pure virtual

Implemented in Tofino::ActionDataBus.

◆ clear()

void ActionDataBus::clear ( )
virtual

Copyright (C) 2024 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Reimplemented in Tofino::ActionDataBus.

◆ update()

void ActionDataBus::update ( cstring name,
const Use & alloc )
virtual

The update procedure for all previously allocated tables in a stage. This fills in the bitvecs correctly in order to be tested against in the allocation of the current table.