p4c: P4-14 to P4-16 fails in getting parameters from extern instatiation
The P4-14 to P4-16 conversion is not getting the correct instatiation parameters. E.g:
Following P4-14 code:
parser start { return ingress; }
extern_type extern_test {
attribute att_test {
type: int;
}
method my_extern_method ();
}
extern extern_test my_extern_inst {
att_test: 0xab;
}
action a() { my_extern_inst.my_extern_method(); }
table t {
actions { a; }
}
control ingress {
apply(t);
}
control egress {}
Generates:
#include <core.p4>
#include <v1model.p4>
struct metadata {
}
struct headers {
}
extern extern_test {
void my_extern_method();
extern_test();
}
parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name("start") state start {
transition accept;
}
}
control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
apply {
}
}
control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
extern_test() my_extern_inst;
@name(".a") action a() {
my_extern_inst.my_extern_method();
}
@name("t") table t {
actions = {
a;
@default_only NoAction;
}
default_action = NoAction();
}
apply {
t.apply();
}
}
control DeparserImpl(packet_out packet, in headers hdr) {
apply {
}
}
control verifyChecksum(in headers hdr, inout metadata meta) {
apply {
}
}
control computeChecksum(inout headers hdr, inout metadata meta) {
apply {
}
}
V1Switch(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main;
I believe there is an issue with the v1parser.ypp, but I feel a bit unconfortable to change it.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (21 by maintainers)
Commits related to this issue
- Fix for issue #604 — committed to mihaibudiu/p4c-clone by deleted user 7 years ago
- Fix for issue #604 — committed to mihaibudiu/p4c-clone by deleted user 7 years ago
- Fix for issue #604 (#637) Fix for issue #604 — committed to p4lang/p4c by deleted user 7 years ago
By the way @engjefersonsantiago, when you paste code, it will be formatted more nicely if you surround it with the appropriate markdown syntax, like this:
(The
p4is not strictly necessary, but it tells Github to highlight the code using P4 syntax.)