<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Verification Martial Arts &#187; Register Abstraction Model with RAL</title>
	<atom:link href="http://www.vmmcentral.org/vmartialarts/category/vmm/ral/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vmmcentral.org/vmartialarts</link>
	<description>A Blog on Verification Methodology</description>
	<lastBuildDate>Fri, 03 Feb 2012 03:34:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Closed Loop Register Verification using IDesignSpec and the Register Abstraction Layer</title>
		<link>http://www.vmmcentral.org/vmartialarts/2011/09/closed-loop-register-verification-using-idesignspec-with-and-the-register-abstraction-model/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/2011/09/closed-loop-register-verification-using-idesignspec-with-and-the-register-abstraction-model/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 04:23:02 +0000</pubDate>
		<dc:creator>Amit Sharma</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Coverage, Metrics]]></category>
		<category><![CDATA[Organization]]></category>
		<category><![CDATA[Register Abstraction Model with RAL]]></category>
		<category><![CDATA[Tools & 3rd Party interfaces]]></category>
		<category><![CDATA[Verification Planning & Management]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=2788</guid>
		<description><![CDATA[Nitin Ahuja, Agnisys Technology Pvt. Ltd In the previous article titled “Automatic generation of Register Model for VMM using IDesignSpecTM ” we discussed how it is advantageous to use a register model generator such as IDesignSpecTM, to automate the process of RALF model generation. Taking it forward, in this article we will discuss how to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Nitin Ahuja, <strong>Agnisys Technology Pvt. Ltd</strong></strong></p>
<p>In the previous article titled “<a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvMjAxMS8wOC9hdXRvbWF0aWMtZ2VuZXJhdGlvbi1vZi1yZWdpc3Rlci1tb2RlbC1mb3Itdm1tLXVzaW5nLWlkZXNpZ25zcGVjLw==">Automatic generation of Register Model for VMM using IDesignSpecTM</a><sup> </sup>” we discussed how it is advantageous to use a register model generator such as IDesignSpec<sup>TM</sup>, to automate the process of RALF model generation. Taking it forward, in this article we will discuss how to close the loop on register verification.</p>
<p>Various forms of coverage are used to ensure that registers are functioning properly. There are three coverage models in VMM. They are:</p>
<p>1. <em><strong>reg_bits</strong></em> coverage: this model is used to make sure that all the bits in the register are covered. This model works by writing and reading both 1 and 0 on every register bit, hence the name. This is specified using “cover +b” in the RALF model.</p>
<p>2. <em><strong>field_vals</strong></em> coverage: field value coverage model is implemented at the register level and supports value coverage of all fields and cross coverage between fields and other cross coverage points within the same register. This is specified using “cover +f” in the RALF model. User can specify the cross coverage depending on the functionality.</p>
<p>3. <em><strong>Address map</strong></em>: this coverage model is implemented at block level and ensures that all registers and the memories in the block have been read from and written to. This is specified using “cover +a” in the RALF model.</p>
<p>We will discuss how coverage can be switched on/off and how the type of coverage can be controlled for each field directly from the register specification.</p>
<p>Once the RALF model is generated, the next step in verification is to generate the RTL and the SystemVerilog RAL model using ‘ralgen’. The generated RAL model along with the RTL can be compiled and simulated in the VMM environment to generate the coverage database. This database is used for the report generation and analysis.</p>
<p>Reports can be generated using IDesignSpec<sup>TM </sup>(IDS). IDS generated reports have advantages over other report in that it generates the reports in a much more concise way showing all the coverage at one glance.</p>
<h3>Turning Coverage ON or OFF</h3>
<p>IDesignSpec<sup>TM</sup> enables the users to turn ON/OFF all the three types of coverage from within the MS Word specification itself.</p>
<p>Coverage can be specified and controlled using the “coverage” property in IDesignSpec<sup>TM</sup> which has the following possible values:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvaW1hZ2UxMC5wbmc="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/image_thumb10.png" border="0" alt="image" width="606" height="188" /></a></p>
<p>The hierarchical “coverage” property enables users to control the coverage of the whole block or at the chip level.</p>
<p>Here is a sample of how coverage can be specified in IDesignSpec<sup>TM</sup>:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvaW1hZ2UxMS5wbmc="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/image_thumb11.png" border="0" alt="image" width="606" height="373" /></a></p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvaW1hZ2UxMi5wbmc="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/image_thumb12.png" border="0" alt="image" width="605" height="252" /></a></p>
<p>This would be the corresponding RALF file :</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvYWduaXN5c19yYWxmLnBuZw=="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/agnisys_ralf_thumb.png" border="0" alt="agnisys_ralf" width="605" height="380" /></a></p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvaW1hZ2UxMy5wbmc="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/image_thumb13.png" border="0" alt="image" width="504" height="358" /></a></p>
<p>The coverage bins for each CoverPoint along with the cross for the various CoverPoints can also be defined in the specification as shown below:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvaW1hZ2UxNC5wbmc="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/image_thumb14.png" border="0" alt="image" width="608" height="237" /></a></p>
<p>This would translate to the following RALF:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvaW1hZ2UxNS5wbmc="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/image_thumb15.png" border="0" alt="image" width="605" height="450" /></a></p>
<p>Now, the next step after RALF generation would be to generate the RAL Model from the IDS generated RALF.</p>
<h3>RAL MODEL AND RTL GENERATION FROM RALF:</h3>
<p>The IDS generated RALF can be used with the Synopsys ‘ralgen’ to generate the RAL  (VMM or UVM) model as well as the RTL.</p>
<p>RAL model can be generated by using the following command:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvaW1hZ2UxNi5wbmc="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/image_thumb16.png" border="0" alt="image" width="605" height="342" /></a></p>
<p>If you specify –uvm above in the fisrt ralgen invocation above, a UVM Register Model would be generated.</p>
<h3>COMPILATION AND REPORT GENERATION:</h3>
<p>Once the RTL and the RAL model are generated using the ‘ralgen’, the complete model can be compiled and simulated in the VMM environment using VCS.</p>
<p>To compile the model use the following command on the command line:</p>
<p>vcs -R +plusarg_save -sverilog -o &#8220;simv1&#8243; -ntb_opts rvm+dtm +incdir+&lt;directories to search `defines&gt; &lt;files to be compiled&gt; +define+RAL_COVERAGE<strong> </strong></p>
<p>The compilation and simulation generates the simulation database which is used for the generation of the coverage reports.</p>
<p>Coverage reports can be generated in various forms but the most concise form can be in the form of the graphics showing all the coverage at a glance. For this, a tcl script “ivs_simif.tcl” takes up the simulation database and generates the text based report on execution of the following command:</p>
<p>% ivs_simif.tcl -in simv.vdb –svg</p>
<p>For running the above command set the environment variable “IDS_SIM_DIR”, the text report are generated at this location. This will also tell IDS where to look for the simulation data file.</p>
<p>A detailed graphical view of the report can be generated from IDS with the help of this text report. To generate the graphical report in the form of “scalable vector graphics” (SVG) select the “SVG” output from the IDS config and regenerate.</p>
<p>Another way of generating the SVG could be by using the IDS-XML or the Doc/Docx specification of the model as the input to the IDS in batch mode to generate the graphical report of the simulation by using the following command:</p>
<p>% idsbatch &lt;IDS_generated_XML or doc/docx specification&gt; -out &#8220;svg&#8221; -dir output_directory</p>
<h3>Coverage Reports</h3>
<p>IDesignSpec generates two types of reports from the input database.</p>
<p>They are:</p>
<p>1. Field_vals report</p>
<p>2. Reg_bits report</p>
<p><strong><span style="text-decoration: underline">Field_vals report:</span></strong></p>
<p>Field_vals report gives the graphical view of the field_vals coverage and the address coverage of the various registers and their respective fields.</p>
<p>The amount of coverage for the field (CoverPoints) is depicted by the level of green color in the fields, while that for complete register (CoverGroup) is shown by the color of name of the register.</p>
<p>The address coverage for the individual register (CoverPoint) is shown by the color of the address of the register (green if addressed; black if not addressed), while that of the entire block (CoverGroup) is shown by the color of the name of the block.</p>
<p>The coloring scheme for all the CoverGroups i.e. register name in case of the field_vals coverage and block name in case of the address coverage is:</p>
<p>1. If the overall coverage is greater than or equal to 80% then the name appears in GREEN color</p>
<p>2. If the coverage is greater than 70% but less than 80% then it appears in YELLOW</p>
<p>3. For coverage less than 70% name appears in RED color</p>
<p>Figure1 shows the field_vals and address coverage.</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvaW1hZ2UxNy5wbmc="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/image_thumb17.png" border="0" alt="image" width="676" height="334" /></a></p>
<p><span style="color: #800080"><strong>Figure:  Closed loop register verification using RALF and IDS</strong></span></p>
<p><strong><span style="color: #800080"> </span></strong></p>
<p>The above sample gives the following coverage information:</p>
<p>a. 2 registers, T and resetvalue, are not addressed out of total of 9 registers. Thus the overall coverage of the block falls in the range &gt;70% &amp;&lt;80% which is depicted by the color of the Stopwatch (name of the block).</p>
<p>b. All the fields of the registers are filled with some amount of the green color which shows the amount of the coverage. As an example field T1 of register arr is covered 100% thus it is completely filled and FLD4 of register X is covered only about 10%. The exact value of coverage can be obtained by hovering over the field to get the tooltip showing the exact coverage value</p>
<p>c. Color of the name of the register, for example X is red, show the overall coverage of the whole register , which is less than 70% for X.</p>
<p><strong> </strong></p>
<p><strong><span style="text-decoration: underline">Reg_bits report:</span></strong></p>
<p>Reg_bits report gives the detailed graphical view of the reg_bits coverage and address coverage.</p>
<p>Address coverage for reg_bits is shown in the same way as for the address coverage in field_vals. Reg_bits coverage has 4 components, that is,</p>
<p>1. Written as 1</p>
<p>2. Read as 1</p>
<p>3. Written as 0</p>
<p>4. Read as 0</p>
<p>Each of the 4 components is allocated a specific region inside a bit. If that component of the coverage is hit then the corresponding region is shown as green else it is blank. The overall coverage of the entire register is shown by the color of the name of the register as in the case of the field_vals.</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDkvaW1hZ2UxOC5wbmc="><img style="border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/09/image_thumb18.png" border="0" alt="image" width="675" height="117" /></a></p>
<p>The above sample report shows that there is no issue in “Read as 1” for the ‘resetvalue’ register. While other types or read/write has not been hit completely.</p>
<p>Thus, in this article we described what the various coverage models for a register are and how to generate the RALF coverage model of the registers automatically with minimum effort. An intuitive visualization of the register coverage data will ease the effort involved in deciphering the coverage reports from simulation lengthy log files. This type of closed loop register verification ensures better coverage and high quality results in less time. Hope you found this useful.. Do share with me your feedback on the same and and also let me know if you want any additional details to get the maximum benefits from this flow..</p>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=2788" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/2011/09/closed-loop-register-verification-using-idesignspec-with-and-the-register-abstraction-model/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatic generation of Register Model for VMM using IDesignSpec</title>
		<link>http://www.vmmcentral.org/vmartialarts/2011/08/automatic-generation-of-register-model-for-vmm-using-idesignspec/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/2011/08/automatic-generation-of-register-model-for-vmm-using-idesignspec/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 09:41:29 +0000</pubDate>
		<dc:creator>Amit Sharma</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Organization]]></category>
		<category><![CDATA[Register Abstraction Model with RAL]]></category>
		<category><![CDATA[Tools & 3rd Party interfaces]]></category>
		<category><![CDATA[VMM infrastructure]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=2643</guid>
		<description><![CDATA[Nitin Ahuja, Verification Engineer, Agnisys Technology Pvt Ltd Generating a register model by hand could take up a lot of time in the design process and may result in serious bugs, which makes the code inefficient. On the other hand, generating the register model using the register model generator such as IDesignSpecTM reduces the coding [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Nitin Ahuja, Verification Engineer, Agnisys Technology Pvt Ltd</strong></p>
<p>Generating a register model by hand could take up a lot of time in the design process and may result in serious bugs, which makes the code inefficient. On the other hand, generating the register model using the register model generator such as IDesignSpec<sup>TM</sup> reduces the coding effort, as well as generates more competent codes by avoiding the bugs in the first place, thus making the process more efficient and reduces the time to market exponentially.</p>
<p>Register model generator can be proved efficient in the following ways:</p>
<p>1. Error free codes in the first place, i.e. being automatically generated, the register model code is free from all the human as well as logical errors.</p>
<p>2. In the case of change in the register model specification, it is easy to modify the spec and generate the codes again in no time.</p>
<p>3. Generating all kind of hardware, software, industry standard specifications as well as verification codes from a single source of specification.</p>
<p>IDesignSpec<sup>TM</sup> (IDS) is capable of generating all the RTL as well as the verification codes such as VMM(RALF) from the register specification defined in Word, Excel, Open-office or IDS-XML.</p>
<p><strong><span style="text-decoration: underline">Getting Started</span></strong><strong></strong></p>
<p>A simple register can be defined inside a block in IDesigSpec<sup>TM </sup>as:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvSURTMjEucG5n"><img class="alignnone size-full wp-image-2669" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/IDS21.png" alt="" width="593" height="292" /></a></p>
<p>The above specification is translated into the following RALF code by IDS.</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvaW1hZ2UzLnBuZw=="><img style="margin-left: 0px;margin-right: 0px;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/image_thumb3.png" border="0" alt="image" width="661" height="468" /></a></p>
<p>As a protocol, all the registers for which the hdl_path is mentioned in the RALF file, the ralgen generates the backdoor access. Thus special properties on the register such as hdl_path and coverage can be mentioned inside the IDS specification itself and will be appropriately translated into the RALF file.</p>
<p>The properties can be defined as below:</p>
<p>For Block:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvaW1hZ2U0LnBuZw=="><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/image_thumb4.png" border="0" alt="image" width="644" height="191" /></a></p>
<p>As for the block, hdl_path , coverage or even any other such property can be mentioned for other IDS elements, such as register or field.</p>
<p>For register/field:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAwMi5naWY="><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image002_thumb.gif" border="0" alt="clip_image002" width="610" height="262" /></a>OR</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAwNC5naWY="><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image004_thumb.gif" border="0" alt="clip_image004" width="618" height="296" /></a></p>
<p>Note: Coverage property can take up the following three possible values:</p>
<p>1. ON/on: This enables all the coverage types i.e for block or memory address coverage and for registers and field the REG_BITS and FIELD_VALS coverage is on.</p>
<p>2. OFF/off: By default all the coverage is off. This option holds valid only in case, when the coverage is turned ON from the top level of the hierarchy or from the parent and to turn off the coverage for some particular register, specify ‘coverage=off’ for that register or field. The coverage for that specific child will be invert of what its parent has.</p>
<p>3. abf: Any combination of these three characters can be used to turn ON the particular type of the coverage. These characters stand for:</p>
<p>· a : address coverage</p>
<p>· b : reg_bits</p>
<p>· f : field_vals</p>
<p>For example to turn on the reg_bits and field_vals coverage, it can be mentioned as:</p>
<p>“coverage=bf”.</p>
<p>In addition to these properties, there are few more properties that can be mentioned in a similar way as above. Some of them are:</p>
<p>1. bins: various bins for the coverpoints can be specified using this property.</p>
<p>Syntax: {bins=”bin_name = {bin} ; &lt;bin_name&gt;…”}</p>
<p>2. constraint : constraints can also be specified for the register or field or for any element.</p>
<p>Syntax : {constraint=”constraint_name {constraint};&lt;constraint_name&gt; …”}</p>
<p>3. [vmm]&lt;code&gt;[/vmm]: This tag gives the users the ability to specify their own piece of system-verilog code in any element.</p>
<p>4. cross: cross for the coverpoints of the registers can be specified using cross property in the syntax:</p>
<p>Syntax: {cross = “coverpoint_1 &lt;{label label_name}&gt;;&lt; coverpoint_2&gt;…”}</p>
<p><strong><span style="text-decoration: underline">Different types of registers in IDS :</span></strong></p>
<p><strong>1.Register Arrays:</strong></p>
<p><strong> </strong>Register arrays in RALF can be defined in IDS using the register groups. To define a register array of size ‘n’, it can be defined by placing a register inside a regroup with the repeat count equal to size of the array (n).</p>
<p>For example a register array of the name ”reg_array” with size equal to 10 can be defined in the IDS as follows:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAwNi5naWY="><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image006_thumb.gif" border="0" alt="clip_image006" width="610" height="242" /></a></p>
<p>The above specification will be translated into the following vmm code by the ids:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAwOC5naWY="><img style="margin-left: 0px;margin-right: 0px;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image008_thumb.gif" border="0" alt="clip_image008" width="446" height="164" /></a></p>
<p><strong> </strong></p>
<p><strong>2.Memory :</strong></p>
<p>Similar to the register array, Memories can also be defined in the IDS using the register groups. The only difference in the memory and register array definition is that in case of memory the external is equal to “true”. The size of the memory is calculated as, ((End_Address – Start_Address)*Repeat_Count)</p>
<p>As an example a memory of name “RAM” can be defined in IDS as follows:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAxMC5naWY="><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image010_thumb.gif" border="0" alt="clip_image010" width="632" height="248" /></a></p>
<p>The above memory specification will be translated into following VMM code:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAxMi5naWY="><img style="margin-left: 0px;margin-right: 0px;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image012_thumb.gif" border="0" alt="clip_image012" width="232" height="113" /></a></p>
<p><strong>3.Regfile</strong></p>
<p>Regfile in RALF can be specified in IDS using the register group containing multiple registers(&gt; 1).</p>
<p>One such regfile with 3 registers, repeated 16 times is shown below:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAxNC5naWY="><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image014_thumb.gif" border="0" alt="clip_image014" width="566" height="474" /></a></p>
<p>Following is the IDS generated VMM code for the above reg file:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAxNi5naWY="><img style="margin-left: 0px;margin-right: 0px;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image016_thumb.gif" border="0" alt="clip_image016" width="541" height="408" /></a><strong></strong></p>
<p><strong></strong></p>
<p><strong><span style="text-decoration: underline">RAL MODEL AND RTL GENERATION FROM RALF:</span></strong></p>
<p>The IDS generated RALF can be used with the Synopsys Ralgen to generate the RAL model as well as the RTL.</p>
<p>To generate the RAL model use the following command:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAxOC5naWY="><img style="margin-left: 0px;margin-right: 0px;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image018_thumb.gif" border="0" alt="clip_image018" width="621" height="153" /></a></p>
<p>And for the RTL generation use the following command:</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDgvY2xpcF9pbWFnZTAyMC5naWY="><img style="margin-left: 0px;margin-right: 0px;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/08/clip_image020_thumb.gif" border="0" alt="clip_image020" width="590" height="167" /></a><strong></strong></p>
<p><strong></strong></p>
<p><strong><span style="text-decoration: underline">SUMMARY:</span></strong></p>
<p>It is beneficial to generate the RALF using the register model generator “IDesignspec<sup>TM</sup>”, as it guarantees bug free code, making it more competent and also reduces the time and effort. In case of modifications in the register model specification, it enables the users to regenerate the code again in no time.</p>
<p><strong>Note:</strong></p>
<p>We will extend this automation further in the next article where we will cover details about how you can “close the loop” on register verification. The “Closed Loop Register Verification” article will be available on VMM Central soon. Meanwhile if you have any questions/comments you can reach me at nitin[at]agnisys[dot]com .</p>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=2643" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/2011/08/automatic-generation-of-register-model-for-vmm-using-idesignspec/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The One stop shop: get done with everything you need to do with your registers</title>
		<link>http://www.vmmcentral.org/vmartialarts/2011/07/the-one-stop-shop-get-done-with-everything-you-need-to-do-with-your-registers/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/2011/07/the-one-stop-shop-get-done-with-everything-you-need-to-do-with-your-registers/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 05:36:40 +0000</pubDate>
		<dc:creator>Amit Sharma</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Modeling]]></category>
		<category><![CDATA[Register Abstraction Model with RAL]]></category>
		<category><![CDATA[Tools & 3rd Party interfaces]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=2580</guid>
		<description><![CDATA[Ballori Bannerjee, Design Engineer, LSI India Processes are created, refined and improved upon and the change in productivity which starts with a big leap subsequently slows down and at the same time as the complexity of tasks increases, the existing processes can no longer scale up. This drives the next paradigm shift in moving towards [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size: small">Ballori Bannerjee, Design Engineer, LSI India</span></strong></p>
<p><strong><span style="font-size: small"> </span></strong></p>
<p>Processes are created, refined and improved upon and the change in productivity which starts with a big leap subsequently slows down and at the same time as the complexity of tasks increases, the existing processes can no longer scale up. This drives the next paradigm shift in moving towards new process and automation. As in the case of all realms of technology, this is true in the context of the Register development and validation flow as well.. So, let’s look at how we changed our process to get the desired boost in productivity that we wanted..</p>
<p>This following flowchart represents our legacy register design and validation process.. This was a closed process and served us well initially when the number of registers, their properties etc were limited.. However, with the complex chips that we are designing and validating today, does this scale up?</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDcvcmVnaXN0ZXJfdmVyaWYucG5n"><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/07/register_verif_thumb.png" border="0" alt="register_verif" width="413" height="343" /></a></p>
<p>As an example, in a module that we are implementing, there are four thousand registers. Translating into number of fields, for 4000 32-bit registers we have 128,000 fields, with different hardware and software properties!</p>
<p>Coding the RTL with address decoding for 4000 registers, with fields having different properties is a week’s effort by a designer. Developing a re-usable randomized verification environment with tests like reset value check, read-write is another 2 weeks, at the least. Closure on bugs requires several feedbacks from verification to update design or document. So overall, there is at least a month’s effort plus maintenance overhead anytime the address mapping is modified or a register updated/added.</p>
<p>This flow is susceptible to errors where there could be disconnect between document, design, verification and software.</p>
<p>So, what do we do? We redefine the process! And this is what I will be talking about, our automated register design and verification (DV) flow which streamlines this process.</p>
<p><strong>AUTOMATED REGISTER DESIGN AND VERIFICATION FLOW </strong></p>
<p><strong> </strong></p>
<p>The flow starts with the designer modeling the registers using a high level register description language. In our case , we use SystemRDL, and then leverage third party tools are available to generate the various downstream components from the RDL file:</p>
<p>· RTL in Verilog/VHDL</p>
<p>· C/C++ code for firmware</p>
<p>· Documentation ( different formats)</p>
<p>· High level verification environment code (HVL) in VMM</p>
<p>This is shown in below. The RDL file serves as a one-stop point for any register update required following a requirement change.</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDcvcmVnaXN0ZXIyLnBuZw=="><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/07/register2_thumb.png" border="0" alt="register2" width="467" height="247" /></a> </p>
<p><strong>Automated Register DV Flow</strong></p>
<p>Given, that its critical to create an efficient object oriented abstraction layer to model registers and memories in a design under test, we exploit VMM RAL for the same. How do we generate the VMM RAL Model? This is generated from RALF. Many 3<sup>rd</sup> party tools are available to generate RALF from various inputs formats and we use one of them to generate RALF from SystemRDL</p>
<p>Thus, a complete VMM compliant randomized, coverage driven register verification environment can be created by extending the flow such that:</p>
<p>i. Using 3<sup>rd</sup> party tool, from SystemRDL the verification component generated is RALF, Synopsys’ Register Abstraction Layer File.</p>
<p>ii. RALF is passed through RALGEN, a Synopsys utility which converts the RALF information to a complete VMM based register verification environment. This includes automatic generation of pre-defined tests like reset value check, bit bash tests etc of registers and complete functional coverage model, which would have taken considerable staff-days of effort to write.</p>
<p>The flowchart below elucidates the process.</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDcvcmVnaXN0ZXIzLnBuZw=="><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/07/register3_thumb.png" border="0" alt="register3" width="251" height="439" /></a></p>
<p>Adopting the automated flow, it took 2 days to write the RDL. The rest of components were generated from this source. A small amount of manual effort may be required for items like back-door path definition, but it is minimal and a one-time effort. The overall benefits are much more than the number of staff days saved and we see this as something which gives us perpetual returns.. I am sure, a lot of you would already be bringing in some amount of automation in your register design and verification setup, and if you aren’t, its time you do it J</p>
<p>While, we are talking about abstraction and automation, lets look at another aspect in register verification.</p>
<p><strong>Multiple Interfaces/Views for a register</strong></p>
<p>It is possible to have registers in today’s complex SOC designs which need to be connected to two or more different buses and accessed differently. The register address will be different for the different physical interfaces it is shared between. So, how do we model this..</p>
<p>This can be defined in SystemRDL by using a parent <em>addressmap</em> with <em>bridge</em> property, which contains sub addressmaps representing the different views.</p>
<p>For example:</p>
<p><em>addrmap dma_blk_bridge {</em><br />
<em>bridge;// top level address map</em><br />
<em>reg commoncontrol_reg {</em><br />
<em>shared; // register will be shared by multiple address maps</em><br />
<em>field {</em><br />
<em>hw=rw;</em><br />
<em>sw=rw;</em><br />
<em>reset=32’h0;</em><br />
<em>} f1[32];</em><br />
<em>};</em></p>
<p><em>addrmap {// Define the Map for the AHB Side of the bridge</em><br />
<em>commoncontrol_reg cmn_ctl_ahb @0&#215;0; // at address=0</em><br />
<em>} ahb;</em><br />
<em> </em></p>
<p><em>addrmap { // Define the Map for the AXI Side of the bridge</em><br />
<em>commoncontrol_reg cmn_ctl_axi @0&#215;40; // at address=0&#215;40</em><br />
<em>} axi;</em><br />
<em>}; </em></p>
<p>The equivalent of multiple view <em>addressmap</em>, in RALF is <strong><em>domain</em></strong>.</p>
<p>This allows one definition of the shared register while allowing access from each domain to it, where register address associated with each domain may be different .The following code is RALF with domain implementation for above RDL.</p>
<p><em>register commoncontrol_reg {</em><br />
<em><strong>shared</strong>;</em><br />
<em>field f1 {</em><br />
<em>bits 32;</em><br />
<em>access rw;</em><br />
<em>reset &#8216;h0;</em><br />
<em>}</em><br />
<em>}</em></p>
<p><em>block dma_blk_bridge {</em><br />
<em><strong>domain</strong> ahb {</em><br />
<em>bytes 4;</em><br />
<em>register commoncontrol_reg =cmn_ctl_ahb @&#8217;h00 ;</em><br />
<em>}</em></p>
<p><em><strong>domain</strong> axi {</em><br />
<em>bytes 4;</em></p>
<p><em>register commoncontrol_reg=cmn_ctl_axi @&#8217;h40 ;</em><br />
<em>}</em><br />
<em>}</em></p>
<p>Each physical interface is a domain in RALF. Only blocks and systems have domains, registers are in the block. For access to a register from one interface/domain RAL provides read/write methods which can be called with the domain name as argument. This is shown below..</p>
<p><em>ral_model.STATUS.write(status, data, <strong>“pci”);</strong></em></p>
<p><em>ral_model.STATUS.read(status, data, <strong>“ahb”</strong>); </em></p>
<h4>This considerably simplifies the verification environment code for the shared register accesses. For more on the same, you can look at : <a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvMjAxMC8wOS9zaGFyZWQtcmVnaXN0ZXItYWNjZXNzLWluLXJhbC10aG91Z2gtbXVsdGlwbGUtcGh5c2ljYWwtaW50ZXJmYWNlcy8=">Shared Register Access in RAL though multiple physical interfaces</a></h4>
<p>However, unfortunately, in our case, the tools we used did not support multiple interfaces and the automated flow created a the RALF having effectively two or more top level systems re-defining the registers. This can blow up the RALF file size and also verification environment code.</p>
<p><em>system dma_blk_bridge {</em><br />
<em>bytes 4;</em><br />
<em>block ahb (ahb) @0&#215;0 {</em><br />
<em>bytes 4;</em><br />
<em>register cmn_ctl_ahb @0&#215;0 {</em><br />
<em>bytes 4;</em><br />
<em>field cmn_ctl_ahb_fl(cmn_ctl_ahb_f1)@0{</em><br />
<em>bits 32;</em><br />
<em>access rw;</em><br />
<em>reset 0&#215;0;</em><br />
<em>} }</em><br />
<em>}</em></p>
<p><em>block axi (axi) @0&#215;0 {</em><br />
<em>bytes 4;</em><br />
<em>register cmn_ctl_axi @0&#215;40 {</em><br />
<em>bytes 4;</em><br />
<em>field cmn_ctl_axi_f1 (cmn_ctl_axi_f1) @0 {</em><br />
<em>bits 32;</em><br />
<em>access rw;</em><br />
<em>reset 0&#215;0;</em><br />
<em>} } </em><br />
<em>}</em><br />
<em>}</em></p>
<p>Thus, as seen above, the tool is generating two blocks ‘ahb’ and ‘axi’ and re-defining the register in each block. For multiple shared registers, the resulting verification code will be much bigger than if <em>domain </em>had been used.</p>
<p>Also, without the domain associated read/write methods (as shown above) for accessing the shared registers will be at least a few lines of code per register for accessing it from a domain/interface. This makes writing the test scenarios complicated and wordy.</p>
<p>Using ‘domain’ in RALF and VMM RAL makes shared register implementation and access in verification environment easy. We hope that we would soon be able to have our automated flow leverage this effectively..</p>
<p>If you are interested to go through more details about our automation setup and register verification experiences, you might want to look at: <a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dzEwLmVkYWNhZmUuY29tL2xpbmsvRFZDb24tMjAxMS1BdXRvbWF0ZWQtYXBwcm9hY2gtUmVnaXN0ZXItRGVzaWduLVZlcmlmaWNhdGlvbi1jb21wbGV4LVNPQy8zNDU2OC92aWV3Lmh0bWw=">http://www10.edacafe.com/link/DVCon-2011-Automated-approach-Register-Design-Verification-complex-SOC/34568/view.html</a></p>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=2580" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/2011/07/the-one-stop-shop-get-done-with-everything-you-need-to-do-with-your-registers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Pipelined RAL Access</title>
		<link>http://www.vmmcentral.org/vmartialarts/2011/05/pipelined-ral-access/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/2011/05/pipelined-ral-access/#comments</comments>
		<pubDate>Thu, 12 May 2011 08:26:26 +0000</pubDate>
		<dc:creator>Amit Sharma</dc:creator>
				<category><![CDATA[Register Abstraction Model with RAL]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=2416</guid>
		<description><![CDATA[Ashok Chandran, Analog Devices Many times, we come across scenarios where a register can be accessed from multiple physical interfaces in a system. An example would be a homogenous multi-core system. Here, each core may be able to access registers within the design through its own interfaces. In such scenarios, defining a “domain” (a testbench [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Ashok Chandran, Analog Devices</strong></p>
<p>Many times, we come across scenarios where a register can be accessed from multiple physical interfaces in a system. An example would be a homogenous multi-core system. Here, each core may be able to access registers within the design through its own interfaces. In such scenarios, defining a “domain” (a testbench abstraction for physical interfaces) for each interface may be an overhead.</p>
<p>    · From a system verification point of view, it does not make any difference as to which core accesses the registers since they are identical. The flexibility to bring in ‘random selection of interfaces’ can provide additional value.</p>
<p>    · Defining a ‘domain’ for each interface in such scenario requires duplication of registers/ or their instantiation.</p>
<p>    · Also, the usage of multiple “domains” for homogenous multi-core systems would prevent us from seamlessly reusing our code from block level to system level. This is because as we will have to incorporate the domain definition within the testbench RAL access code when we migrate to system level as the same wouldn’t have been needed during our register abstraction code in the block level.</p>
<p>Another related scenario is where we need to support multiple outstanding transactions at a time. Different threads could initiate distinct transactions which can return data out of order (as in AXI protocol). The default implementation of RAL allows only one transaction at a time for each domain in consideration.</p>
<p>VMM pipelined RAL comes to our rescue in such cases. This mechanism allows multiple RAL accesses to be simultaneously processed by the RAL access layer. This feature of VMM can be enabled with &#8211; <em>`define VMM_RAL_PIPELINED_ACCESS</em>. This define adds a new state to vmm_rw::status_e – vmm_rw::PENDING. When vmm_rw::PENDING is returned as status from execute single()/execute_burst(), the transaction initiating thread is kept blocked till vmm_data::ENDED notification is received for vmm_rw_access. New transactions can now be initiated from other testbench threads and pending transactions cleared in parallel when response is received from the system.</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTEvMDUvaW1hZ2UucG5n"><img style="float: none;margin-left: auto;margin-right: auto;border: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2011/05/image_thumb.png" border="0" alt="image" width="531" height="166" /></a></p>
<p>As shown in the figure above, transactions initiated by thread A (A0 and A1) can be processed / queued even while transactions from thread B (B0 and B1) are in progress. Here A can be processed by one interface and B by the other. Alternately, A and B can be driven together from same interface in case the protocol supports multiple outstanding accesses.</p>
<p>The code below shows how the user can create his execute_single() functionality to use pipelined RAL for a simple protocol like APB. For protocols like AXI which allow multiple outstanding transactions from same interface, the physical layer transactor can control the sequence further using the vmm_data::ENDED notification of the physical layer transaction. </p>
<blockquote><p><strong><em>virtual task</em></strong> <strong><em>execute_single</em></strong>(vmm_rw_access tr);</p>
<p>&#160;&#160;&#160;apb_trans apb = new; //<strong>Physical layer transaction</strong></p>
<p>&#160;&#160;&#160;apb.randomize() with {<br />
&#160;&#160;&#160;&#160;&#160;&#160;addr == tr.addr;<br />
&#160;&#160;&#160;&#160;&#160;&#160;if(tr.kind == vmm_rw::READ) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dir == READ;<br />
&#160;&#160;&#160;&#160;&#160;&#160;} else {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dir == WRITE;<br />
&#160;&#160;&#160;&#160;&#160;&#160;}<br />
&#160;&#160;&#160;&#160;&#160;&#160;resp == OKAY;<br />
&#160;&#160;&#160;&#160;&#160;&#160;interface_id inside{0,1}; //<strong>the interface_id property in the physical layer transaction maps to the different</strong><em><strong> physical interface instances<br />
</strong></em> &#160;&#160;&#160;&#160;&#160;&#160;};</p></blockquote>
<p>&#160;&#160;&#160;if(tr.kind == vmm_rw::WRITE)  apb.data = tr.data;<br />
&#160;&#160;&#160;//<strong>Fork out the access in  parallel<br />
&#160;&#160;&#160;</strong> fork begin<br />
&#160;&#160;&#160;//Get copies for thread<br />
&#160;&#160;&#160;&#160;&#160;&#160;automatic apb_trans pend = apb;<br />
&#160;&#160;&#160;&#160;&#160;&#160;automatic vmm_rw_access rw = tr;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;//<strong>Push into the physical layer BFM<br />
&#160;&#160;&#160;&#160;&#160;&#160;</strong> &#160;&#160;&#160;&#160;&#160;&#160;this.my_intf[pend.interface_id].in_chan.sneak(pend);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;//<strong>Wait for transaction completion from the physical layer BFM<br />
&#160;&#160;&#160;&#160;&#160;&#160;</strong> pend.notify.wait_for(vmm_data::ENDED);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;//<strong>Get the response and read data<br />
&#160;&#160;&#160;&#160;&#160;&#160;</strong>if(pend.resp == apb_trans::OKAY) begin<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rw.status = vmm_rw::IS_OK;<br />
&#160;&#160;&#160;&#160;&#160;&#160;end else begin<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rw.status = vmm_rw::ERROR;<br />
&#160;&#160;&#160;&#160;&#160;&#160;end</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;if(rw.kind == vmm_rw::READ) begin<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rw.data = pend.data;<br />
&#160;&#160;&#160;&#160;&#160;&#160;end</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;// <strong>End of this transaction – Indicate to RAL<br />
&#160;&#160;&#160;&#160;&#160;&#160;</strong> rw.notify.indicate(vmm_data::ENDED);<br />
&#160;&#160;&#160;end join_none</p>
<p>&#160;&#160;&#160;//<strong>Return pending status to RAL access layer<br />
&#160;&#160;&#160;</strong>tr.status = vmm_rw::PENDING;</p>
<p><strong><em>endtask:execute_single</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong> </strong></p>
<p>For more details on creating “Pipelined Accesses”,  you might want to go through the section “Concurrently Executing Generic Transactions” in the VMM RAL User Guide</p>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=2416" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/2011/05/pipelined-ral-access/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A RAL example with Designware VIP</title>
		<link>http://www.vmmcentral.org/vmartialarts/2011/03/a-ral-example-with-designware-vip/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/2011/03/a-ral-example-with-designware-vip/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 11:48:35 +0000</pubDate>
		<dc:creator>S. Varun</dc:creator>
				<category><![CDATA[Register Abstraction Model with RAL]]></category>
		<category><![CDATA[VMM]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=2218</guid>
		<description><![CDATA[I often get asked how best RAL ought to be used with Designware VIP. Since several of these VIPs provide a mechanism to program registers across different DUTs, I felt it would be useful to create an example with Designware AMBA AHB VIP and RAL. The example has a structure as shown in the block [...]]]></description>
			<content:encoded><![CDATA[<pre>I often get asked how best RAL ought to be used with Designware VIP. Since several of these VIPs provide a mechanism to
program registers across different DUTs, I felt it would be useful to create an example with Designware AMBA AHB VIP and
RAL. 

The example has a structure as shown in the block diagram below,

    <strong> ---------------------------------------------
    |                                             |
    |         Register Abstraction Layer          |
    |                                             |
     ---------------------------------------------
       |
  ----------------
 |                |
 |    RAL2AHB     |
 |  ------------  |     ------------------       -----------      -----------
 | | AHB MASTER | |----| HDL Interconnect |-----| AHB SLAVE |----| Resp Gen  |
 |  ------------  |     ------------------       -----------      -----------
 |                |
  ----------------
</strong>

It uses a dummy HDL interconnect that has two AHB interfaces to connect a VIP AHB master component with a VIP AHB slave
component. I have created a dummy register specification in "<a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NvbHZuZXQuc3lub3BzeXMuY29tL3JldHJpZXZlL2N1c3RvbWVyL3FfYW5kX2EvYXR0YWNoZWRfZmlsZXMvMDMyMzk4L2FoYl9hZHZhbmNlZF9yYWxfc2xhdmUucmFsZj8xMjk5MjMwNzIzMTQy">ahb_advanced_ral_slave.ralf</a>". 

This example lacks a real AHB based DUT with real registers and hence the AHB slave VIP components' internal memory is
used to model the register space of the system. The RALF specification is then used to generate the System Verilog RAL
model using the "ralgen" utility as shown by the command-line below.

% ralgen -l sv -t ahb_advanced_slave ahb_advanced_ral_slave.ralf -c b -c a -c f

The above command will dump an SV based RAL model in a file named "ral_ahb_advanced_slave.sv". This model is instantiated
within the top-level environment class, which by the way is an extension of the "vmm_ral_env" class. You may already be
aware that a "vmm_ral_env" based environment has to be used for RAL verification. Once instantiated it is registered using
vmm_ral_access::set_model() method. This would complete the RAL model instantiation and registration leaving only the
translation logic which is the crux of the task.

Note: "vmm_ral_env" is extended from "vmm_env". Check the RAL userguide to see the additional members.

In the block diagram above, the block RAL2AHB is the block that translates a generic RAL access in to a command, in this
case  the command being an AHB transfer. The functional logic that translates generic READ/WRITE into an AHB master
transfer is within the "vmm_rw_xactor::execute_single()". The code snippet below shows how the translation is done.

// --------------------------------------------------------------------
<span style="color: blue;"><code>task ral2ahb_xlate::execute_single(vmm_rw_access tr);
  ...

  <span style="color: maroon;">// The generic read/write being translated into a AHB transfer.</span>
  ahb_xact_fact.data_id        = tr.data_id;
  ahb_xact_fact.scenario_id    = tr.scenario_id;
  ahb_xact_fact.stream_id      = tr.stream_id;

  <span style="color: maroon;">// Copying over the data width from the system configuration</span>
  ahb_xact_fact.m_enHdataWidth = vip_cfg.m_oSystemCfg.m_enHdataWidth;

  <span style="color: maroon;">// Setting the burst type to SINGLE &amp; number of beats to 1</span>
  ahb_xact_fact.m_enBurstType  = dw_vip_ahb_transaction::SINGLE;
  ahb_xact_fact.m_nNumBeats    = 1;

  <span style="color: maroon;">// Copying the address generated by RAL into the AHB address of the AHB transfer</span>
  ahb_xact_fact.m_bvAddress    = tr.addr;

  <span style="color: maroon;">// Copying the size information over to the AHB transaction. RAL provides
  // the size in terms of bits and the dw_vip_ahb_master_transaction class takes
  // it in terms of bytes.</span>
  ahb_xact_fact.m_nNumBytes    = tr.n_bits/8;
  ahb_xact_fact.m_enXferSize   = dw_vip_ahb_transaction::xfer_size_enum'(func_log(tr.n_bits) - 3);
  ahb_xact_fact.m_bvvData      = new[ahb_xact_fact.m_nNumBytes];

  <span style="color: maroon;">// Setting the transfer type WRITE/READ based on the kind value generated by RAL</span>
  if (tr.kind == vmm_rw::WRITE) begin
    ahb_xact_fact.m_enXactType = dw_vip_ahb_transaction::WRITE;
  end
  else begin
    ahb_xact_fact.m_enXactType = dw_vip_ahb_transaction::READ;
  end

  <span style="color: maroon;">// Unpacking the RAL write data element into the byte sized data queue available within
  // dw_vip_ahb_master_transaction class</span>
  if(tr.kind == vmm_rw::WRITE) begin
    for (int i = 0; i &lt; tr.n_bits/8; j++) begin
       ahb_xact_fact.m_bvvData[i] = tr.data &gt;&gt; 8*i;
    end
  end

  <span style="color: maroon;">// Put the AHB transaction object into the AHB master's input channel</span>
  ahb_xactor.m_oTransactionInputChan.put(xact);

  <span style="color: maroon;">// Wait for the transfer to END</span>
  xact.notify.wait_for(vmm_data::ENDED);

  <span style="color: maroon;">// Pack the READ data from the AHB transfer back into the RAL transactions data
  // member</span>
  if (tr.kind == vmm_rw::READ) begin
     int i;
     tr.data = 0;
     for (i = 0; i &lt; xact.m_nNumBytes; i++) begin
        tr.data += xact.m_bvvData[i] &lt;&lt; 8*i;
     end
  end

  <span style="color: maroon;">// Collecting the status of the transfer and returning it to RAL</span>
  if (xact.m_nvRespLast[0] == 0)
     tr.status = vmm_rw::IS_OK;
  else
     tr.status  = vmm_rw::ERROR;

endtask: execute_single</code></span>
// --------------------------------------------------------------------

The created translator class also has to be instantiated within the environment class and has to be registered using
"vmm_rw_access::add_xactor()" as shown below,

// --------------------------------------------------------------------
<span style="color: blue;"><code>class ahb_advanced_ral_env extends vmm_ral_env ;

  ral2ahb_xlate    ral_to_ahb;

    ...

  virtual function void build() ;
  begin
    super.build();
    ral_to_ahb      = new("AHB RAL MASTER XACTOR", master_mp, cfg.cfg_master);

    this.ral.add_xactor(ral_to_abb);
  end
  endfunction

endclass</code></span>
// --------------------------------------------------------------------

At this juncture, we are set to run the RAL tests and easily program the registers using the Abstarcted model
with simple APIs as shown below;

     <span style="color: blue;">env.ral_model.slave_block.REGA.set( ... );
     env.ral_model.slave_block.REGB.set( ... );
     env.ral_model.update();</span>

The above section shows how to setup for single transfers. For burst transfer, there is a slight variation
wherein you provide the burst translation within the vmm_rw_xactor::execute_burst() task. The code snippet
below shows this.

// --------------------------------------------------------------------
<span style="color: blue;"><code>task ral2ahb_xlate::execute_burst(vmm_rw_burst tr);
 ...

  ahb_xact_fact.data_id        = tr.data_id;
  ahb_xact_fact.scenario_id    = tr.scenario_id;
  ahb_xact_fact.stream_id      = tr.stream_id;
  ahb_xact_fact.m_enHdataWidth = vip_cfg.m_oSystemCfg.m_enHdataWidth;
  ahb_xact_fact.m_nNumBeats    = tr.n_beats;
  ahb_xact_fact.m_bvAddress    = tr.addr;
  ahb_xact_fact.m_nNumBytes    = tr.n_bits/8*tr.n_beats;
  ahb_xact_fact.m_enXferSize   = dw_vip_ahb_transaction::xfer_size_enum'(func_log(tr.n_bits) - 3);

  if (tr.kind == vmm_rw::WRITE) begin
    ahb_xact_fact.m_bvvData    = new[ahb_xact_fact.m_nNumBytes];
    ahb_xact_fact.m_enXactType = dw_vip_ahb_transaction::WRITE;
  end
  else begin
    ahb_xact_fact.m_enXactType = dw_vip_ahb_transaction::READ;
  end

  case(tr.n_beats)
    4  : begin
               ahb_xact_fact.m_enBurstType = dw_vip_ahb_transaction::INCR4;
         end
    8  : begin
               ahb_xact_fact.m_enBurstType = dw_vip_ahb_transaction::INCR8;
         end
    16 : begin
               ahb_xact_fact.m_enBurstType = dw_vip_ahb_transaction::INCR16;
         end
    default : begin
               ahb_xact_fact.m_enBurstType = dw_vip_ahb_transaction::INCR;
              end
  endcase

  <span style="color: maroon;">// Write cycle</span>
  if(tr.kind == vmm_rw::WRITE) begin
     for(int i=0; i&lt;tr.n_beats; i++) begin
       for(int j = 0; &lt; tr.n_bits/8; j++) begin
         ahb_xact_fact.m_bvvData[i*(tr.n_bits/8) + j] = tr.data[i] &gt;&gt; 8*j;
       end
     end
  end

  <span style="color: blue;">// Put the AHB burst transaction into the AHB master's input channel</span>
 ahb_xactor.m_oTransactionInputChan.put(xact);

 <span style="color: maroon;">// Read cycle</span>
 if(tr.kind == vmm_rw::READ) begin
     tr.data = new[tr.n_beats];
     for(int i=0; i&lt;tr.n_beats; i++) begin
        tr.data[i] = 0;
        for(int j = 0; j&lt;tr.n_bits/8; j++) begin
           tr.data[i] += xact.m_bvvData[i*tr.n_bits/8 +  j] &lt;&lt;8*j;
        end
     end
 end

  <span style="color: maroon;">// Collecting the status of the transfer and returning it to RAL</span>
  if (xact.m_nvRespLast[0] == 0)
     tr.status = vmm_rw::IS_OK;
  else
     tr.status  = vmm_rw::ERROR;

endtask: execute_burst</code></span>
// --------------------------------------------------------------------

For invoking burst transfers in RAL, the vmm_ral_access::burst_write() &amp; vmm_ral_access::burst_read() tasks
have to be used as shown below;

     <span style="color: blue;">env.ral.burst_write(status, 8'h00, 4, 8'h0f, exp_data, , 32);
     env.ral.burst_read(status, 8'h00, 4, 8'h0f, 4, act_data, , 32);</span>

The complete example is downloadable from solvnet "<a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NvbHZuZXQuc3lub3BzeXMuY29tL3JldHJpZXZlL2N1c3RvbWVyL3FfYW5kX2EvYXR0YWNoZWRfZmlsZXMvMDMyMzk4L3RiX2FoYl92bW1fMTBfYWR2YW5jZWRfcmFsX3N5cy50YXIuZ3o/MTI5OTIzMDcyMzE0Mg==">tb_ahb_vmm_10_advanced_ral_sys.tar.gz</a>". You will need DesignWare
licenses to compile and run the example. Please follow the instructions in the README to compile and run this example.
The example can be used as a reference for creating a RAL environment with other Designware VIP titles as well.
Do write to me if you have any questions on the example.</pre>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=2218" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/2011/03/a-ral-example-with-designware-vip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

