URL
https://opencores.org/ocsvn/lpffir/lpffir/trunk
Subversion Repositories lpffir
[/] [lpffir/] [trunk/] [uvm/] [tools/] [uvm_syoscb/] [docs/] [html/] [pIntegration.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: How to integrate the UVM scoreboard</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 class="current"><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><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> <div class="contents"> <h1><a class="anchor" id="pIntegration">How to integrate the UVM scoreboard </a></h1><p>The UVM scoreboard is easily integrated into your existing testbench environment.</p> <h2><a class="anchor" id="sCompile"> Compiling the UVM scoreboard</a></h2> <p>To get the UVM scoreboard compiled you need to add <b><a class="el" href="pk__syoscb_8sv_source.html">src/pk_syoscb.sv</a></b> to your list of files that are complied when compiling your testbench. How this is done is highly dependent on the verification environment since some environments compile everything into different libraries and some do not etc.</p> <h2><a class="anchor" id="sAcccess"> Accessing the UVM scoreboard from your own code</a></h2> <p>Once the UVM scoreboard is compiled with the verification environment then it is accessible either by explicit scoping:</p> <div class="fragment"><pre class="fragment"> <span class="keyword">class </span>myclass; pk_syoscb::cl_syoscb my_new_scb; ... </pre></div><p>or by importing the complete package into your scope:</p> <div class="fragment"><pre class="fragment"> <span class="keyword">import</span> pk_syoscb::*; <span class="keyword">class </span>myclass; <a class="code" href="classcl__syoscb.html" title="Top level class implementing the root of the SyoSil UVM scoreboard.">cl_syoscb</a> my_new_scb; ... </pre></div><h2><a class="anchor" id="sInstantiation"> Instantiating the UVM scoreboard</a></h2> <p>The UVM scoreboard itself needs to be instantiated along with the configuration object. The simplest way to to this is to add the UVM scoreboard and the configuration object to the UVM environment - note that the configuration object is passed to the scoreboard via the config_db:</p> <div class="fragment"><pre class="fragment"> <span class="keyword">import</span> pk_syoscb::*; <span class="keyword">class </span>cl_scbtest_env <span class="keyword">extends</span> uvm_env; <a class="code" href="classcl__syoscb.html" title="Top level class implementing the root of the SyoSil UVM scoreboard.">cl_syoscb</a> syoscb; <a class="code" href="classcl__syoscb__cfg.html" title="Configuration class for the SyoSil UVM scoreboard.">cl_syoscb_cfg</a> syoscb_cfg; `uvm_component_utils_begin(cl_scbtest_env) `uvm_field_object(syoscb, UVM_ALL_ON) `uvm_field_object(syoscb_cfg, UVM_ALL_ON) `uvm_component_utils_end ... endclass: cl_scbtest_env function void cl_scbtest_env::build_phase(uvm_phase phase); super.build_phase(phase); <span class="comment">// Create the scoreboard configuration object</span> this.syoscb_cfg = <a class="code" href="classcl__syoscb__cfg.html" title="Configuration class for the SyoSil UVM scoreboard.">cl_syoscb_cfg</a>::type_id::create("syoscb_cfg"); <span class="comment">// Pass the scoreboard configuration object to the config_db</span> uvm_config_db #(cl_syoscb_cfg)::set(this, "syoscb", "cfg", this.syoscb_cfg); <span class="comment">// Create the scoreboard</span> this.syoscb = <a class="code" href="classcl__syoscb.html" title="Top level class implementing the root of the SyoSil UVM scoreboard.">cl_syoscb</a>::type_id::create("syoscb", this); ... endfunction: build_phase </pre></div><h2><a class="anchor" id="sConfiguration"> Configuring the UVM scoreboard</a></h2> <p>The UVM scoreboard configuration object needs to be configured after it has been created. The following example shows how two queues Q1 and Q2 wit Q1 as the primary queue. Furthermore, one producer P1 is added to both queues:</p> <div class="fragment"><pre class="fragment"> function <span class="keywordtype">void</span> cl_scbtest_env::build_phase(uvm_phase phase); super.build_phase(phase); <span class="comment">// Create the scoreboard configuration object</span> this.syoscb_cfg = cl_syoscb_cfg::type_id::create(<span class="stringliteral">"syoscb_cfg"</span>); <span class="comment">// Configure the scoreboard</span> this.syoscb_cfg.set_queues({<span class="stringliteral">"Q1"</span>, <span class="stringliteral">"Q2"</span>}); <span class="keywordtype">void</span><span class="stringliteral">'(this.syoscb_cfg.set_primary_queue("Q1")); </span> <span class="stringliteral"> void'</span>(this.syoscb_cfg.set_producer(<span class="stringliteral">"P1"</span>, {<span class="stringliteral">"Q1"</span>, <span class="stringliteral">"Q2"</span>})); <span class="comment">// Pass the scoreboard configuration object to the config_db</span> uvm_config_db #(<a class="code" href="classcl__syoscb__cfg.html" title="Configuration class for the SyoSil UVM scoreboard.">cl_syoscb_cfg</a>)::<span class="keyword">set</span>(<span class="keyword">this</span>, <span class="stringliteral">"syoscb"</span>, <span class="stringliteral">"cfg"</span>, this.syoscb_cfg); <span class="comment">// Create the scoreboard</span> this.syoscb = cl_syoscb::type_id::create(<span class="stringliteral">"syoscb"</span>, <span class="keyword">this</span>); ... endfunction: build_phase </pre></div><h2><a class="anchor" id="sFunctionAPIHookUp"> Function based API hook up</a></h2> <p>The function based API is very easy to use once you have done the configuration and instantiation of the scoreboard as describe above.</p> <p>Whenever you need to add an UVM sequence item to a queue produced by a specified producer then you simply invoke the <a class="el" href="classcl__syoscb.html#a26c59c91c6fdd22f29a411cba2d5ed8f" title="Method for adding a uvm_sequence_item to a given queue for a given producer.">cl_syoscb::add_item()</a> method:</p> <div class="fragment"><pre class="fragment"> <span class="comment">// *NOTE*: Assumes syoscb is handle to an instance of the scoreboard and</span> <span class="comment">// item1 is a handle to a UVM sequence item</span> ... <span class="comment">// Insert UVM sequence item for queue: Q1, for producer: P1</span> syoscb.add_item(<span class="stringliteral">"Q1"</span>, <span class="stringliteral">"P1"</span>, item1); </pre></div><p>Invoking the <a class="el" href="classcl__syoscb.html#a26c59c91c6fdd22f29a411cba2d5ed8f" title="Method for adding a uvm_sequence_item to a given queue for a given producer.">cl_syoscb::add_item()</a> method will simply wrap the UVM sequence item in a <a class="el" href="classcl__syoscb__item.html" title="The UVM scoreboard item.">cl_syoscb_item</a> object, add it the correct queue and finally invoke the configured compare method.</p> <p>The UVM environment will typically contain a handle to the scoreboard as described above. This can then be utilized if UVM sequences needs to be added from a test case:</p> <div class="fragment"><pre class="fragment"> <span class="keyword">class </span>cl_scbtest_seq_item <span class="keyword">extends</span> uvm_sequence_item; <span class="comment">//-------------------------------------</span> <span class="comment">// Randomizable variables</span> <span class="comment">//-------------------------------------</span> rand int unsigned int_a; <span class="comment">//-------------------------------------</span> <span class="comment">// UVM Macros</span> <span class="comment">//-------------------------------------</span> `uvm_object_utils_begin(cl_scbtest_seq_item) `uvm_field_int(int_a, UVM_ALL_ON) `uvm_object_utils_end <span class="comment">//-------------------------------------</span> <span class="comment">// Constructor</span> <span class="comment">//-------------------------------------</span> function cl_scbtest_seq_item::new (string name = "cl_scbtest_seq_item"); super.new(name); endfunction endclass: cl_scbtest_seq_item class cl_scbtest_test extends uvm_test; <span class="comment">//-------------------------------------</span> <span class="comment">// Non randomizable variables</span> <span class="comment">//-------------------------------------</span> cl_scbtest_env scbtest_env; <span class="comment">//-------------------------------------</span> <span class="comment">// UVM Macros</span> <span class="comment">//-------------------------------------</span> `uvm_component_utils(cl_scbtest_test) <span class="comment">//-------------------------------------</span> <span class="comment">// Constructor</span> <span class="comment">//-------------------------------------</span> function new(string name = "cl_scbtest_test", uvm_component parent = null); super.new(name, parent); endfunction: new <span class="comment">//-------------------------------------</span> <span class="comment">// UVM Phase methods</span> <span class="comment">//-------------------------------------</span> function void build_phase(uvm_phase phase); super.build_phase(phase); scbtest_env = cl_scbtest_env::type_id::create("scbtest_env", this); endfunction: build_phase task run_phase(uvm_phase phase); super.run_phase(phase); begin cl_scbtest_seq_item item1; item1 = cl_scbtest_seq_item::type_id::create("item1"); item1.int_a = 'h3a; scbtest_env.syoscb.add_item("Q1", "P1", item1); end begin cl_scbtest_seq_item item1; item1 = cl_scbtest_seq_item::type_id::create("item1"); item1.int_a = 'h3a; scbtest_env.syoscb.add_item("Q2", "P1", item1); end endtask: run_phase endclass: cl_scbtest_test </pre></div><h2><a class="anchor" id="sTLMAPIHookUp"> TLM based API hook up</a></h2> <p>The TLM API is even easier to use than the function based API. The scoreboard provides generic UVM subscribers which can be connected to anything which has a UVM analysis port (e.g. a UVM monitor). Typically, the UVM agents inside the UVM environment contain one or more monitors with UVM analysis ports which should be connected to the scoreboard. The following example has two agents which each has a monitor. The monitors are connected to Q1 and Q2 in the scoreboard:</p> <div class="fragment"><pre class="fragment"> <span class="keyword">import</span> pk_syoscb::*; <span class="keyword">class </span>cl_scbtest_env <span class="keyword">extends</span> uvm_env; <a class="code" href="classcl__syoscb.html" title="Top level class implementing the root of the SyoSil UVM scoreboard.">cl_syoscb</a> syoscb; <a class="code" href="classcl__syoscb__cfg.html" title="Configuration class for the SyoSil UVM scoreboard.">cl_syoscb_cfg</a> syoscb_cfg; myagent agent1; myagent agent2; ... function void build_phase(uvm_phase phase); ... <span class="comment">// Configure and create the scoreboard</span> <span class="comment">// Create and configure the agents</span> ... endfunction: build_phase ... function void connect_phase(uvm_phase phase); super.connect_phase(phase); begin <a class="code" href="classcl__syoscb__subscriber.html" title="Generic subscriber for the scoreboard.">cl_syoscb_subscriber</a> subscriber; <span class="comment">// Get the subscriber for Producer: P1 for queue: Q1 and connect it</span> <span class="comment">// to the UVM monitor producing transactions for this queue</span> subscriber = this.syoscb.get_subscriber("Q1", "P1"); this.agent1.mon.<analysis port>.connect(subscriber.analysis_export); <span class="comment">// Get the subscriber for Producer: P1 for queue: Q2 and connect it</span> <span class="comment">// to the UVM monitor producing transactions for this queue</span> subscriber = this.syoscb.get_subscriber("Q2", "P1"); this.agent1.mon.<analysis port>.connect(subscriber.analysis_export); end endfunction: connect_phase </pre></div><h2><a class="anchor" id="sFactory"> Factory overwrites</a></h2> <p>Finally, the wanted queue and compare algorithm implementation needs to be selected. This is done by factory overwrites since they can be changed test etc.</p> <p><b>NOTE: This MUST be done before creating the scoreboard!</b></p> <p>The following queue implementations are available:</p> <ol type="1"> <li>Standard SV queue (<a class="el" href="classcl__syoscb__queue__std.html" title="Standard implementation of a queue.">cl_syoscb_queue_std</a>)</li> </ol> <p>and the following compare algorithms are available:</p> <ol type="1"> <li>Out-of-Order (cl_syoscb_compare_ooo)</li> <li>In-Order (<a class="el" href="classcl__syoscb__compare__io.html" title="Class which implements the in order compare algorithm.">cl_syoscb_compare_io</a>)</li> <li>In-Order by producer (cl_syoscb_compare_iop)</li> </ol> <p>The following example shows how they are configured:</p> <div class="fragment"><pre class="fragment"> cl_syoscb_queue::set_type_override_by_type(cl_syoscb_queue::get_type(), cl_syoscb_queue_std::get_type(), <span class="stringliteral">"*"</span>); factory.set_type_override_by_type(cl_syoscb_compare_base::get_type(), cl_syoscb_compare_ooo::get_type(), <span class="stringliteral">"*"</span>); </pre></div><p>The full build phase, including the factory overwrites, of cl_scbtest_env is shown here for completeness:</p> <div class="fragment"><pre class="fragment"> function <span class="keywordtype">void</span> cl_scbtest_env::build_phase(uvm_phase phase); super.build_phase(phase); <span class="comment">// Use the standard SV queue implementation as scoreboard queue</span> cl_syoscb_queue::set_type_override_by_type(cl_syoscb_queue::get_type(), cl_syoscb_queue_std::get_type(), <span class="stringliteral">"*"</span>); <span class="comment">// Set the compare strategy to be OOO</span> factory.set_type_override_by_type(cl_syoscb_compare_base::get_type(), cl_syoscb_compare_ooo::get_type(), <span class="stringliteral">"*"</span>); <span class="comment">// Create the scoreboard configuration object</span> this.syoscb_cfg = cl_syoscb_cfg::type_id::create(<span class="stringliteral">"syoscb_cfg"</span>); <span class="comment">// Configure the scoreboard</span> this.syoscb_cfg.set_queues({<span class="stringliteral">"Q1"</span>, <span class="stringliteral">"Q2"</span>}); <span class="keywordtype">void</span><span class="stringliteral">'(this.syoscb_cfg.set_primary_queue("Q1")); </span> <span class="stringliteral"> void'</span>(this.syoscb_cfg.set_producer(<span class="stringliteral">"P1"</span>, {<span class="stringliteral">"Q1"</span>, <span class="stringliteral">"Q2"</span>})); <span class="comment">// Pass the scoreboard configuration object to the config_db</span> uvm_config_db #(<a class="code" href="classcl__syoscb__cfg.html" title="Configuration class for the SyoSil UVM scoreboard.">cl_syoscb_cfg</a>)::<span class="keyword">set</span>(<span class="keyword">this</span>, <span class="stringliteral">"syoscb"</span>, <span class="stringliteral">"cfg"</span>, this.syoscb_cfg); <span class="comment">// Create the scoreboard</span> this.syoscb = cl_syoscb::type_id::create(<span class="stringliteral">"syoscb"</span>, <span class="keyword">this</span>); ... endfunction: build_phase </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>