VMM OpenSource - sv/perf/vmm_perf_tenure.sv

sv/perf/vmm_perf_tenure.sv expanded source

00001 //
00002 // -------------------------------------------------------------
00003 //    Copyright 2004-2008 Synopsys, Inc.
00004 //    All Rights Reserved Worldwide
00005 // 
00006 //    Licensed under the Apache License, Version 2.0 (the
00007 //    "License"); you may not use this file except in
00008 //    compliance with the License.  You may obtain a copy of
00009 //    the License at
00010 // 
00011 //        http://www.apache.org/licenses/LICENSE-2.0
00012 // 
00013 //    Unless required by applicable law or agreed to in
00014 //    writing, software distributed under the License is
00015 //    distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
00016 //    CONDITIONS OF ANY KIND, either express or implied.  See
00017 //    the License for the specific language governing
00018 //    permissions and limitations under the License.
00019 // -------------------------------------------------------------
00020 //
00021 
00022 
00023 `ifndef VMM_PERF_TENURE__SV
00024 `define VMM_PERF_TENURE__SV
00025 
00026 `include "vmm.sv"
00027 
00028 class vmm_perf_tenure;
00029 
00030    local static int unsigned next_tenure_id = 0;
00031 
00032    local int unsigned tenure_id;
00033    local int unsigned initiator_id;
00034    local int unsigned target_id;
00035 
00036    local vmm_data tr;
00037 
00038    extern function new(int unsigned initiator_id = 0,
00039                        int unsigned target_id    = 0,
00040                        vmm_data     tr           = null);
00041 
00042    extern function int unsigned get_tenure_id();
00043    extern function int unsigned get_initiator_id();
00044    extern function int unsigned get_target_id();
00045    extern function vmm_data     get_tr();
00046 
00047    extern virtual function string psdisplay(string prefix = "");
00048 endclass: vmm_perf_tenure
00049 
00050 
00051 function vmm_perf_tenure::new(int unsigned initiator_id,
00052                               int unsigned target_id,
00053                               vmm_data     tr);
00054    this.tenure_id    = this.next_tenure_id++;
00055    this.initiator_id = initiator_id;
00056    this.target_id    = target_id;
00057    this.tr           = tr;
00058 endfunction: new
00059 
00060 
00061 function int unsigned vmm_perf_tenure::get_tenure_id();
00062    return this.tenure_id;
00063 endfunction: get_tenure_id
00064 
00065 function int unsigned vmm_perf_tenure::get_initiator_id();
00066    return this.initiator_id;
00067 endfunction: get_initiator_id
00068 
00069 
00070 function int unsigned vmm_perf_tenure::get_target_id();
00071    return this.target_id;
00072 endfunction: get_target_id
00073 
00074 
00075 function vmm_data vmm_perf_tenure::get_tr();
00076    return this.tr;
00077 endfunction: get_tr
00078 
00079 
00080 function string vmm_perf_tenure::psdisplay(string prefix);
00081    $sformat(psdisplay, "%sTenure #%0d, %0d->%0d", prefix,
00082             this.tenure_id, this.initiator_id, this.target_id);
00083    if (this.tr != null) begin
00084       $sformat(psdisplay, "%s\n%s", psdisplay, this.tr.psdisplay({prefix, "   "}));
00085    end
00086 endfunction: psdisplay
00087 
00088 
00089 `endif // VMM_PERF_TENURE__SV