Exemplo n.º 1
0
 def build_phase(self, phase):
     val_arr = []
     if UVMConfigDb.get(self, "", "data", val_arr):
         self.data = val_arr[0]
     val_arr = []
     if UVMConfigDb.get(self, "", "str", val_arr):
         self.str = val_arr[0]
Exemplo n.º 2
0
    def test_hier_set_get(self):
        UVMConfigDbOptions.tracing = True
        UVMConfigDb.set(None, str1, "master_id", 666, T=None)

        arr = []
        ok = UVMConfigDb.get(None, str1, "master_id", arr)
        self.assertEqual(ok, True)
        self.assertEqual(arr[0], 666)
Exemplo n.º 3
0
 def __init__(self, name, parent):
     UVMComponent.__init__(self, name, parent)
     self.l1 = lower("l1", self)
     self.l2 = lower("l2", self)
     UVMConfigDb.set(self, "l1", "str", "hi")
     UVMConfigDb.set(self, "*", "data", 0x100)
     self.l1.data = 0x30
     self.l2.data = 0x40
     self.a = [None] * 5
     for i in range(5):
         self.a[i] = i * i
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
def test_module_top(dut):

    mu = myunit("mu", None)
    bar = mydata()

    uvm_top.finish_on_completion = 0
    UVMConfigDb.set(None, "mu.*", "data", 101)
    UVMConfigDb.set(None, "mu.*", "str", "hi")
    UVMConfigDb.set(None, "mu.l1", "data", 55)
    UVMConfigDb.set(None, "mu.*", "obj", bar)
    mu.print()
    yield run_test()
    mu.print()
Exemplo n.º 6
0
    def build_phase(self, phase):
        super().build_phase(phase)
        arr = []
        if UVMConfigDb.get(self, "apb", "vif", arr) is False:
            uvm_fatal("APB/SYS_ENV/NO_VIF", "Could not get vif from config_db")
        self.vif = arr[0]

        self.blk0 = blk_env.type_id.create("blk0", self)
        self.blk1 = blk_env.type_id.create("blk1", self)
        UVMConfigDb.set(self.blk0, "apb", "vif", arr[0])
        UVMConfigDb.set(self.blk1, "apb", "vif", arr[0])

        if self.model is None:
            self.model = reg_sys_S.type_id.create("reg_sys_S", None,
                                                  self.get_full_name())
            self.model.build()
            self.model.lock_model()

        self.blk0.model = self.model.B[0]
        self.blk1.model = self.model.B[1]
        #
        self.apb = apb_agent.type_id.create("apb", self)
Exemplo n.º 7
0
    def __init__(self, name, parent):
        UVMComponent.__init__(self, name, parent)
        UVMConfigDbOptions.turn_on_tracing()

        self.corr_data1 = 55
        self.corr_data2 = 101
        UVMConfigDb.set(self, "l1", "str", "hi")
        UVMConfigDb.set(self, "*", "data", 0x100)
        UVMConfigDb.set(self, "l1", "data", self.corr_data1)
        UVMConfigDb.set(self, "l2", "data", self.corr_data2)

        self.l1 = lower("l1", self)
        self.l2 = lower("l2", self)
        self.l1.data = 0x30
        self.l2.data = 0x40
        self.a = [None] * 5
        for i in range(5):
            self.a[i] = i*i
Exemplo n.º 8
0
    def test_set_get(self):
        cntxt = None
        inst_name = "my_comp"
        field_name = "field1"
        value = 123
        UVMConfigDb.set(cntxt, "other_name", field_name, 666, T=None)
        UVMConfigDb.set(cntxt, inst_name, field_name, value, T=None)
        UVMConfigDb.set(cntxt, inst_name + ".*", field_name, 555, T=None)
        got_val = []
        ok = UVMConfigDb.get(cntxt, inst_name, field_name, got_val, T=None)
        self.assertEqual(ok, True)
        self.assertEqual(got_val[0], value)
        got_val = []
        ok = UVMConfigDb.get(cntxt, inst_name, "wrong_name", got_val, T=None)
        self.assertEqual(ok, False)
        self.assertEqual(len(got_val), 0)

        hier_name = inst_name + "." + "child"
        got_val = []
        ok = UVMConfigDb.get(cntxt, hier_name, field_name, got_val, T=None)
        self.assertEqual(ok, True)
        self.assertEqual(got_val[0], 555)
Exemplo n.º 9
0
def test_module_top(dut):
    mu = myunit("mu", None)
    bar = mydata()
    cs_ = UVMCoreService.get()
    factory = cs_.get_factory()

    UVMConfigDb.set(None, "mu.*", "data", 101)
    UVMConfigDb.set(None, "mu.*", "str", "hi")
    UVMConfigDb.set(None, "mu.l1", "data", 55)
    UVMConfigDb.set(None, "mu.*", "obj", bar)
    mu.print_config_settings("", None, 1)
    uvm_default_printer = uvm_default_tree_printer
    mu.print()
    factory.print(1)
    mu.print()

    # Fork 2 initial tasks
    task1 = cocotb.fork(initial1())
    task2 = cocotb.fork(initial2(mu))
    yield [task1.join(), task2.join()]
Exemplo n.º 10
0
async def test_module_top(dut):
    mu = myunit("mu", None)
    bar = mydata()
    cs_ = UVMCoreService.get()
    factory = cs_.get_factory()

    UVMConfigDb.set(None, "mu.*", "data", 101)
    UVMConfigDb.set(None, "mu.*", "str", "hi")
    UVMConfigDb.set(None, "mu.l1", "data", 55)
    UVMConfigDb.set(None, "mu.*", "obj", bar)
    mu.print_config_settings("", None, 1)
    uvm_default_printer = uvm_default_tree_printer
    mu.print_obj()
    factory.print_factory(1)
    mu.print_obj()

    # tpoikela: Clock required by ghdl, otherwise scheduler throws error
    cocotb.fork(Clock(dut.clk, 10, "NS").start())

    # Fork 2 initial tasks
    task1 = cocotb.fork(initial1())
    task2 = cocotb.fork(initial2(mu))
    await sv.fork_join([task1, task2])
Exemplo n.º 11
0
 def configure_phase(self, phase):
     t = []
     if (UVMConfigDb.get(self, "configure", "timeout", t) and t[0] > 0):
         yield Timer(t[0], "NS")
         uvm_fatal("TIMEOUT", "Time-out expired in configure phase")
Exemplo n.º 12
0
 async def post_shutdown_phase(self, phase):
     t = []
     if (UVMConfigDb.get(self, "post_shutdown", "timeout", t) and t[0] > 0):
         await Timer(t[0], "NS")
         uvm_fatal("TIMEOUT", "Time-out expired in post_shutdown phase")
Exemplo n.º 13
0
 async def reset_phase(self, phase):
     t = []
     if (UVMConfigDb.get(self, "reset", "timeout", t) and t[0] > 0):
         await Timer(t[0], "NS")
         uvm_fatal("TIMEOUT", "Time-out expired in reset phase")
Exemplo n.º 14
0
 async def pre_configure_phase(self, phase):
     t = []
     if (UVMConfigDb.get(self, "pre_configure", "timeout", t) and t[0] > 0):
         await Timer(t[0], "NS")
         uvm_fatal("TIMEOUT", "Time-out expired in pre_configure phase")
Exemplo n.º 15
0
 def build_phase(self, phase):
     UVMConfigDb.set(None, "global_timer.*", "timeout", 1000)
     UVMConfigDb.set(None, "global_timer.main", "timeout", 3000)
     UVMConfigDb.set(None, "global_timer.run", "timeout", 0)
Exemplo n.º 16
0
 def shutdown_phase(self, phase):
     t = []
     if (UVMConfigDb.get(self, "shutdown", "timeout", t) and t[0] > 0):
         yield Timer(t[0], "NS")
         uvm_fatal("TIMEOUT", "Time-out expired in shutdown phase")
Exemplo n.º 17
0
 def post_reset_phase(self, phase):
     t = []
     if (UVMConfigDb.get(self, "post_reset", "timeout", t) and t[0] > 0):
         yield Timer(t[0], "NS")
         uvm_fatal("TIMEOUT", "Time-out expired in post_reset phase")