The following code shows examples of how to "null" each
engine.
// TRANSLATED TO P4 BY XILINX
#include <core.p4>
#include <xsa.p4>
// ********************************************************************** //
// ************************ S T R U C T U R E S ************************ //
// ********************************************************************** //
// header structure
struct headers {
}
// User metadata structure
struct metadata {
}
// ********************************************************************** //
// *************************** P A R S E R ***************************** //
// ********************************************************************** //
parser NullParser(packet_in packet,
out headers hdr,
inout metadata meta,
inout standard_metadata_t smeta) {
state start {
transition accept;
}
}
// ********************************************************************** //
// *************** M A T C H A C T I O N E N G I N E **************** //
// ********************************************************************** //
control NullMAPipe(inout headers hdr,
inout metadata meta,
inout standard_metadata_t smeta) {
apply {
}
}
// ********************************************************************** //
// *************************** D E P A R S E R ************************ //
// ********************************************************************** //
control NullDeparser(packet_out packet,
in headers hdr,
inout metadata meta,
inout standard_metadata_t smeta) {
apply {
}
}
// ********************************************************************** //
// ****************************** M A I N ***************************** //
// ********************************************************************** //
XilinxPipeline(
NullParser(),
NullMAPipe(),
NullDeparser()
) main;
If no packet editing is required, it is recommended to emit all extracted headers again in the original order that they were extracted in the Parser, even in cases where the output packet bus is not used. This results in optimal resource utilization.
If the results of the Parser are not used in any practical way, there is potential for the whole design to be optimized away.