OpenCores
URL https://opencores.org/ocsvn/lpffir/lpffir/trunk

Subversion Repositories lpffir

[/] [lpffir/] [trunk/] [uvm/] [tools/] [uvm_syoscb/] [src/] [cl_syoscb_subscriber.svh] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 vladimirar
//----------------------------------------------------------------------
2
//   Copyright 2014-2015 SyoSil ApS
3
//   All Rights Reserved Worldwide
4
//
5
//   Licensed under the Apache License, Version 2.0 (the
6
//   "License"); you may not use this file except in
7
//   compliance with the License.  You may obtain a copy of
8
//   the License at
9
//
10
//       http://www.apache.org/licenses/LICENSE-2.0
11
//
12
//   Unless required by applicable law or agreed to in
13
//   writing, software distributed under the License is
14
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
15
//   CONDITIONS OF ANY KIND, either express or implied.  See
16
//   the License for the specific language governing
17
//   permissions and limitations under the License.
18
//----------------------------------------------------------------------
19
/// Generic subscriber for the scoreboard. It provides the write method
20
/// for UVM monitors and utilizes the function based API of the scoreboard to insert
21
/// the items received through the write method.
22
class cl_syoscb_subscriber extends uvm_subscriber#(uvm_sequence_item);
23
  //-------------------------------------
24
  // Non randomizable variables
25
  //-------------------------------------
26
  local string queue_name;
27
  local string producer;
28
 
29
  //-------------------------------------
30
  // UVM Macros
31
  //-------------------------------------
32
  `uvm_component_utils_begin(cl_syoscb_subscriber)
33
    `uvm_field_string(queue_name, UVM_DEFAULT);
34
    `uvm_field_string(producer,   UVM_DEFAULT);
35
  `uvm_component_utils_end
36
 
37
  //-------------------------------------
38
  // Constructor
39
  //-------------------------------------
40
  extern function new(string name = "cl_syoscb_subscriber", uvm_component parent = null);
41
 
42
  //-------------------------------------
43
  // UVM overwrites/extensions
44
  //-------------------------------------
45
  extern function void write(uvm_sequence_item t);
46
 
47
  //-------------------------------------
48
  // Subscriber API
49
  //-------------------------------------
50
  extern function string get_queue_name();
51
  extern function void set_queue_name(string qn);
52
  extern function string get_producer();
53
  extern function void set_producer(string p);
54
endclass: cl_syoscb_subscriber
55
 
56
function cl_syoscb_subscriber::new(string name = "cl_syoscb_subscriber", uvm_component parent = null);
57
  super.new(name, parent);
58
endfunction: new
59
 
60
/// The write method which must be implemented when extending uvm_subscriber.
61
function void cl_syoscb_subscriber::write(uvm_sequence_item t);
62
  cl_syoscb parent;
63
 
64
  // Get the parent which is the SCB top
65
  // This is needed for access to the function based API
66
  begin
67
    uvm_component tmp_parent;
68
 
69
    tmp_parent = this.get_parent();
70
 
71
    if(!$cast(parent, tmp_parent)) begin
72
      // *NOTE*: Here the parent cannot be cast. Thus, the print cannot contain the SCB name
73
      `uvm_fatal("IMPL_ERROR", "Unable to cast parent of subscriber");
74
    end
75
  end
76
 
77
  `uvm_info("DEBUG", $sformatf("Trigger add_item by subscriber: %s (Queue: %s, Producer: %s)", this.get_name(), this.queue_name, this.producer), UVM_FULL);
78
 
79
  // Add the item to the queue
80
  parent.add_item(this.queue_name, this.producer, t);
81
endfunction
82
 
83
/// Subscriber API: Returns the name of the queue which this subscriber is connected to.
84
function string cl_syoscb_subscriber::get_queue_name();
85
  return(this.queue_name);
86
endfunction: get_queue_name
87
 
88
/// Subscriber API: Sets the name of the queue which this subscriber is connected to.
89
function void cl_syoscb_subscriber::set_queue_name(string qn);
90
  this.queue_name = qn;
91
endfunction: set_queue_name
92
 
93
/// Subscriber API: Returns the name of the produer which this subscriber is connected to.
94
function string cl_syoscb_subscriber::get_producer();
95
  return(this.producer);
96
endfunction: get_producer
97
 
98
/// Subscriber API: Sets the name of the producer which this subscriber is connected to.
99
function void cl_syoscb_subscriber::set_producer(string p);
100
  this.producer = p;
101
endfunction: set_producer

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.