Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > f2f28f61487f3042d93877451f0a311f > files > 233

geda-docs-1.8.2-4.mga5.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title></title>
  <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
  <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
  <link rel="stylesheet" media="print" type="text/css" href="./print.css" />

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>


<h1 class="sectionedit2244"><a name="geda_gaf_switcap_symbols_and_netlister" id="geda_gaf_switcap_symbols_and_netlister">gEDA/gaf Switcap Symbols and Netlister</a></h1>
<div class="level1">

<p>
by: Dan McMahill
</p>

<p>
This document is released under <a href="http://www.gnu.org/copyleft/fdl.html" class="urlextern" title="http://www.gnu.org/copyleft/fdl.html"  rel="nofollow">GFDL</a>
</p>

<p>
April 13th, 2003
</p>

</div>
<!-- EDIT2244 SECTION "gEDA/gaf Switcap Symbols and Netlister" [1-168] -->
<h2 class="sectionedit2245"><a name="overview" id="overview">Overview</a></h2>
<div class="level2">

<p>
This document describes the symbol library and gnetlist backend which supports driving SWITCAP simulations from the gEDA/gaf system. SWITCAP is a switched capacitor circuit simulator available from Columbia University. It is used in many classroom and research environments. One drawback to SWITCAP is the lack of a freely available schematic capture frontend. The gEDA/gaf SWITCAP symbol library and gnetlist backend tries to fill that gap.<br/>

The basic steps involved with using gEDA as the frontend for SWITCAP simulations are:
</p>
<ol>
<li class="level1"><div class="li"> Create schematics of the circuit.</div>
</li>
<li class="level1"><div class="li"> Create an analysis file.</div>
</li>
<li class="level1"><div class="li"> Extract the netlist.</div>
</li>
<li class="level1"><div class="li"> Run the SWITCAP simulation.</div>
</li>
<li class="level1"><div class="li"> Run <strong>sw2asc</strong> to extract the results.</div>
</li>
<li class="level1"><div class="li"> View the results with <strong>gwave</strong>.</div>
</li>
</ol>

</div>
<!-- EDIT2245 SECTION "Overview" [169-924] -->
<h2 class="sectionedit2246"><a name="requirements" id="requirements">Requirements</a></h2>
<div class="level2">

<p>
You will need the following programs to be installed:
</p>
<ol>
<li class="level1"><div class="li"> A recent version of gEDA/gaf. To see if your version is recent enough, see if the directory <strong><code>$prefix/share/gEDA/sym/switcap</code></strong> exists. <strong><code>$prefix</code></strong> is the installation prefix for gEDA on your system.</div>
</li>
<li class="level1"><div class="li"> SWITCAP. The executable is usually called <strong><code>sw</code></strong>. If you do not have SWITCAP available on your system, you will need to contact Columbia University to obtain a copy. The gEDA/gaf SWITCAP support was tested with SWITCAP Version A.5R Release 21-Sep-87.</div>
</li>
<li class="level1"><div class="li"> Although it is optional, you may wish to install a tool which can be used for plotting the output data. SWITCAP produces both <acronym title="American Standard Code for Information Interchange">ASCII</acronym> data listings as well as ugly <acronym title="American Standard Code for Information Interchange">ASCII</acronym> plots (note the release date of the version of SWITCAP used). Suitable tools are:</div>
<ol>
<li class="level2"><div class="li"> Gwave. Gwave is an analog waveform viewer. It is fairly basic, but easy to use, includes cursors, and has zoom/pan features. See <strong><a href="http://www.geda-project.org" class="urlextern" title="http://www.geda-project.org"  rel="nofollow">http://www.geda-project.org</a></strong></div>
</li>
<li class="level2"><div class="li"> Scilab. Similar to matlab. Powerful, but no cursors or panning. See <strong><a href="http://www-rocq.inria.fr/scilab" class="urlextern" title="http://www-rocq.inria.fr/scilab"  rel="nofollow">http://www-rocq.inria.fr/scilab</a></strong></div>
</li>
<li class="level2"><div class="li"> Octave. Similar to matlab. See <strong><a href="http://www.octave.org" class="urlextern" title="http://www.octave.org"  rel="nofollow">http://www.octave.org</a></strong></div>
</li>
<li class="level2"><div class="li"> Grace. See <strong><a href="http://plasma-gate.weizmann.ac.il/Grace/" class="urlextern" title="http://plasma-gate.weizmann.ac.il/Grace/"  rel="nofollow">http://plasma-gate.weizmann.ac.il/Grace/</a></strong></div>
</li>
</ol>
</li>
</ol>

</div>
<!-- EDIT2246 SECTION "Requirements" [925-2130] -->
<h2 class="sectionedit2247"><a name="creating_schematics" id="creating_schematics">Creating Schematics</a></h2>
<div class="level2">

</div>
<!-- EDIT2247 SECTION "Creating Schematics" [2131-2162] -->
<h3 class="sectionedit2248"><a name="required_symbols" id="required_symbols">Required Symbols</a></h3>
<div class="level3">

<p>
This section assumes you are familiar with using gschem to create and edit schematics. SWITCAP netlisting is only supported for the components contained in the SWITCAP symbol library as well as the ground symbol found in the &#039;power&#039; library which comes with gEDA. All allowed SWITCAP elements except for subcircuits are supported. You <em>must</em> include the following elements
on your schematic:
</p>
<ol>
<li class="level1"><div class="li"> One instance of the switcap-timing symbol. This symbol will set the master clock period for your simulations.</div>
</li>
<li class="level1"><div class="li"> One or more instances of the switcap-clock symbol. This symbol defines a clock with a particular phase and period. The reference designator of the clock symbol is used by the switches to set what phase they switch on.</div>
</li>
<li class="level1"><div class="li"> One or more instances of the switcap-analysis symbol. This symbol defines an analysis by specifying a file to include in the SWITCAP netlist. By including multiple instances of this symbol, multiple analysis files may be included.</div>
</li>
</ol>

</div>
<!-- EDIT2248 SECTION "Required Symbols" [2163-3155] -->
<h3 class="sectionedit2249"><a name="optional_symbols" id="optional_symbols">Optional Symbols</a></h3>
<div class="level3">

<p>
You can also optionally add the following SWITCAP special symbols to your schematic:
</p>
<ol>
<li class="level1"><div class="li"> Zero or one instance of the switcap-title symbol. This will add a TITLE: line to the SWITCAP netlist and will appear in the output file.</div>
</li>
<li class="level1"><div class="li"> Zero or one instance of the switcap-options symbol. By editing the OPTIONS attribute on this symbol you can set the various options which can be passed to SWITCAP.</div>
</li>
</ol>

</div>
<!-- EDIT2249 SECTION "Optional Symbols" [3156-3577] -->
<h3 class="sectionedit2250"><a name="net_names" id="net_names">Net Names</a></h3>
<div class="level3">

<p>
When creating schematics to drive SWITCAP, you should name all nets that you wish to plot. To avoid possible conflicts with unnamed nets, you should avoid using purely numerical names for nets because all unnamed nets will be assigned (somewhat randomly) numbers without checking for possible conflicts with explicitly named nets. SWITCAP limits the length of node names to 7 characters.
</p>

</div>
<!-- EDIT2250 SECTION "Net Names" [3578-3986] -->
<h3 class="sectionedit2251"><a name="switches" id="switches">Switches</a></h3>
<div class="level3">

<p>
When placing switches on your schematic, you will need to define which clock they are controlled with. This is done by setting the clock attribute on the switch to the reference designator of the clock which should control it.
</p>

</div>
<!-- EDIT2251 SECTION "Switches" [3987-4233] -->
<h2 class="sectionedit2252"><a name="extracting_the_switcap_netlist" id="extracting_the_switcap_netlist">Extracting the SWITCAP Netlist</a></h2>
<div class="level2">

<p>
To extract the SWITCAP netlist, run:
</p>
<pre class="code">gnetlist -g switcap -o test.scn file1.sch [file2.sch ...]</pre>

<p>
For the example file contained in this archive, you can run:
</p>
<pre class="code">gnetlist -g switcap -o example.scn ckt.sch clocks.sch analysis.sch</pre>

<p>
The netlist will be left in <strong>example.scn</strong>.
</p>

</div>
<!-- EDIT2252 SECTION "Extracting the SWITCAP Netlist" [4234-4573] -->
<h2 class="sectionedit2253"><a name="running_switcap" id="running_switcap">Running SWITCAP</a></h2>
<div class="level2">

<p>
I typically use something like:
</p>
<pre class="code">printf &quot;example.scn\nexample.out\n&quot; | sw</pre>

<p>
so I can use command history to rerun SWITCAP without having to manually type the file names each time.<br/>

Refer to the SWITCAP manual for more details.
</p>

</div>
<!-- EDIT2253 SECTION "Running SWITCAP" [4574-4841] -->
<h2 class="sectionedit2254"><a name="appendix_a_--_symbols_in_the_library" id="appendix_a_--_symbols_in_the_library">Appendix A -- Symbols in the Library</a></h2>
<div class="level2">

</div>
<!-- EDIT2254 SECTION "Appendix A -- Symbols in the Library" [4842-4890] -->
<h3 class="sectionedit2255"><a name="capacitors_switcap-capacitor" id="capacitors_switcap-capacitor">Capacitors (switcap-capacitor)</a></h3>
<div class="level3">

<p>
Ideal capacitor. Attributes:
</p>
<ul>
<li class="level1"><div class="li"> <strong>C</strong>=capacitance. Required. Specifies filename to be included.</div>
</li>
<li class="level1"><div class="li"> <strong>refdes</strong>=reference designator. Required. Must start with “C” and be unique.</div>
</li>
</ul>

</div>
<!-- EDIT2255 SECTION "Capacitors (switcap-capacitor)" [4891-5111] -->
<h3 class="sectionedit2256"><a name="switches_switcap-switch" id="switches_switcap-switch">Switches (switcap-switch)</a></h3>
<div class="level3">

<p>
Ideal switch. Attributes:
</p>
<ul>
<li class="level1"><div class="li"> <strong>clock</strong>=Controlling clock. Required. Specifies which clock controls this switch.</div>
</li>
<li class="level1"><div class="li"> <strong>refdes</strong>=reference designator. Required. Must start with “S” and be unique.</div>
</li>
</ul>

</div>
<!-- EDIT2256 SECTION "Switches (switcap-switch)" [5112-5343] -->
<h3 class="sectionedit2257"><a name="independent_voltage_sources_switcap-vsrc" id="independent_voltage_sources_switcap-vsrc">Independent Voltage Sources (switcap-vsrc)</a></h3>
<div class="level3">

<p>
Attributes:
</p>
<ul>
<li class="level1"><div class="li"> <strong>refdes</strong>=reference designator. Required. Must start with “V” and be unique.</div>
</li>
</ul>

</div>
<!-- EDIT2257 SECTION "Independent Voltage Sources (switcap-vsrc)" [5344-5491] -->
<h3 class="sectionedit2258"><a name="dependent_voltage_sources_switcap-vcvs" id="dependent_voltage_sources_switcap-vcvs">Dependent Voltage Sources (switcap-vcvs)</a></h3>
<div class="level3">

<p>
Attributes:
</p>
<ul>
<li class="level1"><div class="li"> <strong>gain</strong>=gain. Required. Specifies the gain of the controlled source.</div>
</li>
<li class="level1"><div class="li"> <strong>refdes</strong>=reference designator. Required. Must start with “E” and be unique.</div>
</li>
</ul>

</div>
<!-- EDIT2258 SECTION "Dependent Voltage Sources (switcap-vcvs)" [5492-5711] -->
<h3 class="sectionedit2259"><a name="clock_specification_switcap-clock" id="clock_specification_switcap-clock">Clock Specification (switcap-clock)</a></h3>
<div class="level3">

<p>
Attributes:
</p>
<ul>
<li class="level1"><div class="li"> <strong>PSTART</strong>=starting clock phase. Required. Specifies on what phase of the master clock this clock turns on.</div>
</li>
<li class="level1"><div class="li"> <strong>PSTOP</strong>=ending clock phase. Required. Specifies on what phase of the master clock this clock turns off.</div>
</li>
<li class="level1"><div class="li"> <strong>PERIOD</strong>=clock period. Required. Specifies the period of the clock in terms of master clock cycles.</div>
</li>
<li class="level1"><div class="li"> <strong>refdes</strong>=reference designator. Required. The switches that are controlled by this clock will refer to it by the reference designator. As such, avoid running any reference designator renumbering tools.</div>
</li>
</ul>

</div>
<!-- EDIT2259 SECTION "Clock Specification (switcap-clock)" [5712-6305] -->
<h3 class="sectionedit2260"><a name="master_timing_specification_switcap-timing" id="master_timing_specification_switcap-timing">Master Timing Specification (switcap-timing)</a></h3>
<div class="level3">

<p>
Attributes:
</p>
<ul>
<li class="level1"><div class="li"> PERIOD=clock period. Required. Specifies the period of the master clock in seconds.</div>
</li>
</ul>

<p>
Only a single instance of this symbol is allowed.
</p>

</div>
<!-- EDIT2260 SECTION "Master Timing Specification (switcap-timing)" [6306-6512] -->
<h3 class="sectionedit2261"><a name="analysis_file_include_switcap-analysis" id="analysis_file_include_switcap-analysis">Analysis File Include (switcap-analysis)</a></h3>
<div class="level3">

<p>
This symbol will cause a specified file containing SWITCAP analysis commands to be included in the output netlist. Attributes:
</p>
<ul>
<li class="level1"><div class="li"> <strong>file</strong>=filename. Required. Specifies filename to be included.</div>
</li>
</ul>

</div>
<!-- EDIT2261 SECTION "Analysis File Include (switcap-analysis)" [6513-6759] -->
<h3 class="sectionedit2262"><a name="simulation_title_specification_switcap-title" id="simulation_title_specification_switcap-title">Simulation Title Specification (switcap-title)</a></h3>
<div class="level3">

<p>
Attributes:
</p>
<ul>
<li class="level1"><div class="li"> <strong>TITLE</strong>=switcap title. Required. Specifies the TITLE line for the SWITCAP netlist.</div>
</li>
</ul>

<p>
Only a single instance of this symbol is allowed.
</p>

</div>
<!-- EDIT2262 SECTION "Simulation Title Specification (switcap-title)" [6760-6969] -->
<h3 class="sectionedit2263"><a name="simulation_options_specification_switcap-options" id="simulation_options_specification_switcap-options">Simulation Options Specification (switcap-options)</a></h3>
<div class="level3">

<p>
Attributes:
</p>
<ul>
<li class="level1"><div class="li"> <strong>OPTIONS</strong>=switcap options. Required. Specifies the OPTIONS line for the SWITCAP netlist. See the SWITCAP manual for allowed values.</div>
</li>
</ul>

<p>
Only a single instance of this symbol is allowed.
</p>

</div>
<!-- EDIT2263 SECTION "Simulation Options Specification (switcap-options)" [6970-7232] -->
<h2 class="sectionedit2264"><a name="example" id="example">Example</a></h2>
<div class="level2">

<p>
This appendix provides a simple example of the entire process of generating a schematic, producing a SWITCAP netlist, running a simulation, and plotting the results.
</p>
<div class="table sectionedit2265"><table class="inline">
	<tr class="row0">
		<td class="col0"> <a href="media/geda/switcap_figure1.jpg" class="media" target="_blank" title="geda:switcap_figure1.jpg"><img src="media/geda/switcap_figure1.jpg" class="media" alt="" /></a> </td>
	</tr>
	<tr class="row1">
		<td class="col0"> <a href="media/geda/switcap_figure2.jpg" class="media" target="_blank" title="geda:switcap_figure2.jpg"><img src="media/geda/switcap_figure2.jpg" class="media" alt="" /></a> </td>
	</tr>
	<tr class="row2">
		<td class="col0"> <a href="media/geda/switcap_figure3.jpg" class="media" target="_blank" title="geda:switcap_figure3.jpg"><img src="media/geda/switcap_figure3.jpg" class="media" alt="" /></a> </td>
	</tr>
	<tr class="row3">
		<td class="col0"> <a href="media/geda/switcap_figure4.jpg" class="media" target="_blank" title="geda:switcap_figure4.jpg"><img src="media/geda/switcap_figure4.jpg" class="media" alt="" /></a> </td>
	</tr>
</table></div>
<!-- EDIT2265 TABLE [7420-7555] -->
<p>
Figure 5/6: Simulation Results - Transient MISSING
</p>

</div>
<!-- EDIT2264 SECTION "Example" [7233-7608] -->
<h3 class="sectionedit2266"><a name="example_schematics" id="example_schematics">Example Schematics</a></h3>
<div class="level3">

<p>
<strong>Figure 1</strong> shows the schematic of a simple switched capacitor circuit. Note that some switches, S1 and S3 for example, are controlled by CLK1 while others, S2 and S4 for example, are controlled by the complement of CLK1 (#CLK1).<br/>

<strong>Figure 2</strong> shows the definition of a clock and the master clock. Here we define a master clock period (mcp) of 1.0 μs in the timing block. In the clock definition symbol, we define a clock called CLK1 that has a period equal to 1 master clock period (mcp). The phase of CLK1 turning on switches is 0 and the phase of CLK1 turning off switches is 3/8 mcp. Additional clock phases can be defined by creating more instances of the clock definition symbol.<br/>

<strong>Figure 3</strong> shows an instantiation of the title block symbol which will cause “my title” to be used in the TITLE line in the SWITCAP netlist. Figure 3 also shows an instantiation of an analysis block which directs the netlister to include the contents of the file test.ana in the output netlist. <strong>Figure 4</strong> shows the contents of the test.ana file.
</p>

</div>
<!-- EDIT2266 SECTION "Example Schematics" [7609-8680] -->
<h3 class="sectionedit2267"><a name="netlist_the_design" id="netlist_the_design">Netlist the Design</a></h3>
<div class="level3">

<p>
To netlist the design, run:
</p>
<pre class="code">gnetlist -g switcap -o example.scn ckt.sch clocks.sch analysis.sch</pre>

</div>
<!-- EDIT2267 SECTION "Netlist the Design" [8681-8818] -->
<h3 class="sectionedit2268"><a name="run_the_simulation" id="run_the_simulation">Run the Simulation</a></h3>
<div class="level3">

<p>
Run the simulation with:
</p>
<pre class="code">printf &quot;example.scn\nexample.out\n&quot; | sw</pre>

</div>
<!-- EDIT2268 SECTION "Run the Simulation" [8819-8927] -->
<h3 class="sectionedit2269"><a name="process_the_results" id="process_the_results">Process the Results</a></h3>
<div class="level3">

<p>
Convert the SWITCAP output file to something gwave can read by running:
</p>
<pre class="code">sw2asc example.out</pre>

</div>
<!-- EDIT2269 SECTION "Process the Results" [8928-9062] -->
<h3 class="sectionedit2270"><a name="plot_the_results" id="plot_the_results">Plot the Results</a></h3>
<div class="level3">

<p>
Start up the gwave program and load the first sinusoidal steady state result by running:
</p>
<pre class="code">gwave example.out.SSS.1.asc</pre>

<p>
Drag the two waveforms onto the two waveform panels and change the x-axis to a log scale. Figure 5 shows the output. Start up the gwave program and load the transient result by running:
</p>
<pre class="code">gwave example.out.TRAN.1.asc</pre>

</div>
<!-- EDIT2270 SECTION "Plot the Results" [9063-9449] -->
<h2 class="sectionedit2271"><a name="document_revision_history" id="document_revision_history">Document Revision History</a></h2>
<div class="level2">
<div class="table sectionedit2272"><table class="inline">
	<tr class="row0">
		<td class="col0"> April 13th, 2003 </td><td class="col1"> Created switcap.tex </td>
	</tr>
</table></div>
<!-- EDIT2272 TABLE [9488-9530] -->
</div>
<!-- EDIT2271 SECTION "Document Revision History" [9450-] --></body>
</html>