[P4-dev] Error updating direct register

niemand at darkenwood.net niemand at darkenwood.net
Tue May 9 08:55:29 EDT 2017

I'm having some issues implementing a direct register using bmv2. My 
understanding is that with direct access there is a cell of the register 
for each entry in the table. However when I try to update the register 
with the register_write action I get this error, crashing the switch.

[14:28:13.147] [bmv2] [D] [thread 5684] [1.0] [cxt 0] Action entry is 
update_flow -
lt-simple_switch: ../../include/bm/bm_sim/stateful.h:111: bm::Register& 
bm::RegisterArray::operator[](size_t): Assertion `idx < size()' failed.

This looks like the index is out of range. I'm using 0 but according to 
the spec with a direct access register the index should be ignored since 
the matching table entry should determine which cell to use. Any idea 
what I'm doing wrong here? I haven't been able to find any examples of 
direct access registers being used, and I'm starting to wonder if they 
are implemented in bmv2. Thanks.

register timestamp {
     width : 48;
     direct: flow;

action add_flow() {
	modify_field(standard_metadata.egress_spec, 1);
	// Packet received by control plane program and new entry
	// created with Source/Destination MAC and update_flow action

action update_flow() {
     register_write(timestamp, 0, 

table flow {
	reads {
		ether_hdr.src : exact;
		ether_hdr.dst : exact;
	actions {
		add_flow; // Default

More information about the P4-dev mailing list