Adding P4 cheat cheet and its latex source files. (#201)
This commit is contained in:
13
utils/cheat_sheet_src/src/expressions.txt
Normal file
13
utils/cheat_sheet_src/src/expressions.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
// Local metadata declaration, assignment
|
||||
bit<16> tmp1; bit<16> tmp2;
|
||||
tmp1 = hdr.ethernet.type;
|
||||
|
||||
// bit slicing, concatenation
|
||||
tmp2 = tmp1[7:0] ++ tmp1[15:8];
|
||||
|
||||
// addition, subtraction, casts
|
||||
tmp2 = tmp1 + tmp1 - (bit<16>)tmp1[7:0];
|
||||
|
||||
// bitwise operators
|
||||
tmp2 = (~tmp1 & tmp1) | (tmp1 ^ tmp1);
|
||||
tmp2 = tmp1 << 3;
|
||||
Reference in New Issue
Block a user