-
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.
- Loading branch information
mbudiu-vmw
authored and
Chris Dodd
committed
Dec 23, 2016
1 parent
a350376
commit 76d35a5
Showing
3 changed files
with
60 additions
and
4 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
This folder contains negative tests: which are supposed to generate compiler errors when compiled. | ||
All files should be named like *-bmv2.p4 |
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,54 @@ | ||
/* | ||
Copyright 2016 VMware, 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 foo { | ||
bit<8> foo_1; | ||
bit<7> foo_2; | ||
bit<8> foo_3; | ||
} | ||
|
||
header bar { | ||
bit<2> bar_1; | ||
} | ||
|
||
struct baz { | ||
foo baz_1; | ||
} | ||
|
||
struct Headers { | ||
bar a; | ||
baz b; | ||
} | ||
|
||
struct Meta {} | ||
|
||
parser p(packet_in b, out Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
state start { | ||
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 ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { apply {} } | ||
control deparser(packet_out b, in Headers h) { apply {} } | ||
|
||
V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; |