def __init__(self, t, sz=0, is_rand=False, is_randsz=False, init=None): self.t = t self._int_field_info = field_info() self.is_scalar = isinstance(t, (type_base, type_enum)) if self.is_scalar: self.mask = (1 << self.t.width) - 1 self.is_enum = isinstance(t, type_enum) self._int_field_info.is_rand = is_rand self.is_rand_sz = is_randsz self.init_sz = sz self.init = init if self.init is not None and self.init_sz > 0: raise Exception("Only one of 'init' and 'sz' may be specified") if not self.is_scalar: if not hasattr(t, "_int_field_info"): raise Exception("list_t type " + str(t) + " (type " + str(type(t)) + ") is not a VSC randobj type") # Fill out field index and parent relationships # to support indexed field access # TODO: look out for recursive relationships... with expr_mode(): self._id_fields(t, None) # Non-scalar arrays require a backing array self.backing_arr = []
def __init__(self, t, sz=0, is_rand=False, is_randsz=False): self.t = t self._int_field_info = field_info() self.is_scalar = isinstance(t, type_base) self._int_field_info.is_rand = is_rand self.is_rand_sz = is_randsz self.init_sz = sz if not self.is_scalar: if not hasattr(t, "_int_field_info"): raise Exception("list_t type " + str(t) + " (type " + str(type(t)) + ") is not a VSC randobj type") # Fill out field index and parent relationships # to support indexed field access # TODO: look out for recursive relationships... with expr_mode(): self._id_fields(t, None) # Non-scalar arrays require a backing array self.backing_arr = []