Neah/node_modules/vcd-parser/docs/vcd-parser/1.0.1/index.html
2025-04-24 19:06:27 +02:00

375 lines
8.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Home</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Home</h1>
<h3>vcd-parser 1.0.1</h3>
<section>
<article><h1>vcd-parser</h1>
<p>A Node.js parsing tool for Value Change Dump (VCD) files and generating a readable JSON document. It can be used with different hardware simulation tools such as <a href="http://iverilog.icarus.com">Icarus Iverilog</a>.</p>
<h2>Installation</h2>
<p><code>npm install --save vcd-parser</code></p>
<h2>Usage example</h2>
<pre class="prettyprint source lang-javascript"><code>const VCDParser = require('vcd-parser');
VCDParser.parse(
`
$date
Tue Feb 12 14:01:15 2019
$end
$version
Icarus Verilog
$end
$timescale
1ns
$end
$scope module test_tb $end
$var reg 1 ! clk $end
$var wire 1 &quot; rst $end
$upscope $end
$enddefinitions $end
#0
$dumpvars
0&quot;
0!
$end
#15
1&quot;
#20
1!
#40
0!
#60
1!
#80
0!
#100
1!
#115
`
)
.then(parsedData => {
console.log(parsedData);
// {
// &quot;date&quot;: &quot;Tue Feb 12 14:01:15 2019&quot;,
// &quot;version&quot;: &quot;Icarus Verilog&quot;,
// &quot;timescale&quot;: &quot;1ns&quot;,
// &quot;endtime&quot;: &quot;115&quot;,
// &quot;scale&quot;: &quot;1ns&quot;,
// &quot;signal&quot;: [
// {
// &quot;type&quot;: &quot;reg&quot;,
// &quot;size&quot;: 1,
// &quot;refName&quot;: &quot;!&quot;,
// &quot;signalName&quot;: &quot;clk&quot;,
// &quot;module&quot;: &quot;test_tb&quot;,
// &quot;name&quot;: &quot;test_tb.clk&quot;,
// &quot;wave&quot;: [
// [
// &quot;0&quot;,
// &quot;0&quot;
// ],
// [
// &quot;20&quot;,
// &quot;1&quot;
// ],
// [
// &quot;40&quot;,
// &quot;0&quot;
// ],
// [
// &quot;60&quot;,
// &quot;1&quot;
// ],
// [
// &quot;80&quot;,
// &quot;0&quot;
// ],
// [
// &quot;100&quot;,
// &quot;1&quot;
// ]
// ]
// },
// {
// &quot;type&quot;: &quot;wire&quot;,
// &quot;size&quot;: 1,
// &quot;refName&quot;: &quot;\&quot;&quot;,
// &quot;signalName&quot;: &quot;rst&quot;,
// &quot;module&quot;: &quot;test_tb&quot;,
// &quot;name&quot;: &quot;test_tb.rst&quot;,
// &quot;wave&quot;: [
// [
// &quot;0&quot;,
// &quot;0&quot;
// ],
// [
// &quot;15&quot;,
// &quot;1&quot;
// ]
// ]
// }
// ]
// }
})
.catch(err => {
console.error(err);
});
</code></pre>
<h2>API Documentation</h2>
<ul>
<li><a href="#VCDParser">VCDParser</a> :
<ul>
<li><a href="#VCDParser..parse">.parse(content, [opts], [cb])</a><a href="#VCDParser..ParsedData"><code>Promise.&lt;ParsedData&gt;</code></a></li>
</ul>
</li>
</ul>
<p><a name="VCDParser..parse"></a></p>
<h3>VCDParser.parse(content, [opts], [cb]) ⇒ <a href="#VCDParser..ParsedData"><code>Promise.&lt;ParsedData&gt;</code></a></h3>
<p>Parse VCD text content and generate a valid JSON representation.
The function returns a promise unless a callback is provided.</p>
<p><strong>Returns</strong>: <a href="#VCDParser..ParsedData"><code>Promise.&lt;ParsedData&gt;</code></a> - that resolves with the parsed data</p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>content</td>
<td><code>string</code></td>
<td></td>
<td>The text content of the VCD file</td>
</tr>
<tr>
<td>[opts]</td>
<td><a href="#VCDParser..Options"><code>Options</code></a></td>
<td><code>{}</code></td>
<td>Optional configuration to customize the parsing process</td>
</tr>
<tr>
<td>[cb]</td>
<td><a href="#VCDParser..ParseCallback"><code>ParseCallback</code></a></td>
<td><code></code></td>
<td>Optional callback if you don't prefer to use promises</td>
</tr>
</tbody>
</table>
<p><a name="VCDParser..Options"></a></p>
<h3>VCDParser:Options : <code>Object</code></h3>
<p>The optional configuration for the VCD parser</p>
<p><strong>Properties</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>compress</td>
<td><code>boolean</code></td>
<td>Compress the output wave by ignoring the unchanged values</td>
</tr>
<tr>
<td>expandAmbigousBus</td>
<td><code>boolean</code></td>
<td>If the bus has some ambigous value (z or x), it gets expanded to represent the whole bus signal</td>
</tr>
</tbody>
</table>
<p><a name="VCDParser..ParsedData"></a></p>
<h3>VCDParser:ParsedData : <code>Object</code></h3>
<p>The parsed VCD object generated by the parser</p>
<p><strong>Properties</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>[...meta]</td>
<td><code>string</code></td>
<td>The values of different initial meta-data, e.g. date, timescale..etc</td>
</tr>
<tr>
<td>endtime</td>
<td><code>string</code></td>
<td>The endtime of the simulation</td>
</tr>
<tr>
<td>scale</td>
<td><code>string</code></td>
<td>The time-scale unit of the simulation</td>
</tr>
<tr>
<td>signal</td>
<td><a href="#VCDParser..Signal"><code>Array.&lt;Signal&gt;</code></a></td>
<td>The signal values of the simulation</td>
</tr>
</tbody>
</table>
<p><a name="VCDParser..Signal"></a></p>
<h3>VCDParser:Signal : <code>Object</code></h3>
<p>The object representing one signal data</p>
<p><strong>Properties</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td><code>string</code></td>
<td>The full name of the signal</td>
</tr>
<tr>
<td>type</td>
<td><code>string</code></td>
<td>The type of the signal, e.g. wire, reg,..etc</td>
</tr>
<tr>
<td>size</td>
<td><code>number</code></td>
<td>The size/width of the signal in bits</td>
</tr>
<tr>
<td>refName</td>
<td><code>string</code></td>
<td>The reference for this signal used inside the VCD file</td>
</tr>
<tr>
<td>module</td>
<td><code>string</code></td>
<td>The name of the top module for which this signal belongs</td>
</tr>
<tr>
<td>wave</td>
<td><a href="#VCDParser..SignalValue"><code>Array.&lt;SignalValue&gt;</code></a></td>
<td>The values of the signal at different points of time</td>
</tr>
</tbody>
</table>
<p><a name="VCDParser..SignalValue"></a></p>
<h3>VCDParser:SignalValue : <code>Array.&lt;number&gt;</code></h3>
<p>The value of a signal at a specific point of time, represnted as a tuple [time, value]</p>
<p><strong>Properties</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td><code>number</code></td>
<td>The time of the event</td>
</tr>
<tr>
<td>1</td>
<td><code>number</code></td>
<td>The value of the signal at that event</td>
</tr>
</tbody>
</table>
<p><a name="VCDParser..ParseCallback"></a></p>
<h3>VCDParser:ParseCallback : <code>function</code></h3>
<p>The callback for the parsing function.</p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>err</td>
<td><code>error</code></td>
<td>The error generated while parsing</td>
</tr>
<tr>
<td>parsedJSON</td>
<td><a href="#VCDParser..ParsedData"><code>ParsedData</code></a></td>
<td>The JSON document generated by the parser</td>
</tr>
</tbody>
</table></article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="VCDParser.html">VCDParser</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a> on Sun Jul 05 2020 21:57:23 GMT+0200 (Eastern European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>