URL
https://opencores.org/ocsvn/lpffir/lpffir/trunk
Subversion Repositories lpffir
[/] [lpffir/] [trunk/] [uvm/] [tools/] [uvm_syoscb/] [docs/] [html/] [cl__syoscb__compare__ooo_8svh_source.html] - Rev 4
Compare with Previous | Blame | View Log
<!-- This comment will put IE 6, 7 and 8 in quirks mode --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>SyoSil ApS UVM Scoreboard: cl_syoscb_compare_ooo.svh Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javaScript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.6.1 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <script type="text/javascript"> <!-- function changeDisplayState (e){ var num=this.id.replace(/[^[0-9]/g,''); var button=this.firstChild; var sectionDiv=document.getElementById('dynsection'+num); if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ sectionDiv.style.display='block'; button.src='open.gif'; }else{ sectionDiv.style.display='none'; button.src='closed.gif'; } } function initDynSections(){ var divs=document.getElementsByTagName('div'); var sectionCounter=1; for(var i=0;i<divs.length-1;i++){ if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ var header=divs[i]; var section=divs[i+1]; var button=header.firstChild; if (button!='IMG'){ divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); button=document.createElement('img'); divs[i].insertBefore(button,divs[i].firstChild); } header.style.cursor='pointer'; header.onclick=changeDisplayState; header.id='dynheader'+sectionCounter; button.src='closed.gif'; section.id='dynsection'+sectionCounter; section.style.display='none'; section.style.marginLeft='14px'; sectionCounter++; } } } window.onload = initDynSections; --> </script> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <img id="MSearchSelect" src="search/search.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </div> </li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_562324e130495ce1321e3e3f14c8d761.html">src</a> </div> </div> <div class="contents"> <h1>cl_syoscb_compare_ooo.svh</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Class which implements the out of order compare algorithm</span> <a name="l00002"></a>00002 <span class="keyword">class </span>cl_syoscb_compare_ooo <span class="keyword">extends</span> <a class="code" href="classcl__syoscb__compare__base.html" title="Base class for all comapre algorithms.">cl_syoscb_compare_base</a>; <a name="l00003"></a>00003 <span class="comment">//-------------------------------------</span> <a name="l00004"></a>00004 <span class="comment">// UVM Macros</span> <a name="l00005"></a>00005 <span class="comment">//-------------------------------------</span> <a name="l00006"></a>00006 `uvm_object_utils(cl_syoscb_compare_ooo) <a name="l00007"></a>00007 <a name="l00008"></a>00008 <span class="comment">//-------------------------------------</span> <a name="l00009"></a>00009 <span class="comment">// Constructor</span> <a name="l00010"></a>00010 <span class="comment">//-------------------------------------</span> <a name="l00011"></a>00011 extern function new(string name = "cl_syoscb_compare_ooo"); <a name="l00012"></a>00012 <a name="l00013"></a>00013 <span class="comment">//-------------------------------------</span> <a name="l00014"></a>00014 <span class="comment">// Compare API</span> <a name="l00015"></a>00015 <span class="comment">//-------------------------------------</span> <a name="l00016"></a>00016 extern <span class="keyword">virtual</span> function void compare(); <a name="l00017"></a>00017 extern function void compare_do(); <a name="l00018"></a>00018 endclass: cl_syoscb_compare_ooo <a name="l00019"></a>00019 <a name="l00020"></a>00020 function cl_syoscb_compare_ooo::new(string name = "cl_syoscb_compare_ooo"); <a name="l00021"></a>00021 super.new(name); <a name="l00022"></a>00022 endfunction: new <a name="l00023"></a>00023 <span class="comment"></span> <a name="l00024"></a>00024 <span class="comment">/// <b>Compare API</b>: Mandatory overwriting of the base class' compare method.</span> <a name="l00025"></a>00025 <span class="comment">/// Currently, this just calls do_copy() blindly </span> <a name="l00026"></a>00026 <span class="comment"></span>function void cl_syoscb_compare_ooo::compare(); <a name="l00027"></a>00027 <span class="comment">// Here any state variables should be queried</span> <a name="l00028"></a>00028 <span class="comment">// to compute if the compare should be done or not</span> <a name="l00029"></a>00029 this.compare_do(); <a name="l00030"></a>00030 endfunction: compare <a name="l00031"></a>00031 <span class="comment"></span> <a name="l00032"></a>00032 <span class="comment">/// <b>Compare API</b>: Mandatory overwriting of the base class' do_compare method.</span> <a name="l00033"></a>00033 <span class="comment">/// Here the actual out of order compare is implemented.</span> <a name="l00034"></a>00034 <span class="comment">///</span> <a name="l00035"></a>00035 <span class="comment">/// The algorithm gets the primary queue and then loops over all other queues to see if</span> <a name="l00036"></a>00036 <span class="comment">/// it can find primary item as any item in all of the other queues. If so then the items</span> <a name="l00037"></a>00037 <span class="comment">/// are removed from all queues. If not then nothing is done. Thus, if some items are not</span> <a name="l00038"></a>00038 <span class="comment">/// matched then the result is that the queue will be non-empty at the end of simulation.</span> <a name="l00039"></a>00039 <span class="comment">/// This will then be caught by the check_phase.</span> <a name="l00040"></a>00040 <span class="comment"></span>function void cl_syoscb_compare_ooo::compare_do(); <a name="l00041"></a>00041 string primary_queue_name; <a name="l00042"></a>00042 <a class="code" href="classcl__syoscb__queue.html" title="Class which base concet of a queue.">cl_syoscb_queue</a> primary_queue; <a name="l00043"></a>00043 <a class="code" href="classcl__syoscb__queue__iterator__base.html" title="Queue iterator base class defining the iterator API used for iterating queues.">cl_syoscb_queue_iterator_base</a> primary_queue_iter; <a name="l00044"></a>00044 string queue_names[]; <a name="l00045"></a>00045 int unsigned secondary_item_found[string]; <a name="l00046"></a>00046 bit compare_continue = 1'b1; <a name="l00047"></a>00047 bit compare_result = 1'b0; <a name="l00048"></a>00048 <a class="code" href="classcl__syoscb__item.html" title="The UVM scoreboard item.">cl_syoscb_item</a> primary_item; <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="comment">// Initialize state variables</span> <a name="l00051"></a>00051 primary_queue_name = this.get_primary_queue_name(); <a name="l00052"></a>00052 this.cfg.get_queues(queue_names); <a name="l00053"></a>00053 <a name="l00054"></a>00054 primary_queue = this.cfg.get_queue(primary_queue_name); <a name="l00055"></a>00055 if(primary_queue == null) begin <a name="l00056"></a>00056 `uvm_fatal("QUEUE_ERROR", $sformatf("[%s]: cmp-ooo: Unable to retrieve primary queue handle", this.cfg.get_scb_name())); <a name="l00057"></a>00057 end <a name="l00058"></a>00058 <a name="l00059"></a>00059 primary_queue_iter = primary_queue.create_iterator(); <a name="l00060"></a>00060 <a name="l00061"></a>00061 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: primary queue: %s", this.cfg.get_scb_name(), primary_queue_name), UVM_FULL); <a name="l00062"></a>00062 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: number of queues: %0d", this.cfg.get_scb_name(), queue_names.size()), UVM_FULL); <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="comment">// Outer loop loops through all</span> <a name="l00065"></a>00065 while (!primary_queue_iter.is_done()) begin <a name="l00066"></a>00066 primary_item = primary_queue_iter.get_item(); <a name="l00067"></a>00067 <a name="l00068"></a>00068 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: Now comparing primary transaction:\n%s", this.cfg.get_scb_name(), primary_item.sprint()), UVM_FULL); <a name="l00069"></a>00069 <a name="l00070"></a>00070 <span class="comment">// Clear list of found slave items before starting new inner loop</span> <a name="l00071"></a>00071 secondary_item_found.delete(); <a name="l00072"></a>00072 <a name="l00073"></a>00073 <span class="comment">// Inner loop through all queues</span> <a name="l00074"></a>00074 foreach(queue_names[i]) begin <a name="l00075"></a>00075 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: Looking at queue: %s", this.cfg.get_scb_name(), queue_names[i]), UVM_FULL); <a name="l00076"></a>00076 <a name="l00077"></a>00077 if(queue_names[i] != primary_queue_name) begin <a name="l00078"></a>00078 <a class="code" href="classcl__syoscb__queue.html" title="Class which base concet of a queue.">cl_syoscb_queue</a> secondary_queue; <a name="l00079"></a>00079 <a class="code" href="classcl__syoscb__queue__iterator__base.html" title="Queue iterator base class defining the iterator API used for iterating queues.">cl_syoscb_queue_iterator_base</a> secondary_queue_iter; <a name="l00080"></a>00080 <a name="l00081"></a>00081 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: %s is a secondary queue - now comparing", this.cfg.get_scb_name(), queue_names[i]), UVM_FULL); <a name="l00082"></a>00082 <a name="l00083"></a>00083 <span class="comment">// Get the secondary queue</span> <a name="l00084"></a>00084 secondary_queue = this.cfg.get_queue(queue_names[i]); <a name="l00085"></a>00085 <a name="l00086"></a>00086 if(secondary_queue == null) begin <a name="l00087"></a>00087 `uvm_fatal("QUEUE_ERROR", $sformatf("[%s]: cmp-ooo: Unable to retrieve secondary queue handle", this.cfg.get_scb_name())); <a name="l00088"></a>00088 end <a name="l00089"></a>00089 <a name="l00090"></a>00090 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: %0d items in queue: %s", this.cfg.get_scb_name(), secondary_queue.get_size(), queue_names[i]), UVM_FULL); <a name="l00091"></a>00091 <a name="l00092"></a>00092 <span class="comment">// Only trigger the compare if there are elements in the queue</span> <a name="l00093"></a>00093 if(secondary_queue.get_size()>0) begin <a name="l00094"></a>00094 <span class="comment">// Get an iterator for the secondary queue</span> <a name="l00095"></a>00095 secondary_queue_iter = secondary_queue.create_iterator(); <a name="l00096"></a>00096 <a name="l00097"></a>00097 <span class="comment">// Only the first match is removed</span> <a name="l00098"></a>00098 while(!secondary_queue_iter.is_done()) begin <a name="l00099"></a>00099 <span class="comment">// Get the item from the secondary queue</span> <a name="l00100"></a>00100 <a class="code" href="classcl__syoscb__item.html" title="The UVM scoreboard item.">cl_syoscb_item</a> sih = secondary_queue_iter.get_item(); <a name="l00101"></a>00101 <a name="l00102"></a>00102 if(sih.compare(primary_item) == 1'b1) begin <a name="l00103"></a>00103 secondary_item_found[queue_names[i]] = secondary_queue_iter.get_idx(); <a name="l00104"></a>00104 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: Secondary item found at index: %0d:\n%s", this.cfg.get_scb_name(), secondary_queue_iter.get_idx(), sih.sprint()), UVM_FULL); <a name="l00105"></a>00105 break; <a name="l00106"></a>00106 end <a name="l00107"></a>00107 if(!secondary_queue_iter.next()) begin <a name="l00108"></a>00108 `uvm_fatal("QUEUE_ERROR", $sformatf("[%s]: cmp-ooo: Unable to get next element from iterator on secondary queue: %s", this.cfg.get_scb_name(), queue_names[i])); <a name="l00109"></a>00109 end <a name="l00110"></a>00110 end <a name="l00111"></a>00111 <a name="l00112"></a>00112 if(!secondary_queue.delete_iterator(secondary_queue_iter)) begin <a name="l00113"></a>00113 `uvm_fatal("QUEUE_ERROR", $sformatf("[%s]: cmp-ooo: Unable to delete iterator from secondaery queue: %s", this.cfg.get_scb_name(), queue_names[i])); <a name="l00114"></a>00114 end <a name="l00115"></a>00115 end else begin <a name="l00116"></a>00116 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: %s is empty - skipping", this.cfg.get_scb_name(), queue_names[i]), UVM_FULL); <a name="l00117"></a>00117 end <a name="l00118"></a>00118 <a name="l00119"></a>00119 end else begin <a name="l00120"></a>00120 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: %s is the primary queue - skipping", this.cfg.get_scb_name(), queue_names[i]), UVM_FULL); <a name="l00121"></a>00121 end <a name="l00122"></a>00122 end <a name="l00123"></a>00123 <a name="l00124"></a>00124 <span class="comment">// Only start to remove items if all slave items are found (One from each slave queue)</span> <a name="l00125"></a>00125 if(secondary_item_found.size() == queue_names.size()-1) begin <a name="l00126"></a>00126 string queue_name; <a name="l00127"></a>00127 <a class="code" href="classcl__syoscb__item.html" title="The UVM scoreboard item.">cl_syoscb_item</a> pih; <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="comment">// Get the item from the primary queue</span> <a name="l00130"></a>00130 pih = primary_queue_iter.get_item(); <a name="l00131"></a>00131 <a name="l00132"></a>00132 `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: Found match for primary queue item :\n%s", this.cfg.get_scb_name(), pih.sprint()), UVM_FULL); <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="comment">// Remove from primary</span> <a name="l00135"></a>00135 if(!primary_queue.delete_item(primary_queue_iter.get_idx())) begin <a name="l00136"></a>00136 `uvm_error("QUEUE_ERROR", $sformatf("[%s]: cmp-ooo: Unable to delete item idx %0d from queue %s", <a name="l00137"></a>00137 this.cfg.get_scb_name(), primary_queue_iter.get_idx(), primary_queue.get_name())); <a name="l00138"></a>00138 end <a name="l00139"></a>00139 <a name="l00140"></a>00140 <span class="comment">// Remove from all secondaries</span> <a name="l00141"></a>00141 while(secondary_item_found.next(queue_name)) begin <a name="l00142"></a>00142 <a class="code" href="classcl__syoscb__queue.html" title="Class which base concet of a queue.">cl_syoscb_queue</a> secondary_queue; <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="comment">// Get the secondary queue</span> <a name="l00145"></a>00145 secondary_queue = this.cfg.get_queue(queue_name); <a name="l00146"></a>00146 <a name="l00147"></a>00147 if(secondary_queue == null) begin <a name="l00148"></a>00148 `uvm_fatal("QUEUE_ERROR", $sformatf("[%s]: cmp-ooo: Unable to retrieve secondary queue handle", this.cfg.get_scb_name())); <a name="l00149"></a>00149 end <a name="l00150"></a>00150 <a name="l00151"></a>00151 if(!secondary_queue.delete_item(secondary_item_found[queue_name])) begin <a name="l00152"></a>00152 `uvm_error("QUEUE_ERROR", $sformatf("[%s]: cmp-ooo: Unable to delete item idx %0d from queue %s", <a name="l00153"></a>00153 this.cfg.get_scb_name(), secondary_item_found[queue_name], secondary_queue.get_name())); <a name="l00154"></a>00154 end <a name="l00155"></a>00155 end <a name="l00156"></a>00156 end <a name="l00157"></a>00157 <a name="l00158"></a>00158 <span class="comment">// Call .next() blindly since we do not care about the</span> <a name="l00159"></a>00159 <span class="comment">// return value, since we might be at the end of the queue.</span> <a name="l00160"></a>00160 <span class="comment">// Thus, .next() will return 1'b0 at the end of the queue</span> <a name="l00161"></a>00161 void'(primary_queue_iter.next()); <a name="l00162"></a>00162 end <a name="l00163"></a>00163 <a name="l00164"></a>00164 if(!primary_queue.delete_iterator(primary_queue_iter)) begin <a name="l00165"></a>00165 `uvm_fatal("QUEUE_ERROR", $sformatf("[%s]: cmp-ooo: Unable to delete iterator from primary queue: %s", this.cfg.get_scb_name(), primary_queue_name)); <a name="l00166"></a>00166 end <a name="l00167"></a>00167 endfunction: compare_do </pre></div></div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <!--*************************************************************************--> <!-- $Id: idv_dox_footer.html 136 2010-05-31 19:13:27Z seanoboyle $ --> <!--*************************************************************************--> <!-- This program is free software: you can redistribute it and/or modify --> <!-- it under the terms of the GNU General Public License as published by --> <!-- the Free Software Foundation, either version 3 of the License, or --> <!-- (at your option) any later version. --> <!-- --> <!-- This program is distributed in the hope that it will be useful, --> <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of --> <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --> <!-- GNU General Public License for more details. --> <!-- --> <!-- You should have received a copy of the GNU General Public License --> <!-- along with this program. If not, see http://www.gnu.org/licenses/. --> <!-- --> <!--*************************************************************************--> <!-- Title: IDV Doxygen Footer File --> <!-- Description: This file is a doxygen footer with the IDV logo and a --> <!-- and a reference to the GNU FDL License. --> <!-- --> <!-- Original Author: Sean O'Boyle --> <!-- Contact: seanoboyle@intelligentdv.com --> <!-- Company: Intelligent Design Verification --> <!-- Company URL: http://intelligentdv.com --> <!-- --> <!-- Download the most recent version here: --> <!-- http://intelligentdv.com/downloads --> <!-- --> <!-- File Bugs Here: http://bugs.intelligentdv.com --> <!-- Project: DoxygenFilterSV --> <!-- --> <!-- File: idv_dox_header.xml --> <!-- $LastChangedBy: seanoboyle $ --> <!-- $LastChangedDate: 2010-05-31 12:13:27 -0700 (Mon, 31 May 2010) $ --> <!-- $LastChangedRevision: 136 $ --> <!-- --> <!--*************************************************************************--> <br> <table border="1" width = "100%"> <tr> <td width = "20%"> <img src="syosil.jpg"> </td> <td width = "60%"> <address style="text-align: center;"> Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.2.5<br> <br> Copyright 2014-2015 SyoSil ApS<br> All Rights Reserved Worldwide<br> <br> 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<br> <br> <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><br> <br> 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. </address> </td> <td width = "20%"> <address style="text-align: right;"><small> <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a><br> <a href="http://www.doxygen.org/index.html">Doxygen</a> Version: 1.6.1<br> <a href="http://www.intelligentdv.com/index.html">IDV SV Filter</a> Version: 2.6.2<br> Sat Nov 28 05:41:54 2015</small></address> </td> </tr> </table> <address style="text-align: left;"><small> Find a documentation bug? Report bugs to: <a href="http://bugs.intelligentdv.com/">bugs.intelligentdv.com</a> Project: DoxygenFilterSV </small></address> </body> </html>