}
@pragma netro reglocked register
register hh_reg {
width : 32;
instance_count : 1;
}
action load_count_act() {
register_read(load.load,hh_reg,0);
register_write(hh_reg,0,load.load + 1);
}
action load_rewrite() {
register_write(hh_reg,0,0);
}
table tbl_load_count_act {
actions {
load_count_act;
}
}
table tbl_load_rewrite {
actions {
load_rewrite;
}
}
action test_count() {
modify_field(ipv4.srcAddr,0);
}
table tbl_test {
actions {
test_count;
}
}
control ingress {
apply(tbl_forward);
}
control egress {
apply(tbl_load_count_act);
if (load.load == 100) {
apply(tbl_load_rewrite);
apply(tbl_test);
}
}