-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Mihai Budiu
authored
Dec 26, 2018
1 parent
cb8e3ee
commit e4386b8
Showing
7 changed files
with
341 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#include <v1model.p4> | ||
|
||
header short { | ||
bit<32> f; | ||
} | ||
|
||
struct alt_t { | ||
bit<1> valid; | ||
bit<7> port; | ||
}; | ||
|
||
struct row_t { | ||
alt_t alt0; | ||
alt_t alt1; | ||
}; | ||
|
||
struct parsed_packet_t {}; | ||
|
||
struct local_metadata_t { | ||
short s; | ||
row_t row; | ||
}; | ||
|
||
parser parse(packet_in pk, out parsed_packet_t hdr, | ||
inout local_metadata_t local_metadata, | ||
inout standard_metadata_t standard_metadata) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout parsed_packet_t hdr, | ||
inout local_metadata_t local_metadata, | ||
inout standard_metadata_t standard_metadata) { | ||
apply { | ||
local_metadata.s.setValid(); | ||
local_metadata.s.f = 0; | ||
local_metadata.row.alt0 = local_metadata.row.alt1; | ||
local_metadata.row.alt0.valid = 1; | ||
local_metadata.row.alt1.port = local_metadata.row.alt1.port + 1; | ||
clone3(CloneType.I2E, 0, local_metadata.row); | ||
} | ||
} | ||
|
||
control egress(inout parsed_packet_t hdr, | ||
inout local_metadata_t local_metadata, | ||
inout standard_metadata_t standard_metadata) { | ||
apply { } | ||
} | ||
|
||
control deparser(packet_out b, in parsed_packet_t hdr) { | ||
apply { } | ||
} | ||
|
||
control verify_checksum(inout parsed_packet_t hdr, | ||
inout local_metadata_t local_metadata) { | ||
apply { } | ||
} | ||
|
||
control compute_checksum(inout parsed_packet_t hdr, | ||
inout local_metadata_t local_metadata) { | ||
apply { } | ||
} | ||
|
||
V1Switch(parse(), verify_checksum(), ingress(), egress(), | ||
compute_checksum(), 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,64 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header short { | ||
bit<32> f; | ||
} | ||
|
||
struct alt_t { | ||
bit<1> valid; | ||
bit<7> port; | ||
} | ||
|
||
struct row_t { | ||
alt_t alt0; | ||
alt_t alt1; | ||
} | ||
|
||
struct parsed_packet_t { | ||
} | ||
|
||
struct local_metadata_t { | ||
short s; | ||
row_t row; | ||
} | ||
|
||
parser parse(packet_in pk, out parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
local_metadata.s.setValid(); | ||
local_metadata.s.f = 32w0; | ||
local_metadata.row.alt0 = local_metadata.row.alt1; | ||
local_metadata.row.alt0.valid = 1w1; | ||
local_metadata.row.alt1.port = local_metadata.row.alt1.port + 7w1; | ||
clone3<row_t>(CloneType.I2E, 32w0, local_metadata.row); | ||
} | ||
} | ||
|
||
control egress(inout parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control deparser(packet_out b, in parsed_packet_t hdr) { | ||
apply { | ||
} | ||
} | ||
|
||
control verify_checksum(inout parsed_packet_t hdr, inout local_metadata_t local_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control compute_checksum(inout parsed_packet_t hdr, inout local_metadata_t local_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
V1Switch<parsed_packet_t, local_metadata_t>(parse(), verify_checksum(), ingress(), egress(), compute_checksum(), 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,64 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header short { | ||
bit<32> f; | ||
} | ||
|
||
struct alt_t { | ||
bit<1> valid; | ||
bit<7> port; | ||
} | ||
|
||
struct row_t { | ||
alt_t alt0; | ||
alt_t alt1; | ||
} | ||
|
||
struct parsed_packet_t { | ||
} | ||
|
||
struct local_metadata_t { | ||
short s; | ||
row_t row; | ||
} | ||
|
||
parser parse(packet_in pk, out parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
local_metadata.s.setValid(); | ||
local_metadata.s.f = 32w0; | ||
local_metadata.row.alt0 = local_metadata.row.alt1; | ||
local_metadata.row.alt0.valid = 1w1; | ||
local_metadata.row.alt1.port = local_metadata.row.alt1.port + 7w1; | ||
clone3<row_t>(CloneType.I2E, 32w0, local_metadata.row); | ||
} | ||
} | ||
|
||
control egress(inout parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control deparser(packet_out b, in parsed_packet_t hdr) { | ||
apply { | ||
} | ||
} | ||
|
||
control verify_checksum(inout parsed_packet_t hdr, inout local_metadata_t local_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control compute_checksum(inout parsed_packet_t hdr, inout local_metadata_t local_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
V1Switch<parsed_packet_t, local_metadata_t>(parse(), verify_checksum(), ingress(), egress(), compute_checksum(), 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,74 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header short { | ||
bit<32> f; | ||
} | ||
|
||
struct alt_t { | ||
bit<1> valid; | ||
bit<7> port; | ||
} | ||
|
||
struct row_t { | ||
alt_t alt0; | ||
alt_t alt1; | ||
} | ||
|
||
struct parsed_packet_t { | ||
} | ||
|
||
struct local_metadata_t { | ||
short s; | ||
row_t row; | ||
} | ||
|
||
parser parse(packet_in pk, out parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
@hidden action act() { | ||
local_metadata.s.setValid(); | ||
local_metadata.s.f = 32w0; | ||
local_metadata.row.alt0.valid = local_metadata.row.alt1.valid; | ||
local_metadata.row.alt0.port = local_metadata.row.alt1.port; | ||
local_metadata.row.alt0.valid = 1w1; | ||
local_metadata.row.alt1.port = local_metadata.row.alt1.port + 7w1; | ||
clone3<row_t>(CloneType.I2E, 32w0, local_metadata.row); | ||
} | ||
@hidden table tbl_act { | ||
actions = { | ||
act(); | ||
} | ||
const default_action = act(); | ||
} | ||
apply { | ||
tbl_act.apply(); | ||
} | ||
} | ||
|
||
control egress(inout parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control deparser(packet_out b, in parsed_packet_t hdr) { | ||
apply { | ||
} | ||
} | ||
|
||
control verify_checksum(inout parsed_packet_t hdr, inout local_metadata_t local_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control compute_checksum(inout parsed_packet_t hdr, inout local_metadata_t local_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
V1Switch<parsed_packet_t, local_metadata_t>(parse(), verify_checksum(), ingress(), egress(), compute_checksum(), 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,64 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header short { | ||
bit<32> f; | ||
} | ||
|
||
struct alt_t { | ||
bit<1> valid; | ||
bit<7> port; | ||
} | ||
|
||
struct row_t { | ||
alt_t alt0; | ||
alt_t alt1; | ||
} | ||
|
||
struct parsed_packet_t { | ||
} | ||
|
||
struct local_metadata_t { | ||
short s; | ||
row_t row; | ||
} | ||
|
||
parser parse(packet_in pk, out parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
local_metadata.s.setValid(); | ||
local_metadata.s.f = 0; | ||
local_metadata.row.alt0 = local_metadata.row.alt1; | ||
local_metadata.row.alt0.valid = 1; | ||
local_metadata.row.alt1.port = local_metadata.row.alt1.port + 1; | ||
clone3(CloneType.I2E, 0, local_metadata.row); | ||
} | ||
} | ||
|
||
control egress(inout parsed_packet_t hdr, inout local_metadata_t local_metadata, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control deparser(packet_out b, in parsed_packet_t hdr) { | ||
apply { | ||
} | ||
} | ||
|
||
control verify_checksum(inout parsed_packet_t hdr, inout local_metadata_t local_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control compute_checksum(inout parsed_packet_t hdr, inout local_metadata_t local_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
V1Switch(parse(), verify_checksum(), ingress(), egress(), compute_checksum(), deparser()) main; | ||
|
Empty file.