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,21 @@
// header stack declaration
header label_t {
bit<20> label;
bit bos;
}
struct header_t {
label_t[10] labels;
}
header_t hdr;
// remove from header stack
action pop_label() {
hdr.labels.pop_front(1);
}
// add to header stack
action push_label(in bit<20> label) {
hdr.labels.push_front(1);
hdr.labels[0].setValid();
hdr.labels[0] = { label, 0};
}