Пример #1
0
 def __init__(self, name, parent=None, T=packet):
     UVMComponent.__init__(self, name, parent)
     self.out = UVMBlockingPutPort("out", self)
     self.num_packets = 10
     nn = []
     self.T = T
     self.add_objection = True
     self.proto = self.T("my_packet")
     if UVMConfigDb.get(self, "", "num_packets", nn):
         self.num_packets = nn[0]
Пример #2
0
    def __init__(self, name, parent=None):
        UVMComponent.__init__(self, name, parent)
        UVMPhase.m_phase_trace = True
        self.p1 = producer("producer1", self)
        self.p2 = producer("producer2", self)
        self.f = UVMTLMFIFO("fifo", self)
        self.c = consumer("consumer", self)

        # Create connections between components
        self.p1.out.connect(self.c.input)
        self.p2.out.connect(self.f.blocking_put_export)
        self.c.out.connect(self.f.get_export)
        self.error = False
Пример #3
0
 def test_name(self):
     from uvm.base.uvm_root import UVMRoot
     uvm_top = UVMRoot.get()
     comp = UVMComponent("my_component", uvm_top)
     self.assertEqual(comp.get_full_name(), "my_component")
     comp_child = UVMComponent("my_child", comp)
     self.assertEqual(comp_child.get_full_name(), "my_component.my_child")
Пример #4
0
    def test_lookup(self):
        comp = UVMComponent("parent1", None)
        child = UVMComponent("child", comp)
        sub_child = UVMComponent("sub_child", child)

        c1 = comp.lookup('child')
        sc = comp.lookup('child.sub_child')
        self.assertEqual(c1, child)
        self.assertEqual(sub_child, sc)
Пример #5
0
 def __init__(self, name, parent=None):
     UVMComponent.__init__(self, name, parent)
     self.input = UVMBlockingPutImp("in",self)
     self.out = UVMGetPort("out",self,0)
     self.count = 0
     self.lock = semaphore(1)
Пример #6
0
 def test_errors(self):
     comp = UVMComponent("parent12345", None)
     child = comp.get_first_child()
     self.assertIsNone(child)
     child = comp.get_next_child()
     self.assertIsNone(child)
Пример #7
0
 def test_children(self):
     comp = UVMComponent("parent", None)
     child = UVMComponent("child", comp)
     self.assertEqual(child.get_parent(), comp)
     self.assertEqual(comp.get_first_child(), child)
     self.assertEqual(comp.get_num_children(), 1)
     self.assertEqual(comp.get_child("child"), child)
     self.assertEqual(comp.has_child("child"), True)
     self.assertEqual(comp.has_child("xchild"), False)
     children = []
     comp.get_children(children)
     self.assertEqual(children[0], child)