async def run_phase(self, phase): env = self.env phase.raise_objection(self) env.regmodel.reset() env.regmodel.set_coverage(UVM_CVR_ALL) # cast to 'void' removed self.dut.rst <= 0 for _ in range(3): await FallingEdge(self.dut.clk) self.dut.rst <= 1 await FallingEdge(self.dut.clk) seq = UVMRegBitBashSeq.type_id.create("reg_test_seq") seq.model = env.regmodel await seq.start(env.bus.sqr) await seq.wait_for_sequence_state(UVM_FINISHED) seq = UVMMemWalkSeq.type_id.create("memory_test_seq") seq.model = env.regmodel await seq.start(env.bus.sqr) await seq.wait_for_sequence_state(UVM_FINISHED) uvm_info("Test", "Generating and uploading 5 configurations...", UVM_LOW) for _ in range(5): status = 0 #env.regmodel.randomize_with({Ra.F2.value == Rb.F2.value}) # TODO env.regmodel.randomize() status = [] await env.regmodel.update(status) env.regmodel.sample_values() phase.drop_objection(self)
def final_phase(self, phase): if self.phases_started != CORRECT_PHASES: uvm_error("PHASES_STARTED_FAIL", self.get_name() + ": " + str(self.phases_started)) else: self.correct = True uvm_info("PHASES_STARTED_OK", self.get_name() + ": " + str(self.phases_started), UVM_NONE)
def initial(dut): print("dut parameter NUM_BLKS: " + str(dut.NUM_BLKS)) env = sys_env("env") vif = apb_if(dut) UVMConfigDb.set(env, "apb", "vif", vif) c = Clock(dut.apb_pclk, 10, 'ns') cocotb.fork(c.start()) yield run_test() if env.all_ok is False: uvm_fatal("ALL_NOT_OK", "env.all_ok == False, something went wrong!") else: uvm_info("ALL_OK", "*** TEST PASSED ***", UVM_NONE)
def build_phase(self, phase): super().build_phase(phase) arr = [] if UVMConfigDb.get(self, "", "debug", arr) is True: self.debug = arr[0] UVMConfigDb.set(self, "inst1.u2", "v", 5) UVMConfigDb.set(self, "inst2.u1", "v", 3) UVMConfigDb.set(self, "inst1.*", "s", 0x10) sv.display("%s: In Build: debug = %0d", self.get_full_name(), self.debug) self.inst1 = ClassA("inst1", self) self.inst2 = ClassB("inst2", self) if UVMConfigDb.get(uvm_top, "topenv", "should_match", arr): uvm_info("MATCH_OK", "should_match found from DB", UVM_MEDIUM) else: uvm_error("MATCH_ERROR", "should_match NOT found from DB")
def my_log(msg): uvm_info("COV_RPT", msg, UVM_LOW)