-
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
committed
Mar 29, 2017
1 parent
71fa5f1
commit 5910398
Showing
6 changed files
with
128 additions
and
1 deletion.
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,60 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header hdr { | ||
bit<32> a; | ||
} | ||
|
||
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<hdr>(h.h); | ||
} | ||
} | ||
|
||
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
@name("c") direct_counter(CounterType.packets) c; | ||
@name("my_action") action my_action_0(bit<32> a) { | ||
sm.egress_spec = (bit<9>)a; | ||
} | ||
@name("t") table t { | ||
actions = { | ||
my_action_0(); | ||
} | ||
const default_action = my_action_0(32w0); | ||
counters = c; | ||
} | ||
apply { | ||
t.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 |
---|---|---|
|
@@ -15,3 +15,4 @@ control Map1(in bit<32> d) { | |
} | ||
|
||
Switch<bit<32>>(P(), Map1()) main; | ||
Switch<bit<32>>(P(), Map1()) main1; |
61 changes: 61 additions & 0 deletions
61
testdata/p4_16_samples_outputs/unused-counter-bmv2-midend.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,61 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header hdr { | ||
bit<32> a; | ||
} | ||
|
||
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<hdr>(h.h); | ||
} | ||
} | ||
|
||
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
@name("c") direct_counter(CounterType.packets) c; | ||
@name("c1") direct_counter(CounterType.packets) c1; | ||
@name("my_action") action my_action_0(bit<32> a) { | ||
sm.egress_spec = (bit<9>)a; | ||
} | ||
@name("t") table t { | ||
actions = { | ||
my_action_0(); | ||
} | ||
const default_action = my_action_0(32w0); | ||
counters = c; | ||
} | ||
apply { | ||
t.apply(); | ||
} | ||
} | ||
|
||
V1Switch<Headers, Meta>(p(), vrfy(), ingress(), egress(), update(), deparser()) main; |