P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::match_t Struct Reference

#include <match.h>

Public Member Functions

 match_t (big_int w0, big_int w1)
 
 match_t (int size, big_int val, big_int mask)
 
bool matches (big_int v) const
 
 operator bool () const
 
bool operator!= (const match_t &a) const
 
bool operator== (const match_t &a) const
 
void setwidth (int bits)
 

Static Public Member Functions

static match_t dont_care (int size)
 

Public Attributes

big_int word0
 
big_int word1
 

Detailed Description

The ternary expression being matched, given as a pair of bitmasks: (word0, word1). The ternary expression cares about the value of an input bit if the corresponding bit is set in exactly one of the bitmasks. If it is set in word0, then the input must have a 0 in that position. Otherwise, if it is set in word1, then the input must have a 1 in that position. More formally, the ternary expression matches when the following expression is true: (input ^ word1) & (word0 ^ word1) == 0