cl_syoscb_subscriber.svh

00001 /// Generic subscriber for the scoreboard. It provides the write method
00002 /// for UVM monitors and utilizes the function based API of the scoreboard to insert
00003 /// the items received through the write method.
00004 class cl_syoscb_subscriber extends uvm_subscriber#(uvm_sequence_item);
00005   //-------------------------------------
00006   // Non randomizable variables
00007   //-------------------------------------
00008   local string queue_name;
00009   local string producer;
00010 
00011   //-------------------------------------
00012   // UVM Macros
00013   //-------------------------------------
00014   `uvm_component_utils_begin(cl_syoscb_subscriber)
00015     `uvm_field_string(queue_name, UVM_DEFAULT);
00016     `uvm_field_string(producer,   UVM_DEFAULT);
00017   `uvm_component_utils_end
00018 
00019   //-------------------------------------
00020   // Constructor
00021   //-------------------------------------
00022   extern function new(string name = "cl_syoscb_subscriber", uvm_component parent = null);
00023 
00024   //-------------------------------------
00025   // UVM overwrites/extensions
00026   //-------------------------------------
00027   extern function void write(uvm_sequence_item t);
00028 
00029   //-------------------------------------
00030   // Subscriber API
00031   //-------------------------------------
00032   extern function string get_queue_name();
00033   extern function void set_queue_name(string qn);
00034   extern function string get_producer();
00035   extern function void set_producer(string p);
00036 endclass: cl_syoscb_subscriber
00037 
00038 function cl_syoscb_subscriber::new(string name = "cl_syoscb_subscriber", uvm_component parent = null);
00039   super.new(name, parent);
00040 endfunction: new
00041 
00042 /// The write method which must be implemented when extending uvm_subscriber.
00043 function void cl_syoscb_subscriber::write(uvm_sequence_item t);
00044   cl_syoscb parent;
00045 
00046   // Get the parent which is the SCB top
00047   // This is needed for access to the function based API
00048   begin
00049     uvm_component tmp_parent;
00050 
00051     tmp_parent = this.get_parent();
00052 
00053     if(!$cast(parent, tmp_parent)) begin
00054       // *NOTE*: Here the parent cannot be cast. Thus, the print cannot contain the SCB name
00055       `uvm_fatal("IMPL_ERROR", "Unable to cast parent of subscriber");
00056     end
00057   end
00058 
00059   `uvm_info("DEBUG", $sformatf("Trigger add_item by subscriber: %s (Queue: %s, Producer: %s)", this.get_name(), this.queue_name, this.producer), UVM_FULL);
00060   
00061   // Add the item to the queue
00062   parent.add_item(this.queue_name, this.producer, t);
00063 endfunction
00064 
00065 /// <b>Subscriber API</b>: Returns the name of the queue which this subscriber is connected to.
00066 function string cl_syoscb_subscriber::get_queue_name();
00067   return(this.queue_name);
00068 endfunction: get_queue_name
00069 
00070 /// <b>Subscriber API</b>: Sets the name of the queue which this subscriber is connected to.
00071 function void cl_syoscb_subscriber::set_queue_name(string qn);
00072   this.queue_name = qn;
00073 endfunction: set_queue_name
00074 
00075 /// <b>Subscriber API</b>: Returns the name of the produer which this subscriber is connected to.
00076 function string cl_syoscb_subscriber::get_producer();
00077   return(this.producer);
00078 endfunction: get_producer
00079 
00080 /// <b>Subscriber API</b>: Sets the name of the producer which this subscriber is connected to.
00081 function void cl_syoscb_subscriber::set_producer(string p);
00082   this.producer = p;
00083 endfunction: set_producer
 All Classes Functions Variables

Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.2.5

Copyright 2014-2015 SyoSil ApS
All Rights Reserved Worldwide

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
doxygen
Doxygen Version: 1.6.1
IDV SV Filter Version: 2.6.2
Sat Nov 28 05:41:54 2015
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV