Adding P4 cheat cheet and its latex source files. (#201)
This commit is contained in:
15
utils/cheat_sheet_src/src/control_flow.txt
Normal file
15
utils/cheat_sheet_src/src/control_flow.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
apply {
|
||||
// branch on header validity
|
||||
if (hdr.ipv4.isValid()) {
|
||||
ipv4_lpm.apply();
|
||||
}
|
||||
// branch on table hit result
|
||||
if (local_ip_table.apply().hit) {
|
||||
send_to_cpu();
|
||||
}
|
||||
// branch on table action invocation
|
||||
switch (table1.apply().action_run) {
|
||||
action1: { table2.apply(); }
|
||||
action2: { table3.apply(); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user