def test_cast(self): my_int = 6 arr = [] ok = sv.cast(arr, my_int, int) self.assertEqual(ok, True) self.assertEqual(arr[0], 6) arr = [] ok = sv.cast(arr, my_int, str) self.assertEqual(ok, False) self.assertEqual(len(arr), 0)
def build_phase(self, phase): env = [] if self.env is None: if sv.cast(env, uvm_top.find("env$"), sys_env) is True: self.env = env[0] else: uvm_fatal("SYS_TEST/NO_ENV", "Unable to find/cast sys_env")
def build_phase(self, phase): if (self.env is None): arr = [] if (sv.cast(arr, uvm_top.find("env$"), blk_env)): self.env = arr[0] else: uvm_fatal("NO_ENV_ERR", "test_top unable to find 'env'")
def do_compare(self, rhs, comparer): rhs_ = [] if not sv.cast(rhs_,rhs, UVMBuiltInPair): uvm_error("WRONG_TYPE", {"do_compare: rhs argument is not of type '", self.get_type_name(),"'"}) return 0 rhs_ = rhs[0] return self.first == rhs_.first and self.second == rhs_.second
def do_copy(self, rhs): #bus_trans rhs_ rhs_ = rhs if not sv.cast(rhs_, rhs): uvm_error("do_copy", "cast failed, check type compatability") UVMSequenceItem.do_copy(self, rhs) self.addr = rhs_.addr self.data = rhs_.data self.op = rhs_.op
def build_phase(self, phase): agent = [] if (sv.cast(agent, self.get_parent(), apb_agent) and len(agent) == 1): self.sigs = agent[0].vif else: tmp = [] if (not UVMConfigDb.get(self, "", "vif", tmp)): uvm_fatal( "APB/MON/NOVIF", "No virtual interface specified for self monitor instance") self.sigs = tmp[0]