async def test_codec(dut): # Create the interfaces and bus map for APB apb_bus_map = { "clk": "clk", "psel": "apb_psel", "penable": "apb_penable", "pwrite": "apb_pwrite", "prdata": "apb_prdata", "pwdata": "apb_pwdata", "paddr": "apb_paddr" } apb_vif = apb_if(dut, bus_map=apb_bus_map, name="") vip0 = vip_if(clk=dut.sclk, Tx=dut.rx, Rx=dut.tx) ctl = tb_ctl_if(clk=dut.clk, sclk=dut.sclk, rst=dut.rst, intr=dut.intr) UVMConfigDb.set(None, "env", "vif", ctl) UVMConfigDb.set(None, "env.apb", "vif", apb_vif) UVMConfigDb.set(None, "env.vip", "vif", vip0) cocotb.fork(do_reset_and_start_clocks(dut)) await run_test()
async def initial_begin(dut): cs_ = UVMCoreService.get() env = tb_env("env") print(str(dir(simulator))) print(str(dir(dut))) vif = apb_if(dut) uvm_hdl.set_dut(dut) #root = simulator.get_root_handle() #print(str(dir(root))) cocotb.fork(Clock(vif.clk, 10, "NS").start()) svr = cs_.get_report_server() svr.set_max_quit_count(10) seq_name = [] if sv.value_plusargs("UVM_SEQUENCE=%s", seq_name): seq = UVMUtils.create_type_by_name(seq_name[0], "tb") if seq is None: uvm_fatal( "NO_SEQUENCE", "This env requires you to specify the sequence to run using UVM_SEQUENCE=<name>" ) env.seq = seq UVMConfigDb.set(env, "apb", "vif", vif) UVMConfigDb.set(None, "DUT_REF", "dut", dut) await run_test()
def initial(dut): env = tb_env("env", None) vif = apb_if(dut) UVMConfigDb.set(env, "apb", "vif", vif) UVMConfigDb.set(None, "", "dut", dut) #UVMConfigDb.set(env, "apb", "vif", tb_top.apb0) cocotb.fork(Clock(vif.clk, 10, "NS").start()) yield run_test()
async def initial(dut): env = blk_env("env") vif = apb_if(dut) UVMConfigDb.set(env, "apb", "vif", vif) c = Clock(dut.apb_pclk, 10, 'ns') cocotb.fork(c.start()) cocotb.fork(run_test()) await Timer(1000, "NS") 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 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)
async def test_reg_fifo(dut): cs_ = UVMCoreService.get() test = FIFORegTest("test") svr = cs_.get_report_server() svr.set_max_quit_count(10) vif = apb_if(dut) UVMConfigDb.set(test, "apb", "vif", vif) UVMConfigDb.set(None, "DUT_REF", "dut", dut) cocotb.fork(Clock(vif.clk, 10, "NS").start()) await run_test(dut=dut) num_errors = svr.get_severity_count(UVM_ERROR) if num_errors > 0: raise Exception("Test failed. Got {} UVM_ERRORs".format(num_errors)) num_warnings = svr.get_severity_count(UVM_WARNING) if num_warnings > 0: raise Exception( "Test failed. Got {} UVM_WARNINGs".format(num_warnings))