Hello, does anyone know how to solve the error: PHV allocation was not successful. I am trying to convert bmv2 program to tofino. Part of the code and error prompts is attached below. Let me know if you need more info. I very appreciate your help.
struct my_ingress_metadata_t {
bit<2> meter_color;
bit<32> weight;
bit<32> threshold;
bit<32> plr;
bit<32> current_rate;
bit<32> demand;
bit<32> flow_h1;
bit<48> flow_time;
tPort_t destinationPort;
bit<16> next_rate_tbl;
bit<16> next_demand_tbl;
bit<10> meter_index;
bit<32> flow_byte_counter;
bit<32> prev_flow_byte_counter;
bit<32> flow_last_time_stamp_32;
bit<32> flow_last_time_stamp_16;
bit<32> delta;
bit<48> time_diff;
}
control Ingress(
/* User */
inout my_ingress_headers_t hdr,
inout my_ingress_metadata_t meta,
/* Intrinsic */
in ingress_intrinsic_metadata_t ig_intr_md,
in ingress_intrinsic_metadata_from_parser_t ig_prsr_md,
inout ingress_intrinsic_metadata_for_deparser_t ig_dprsr_md,
inout ingress_intrinsic_metadata_for_tm_t ig_tm_md)
{
Register<bit<32>, bit<REGISTER_CELL_WIDTH>>(REGISTER_SIZE_TOTAL, 0) flow_payload_counter;
RegisterAction<bit<32>, bit<32>, bit<32>>(flow_payload_counter) write_flow_payload_counter = {
void apply(inout bit<32> write_value){
write_value = meta.flow_byte_counter;
}
};
...
apply {
/* write to register */
meta.flow_byte_counter = meta.flow_byte_counter + (bit<32>)hdr.ipv4.totalLen;
write_flow_payload_counter.execute(meta.flow_h1);
}
}
error prompts:
========================= make.log =========================
error: PHV allocation was not successful
3 field slices remain unallocated
The following fields were not allocated:
ingress::meta.flow_byte_counter<32b>[15:0]
ingress::hdr.ipv4.totalLen<16b>
ingress::meta.flow_byte_counter<32b>[31:16]
Number of P4 compiler-proper ERRORs: 2
Number of P4 compiler-proper WARNINGs: 11
Number of errors exceeded set maximum of 1
make[2]: *** [CMakeFiles/l4_learning_tna-tofino.dir/build.make:73: l4_learning_tna/tofino/bf-rt.json] Error 3
make[2]: *** Deleting file 'l4_learning_tna/tofino/bf-rt.json'
make[1]: *** [CMakeFiles/Makefile2:166: CMakeFiles/l4_learning_tna-tofino.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
========================= make.log =========================