Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

sig width in action when execute_meter is used #4

Open
ghost opened this issue Jul 9, 2015 · 1 comment
Open

sig width in action when execute_meter is used #4

ghost opened this issue Jul 9, 2015 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 9, 2015

I have an action:
action save_and_meter(meter_id) {
modify_field( meter_metadata.meter_id, meter_id);
execute_meter( color_meter, meter_id, meter_metadata.meter_color);
}
for which the metadata field meter_id is 10 bits.

The presence of the execute_meter statement seems to be over-riding the correct determination of the signature width:

h.p4_actions['save_and_meter'].signature_widths
[32]

Without the execute_meter statement the correct value (10) will be reported.

@antoninbas
Copy link
Member

The behavioral model assumes that all meter indexes are 32-bit wide, so I am not surprised by this behavior. This should not be a major problem given that the modify_field primitive action will correctly truncate the 32-bit input to copy it to your 10-bit field. It just means that your action data for this table will be wider than what you want. Ideally however, the compiler would use the instance_count attribute of the meter to determine a more accurate width. For example, if instance_count = 1024, a 10-bit index is good enough. Thanks for reporting this issue, I will try to make this better in the future.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant