Adding P4 cheat cheet and its latex source files. (#201)

This commit is contained in:
sibanez12
2018-10-05 12:52:35 -07:00
committed by Nate Foster
parent e3ef4d14db
commit 7ff3af57fb
14 changed files with 476 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
// counters
counter(8192, CounterType.packets) c;
action count(bit<32> index) {
//increment counter at index
c.count(index);
}
// registers
register<bit<48>>(16384) r;
action ipg(out bit<48> ival, bit<32> x) {
bit<48> last;
bit<48> now;
r.read(last, x);
now = std_meta.ingress_global_timestamp;
ival = now - last;
r.write(x, now);
}