{"action":"created","issue":{"url":"https://api.github.com/repos/p4lang/p4-spec/issues/264","repository_url":"https://api.github.com/repos/p4lang/p4-spec","labels_url":"https://api.github.com/repos/p4lang/p4-spec/issues/264/labels{/name}","comments_url":"https://api.github.com/repos/p4lang/p4-spec/issues/264/comments","events_url":"https://api.github.com/repos/p4lang/p4-spec/issues/264/events","html_url":"https://github.com/p4lang/p4-spec/issues/264","id":229250434,"node_id":"MDU6SXNzdWUyMjkyNTA0MzQ=","number":264,"title":"Define new operations on varbits","user":{"login":"jafingerhut","id":109629,"node_id":"MDQ6VXNlcjEwOTYyOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/109629?v=4","gravatar_id":"","url":"https://api.github.com/users/jafingerhut","html_url":"https://github.com/jafingerhut","followers_url":"https://api.github.com/users/jafingerhut/followers","following_url":"https://api.github.com/users/jafingerhut/following{/other_user}","gists_url":"https://api.github.com/users/jafingerhut/gists{/gist_id}","starred_url":"https://api.github.com/users/jafingerhut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jafingerhut/subscriptions","organizations_url":"https://api.github.com/users/jafingerhut/orgs","repos_url":"https://api.github.com/users/jafingerhut/repos","events_url":"https://api.github.com/users/jafingerhut/events{/privacy}","received_events_url":"https://api.github.com/users/jafingerhut/received_events","type":"User","site_admin":false},"labels":[{"id":600642134,"node_id":"MDU6TGFiZWw2MDA2NDIxMzQ=","url":"https://api.github.com/repos/p4lang/p4-spec/labels/future%20enhancement","name":"future enhancement","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-05-17T06:32:28Z","updated_at":"2018-11-06T05:34:11Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"This is intended to be post P4-16.  I wanted to add a placeholder issue to remind me to flesh out more details later.\r\n\r\nThe basic idea is that for some protocols, it would be useful to be able to read bits from, and modify bits within, a varbit field.  This would be most useful if the bit offsets can be run-time calculated (if they were restricted to be at fixed bit offsets, then most likely the field could have been defined as a header with fixed width fields, and wouldn't have been defined as a varbit).\r\n\r\nDraft version of signatures, open to refinement:\r\n```\r\n// return current dynamic length of @vb\r\nbit<32> varbit_length(in varbit<W> vb);\r\n\r\n// Change the dynamic length of @vb to @new_length_in_bits, or to W if @new_length_in_bits\r\n// is larger than W.\r\nvoid varbit_resize(inout varbit<W> vb, in bit<32> new_length_in_bits);\r\n\r\n// I am not clear whether X needs to be a parameter as well as part of the return type.\r\n// Extract and return @length_in_bits_X consecutive bit positions of @vb starting at offset\r\n// @start_bit_offset.  @start_bit_offset == 0 is the most significant bit position of @vb.\r\n// The return value is undefined in any bit positions that one attempts to extract from\r\n// outside of the current dynamic length of @vb.\r\nbit<X> varbit_slice(in varbit<W> vb, in bit<32> start_bit_offset, in bit<32> length_in_bits_X);\r\n\r\n// replace X consecutive bit positions of @vb starting at offset @start_bit_offset with contents of\r\n// @data.  @start_bit_offset == 0 is the most significant bit position of @vb.\r\n// Any bits one attempts to inject outside of the current dynamic length of @vb are lost.\r\nvoid varbit_inject(inout varbit<W> vb, in bit<32> start_bit_offset, in bit<X> data);\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/p4lang/p4-spec/issues/comments/436136394","html_url":"https://github.com/p4lang/p4-spec/issues/264#issuecomment-436136394","issue_url":"https://api.github.com/repos/p4lang/p4-spec/issues/264","id":436136394,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjEzNjM5NA==","user":{"login":"vgurevich","id":12835827,"node_id":"MDQ6VXNlcjEyODM1ODI3","avatar_url":"https://avatars3.githubusercontent.com/u/12835827?v=4","gravatar_id":"","url":"https://api.github.com/users/vgurevich","html_url":"https://github.com/vgurevich","followers_url":"https://api.github.com/users/vgurevich/followers","following_url":"https://api.github.com/users/vgurevich/following{/other_user}","gists_url":"https://api.github.com/users/vgurevich/gists{/gist_id}","starred_url":"https://api.github.com/users/vgurevich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vgurevich/subscriptions","organizations_url":"https://api.github.com/users/vgurevich/orgs","repos_url":"https://api.github.com/users/vgurevich/repos","events_url":"https://api.github.com/users/vgurevich/events{/privacy}","received_events_url":"https://api.github.com/users/vgurevich/received_events","type":"User","site_admin":false},"created_at":"2018-11-06T05:34:11Z","updated_at":"2018-11-06T05:34:11Z","author_association":"CONTRIBUTOR","body":"My recommendation here (and in general) -- let's follow the actual capabilities of the practical hardware and even then start with an extern and then promote to the standard language capability. \r\n\r\nUntil then we are not going to do a good job anyway."}}
{"actor":{"display_login":"vgurevich"}}