-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
282 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
Copyright 2013-present Barefoot Networks, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header hdr { | ||
bit<32> f; | ||
} | ||
|
||
struct Headers { | ||
hdr h; | ||
} | ||
|
||
struct Meta { } | ||
|
||
parser p(packet_in b, out Headers h, | ||
inout Meta m, inout standard_metadata_t sm) { | ||
state start { | ||
b.extract(h.h); | ||
transition accept; | ||
} | ||
} | ||
|
||
control vrfy(in Headers h, inout Meta m) { apply {} } | ||
control update(inout Headers h, inout Meta m) { apply {} } | ||
|
||
control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
apply {} | ||
} | ||
|
||
control deparser(packet_out b, in Headers h) { | ||
apply { b.emit(h); } | ||
} | ||
|
||
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
action my_a(bit<32> v) { h.h.f = v; } | ||
apply { | ||
my_a(0); | ||
my_a(1); | ||
} | ||
} | ||
|
||
V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header hdr { | ||
bit<32> f; | ||
} | ||
|
||
struct Headers { | ||
hdr h; | ||
} | ||
|
||
struct Meta { | ||
} | ||
|
||
parser p(packet_in b, out Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
state start { | ||
b.extract<hdr>(h.h); | ||
transition accept; | ||
} | ||
} | ||
|
||
control vrfy(in Headers h, inout Meta m) { | ||
apply { | ||
} | ||
} | ||
|
||
control update(inout Headers h, inout Meta m) { | ||
apply { | ||
} | ||
} | ||
|
||
control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
apply { | ||
} | ||
} | ||
|
||
control deparser(packet_out b, in Headers h) { | ||
apply { | ||
b.emit<Headers>(h); | ||
} | ||
} | ||
|
||
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
@name("my_a") action my_a_0(bit<32> v) { | ||
h.h.f = v; | ||
} | ||
apply { | ||
my_a_0(32w0); | ||
my_a_0(32w1); | ||
} | ||
} | ||
|
||
V1Switch<Headers, Meta>(p(), vrfy(), ingress(), egress(), update(), deparser()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header hdr { | ||
bit<32> f; | ||
} | ||
|
||
struct Headers { | ||
hdr h; | ||
} | ||
|
||
struct Meta { | ||
} | ||
|
||
parser p(packet_in b, out Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
state start { | ||
b.extract<hdr>(h.h); | ||
transition accept; | ||
} | ||
} | ||
|
||
control vrfy(in Headers h, inout Meta m) { | ||
apply { | ||
} | ||
} | ||
|
||
control update(inout Headers h, inout Meta m) { | ||
apply { | ||
} | ||
} | ||
|
||
control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
apply { | ||
} | ||
} | ||
|
||
control deparser(packet_out b, in Headers h) { | ||
apply { | ||
b.emit<Headers>(h); | ||
} | ||
} | ||
|
||
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
bit<32> v_0; | ||
bit<32> v_1; | ||
@name("my_a") action my_a_0() { | ||
v_0 = 32w0; | ||
h.h.f = 32w0; | ||
} | ||
@name("my_a") action my_a_2() { | ||
v_1 = 32w1; | ||
h.h.f = 32w1; | ||
} | ||
table tbl_my_a() { | ||
actions = { | ||
my_a_0(); | ||
} | ||
const default_action = my_a_0(); | ||
} | ||
table tbl_my_a_0() { | ||
actions = { | ||
my_a_2(); | ||
} | ||
const default_action = my_a_2(); | ||
} | ||
apply { | ||
tbl_my_a.apply(); | ||
tbl_my_a_0.apply(); | ||
} | ||
} | ||
|
||
V1Switch<Headers, Meta>(p(), vrfy(), ingress(), egress(), update(), deparser()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header hdr { | ||
bit<32> f; | ||
} | ||
|
||
struct Headers { | ||
hdr h; | ||
} | ||
|
||
struct Meta { | ||
} | ||
|
||
parser p(packet_in b, out Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
state start { | ||
b.extract(h.h); | ||
transition accept; | ||
} | ||
} | ||
|
||
control vrfy(in Headers h, inout Meta m) { | ||
apply { | ||
} | ||
} | ||
|
||
control update(inout Headers h, inout Meta m) { | ||
apply { | ||
} | ||
} | ||
|
||
control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
apply { | ||
} | ||
} | ||
|
||
control deparser(packet_out b, in Headers h) { | ||
apply { | ||
b.emit(h); | ||
} | ||
} | ||
|
||
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
action my_a(bit<32> v) { | ||
h.h.f = v; | ||
} | ||
apply { | ||
my_a(0); | ||
my_a(1); | ||
} | ||
} | ||
|
||
V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; |
Empty file.