<?xml version="1.0" encoding="utf-8"?> <!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" xml:lang="en" lang="en"> <head> <title>File: generate_test.rb</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="fileHeader"> <h1>generate_test.rb</h1> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Path:</strong></td> <td>bin/generate_test.rb </td> </tr> <tr class="top-aligned-row"> <td><strong>Last Update:</strong></td> <td>Tue Aug 29 22:50:44 PDT 2006</td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <h2>Synopsis</h2> <p> Generates Ruby-VPI tests from Verilog 2001 module declarations. A generated test is composed of the following parts. </p> <table> <tr><td valign="top">Runner:</td><td>Written in Rake, this file builds and runs the test bench. </td></tr> <tr><td valign="top">Bench:</td><td>Written in Verilog and Ruby, these files define the testing environment. </td></tr> <tr><td valign="top">Design:</td><td>Written in Ruby, this file provides an interface to the Verilog module under test. </td></tr> <tr><td valign="top">Prototype:</td><td>Written in Ruby, this file defines a prototype of the design under test. </td></tr> <tr><td valign="top">Specification:</td><td>Written in Ruby, this file verifies the design. </td></tr> </table> <p> The reason for dividing a single test into these parts is mainly to decouple the design from the specification. This allows humans to focus on writing the specification while the remainder is automatically generated by this tool. </p> <p> For example, when the interface of a Verilog module changes, you would simply re-run this tool to incorporate those changes into the test without diverting your focus from the specification. </p> <h2>Notes</h2> <ul> <li>If no input files are specified, then the standard input stream will be read instead. </li> <li>The first signal parameter in a module’s declaration is assumed to be the clocking signal. </li> <li>Existing output files will be backed-up before being over-written. A backed-up file has a tilde (~) appended to its name. </li> </ul> </div> <div id="requires-list"> <h3 class="section-bar">Required files</h3> <div class="name-list"> fileutils ruby-vpi/erb optparse ruby-vpi/rdoc </div> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000002">write_file</a> </div> </div> </div> <!-- if includes --> <div id="section"> <div id="constants-list"> <h3 class="section-bar">Constants</h3> <div class="name-list"> <table summary="Constants"> <tr class="top-aligned-row context-row"> <td class="context-item-name">VERILOG_BENCH_TEMPLATE</td> <td>=</td> <td class="context-item-value">Template.new('bench.v')</td> <td width="3em"> </td> <td class="context-item-desc"> obtain templates for output generation </td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">RUBY_BENCH_TEMPLATE</td> <td>=</td> <td class="context-item-value">Template.new('bench.rb')</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">DESIGN_TEMPLATE</td> <td>=</td> <td class="context-item-value">Template.new('design.rb')</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">PROTO_TEMPLATE</td> <td>=</td> <td class="context-item-value">Template.new('proto.rb')</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">SPEC_TEMPLATE</td> <td>=</td> <td class="context-item-value">Template.new('spec.rb')</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">RUNNER_TEMPLATE</td> <td>=</td> <td class="context-item-value">Template.new('runner.rake')</td> </tr> </table> </div> </div> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000002" class="method-detail"> <a name="M000002"></a> <div class="method-heading"> <a href="generate_test_rb.src/M000002.html" target="Code" class="method-signature" onclick="popupCode('generate_test_rb.src/M000002.html');return false;"> <span class="method-name">write_file</span><span class="method-args">(aPath, aContent)</span> </a> </div> <div class="method-description"> <p> Writes the given contents to the file at the given path. If the given path already exists, then a backup is created before proceeding. </p> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>