class Node(enc.TlvModel): id = enc.UintField(TypeNumber.NODE_ID) parent = enc.UintField(TypeNumber.PARENT_ID) rule_name = enc.RepeatedField(enc.BytesField(TypeNumber.IDENTIFIER, is_string=True)) v_edges = enc.RepeatedField(enc.ModelField(TypeNumber.VALUE_EDGE, ValueEdge)) p_edges = enc.RepeatedField(enc.ModelField(TypeNumber.PATTERN_EDGE, PatternEdge)) sign_cons = enc.RepeatedField(enc.UintField(TypeNumber.KEY_NODE_ID))
class ConstraintOption(enc.TlvModel): # Equal to a given NameComponent value value = enc.BytesField(TypeNumber.COMPONENT_VALUE) # Equal to another pattern tag = enc.UintField(TypeNumber.PATTERN_TAG) # Decide by a user function call fn = enc.ModelField(TypeNumber.USER_FN_CALL, UserFnCall)
class PushRequest(enc.TlvModel): ret_info = enc.ModelField(0x05, RefInfo) force = enc.BoolField(0x06)
class SyncUpdate(enc.TlvModel): ref_into = enc.RepeatedField(enc.ModelField(0x05, RefInfo))
class PatternEdge(enc.TlvModel): dest = enc.UintField(TypeNumber.NODE_ID) tag = enc.UintField(TypeNumber.PATTERN_TAG) cons_sets = enc.RepeatedField(enc.ModelField(TypeNumber.CONSTRAINT, PatternConstraint))
class PatternConstraint(enc.TlvModel): options = enc.RepeatedField(enc.ModelField(TypeNumber.CONS_OPTION, ConstraintOption))
class UserFnCall(enc.TlvModel): fn_id = enc.BytesField(TypeNumber.USER_FN_ID, is_string=True) args = enc.RepeatedField(enc.ModelField(TypeNumber.FN_ARGS, UserFnArg))
class LvsModel(enc.TlvModel): version = enc.UintField(TypeNumber.VERSION) start_id = enc.UintField(TypeNumber.NODE_ID) named_pattern_cnt = enc.UintField(TypeNumber.NAMED_PATTERN_NUM) nodes = enc.RepeatedField(enc.ModelField(TypeNumber.NODE, Node)) symbols = enc.RepeatedField(enc.ModelField(TypeNumber.TAG_SYMBOL, TagSymbol))