Previous Section Next Section

5.7 Constraint Resolution

While generating fields, the generator must satisfy all relevant constraints. These constraints may be defined in several places including:

We have seen many examples of constraints in the original struct definition and the extensions to the struct definition. Example 5-9 shows a constraint defined using the hierarchical path notation.

Example 5-9 Resolution of Hierarchical Constraints
Example shows the resolution of a constraint
specified using a hierarchical path notation.
<'
struct cell { //Original struct definition
    len: uint(bits:8); //Field len, default range [0..255]
    keep len in [0..48]; //All cells constrain len to [0..48]
};

struct port {
     cell_inst: cell; //Instantiate the cell
     keep cell_inst.len > 5; //Hierarchical constraint for cell_inst
                             //len is now constrained to [6..48]
};
'>
Previous Section Next Section