Пример #1
0
    def build_phase(self, phase):
        super().build_phase(phase)
        UVMConfigDb.set(self, "u1", "v", 0)

        sv.display("%s: In Build: debug = %0d", self.get_full_name(),
                   self.debug)
        self.u1 = C("u1", self)
Пример #2
0
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()
Пример #3
0
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()
Пример #4
0
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)
Пример #5
0
    def build_phase(self, phase):
        super().build_phase(phase)

        _str = []
        if UVMConfigDb.get(self, "", "debug", _str):
            self.debug = _str[0]
        else:
            uvm_error("NO_CONF_MATCH", "Did not get debug")
        UVMConfigDb.set(self, "u1", "v", 0)

        sv.display("%s: In Build: debug = %0d", self.get_full_name(),
                   self.debug)

        self.u1 = ClassC("u1", self)
Пример #6
0
    def build_phase(self, phase):
        super().build_phase(phase)

        arr = []
        if UVMConfigDb.get(self, "", "debug", arr):
            self.debug = arr[0]
        else:
            uvm_error("NO_CONF_MATCH", "Failed to get 'debug' from config DB")
        UVMConfigDb.set(self, "*", "v", 0)

        sv.display("%s: In Build: debug = %0d", self.get_full_name(),
                   self.debug)

        self.u1 = ClassC("u1", self)
        self.u2 = ClassC("u2", self)
Пример #7
0
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))
Пример #8
0
async def initial_begin(dut):
    cs_ = UVMCoreService.get()

    UVMReg.include_coverage("*", UVM_CVR_ALL)
    c = Clock(dut.clk, 10, 'ns')

    test = tb_test("test")

    svr = cs_.get_report_server()
    svr.set_max_quit_count(10)
    UVMConfigDb.set(None, "", "dut", dut)

    cocotb.fork(c.start())
    await run_test()

    def my_log(msg):
        uvm_info("COV_RPT", msg, UVM_LOW)

    coverage_db.report_coverage(my_log, bins=False)
    coverage_db.export_to_xml("results_coverage.xml")
Пример #9
0
    def build_phase(self, phase):
        super().build_phase(phase)
        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 = A("inst1", self)
        self.inst2 = B("inst2", self)
Пример #10
0
    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")
Пример #11
0
def module_top(dut):
    obj = UVMObject("my_conf_obj")

    # set configuration prior to creating the environment
    UVMConfigDb.set(None, "topenv.*.u1", "v", 30)
    UVMConfigDb.set(None, "topenv.inst2.u1", "v", 10)
    UVMConfigDb.set(None, "*", "recording_detail", 0)
    UVMConfigDb.set(None, "*", "myaa[foo]", "hi")
    UVMConfigDb.set(None, "*", "myaa[bar]", "bye")
    UVMConfigDb.set(None, "*", "myaa[foobar]", "howdy")
    UVMConfigDb.set(None, "topenv.inst1.u1", "myaa[foo]", "boo")
    UVMConfigDb.set(None, "topenv.inst1.u1", "myaa[foobar]", "boobah")
    UVMConfigDb.set(None, "topenv.inst1.u1", "my_conf_obj", obj)
    UVMConfigDb.set(None, "topenv.inst1.u1", "tag", 'I am tagged')
    topenv = my_env("topenv", None)
    yield run_test()
Пример #12
0
def module_top(dut):
    #  my_env topenv
    uvm_default_printer = uvm_default_table_printer
    uvm_top.enable_print_topology = 1

    # set configuration prior to creating the environment
    UVMConfigDb.set(None, "topenv.*.u1", "v", 30)
    UVMConfigDb.set(None, "topenv.inst2.u1", "v", 10)
    UVMConfigDb.set(None, "topenv.*", "debug", 1)
    UVMConfigDb.set(None, "*", "myaa[foo]", "hi")
    UVMConfigDb.set(None, "*", "myaa[bar]", "bye")
    UVMConfigDb.set(None, "*", "myaa[foobar]", "howdy")
    UVMConfigDb.set(None, "topenv.inst1.u1", "myaa[foo]", "boo")
    UVMConfigDb.set(None, "topenv.inst1.u1", "myaa[foobar]", "boobah")

    topenv = my_env("topenv", uvm_top)
    UVMConfigDb.set(topenv, "*.u1", "v", 30)
    UVMConfigDb.set(topenv, "inst2.u1", "v", 10)
    UVMConfigDb.set(topenv, "*", "debug", 1)
    UVMConfigDb.set(topenv, "*", "myaa[foo]", "hi")
    UVMConfigDb.set(topenv, "*", "myaa[bar]", "bye")
    UVMConfigDb.set(topenv, "*", "myaa[foobar]", "howdy")
    UVMConfigDb.set(topenv, "inst1.u1", "myaa[foo]", "boo")
    UVMConfigDb.set(topenv, "inst1.u1", "myaa[foobar]", "boobah")

    UVMConfigDb.set(uvm_top, "topenv", "should_match", 1234)

    yield run_test()