932 lines
137 KiB
HTML
932 lines
137 KiB
HTML
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||
<title>VLSI SAPD Documentation</title>
|
||
<link href="stylesheet.css" rel="stylesheet" type="text/css">
|
||
</head>
|
||
<h1 id="pagetop" class="header">VLSI SAPD Documentation</h1>
|
||
<center class="header">
|
||
<table class="header">
|
||
<tr>
|
||
<td><a href="index.html">Presentation</a></td>
|
||
<td><a href="agds.html">AGDS</a></td>
|
||
<td><a href="cif.html">CIF</a></td>
|
||
<td><a href="dtr.html">DTR</a></td>
|
||
<td><a href="openchams.html">OPENCHAMS</a></td>
|
||
<td><a href="spice.html">SPICE</a></td>
|
||
<td><a href="contact.html">Links & Contact</a></td>
|
||
</tr>
|
||
</table>
|
||
</center>
|
||
<br>
|
||
<hr>
|
||
<body>
|
||
<!-- Generated by Doxygen 1.8.5 -->
|
||
</div><!-- top -->
|
||
<div class="header">
|
||
<div class="headertitle">
|
||
<div class="title">OPENCHAMS Format </div> </div>
|
||
</div><!--header-->
|
||
<div class="contents">
|
||
<div class="textblock"><h1><a class="anchor" id="openChamsPres"></a>
|
||
Presentation</h1>
|
||
<p>The <b>OpenCHAMS</b> format was developped as a part of the Chams Project (<a href="http://www-soc.lip6.fr/recherche/cian/chams/">http://www-soc.lip6.fr/recherche/cian/chams/</a>). It aims at offering a convenient way to describe analogic circuits' netlists and is based on XML. Some CHAMS specific informations, such as schematic properties, layout properties or sizing procedure, can be described in this format.<br/>
|
||
</p>
|
||
<h2><a class="anchor" id="openChamsAutrhos"></a>
|
||
Author</h2>
|
||
<p>Damien Dupuis: damien.dupuis(at)lip6(.)fr</p>
|
||
<h1><a class="anchor" id="openChamsDB"></a>
|
||
Stand alone database structure</h1>
|
||
<p>The database has many objects that can be arranged in five categories:</p>
|
||
<ul>
|
||
<li>General<ul>
|
||
<li><a class="el" href="class_open_chams_1_1_circuit.html">OpenChams::Circuit</a></li>
|
||
<li>OpenChams::Name</li>
|
||
<li><a class="el" href="class_open_chams_1_1_open_chams_exception.html">OpenChams::OpenChamsException</a></li>
|
||
</ul>
|
||
</li>
|
||
<li>Netlist<ul>
|
||
<li><a class="el" href="class_open_chams_1_1_netlist.html">OpenChams::Netlist</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_instance.html">OpenChams::Instance</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_device.html">OpenChams::Device</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_transistor.html">OpenChams::Transistor</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_parameters.html">OpenChams::Parameters</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_net.html">OpenChams::Net</a></li>
|
||
</ul>
|
||
</li>
|
||
<li>Sizing<ul>
|
||
<li><a class="el" href="class_open_chams_1_1_sizing.html">OpenChams::Sizing</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_operator.html">OpenChams::Operator</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_simul_model.html">OpenChams::SimulModel</a></li>
|
||
</ul>
|
||
</li>
|
||
<li>Schematic<ul>
|
||
<li><a class="el" href="class_open_chams_1_1_schematic.html">OpenChams::Schematic</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_port.html">OpenChams::Port</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_wire.html">OpenChams::Wire</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_wire_point.html">OpenChams::WirePoint</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_instance_point.html">OpenChams::InstancePoint</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_port_point.html">OpenChams::PortPoint</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_intermediate_point.html">OpenChams::IntermediatePoint</a></li>
|
||
</ul>
|
||
</li>
|
||
<li>Layout<ul>
|
||
<li><a class="el" href="class_open_chams_1_1_layout.html">OpenChams::Layout</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_node.html">OpenChams::Node</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_bloc.html">OpenChams::Bloc</a></li>
|
||
<li><a class="el" href="class_open_chams_1_1_group.html">OpenChams::Group</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h2><a class="anchor" id="openChamsParser"></a>
|
||
Using the parser</h2>
|
||
<p>Simply load an OPENCHAMS file using the static function <a class="el" href="class_open_chams_1_1_circuit.html#ad0aa3183bdea59e62f69c295026b7fe7" title="creates and returns a Circuit object based on a database source file. ">OpenChams::Circuit::readFromFile()</a> and then get the netlist object (<a class="el" href="class_open_chams_1_1_circuit.html#a4085d6a7b6958ffdd7ab5df7e6d6e53f" title="returns the Netlist object associated to the circuit or NULL if it does not exist. ">OpenChams::Circuit::getNetlist()</a>) or the sizing procedure (<a class="el" href="class_open_chams_1_1_circuit.html#a0ce52bc8747f684ec0123faa8ff97b6d" title="returns the Sizing object associated to the circuit or NULL if it does not exist. ...">OpenChams::Circuit::getSizing()</a>, might be NULL) or any other useful information (see <a class="el" href="class_open_chams_1_1_circuit.html">OpenChams::Circuit</a>).</p>
|
||
<h2><a class="anchor" id="openChamsDriver"></a>
|
||
Using the driver</h2>
|
||
<p>Using the driver is very simple, user has to create an <a class="el" href="class_open_chams_1_1_circuit.html">OpenChams::Circuit</a> object and simply add <a class="el" href="class_open_chams_1_1_netlist.html">OpenChams::Netlist</a> (mandatory) and <a class="el" href="class_open_chams_1_1_sizing.html">OpenChams::Sizing</a> (optionnal) or <a class="el" href="class_open_chams_1_1_schematic.html">OpenChams::Schematic</a> (optionnal) or <a class="el" href="class_open_chams_1_1_layout.html">OpenChams::Layout</a> (optinnal) to it. Finally use the <a class="el" href="class_open_chams_1_1_circuit.html#a2eb07935ec946a07edcee2255b781193" title="writes the database to file. ">OpenChams::Circuit::writeToFile()</a> method to dump the database to file.</p>
|
||
<h1><a class="anchor" id="openChamsExamples"></a>
|
||
Examples</h1>
|
||
<p>As said is the global presentation, VLSI SAPD project provides C++ libraries and Python modules for each supported format. In this section we present simple code examples to parse and drive a OPENCHAMS file using C++ or Python. The OPENCHAMS files considered are the same for all examples: <code>inverter.xml</code> and <code>buffer.xml</code> </p>
|
||
<div class="fragment"><div class="line"><?xml version=<span class="stringliteral">"1.0"</span> encoding=<span class="stringliteral">"UTF-8"</span>?></div>
|
||
<div class="line"><circuit name=<span class="stringliteral">"inverter"</span> techno=<span class="stringliteral">"myTech"</span>></div>
|
||
<div class="line"> <parameters></div>
|
||
<div class="line"> <parameter name=<span class="stringliteral">"temp"</span> value=<span class="stringliteral">"27.0"</span>/></div>
|
||
<div class="line"> <parameter name=<span class="stringliteral">"Vdd"</span> value=<span class="stringliteral">"1.2"</span>/></div>
|
||
<div class="line"> <parameter name=<span class="stringliteral">"Vss"</span> value=<span class="stringliteral">"0.0"</span>/></div>
|
||
<div class="line"> <parameter name=<span class="stringliteral">"L"</span> value=<span class="stringliteral">"0.10e-6"</span>/></div>
|
||
<div class="line"> <parameter name=<span class="stringliteral">"Ids"</span> value=<span class="stringliteral">"30e-6"</span>/></div>
|
||
<div class="line"> <parameter name=<span class="stringliteral">"Veg"</span> value=<span class="stringliteral">"0.12"</span>/></div>
|
||
<div class="line"> <parameterEq name=<span class="stringliteral">"complex"</span> equation=<span class="stringliteral">"myEq"</span>/></div>
|
||
<div class="line"> </parameters></div>
|
||
<div class="line"> <netlist></div>
|
||
<div class="line"> <instances></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"nmos1"</span> model=<span class="stringliteral">"Transistor"</span> order=<span class="stringliteral">"1"</span> mostype=<span class="stringliteral">"NMOS"</span> sourceBulkConnected=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connectors></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"G"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"D"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"S"</span>/></div>
|
||
<div class="line"> </connectors></div>
|
||
<div class="line"> <transistors></div>
|
||
<div class="line"> <transistor name=<span class="stringliteral">"m1"</span>></div>
|
||
<div class="line"> <connection gate=<span class="stringliteral">"G"</span> source=<span class="stringliteral">"S"</span> drain=<span class="stringliteral">"D"</span> bulk=<span class="stringliteral">"S"</span>/></div>
|
||
<div class="line"> </transistor></div>
|
||
<div class="line"> </transistors></div>
|
||
<div class="line"> </instance></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"pmos1"</span> model=<span class="stringliteral">"Transistor"</span> order=<span class="stringliteral">"2"</span> mostype=<span class="stringliteral">"PMOS"</span> sourceBulkConnected=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connectors></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"G"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"D"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"S"</span>/></div>
|
||
<div class="line"> </connectors></div>
|
||
<div class="line"> <transistors></div>
|
||
<div class="line"> <transistor name=<span class="stringliteral">"m1"</span>></div>
|
||
<div class="line"> <connection gate=<span class="stringliteral">"G"</span> source=<span class="stringliteral">"S"</span> drain=<span class="stringliteral">"D"</span> bulk=<span class="stringliteral">"S"</span>/></div>
|
||
<div class="line"> </transistor></div>
|
||
<div class="line"> </transistors></div>
|
||
<div class="line"> </instance></div>
|
||
<div class="line"> </instances></div>
|
||
<div class="line"> <nets></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"vdd"</span> type=<span class="stringliteral">"power"</span> isExternal=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"pmos1"</span> name=<span class="stringliteral">"S"</span>/></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"vss"</span> type=<span class="stringliteral">"ground"</span> isExternal=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"nmos1"</span> name=<span class="stringliteral">"S"</span>/></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"in"</span> type=<span class="stringliteral">"logical"</span> isExternal=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"nmos1"</span> name=<span class="stringliteral">"G"</span>/></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"pmos1"</span> name=<span class="stringliteral">"G"</span>/></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"out"</span> type=<span class="stringliteral">"logical"</span> isExternal=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"nmos1"</span> name=<span class="stringliteral">"D"</span>/></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"pmos1"</span> name=<span class="stringliteral">"D"</span>/></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> </nets></div>
|
||
<div class="line"> </netlist></div>
|
||
<div class="line"> <schematic></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"nmos1"</span> x=<span class="stringliteral">"2490"</span> y=<span class="stringliteral">"2600"</span> orient=<span class="stringliteral">"ID"</span>/></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"pmos1"</span> x=<span class="stringliteral">"2490"</span> y=<span class="stringliteral">"2490"</span> orient=<span class="stringliteral">"ID"</span>/></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"vdd"</span>></div>
|
||
<div class="line"> <port type=<span class="stringliteral">"inV"</span> idx=<span class="stringliteral">"0"</span> x=<span class="stringliteral">"2525"</span> y=<span class="stringliteral">"2430"</span> orient=<span class="stringliteral">"ID"</span>/></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"pmos1"</span> plug=<span class="stringliteral">"S"</span>/></div>
|
||
<div class="line"> <!--point x=<span class="stringliteral">""</span> y=<span class="stringliteral">""</span>/--></div>
|
||
<div class="line"> <connector idx=<span class="stringliteral">"0"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"vss"</span>></div>
|
||
<div class="line"> <port type=<span class="stringliteral">"inV"</span> idx=<span class="stringliteral">"0"</span> x=<span class="stringliteral">"2525"</span> y=<span class="stringliteral">"2740"</span> orient=<span class="stringliteral">"MY"</span>/></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"nmos1"</span> plug=<span class="stringliteral">"S"</span>/></div>
|
||
<div class="line"> <connector idx=<span class="stringliteral">"0"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"in"</span>></div>
|
||
<div class="line"> <port type=<span class="stringliteral">"inH"</span> idx=<span class="stringliteral">"0"</span> x=<span class="stringliteral">"2415"</span> y=<span class="stringliteral">"2520"</span> orient=<span class="stringliteral">"ID"</span>/></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"pmos1"</span> plug=<span class="stringliteral">"G"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"nmos1"</span> plug=<span class="stringliteral">"G"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector idx=<span class="stringliteral">"0"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"pmos1"</span> plug=<span class="stringliteral">"G"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"out"</span>></div>
|
||
<div class="line"> <port type=<span class="stringliteral">"outH"</span> idx=<span class="stringliteral">"0"</span> x=<span class="stringliteral">"2570"</span> y=<span class="stringliteral">"2590"</span> orient=<span class="stringliteral">"ID"</span>/></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"pmos1"</span> plug=<span class="stringliteral">"D"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"nmos1"</span> plug=<span class="stringliteral">"D"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"nmos1"</span> plug=<span class="stringliteral">"D"</span>/></div>
|
||
<div class="line"> <connector idx=<span class="stringliteral">"0"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> </schematic></div>
|
||
<div class="line"> <sizing></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"pmos1"</span> <span class="keyword">operator</span>=<span class="stringliteral">"OPVG(Veg)"</span> simulModel=<span class="stringliteral">"BSIM3V3"</span>></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Temp"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"temp"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Ids"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"Ids"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"L"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"L"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Veg"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"Veg"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Vd"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"Vdd"</span> factor=<span class="stringliteral">"0.5"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Vs"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"Vdd"</span>/></div>
|
||
<div class="line"> </instance></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"nmos1"</span> <span class="keyword">operator</span>=<span class="stringliteral">"OPW(Vg,Vs)"</span> simulModel=<span class="stringliteral">"BSIM3V3"</span>></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Temp"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"temp"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Ids"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"Ids"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"L"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"L"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Vs"</span> ref=<span class="stringliteral">"design"</span> refParam=<span class="stringliteral">"Vdd"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Vg"</span> ref=<span class="stringliteral">"pmos1"</span> refParam=<span class="stringliteral">"Vg"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"Vd"</span> ref=<span class="stringliteral">"pmos1"</span> refParam=<span class="stringliteral">"Vd"</span>/></div>
|
||
<div class="line"> <constraint param=<span class="stringliteral">"another"</span> refEquation=<span class="stringliteral">"myEq"</span> factor=<span class="stringliteral">"-2.5"</span>/></div>
|
||
<div class="line"> </instance></div>
|
||
<div class="line"> <equations></div>
|
||
<div class="line"> <eq name=<span class="stringliteral">"myEq"</span> equation=<span class="stringliteral">"A/more+complex*equation"</span>/></div>
|
||
<div class="line"> </equations></div>
|
||
<div class="line"> </sizing></div>
|
||
<div class="line"> <layout></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"pmos1"</span> style=<span class="stringliteral">"Common transistor"</span>/></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"nmos1"</span> style=<span class="stringliteral">"Rotate transistor"</span>/></div>
|
||
<div class="line"> <hbtree></div>
|
||
<div class="line"> <group name=<span class="stringliteral">"g1"</span> align=<span class="stringliteral">"vertical"</span>></div>
|
||
<div class="line"> <bloc name=<span class="stringliteral">"nmos1"</span>></div>
|
||
<div class="line"> <bloc name=<span class="stringliteral">"pmos1"</span> position=<span class="stringliteral">"top"</span>/></div>
|
||
<div class="line"> </bloc></div>
|
||
<div class="line"> </group></div>
|
||
<div class="line"> </hbtree></div>
|
||
<div class="line"> </layout></div>
|
||
<div class="line"></circuit></div>
|
||
</div><!-- fragment --> <div class="fragment"><div class="line"><?xml version=<span class="stringliteral">"1.0"</span> encoding=<span class="stringliteral">"UTF-8"</span>?></div>
|
||
<div class="line"><circuit name=<span class="stringliteral">"buffer"</span> techno=<span class="stringliteral">"myTech"</span>></div>
|
||
<div class="line"> <subCircuitsPaths></div>
|
||
<div class="line"> <path path=<span class="stringliteral">"."</span>/></div>
|
||
<div class="line"> </subCircuitsPaths></div>
|
||
<div class="line"> <netlist></div>
|
||
<div class="line"> <instances></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"inv1"</span> model=<span class="stringliteral">"inverter"</span>></div>
|
||
<div class="line"> <connectors></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"vdd"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"vss"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"in"</span> /></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"out"</span>/></div>
|
||
<div class="line"> </connectors></div>
|
||
<div class="line"> </instance></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"inv2"</span> model=<span class="stringliteral">"inverter"</span>></div>
|
||
<div class="line"> <connectors></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"vdd"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"vss"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"in"</span> /></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"out"</span>/></div>
|
||
<div class="line"> </connectors></div>
|
||
<div class="line"> </instance></div>
|
||
<div class="line"> </instances></div>
|
||
<div class="line"> <nets></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"vdd"</span> type=<span class="stringliteral">"power"</span> isExternal=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"inv1"</span> name=<span class="stringliteral">"vdd"</span>/></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"inv2"</span> name=<span class="stringliteral">"vdd"</span>/></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"vss"</span> type=<span class="stringliteral">"ground"</span> isExternal=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"inv1"</span> name=<span class="stringliteral">"vss"</span>/></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"inv2"</span> name=<span class="stringliteral">"vss"</span>/></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"in"</span> type=<span class="stringliteral">"logical"</span> isExternal=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"inv1"</span> name=<span class="stringliteral">"in"</span>/></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"out"</span> type=<span class="stringliteral">"logical"</span> isExternal=<span class="stringliteral">"True"</span>></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"inv2"</span> name=<span class="stringliteral">"out"</span>/></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"internal"</span> type=<span class="stringliteral">"logical"</span> isExternal=<span class="stringliteral">"False"</span>></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"inv1"</span> name=<span class="stringliteral">"out"</span>/></div>
|
||
<div class="line"> <connector instance=<span class="stringliteral">"inv2"</span> name=<span class="stringliteral">"in"</span>/></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> </nets></div>
|
||
<div class="line"> </netlist></div>
|
||
<div class="line"> <schematic></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"inv1"</span> x=<span class="stringliteral">"2490"</span> y=<span class="stringliteral">"2600"</span> orient=<span class="stringliteral">"ID"</span>/></div>
|
||
<div class="line"> <instance name=<span class="stringliteral">"inv2"</span> x=<span class="stringliteral">"2490"</span> y=<span class="stringliteral">"2300"</span> orient=<span class="stringliteral">"ID"</span>/></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"in"</span>></div>
|
||
<div class="line"> <port type=<span class="stringliteral">"inV"</span> idx=<span class="stringliteral">"0"</span> x=<span class="stringliteral">"2415"</span> y=<span class="stringliteral">"2700"</span> orient=<span class="stringliteral">"MY"</span>/></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv1"</span> plug=<span class="stringliteral">"in"</span>/></div>
|
||
<div class="line"> <connector idx=<span class="stringliteral">"0"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"internal"</span>></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv1"</span> plug=<span class="stringliteral">"out"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv2"</span> plug=<span class="stringliteral">"in"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"out"</span>></div>
|
||
<div class="line"> <port type=<span class="stringliteral">"outV"</span> idx=<span class="stringliteral">"0"</span> x=<span class="stringliteral">"2415"</span> y=<span class="stringliteral">"2200"</span> orient=<span class="stringliteral">"MY"</span>/></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv2"</span> plug=<span class="stringliteral">"out"</span>/></div>
|
||
<div class="line"> <connector idx=<span class="stringliteral">"0"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"vdd"</span>></div>
|
||
<div class="line"> <port type=<span class="stringliteral">"inH"</span> idx=<span class="stringliteral">"0"</span> x=<span class="stringliteral">"2200"</span> y=<span class="stringliteral">"2500"</span> orient=<span class="stringliteral">"ID"</span>/></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector idx=<span class="stringliteral">"0"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv2"</span> plug=<span class="stringliteral">"vdd"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv1"</span> plug=<span class="stringliteral">"vdd"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv2"</span> plug=<span class="stringliteral">"vdd"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> <net name=<span class="stringliteral">"vss"</span>></div>
|
||
<div class="line"> <port type=<span class="stringliteral">"inH"</span> idx=<span class="stringliteral">"0"</span> x=<span class="stringliteral">"2700"</span> y=<span class="stringliteral">"2500"</span> orient=<span class="stringliteral">"MX"</span>/></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector idx=<span class="stringliteral">"0"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv2"</span> plug=<span class="stringliteral">"vss"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> <wire></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv1"</span> plug=<span class="stringliteral">"vss"</span>/></div>
|
||
<div class="line"> <connector name=<span class="stringliteral">"inv2"</span> plug=<span class="stringliteral">"vss"</span>/></div>
|
||
<div class="line"> </wire></div>
|
||
<div class="line"> </net></div>
|
||
<div class="line"> </schematic></div>
|
||
<div class="line"></circuit></div>
|
||
</div><!-- fragment --><p>All source codes are available in the <code>examples</code> directory.</p>
|
||
<h2><a class="anchor" id="openChamsC"></a>
|
||
C++</h2>
|
||
<h3><a class="anchor" id="openChamsParseC"></a>
|
||
Parser</h3>
|
||
<p>The following code (<code>parseOpenChams.cpp</code>) is an example of how to parse a OPENCHAMS file using C++ library. </p>
|
||
<div class="fragment"><div class="line"><span class="preprocessor">#include <iostream></span></div>
|
||
<div class="line"><span class="preprocessor">#include <string></span></div>
|
||
<div class="line"><span class="preprocessor">#include <map></span></div>
|
||
<div class="line"><span class="preprocessor">#include <vector></span></div>
|
||
<div class="line"><span class="keyword">using namespace </span>std;</div>
|
||
<div class="line"></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Circuit.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Name.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Parameters.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Netlist.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Instance.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Device.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Net.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Transistor.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Schematic.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Sizing.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Operator.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Layout.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Node.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Port.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Wire.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/OpenChamsException.h"</span></div>
|
||
<div class="line"></div>
|
||
<div class="line"><span class="keywordtype">void</span> printHBTree(<a class="code" href="class_open_chams_1_1_node.html">OpenChams::Node</a>* node, <span class="keywordtype">unsigned</span> indent) {</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (!node) <span class="keywordflow">return</span>; <span class="comment">// since we pass nnode->getRight and node-getTop without checking for NULL</span></div>
|
||
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0 ; i < indent ; i++) {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" |"</span>;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <span class="keywordtype">string</span> pos = <span class="stringliteral">""</span>;</div>
|
||
<div class="line"> <span class="keywordflow">switch</span>(node-><a class="code" href="class_open_chams_1_1_node.html#a2843ffc4a8a476bc6d96d9a155d3071e">getPosition</a>()) {</div>
|
||
<div class="line"> <span class="keywordflow">case</span> OpenChams::Node::TOP:</div>
|
||
<div class="line"> pos = <span class="stringliteral">"top"</span>;</div>
|
||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
<div class="line"> <span class="keywordflow">case</span> OpenChams::Node::RIGHT:</div>
|
||
<div class="line"> pos = <span class="stringliteral">"right"</span>;</div>
|
||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
<div class="line"> <span class="keywordflow">default</span>:</div>
|
||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_bloc.html">OpenChams::Bloc</a>* bloc = <span class="keyword">dynamic_cast<</span><a class="code" href="class_open_chams_1_1_bloc.html">OpenChams::Bloc</a>*<span class="keyword">></span>(node);</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (bloc) {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" bloc: "</span> << bloc-><a class="code" href="class_open_chams_1_1_node.html#aef436e6e20d1dbf2eb78b089ca9d0794">getName</a>().getString() << <span class="stringliteral">" - "</span> << pos << endl;</div>
|
||
<div class="line"> printHBTree(bloc-><a class="code" href="class_open_chams_1_1_node.html#af59967a8c2d5a04ca0a58e2ef29bead1">getTop</a>() , indent+1);</div>
|
||
<div class="line"> printHBTree(bloc-><a class="code" href="class_open_chams_1_1_node.html#a9533ddcf078ddfc2a4e9bd9ffafa51cb">getRight</a>(), indent+1);</div>
|
||
<div class="line"> <span class="keywordflow">return</span>;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_group.html">OpenChams::Group</a>* group = <span class="keyword">dynamic_cast<</span><a class="code" href="class_open_chams_1_1_group.html">OpenChams::Group</a>*<span class="keyword">></span>(node);</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (group) {</div>
|
||
<div class="line"> <span class="keywordtype">string</span> align = <span class="stringliteral">"none"</span>;</div>
|
||
<div class="line"> <span class="keywordflow">switch</span>(group-><a class="code" href="class_open_chams_1_1_group.html#a7cff0c4a6957f23fb1ea4598f4b8a0b8">getAlign</a>()) {</div>
|
||
<div class="line"> <span class="keywordflow">case</span> OpenChams::Group::VERTICAL:</div>
|
||
<div class="line"> align = <span class="stringliteral">"vertical"</span>;</div>
|
||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
<div class="line"> <span class="keywordflow">case</span> OpenChams::Group::HORIZONTAL:</div>
|
||
<div class="line"> align = <span class="stringliteral">"horizontal"</span>;</div>
|
||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
<div class="line"> <span class="keywordflow">default</span>:</div>
|
||
<div class="line"> <span class="keywordflow">break</span>;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" group: "</span> << group-><a class="code" href="class_open_chams_1_1_node.html#aef436e6e20d1dbf2eb78b089ca9d0794">getName</a>().getString() << <span class="stringliteral">" - "</span> << pos << <span class="stringliteral">" - align: "</span> << align << <span class="stringliteral">" - isolated: "</span> << group-><a class="code" href="class_open_chams_1_1_group.html#ab5ae4a4550c418c974ff6e59967eeec2">isIsolated</a>() << <span class="stringliteral">" - paired: "</span> << group-><a class="code" href="class_open_chams_1_1_group.html#aee0abf07a6e9d41f511c648e6eaecea3">isPaired</a>() << endl; </div>
|
||
<div class="line"> printHBTree(group->getRootNode(), indent+1);</div>
|
||
<div class="line"> printHBTree(group-><a class="code" href="class_open_chams_1_1_node.html#af59967a8c2d5a04ca0a58e2ef29bead1">getTop</a>() , indent+1);</div>
|
||
<div class="line"> printHBTree(group-><a class="code" href="class_open_chams_1_1_node.html#a9533ddcf078ddfc2a4e9bd9ffafa51cb">getRight</a>() , indent+1);</div>
|
||
<div class="line"> <span class="keywordflow">return</span>;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> cerr << <span class="stringliteral">"[ERROR] printHBTree: node is nor a bloc nor a group !"</span> << endl;</div>
|
||
<div class="line"> <span class="keywordflow">return</span>;</div>
|
||
<div class="line">}</div>
|
||
<div class="line"></div>
|
||
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> * argv[]) {</div>
|
||
<div class="line"> <span class="keywordtype">string</span> file = <span class="stringliteral">""</span>;</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (argc == 1)</div>
|
||
<div class="line"> file = <span class="stringliteral">"./inverter.xml"</span>;</div>
|
||
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (argc == 2)</div>
|
||
<div class="line"> file = argv[1];</div>
|
||
<div class="line"> <span class="keywordflow">else</span> {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">"Usage: openChamsParser [filename]"</span> << endl;</div>
|
||
<div class="line"> exit(1);</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_circuit.html">OpenChams::Circuit</a>* circuit = NULL;</div>
|
||
<div class="line"> <span class="keywordflow">try</span> {</div>
|
||
<div class="line"> circuit = <a class="code" href="class_open_chams_1_1_circuit.html#ad0aa3183bdea59e62f69c295026b7fe7">OpenChams::Circuit::readFromFile</a>(file);</div>
|
||
<div class="line"> } <span class="keywordflow">catch</span> (<a class="code" href="class_open_chams_1_1_open_chams_exception.html">OpenChams::OpenChamsException</a>& e) {</div>
|
||
<div class="line"> cerr << e.what() << endl;</div>
|
||
<div class="line"> exit(48);</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"></div>
|
||
<div class="line"> cerr << circuit-><a class="code" href="class_open_chams_1_1_circuit.html#a2858c0c4e8b5108f041237cf5a802029">getName</a>().getString() << endl;</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" + parameters"</span> << endl;</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_parameters.html">OpenChams::Parameters</a> params = circuit-><a class="code" href="class_open_chams_1_1_circuit.html#a2e51ad4344607fc279c5c8cda4edae02">getParameters</a>();</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (!params.<a class="code" href="class_open_chams_1_1_parameters.html#af337ffd75e4f019ce15302c60715d84b">isEmpty</a>()) {</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (map<OpenChams::Name, string>::const_iterator it = params.<a class="code" href="class_open_chams_1_1_parameters.html#a0f890d16c3b2a0bcbdf060854ea07877">getValues</a>().begin() ; it != params.<a class="code" href="class_open_chams_1_1_parameters.html#a0f890d16c3b2a0bcbdf060854ea07877">getValues</a>().end() ; ++it) {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | "</span> << ((*it).first).getString() << <span class="stringliteral">" : "</span> << (*it).second << endl;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" + netlist"</span> << endl;</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | + instances"</span> << endl;</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_netlist.html">OpenChams::Netlist</a>* netlist = circuit-><a class="code" href="class_open_chams_1_1_circuit.html#a4085d6a7b6958ffdd7ab5df7e6d6e53f">getNetlist</a>();</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (netlist && !netlist-><a class="code" href="class_open_chams_1_1_netlist.html#adab62a25face462baec9a7fffb2b6158">hasNoInstances</a>()) {</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0 ; i < netlist-><a class="code" href="class_open_chams_1_1_netlist.html#a8e6e58ffab876152a740092520c35d73">getInstances</a>().size() ; i++) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_instance.html">OpenChams::Instance</a>* inst = netlist-><a class="code" href="class_open_chams_1_1_netlist.html#a8e6e58ffab876152a740092520c35d73">getInstances</a>()[i];</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_device.html">OpenChams::Device</a>* dev = NULL;</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (dynamic_cast<OpenChams::Device*>(inst)) {</div>
|
||
<div class="line"> dev = <span class="keyword">static_cast<</span><a class="code" href="class_open_chams_1_1_device.html">OpenChams::Device</a>*<span class="keyword">></span>(inst);</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | + "</span> << dev->getName().getString() << <span class="stringliteral">" : "</span> << dev->getModel().getString() << <span class="stringliteral">" - "</span> << dev->getOrder() << <span class="stringliteral">" - "</span> << dev-><a class="code" href="class_open_chams_1_1_device.html#a831ce553c23908f447a5be332ecd5946">getMosType</a>().getString() << <span class="stringliteral">" - "</span> << (dev-><a class="code" href="class_open_chams_1_1_device.html#a29ed1982e1a8b3a634df8d0c70039669">isSourceBulkConnected</a>()?<span class="stringliteral">"true"</span>:<span class="stringliteral">"false"</span>) << endl;</div>
|
||
<div class="line"> } <span class="keywordflow">else</span> {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | + "</span> << inst->getName().getString() << <span class="stringliteral">" : "</span> << inst->getModel().getString() << <span class="stringliteral">" - "</span> << inst->getOrder() << endl;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | | + connectors"</span> << endl;</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (map<OpenChams::Name, OpenChams::Net*>::const_iterator cit = inst-><a class="code" href="class_open_chams_1_1_instance.html#a745fe0a50eb770ce3bea36ef0e62c8ca">getConnectors</a>().begin() ; cit != inst-><a class="code" href="class_open_chams_1_1_instance.html#a745fe0a50eb770ce3bea36ef0e62c8ca">getConnectors</a>().end() ; ++cit) {</div>
|
||
<div class="line"> <span class="keywordflow">if</span> ((*cit).second)</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | | | "</span> << ((*cit).first).getString() << <span class="stringliteral">" : "</span> << ((*cit).second)->getName().getString() << endl;</div>
|
||
<div class="line"> <span class="keywordflow">else</span></div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | | | "</span> << ((*cit).first).getString() << endl; <span class="comment">// no net connected !</span></div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (dev) {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | | + transistors"</span> << endl;</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0 ; j < dev-><a class="code" href="class_open_chams_1_1_device.html#a4033525cab6387eb057f71f5feed9802">getTransistors</a>().size() ; j++) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_transistor.html">OpenChams::Transistor</a>* tr = dev-><a class="code" href="class_open_chams_1_1_device.html#a4033525cab6387eb057f71f5feed9802">getTransistors</a>()[j];</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | | | name: "</span> << tr-><a class="code" href="class_open_chams_1_1_transistor.html#a2858c0c4e8b5108f041237cf5a802029">getName</a>().getString() << <span class="stringliteral">" - gate: "</span> << tr-><a class="code" href="class_open_chams_1_1_transistor.html#a99f1449aa735ff6cb4927b4f6aa34d9d">getGate</a>().getString() << <span class="stringliteral">" - source: "</span> << tr-><a class="code" href="class_open_chams_1_1_transistor.html#aee4d52a0b13e6db247c1a6c051aede25">getSource</a>().getString() << <span class="stringliteral">" - drain: "</span> << tr-><a class="code" href="class_open_chams_1_1_transistor.html#a62ea0998b3a61310a8331873f5bcce58">getDrain</a>().getString() << <span class="stringliteral">" - bulk: "</span> << tr-><a class="code" href="class_open_chams_1_1_transistor.html#a27ba43f825f9243556ec65d306a2b1a7">getBulk</a>().getString() << endl;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | + nets"</span> << endl;</div>
|
||
<div class="line"> <span class="keywordtype">bool</span> schematicNet = <span class="keyword">false</span>; <span class="comment">// define wether net sections are needed in schematic section</span></div>
|
||
<div class="line"> <span class="keywordflow">if</span> (!netlist-><a class="code" href="class_open_chams_1_1_netlist.html#a36089e1b3a3f2d3f7c9dcc8e3c3bd6d8">hasNoNets</a>()) {</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0 ; i < netlist-><a class="code" href="class_open_chams_1_1_netlist.html#abf36db82efb99a8ec8ae4b454be00019">getNets</a>().size() ; i++) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_net.html">OpenChams::Net</a>* net = netlist-><a class="code" href="class_open_chams_1_1_netlist.html#abf36db82efb99a8ec8ae4b454be00019">getNets</a>()[i];</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | + "</span> << net-><a class="code" href="class_open_chams_1_1_net.html#aef436e6e20d1dbf2eb78b089ca9d0794">getName</a>().getString() << <span class="stringliteral">" : "</span> << net-><a class="code" href="class_open_chams_1_1_net.html#a7a88ff26f0ba9cfbfa5059c565d1e30b">getType</a>().getString() << <span class="stringliteral">" - "</span> << (net-><a class="code" href="class_open_chams_1_1_net.html#ab2570574db49633f58f7b64099d6852c">isExternal</a>()?<span class="stringliteral">"true"</span>:<span class="stringliteral">"false"</span>) << endl;</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | | + connections"</span> << endl;</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0 ; j < net-><a class="code" href="class_open_chams_1_1_net.html#a87e7c71b25171dd479af0488865c8179">getConnections</a>().size() ; j++) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_net_1_1_connection.html">OpenChams::Net::Connection</a>* connect = net-><a class="code" href="class_open_chams_1_1_net.html#a87e7c71b25171dd479af0488865c8179">getConnections</a>()[j];</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | | | "</span> << connect-><a class="code" href="class_open_chams_1_1_net_1_1_connection.html#a44e43ff95d18d91abb9449a09e3c9d1f">getInstanceName</a>().getString() << <span class="stringliteral">"."</span> << connect-><a class="code" href="class_open_chams_1_1_net_1_1_connection.html#a42f70d94ed3768e0342ae2bcb09ac0ed">getConnectorName</a>().getString() << endl;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (!net-><a class="code" href="class_open_chams_1_1_net.html#a3eef7a6d1e945441f197f0918ab8895e">hasNoPorts</a>() || !net-><a class="code" href="class_open_chams_1_1_net.html#ac9470e72b26d4cddef3d13e69057ee54">hasNoWires</a>())</div>
|
||
<div class="line"> schematicNet = <span class="keyword">true</span>;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_schematic.html">OpenChams::Schematic</a>* schematic = circuit-><a class="code" href="class_open_chams_1_1_circuit.html#af6f967a5685ac92fe760f4eb95c8c51f">getSchematic</a>();</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (schematic && !schematic-><a class="code" href="class_open_chams_1_1_schematic.html#adab62a25face462baec9a7fffb2b6158">hasNoInstances</a>()) {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" + schematic"</span> << endl;</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (map<OpenChams::Name, OpenChams::Schematic::Infos*>::const_iterator sit = schematic-><a class="code" href="class_open_chams_1_1_schematic.html#afa015b02922d82de9c44e8ffe8dc5d56">getInstances</a>().begin() ; sit != schematic-><a class="code" href="class_open_chams_1_1_schematic.html#afa015b02922d82de9c44e8ffe8dc5d56">getInstances</a>().end() ; ++sit) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_schematic_1_1_infos.html">OpenChams::Schematic::Infos</a>* inf = (*sit).second;</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | + instance: name: "</span> << ((*sit).first).getString() << <span class="stringliteral">" - x: "</span> << inf-><a class="code" href="class_open_chams_1_1_schematic_1_1_infos.html#a2b69e4312b7814c6efce42f851893409">getX</a>() << <span class="stringliteral">" - y: "</span> << inf-><a class="code" href="class_open_chams_1_1_schematic_1_1_infos.html#a15f19cf52955c8c3406831b288681358">getY</a>() << <span class="stringliteral">" - orientation: "</span> << inf-><a class="code" href="class_open_chams_1_1_schematic_1_1_infos.html#ac7e0f89be2baffb526b2dca46da7aa47">getOrientation</a>().getString() << endl;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (schematicNet) {</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0 ; i < netlist-><a class="code" href="class_open_chams_1_1_netlist.html#abf36db82efb99a8ec8ae4b454be00019">getNets</a>().size() ; i++) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_net.html">OpenChams::Net</a>* net = netlist-><a class="code" href="class_open_chams_1_1_netlist.html#abf36db82efb99a8ec8ae4b454be00019">getNets</a>()[i];</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | + net name: "</span> << net-><a class="code" href="class_open_chams_1_1_net.html#aef436e6e20d1dbf2eb78b089ca9d0794">getName</a>().getString() << endl;</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (!net-><a class="code" href="class_open_chams_1_1_net.html#a3eef7a6d1e945441f197f0918ab8895e">hasNoPorts</a>()) {</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0 ; j < net-><a class="code" href="class_open_chams_1_1_net.html#ae9d241ec6dd833b6d7813e14ff2d9eca">getPorts</a>().size() ; j++) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_port.html">OpenChams::Port</a>* port = net-><a class="code" href="class_open_chams_1_1_net.html#ae9d241ec6dd833b6d7813e14ff2d9eca">getPorts</a>()[j];</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | + port type: "</span> << port-><a class="code" href="class_open_chams_1_1_port.html#a03950ba8678003d3a246bbd1d03cfbfb">getType</a>().getString() << <span class="stringliteral">" - idx: "</span> << port-><a class="code" href="class_open_chams_1_1_port.html#affe6668af1b3e04a80ff75e55f8024ef">getIndex</a>() << <span class="stringliteral">" - x: "</span> << port-><a class="code" href="class_open_chams_1_1_port.html#af71e522ec6aa935c2618819b54f20e02">getX</a>() << <span class="stringliteral">" - y: "</span> << port-><a class="code" href="class_open_chams_1_1_port.html#acd84440598b1da2a23c326ce371db4e4">getY</a>() << <span class="stringliteral">" - orientation: "</span> << port-><a class="code" href="class_open_chams_1_1_port.html#acbe891eaa3be07cacb7385362ab98ecc">getOrientation</a>().getString() << endl;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (!net-><a class="code" href="class_open_chams_1_1_net.html#ac9470e72b26d4cddef3d13e69057ee54">hasNoWires</a>()) {</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0 ; j < net-><a class="code" href="class_open_chams_1_1_net.html#a2f8bcf7cad7711850efeca408f146b8a">getWires</a>().size() ; j++) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_wire.html">OpenChams::Wire</a>* wire = net-><a class="code" href="class_open_chams_1_1_net.html#a2f8bcf7cad7711850efeca408f146b8a">getWires</a>()[j];</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | + wire "</span>;</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_wire_point.html">OpenChams::WirePoint</a>* start = wire-><a class="code" href="class_open_chams_1_1_wire.html#ad68ddfcb6d4cbbe3c06d03fb4350dcdb">getStartPoint</a>();</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (dynamic_cast<OpenChams::InstancePoint*>(start)) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_instance_point.html">OpenChams::InstancePoint</a>* iP = <span class="keyword">static_cast<</span><a class="code" href="class_open_chams_1_1_instance_point.html">OpenChams::InstancePoint</a>*<span class="keyword">></span>(start);</div>
|
||
<div class="line"> cerr << <span class="stringliteral">"<"</span> << iP-><a class="code" href="class_open_chams_1_1_instance_point.html#a2858c0c4e8b5108f041237cf5a802029">getName</a>().getString() << <span class="stringliteral">","</span> << iP-><a class="code" href="class_open_chams_1_1_instance_point.html#a646d464666fc56ab2e04a6b87fdd3279">getPlug</a>().getString() << <span class="stringliteral">"> "</span>;</div>
|
||
<div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast<OpenChams::PortPoint*>(start)) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_port_point.html">OpenChams::PortPoint</a>* pP = <span class="keyword">static_cast<</span><a class="code" href="class_open_chams_1_1_port_point.html">OpenChams::PortPoint</a>*<span class="keyword">></span>(start);</div>
|
||
<div class="line"> cerr << <span class="stringliteral">"<"</span> << pP-><a class="code" href="class_open_chams_1_1_port_point.html#ab4018980dcd1fed5208e7a72846cd815">getIndex</a>() << <span class="stringliteral">"> "</span>;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> k = 0 ; k < wire-><a class="code" href="class_open_chams_1_1_wire.html#aac2840e22e03db0ff2c0fe0f83c56fdd">getIntermediatePoints</a>().size() ; k++) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_intermediate_point.html">OpenChams::IntermediatePoint</a>* iP = wire-><a class="code" href="class_open_chams_1_1_wire.html#aac2840e22e03db0ff2c0fe0f83c56fdd">getIntermediatePoints</a>()[k];</div>
|
||
<div class="line"> cerr << <span class="stringliteral">"<"</span> << iP-><a class="code" href="class_open_chams_1_1_intermediate_point.html#a2b69e4312b7814c6efce42f851893409">getX</a>() << <span class="stringliteral">","</span> << iP-><a class="code" href="class_open_chams_1_1_intermediate_point.html#a15f19cf52955c8c3406831b288681358">getY</a>() << <span class="stringliteral">"> "</span>;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_wire_point.html">OpenChams::WirePoint</a>* end = wire-><a class="code" href="class_open_chams_1_1_wire.html#ab1c91025a4117cede119f53d9eb8093b">getEndPoint</a>();</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (dynamic_cast<OpenChams::InstancePoint*>(end)) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_instance_point.html">OpenChams::InstancePoint</a>* iP = <span class="keyword">static_cast<</span><a class="code" href="class_open_chams_1_1_instance_point.html">OpenChams::InstancePoint</a>*<span class="keyword">></span>(end);</div>
|
||
<div class="line"> cerr << <span class="stringliteral">"<"</span> << iP-><a class="code" href="class_open_chams_1_1_instance_point.html#a2858c0c4e8b5108f041237cf5a802029">getName</a>().getString() << <span class="stringliteral">","</span> << iP-><a class="code" href="class_open_chams_1_1_instance_point.html#a646d464666fc56ab2e04a6b87fdd3279">getPlug</a>().getString() << <span class="stringliteral">"> "</span>;</div>
|
||
<div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast<OpenChams::PortPoint*>(end)) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_port_point.html">OpenChams::PortPoint</a>* pP = <span class="keyword">static_cast<</span><a class="code" href="class_open_chams_1_1_port_point.html">OpenChams::PortPoint</a>*<span class="keyword">></span>(end);</div>
|
||
<div class="line"> cerr << <span class="stringliteral">"<"</span> << pP-><a class="code" href="class_open_chams_1_1_port_point.html#ab4018980dcd1fed5208e7a72846cd815">getIndex</a>() << <span class="stringliteral">"> "</span>;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> cerr << endl;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"></div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"></div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_sizing.html">OpenChams::Sizing</a>* sizing = circuit-><a class="code" href="class_open_chams_1_1_circuit.html#a0ce52bc8747f684ec0123faa8ff97b6d">getSizing</a>();</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (sizing) {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" + sizing"</span> << endl;</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (!sizing-><a class="code" href="class_open_chams_1_1_sizing.html#ac8a299add4fd32ff8bf99c889f4a79a6">hasNoOperators</a>()) {</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (map<OpenChams::Name, OpenChams::Operator*>::const_iterator oit = sizing-><a class="code" href="class_open_chams_1_1_sizing.html#ad35c9083b30dac45186f4f0eb49b435d">getOperators</a>().begin() ; oit != sizing-><a class="code" href="class_open_chams_1_1_sizing.html#ad35c9083b30dac45186f4f0eb49b435d">getOperators</a>().end() ; ++oit) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_operator.html">OpenChams::Operator</a>* op = (*oit).second;</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | + instance name: "</span> << ((*oit).first).getString() << <span class="stringliteral">" - operator: "</span> << op-><a class="code" href="class_open_chams_1_1_operator.html#a2858c0c4e8b5108f041237cf5a802029">getName</a>().getString() << <span class="stringliteral">" - simulModel: "</span> << op-><a class="code" href="class_open_chams_1_1_operator.html#aa189a1b119b44a8877c478e2d2357a89">getSimulModel</a>().getString() << endl;</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (!op-><a class="code" href="class_open_chams_1_1_operator.html#a9ac68ad3e43b1649a8582c8685f4886d">hasNoConstraints</a>()) {</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (map<OpenChams::Name, OpenChams::Operator::Constraint*>::const_iterator cit = op-><a class="code" href="class_open_chams_1_1_operator.html#a0002889b395185948d7c71b261343620">getConstraints</a>().begin() ; cit != op-><a class="code" href="class_open_chams_1_1_operator.html#a0002889b395185948d7c71b261343620">getConstraints</a>().end() ; ++cit) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_operator_1_1_constraint.html">OpenChams::Operator::Constraint</a>* cstr = (*cit).second;</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | + param: "</span> << ((*cit).first).getString() << <span class="stringliteral">" - ref: "</span> << cstr-><a class="code" href="class_open_chams_1_1_operator_1_1_constraint.html#a07cf74adaf661f0aaaa1818d24c2243d">getRef</a>().getString() << <span class="stringliteral">" - refParam: "</span> << cstr-><a class="code" href="class_open_chams_1_1_operator_1_1_constraint.html#a621539b1a4f31053649031c8034b0bd3">getRefParam</a>().getString() << <span class="stringliteral">" - factor: "</span> << cstr-><a class="code" href="class_open_chams_1_1_operator_1_1_constraint.html#a973fc85365f2d3f07007d88a90d7ab1d">getFactor</a>() << endl;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <span class="comment">// To update to the new equations.</span></div>
|
||
<div class="line"> <span class="comment">// if (!sizing->hasNoEquations()) {</span></div>
|
||
<div class="line"> <span class="comment">// cerr << " | + equations" << endl;</span></div>
|
||
<div class="line"> <span class="comment">// for (map<OpenChams::Name, string>::const_iterator eit = sizing->getEquations().begin() ; eit != sizing->getEquations().end() ; ++eit) {</span></div>
|
||
<div class="line"> <span class="comment">// cerr << " | | " << ((*eit).first).getString() << " : " << (*eit).second << endl;</span></div>
|
||
<div class="line"> <span class="comment">// }</span></div>
|
||
<div class="line"> <span class="comment">// }</span></div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_layout.html">OpenChams::Layout</a>* layout = circuit-><a class="code" href="class_open_chams_1_1_circuit.html#a403a908943f9a3e820fd25a86d00531d">getLayout</a>();</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (layout) {</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (!layout-><a class="code" href="class_open_chams_1_1_layout.html#af27a31f10fcf22daa64f35c9c6bd2cda">hasNoInstance</a>()) {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" + layout"</span> << endl;</div>
|
||
<div class="line"> <span class="keywordflow">for</span> (map<OpenChams::Name, OpenChams::Name>::const_iterator lit = layout-><a class="code" href="class_open_chams_1_1_layout.html#ab0550a9050b7e788b2a18452c9df21f7">getInstances</a>().begin() ; lit != layout-><a class="code" href="class_open_chams_1_1_layout.html#ab0550a9050b7e788b2a18452c9df21f7">getInstances</a>().end() ; ++lit) {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | | instance name: "</span> << ((*lit).first).getString() << <span class="stringliteral">" - style: "</span> << ((*lit).second).getString() << endl;</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_node.html">OpenChams::Node</a>* root = layout-><a class="code" href="class_open_chams_1_1_layout.html#a13df4992219ef28a7dc014e9f5f0566a">getHBTreeRoot</a>();</div>
|
||
<div class="line"> <span class="keywordflow">if</span> (root) {</div>
|
||
<div class="line"> cerr << <span class="stringliteral">" | + hbtree"</span> << endl;</div>
|
||
<div class="line"> printHBTree(root, 2);</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"> }</div>
|
||
<div class="line"></div>
|
||
<div class="line"></div>
|
||
<div class="line"> <span class="keywordflow">return</span> 0;</div>
|
||
<div class="line">}</div>
|
||
<div class="line"></div>
|
||
</div><!-- fragment --><h3><a class="anchor" id="openChamsDriveC"></a>
|
||
Driver</h3>
|
||
<p>This C++ code (<code>driveOpenChams.cpp</code>) generates an inverter.xml file equivalent to the included one. </p>
|
||
<div class="fragment"><div class="line"><span class="preprocessor">#include <string></span></div>
|
||
<div class="line"><span class="keyword">using namespace </span>std;</div>
|
||
<div class="line"></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Circuit.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Netlist.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Instance.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Device.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Transistor.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Net.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Schematic.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Sizing.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Operator.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Layout.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Node.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Port.h"</span></div>
|
||
<div class="line"><span class="preprocessor">#include "vlsisapd/openChams/Wire.h"</span></div>
|
||
<div class="line"></div>
|
||
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> * argv[]) {</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_circuit.html">OpenChams::Circuit</a>* circuit = <span class="keyword">new</span> <a class="code" href="class_open_chams_1_1_circuit.html">OpenChams::Circuit</a>(OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"myTech"</span>));</div>
|
||
<div class="line"> <span class="comment">// value parameters</span></div>
|
||
<div class="line"> circuit->addParameter(OpenChams::Name(<span class="stringliteral">"temp"</span>), <span class="stringliteral">"27.0"</span> );</div>
|
||
<div class="line"> circuit->addParameter(OpenChams::Name(<span class="stringliteral">"Vdd"</span>) , <span class="stringliteral">"1.2"</span> );</div>
|
||
<div class="line"> circuit->addParameter(OpenChams::Name(<span class="stringliteral">"Vss"</span>) , <span class="stringliteral">"0.0"</span> );</div>
|
||
<div class="line"> circuit->addParameter(OpenChams::Name(<span class="stringliteral">"L"</span>) , <span class="stringliteral">"0.1e-6"</span>);</div>
|
||
<div class="line"> circuit->addParameter(OpenChams::Name(<span class="stringliteral">"Ids"</span>) , <span class="stringliteral">"30e-6"</span> );</div>
|
||
<div class="line"> circuit->addParameter(OpenChams::Name(<span class="stringliteral">"Veg"</span>) , <span class="stringliteral">"0.12"</span> );</div>
|
||
<div class="line"> <span class="comment">// equation parameters</span></div>
|
||
<div class="line"> circuit->addParameter(OpenChams::Name(<span class="stringliteral">"complex"</span>), <span class="stringliteral">"myEq"</span>);</div>
|
||
<div class="line"></div>
|
||
<div class="line"> <span class="comment">// netlist</span></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_netlist.html">OpenChams::Netlist</a>* netlist = circuit-><a class="code" href="class_open_chams_1_1_circuit.html#a3f11671c7ea7b4e2cc3487bd7954b667">createNetlist</a>();</div>
|
||
<div class="line"> <span class="comment">// instances</span></div>
|
||
<div class="line"> <span class="comment">// nmos1</span></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_device.html">OpenChams::Device</a>* inst_nmos1 = netlist-><a class="code" href="class_open_chams_1_1_netlist.html#a8e1798a2516c32fbab629ce8d60d4b1d">addDevice</a>(OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"Transistor"</span>), 1, OpenChams::Name(<span class="stringliteral">"NMOS"</span>), <span class="keyword">true</span>);</div>
|
||
<div class="line"> inst_nmos1->addConnector(OpenChams::Name(<span class="stringliteral">"G"</span>));</div>
|
||
<div class="line"> inst_nmos1->addConnector(OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> inst_nmos1->addConnector(OpenChams::Name(<span class="stringliteral">"D"</span>));</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_transistor.html">OpenChams::Transistor</a>* tr_nmos1 = inst_nmos1-><a class="code" href="class_open_chams_1_1_device.html#ad45d34f8765dd113a5b12289efe66c07">addTransistor</a>(OpenChams::Name(<span class="stringliteral">"m1"</span>));</div>
|
||
<div class="line"> tr_nmos1-><a class="code" href="class_open_chams_1_1_transistor.html#a705b53a51f0e265533b228f6e8beaf50">setGate</a> (OpenChams::Name(<span class="stringliteral">"G"</span>)); <span class="comment">// the name of the connector of inst_nmos1</span></div>
|
||
<div class="line"> tr_nmos1-><a class="code" href="class_open_chams_1_1_transistor.html#abc4a5d86e639ea13e27551722e2f9c17">setSource</a>(OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> tr_nmos1-><a class="code" href="class_open_chams_1_1_transistor.html#a72ff8491040e3fdc1c8bd62b2392ab82">setDrain</a> (OpenChams::Name(<span class="stringliteral">"D"</span>));</div>
|
||
<div class="line"> tr_nmos1-><a class="code" href="class_open_chams_1_1_transistor.html#a1484abe63e3f8ffbc2911c5230fa7091">setBulk</a> (OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> <span class="comment">// pmos1</span></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_device.html">OpenChams::Device</a>* inst_pmos1 = netlist-><a class="code" href="class_open_chams_1_1_netlist.html#a8e1798a2516c32fbab629ce8d60d4b1d">addDevice</a>(OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"Transistor"</span>), 2, OpenChams::Name(<span class="stringliteral">"PMOS"</span>), <span class="keyword">true</span>);</div>
|
||
<div class="line"> inst_pmos1->addConnector(OpenChams::Name(<span class="stringliteral">"G"</span>));</div>
|
||
<div class="line"> inst_pmos1->addConnector(OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> inst_pmos1->addConnector(OpenChams::Name(<span class="stringliteral">"D"</span>));</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_transistor.html">OpenChams::Transistor</a>* tr_pmos1 = inst_pmos1-><a class="code" href="class_open_chams_1_1_device.html#ad45d34f8765dd113a5b12289efe66c07">addTransistor</a>(OpenChams::Name(<span class="stringliteral">"m1"</span>));</div>
|
||
<div class="line"> tr_pmos1-><a class="code" href="class_open_chams_1_1_transistor.html#a705b53a51f0e265533b228f6e8beaf50">setGate</a> (OpenChams::Name(<span class="stringliteral">"G"</span>)); <span class="comment">// the name of the connector of inst_pmos1</span></div>
|
||
<div class="line"> tr_pmos1-><a class="code" href="class_open_chams_1_1_transistor.html#abc4a5d86e639ea13e27551722e2f9c17">setSource</a>(OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> tr_pmos1-><a class="code" href="class_open_chams_1_1_transistor.html#a72ff8491040e3fdc1c8bd62b2392ab82">setDrain</a> (OpenChams::Name(<span class="stringliteral">"D"</span>));</div>
|
||
<div class="line"> tr_pmos1-><a class="code" href="class_open_chams_1_1_transistor.html#a1484abe63e3f8ffbc2911c5230fa7091">setBulk</a> (OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> <span class="comment">// nets</span></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_net.html">OpenChams::Net</a>* _vdd = netlist-><a class="code" href="class_open_chams_1_1_netlist.html#a52be455a704925328843770552eca43d">addNet</a>(OpenChams::Name(<span class="stringliteral">"vdd"</span>), OpenChams::Name(<span class="stringliteral">"power"</span>) , <span class="keyword">true</span>);</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_net.html">OpenChams::Net</a>* _vss = netlist-><a class="code" href="class_open_chams_1_1_netlist.html#a52be455a704925328843770552eca43d">addNet</a>(OpenChams::Name(<span class="stringliteral">"vss"</span>), OpenChams::Name(<span class="stringliteral">"ground"</span>) , <span class="keyword">true</span>);</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_net.html">OpenChams::Net</a>* _in = netlist-><a class="code" href="class_open_chams_1_1_netlist.html#a52be455a704925328843770552eca43d">addNet</a>(OpenChams::Name(<span class="stringliteral">"in"</span> ), OpenChams::Name(<span class="stringliteral">"logical"</span>), <span class="keyword">true</span>);</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_net.html">OpenChams::Net</a>* _out = netlist-><a class="code" href="class_open_chams_1_1_netlist.html#a52be455a704925328843770552eca43d">addNet</a>(OpenChams::Name(<span class="stringliteral">"out"</span>), OpenChams::Name(<span class="stringliteral">"logical"</span>), <span class="keyword">true</span>);</div>
|
||
<div class="line"> _vdd-><a class="code" href="class_open_chams_1_1_net.html#a40c2c019175ba3bfa4b90f4ad5d06483">connectTo</a>(OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> _vss-><a class="code" href="class_open_chams_1_1_net.html#a40c2c019175ba3bfa4b90f4ad5d06483">connectTo</a>(OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> _in-><a class="code" href="class_open_chams_1_1_net.html#a40c2c019175ba3bfa4b90f4ad5d06483">connectTo</a> (OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"G"</span>));</div>
|
||
<div class="line"> _in-><a class="code" href="class_open_chams_1_1_net.html#a40c2c019175ba3bfa4b90f4ad5d06483">connectTo</a> (OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"G"</span>));</div>
|
||
<div class="line"> _out-><a class="code" href="class_open_chams_1_1_net.html#a40c2c019175ba3bfa4b90f4ad5d06483">connectTo</a>(OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"D"</span>));</div>
|
||
<div class="line"> _out-><a class="code" href="class_open_chams_1_1_net.html#a40c2c019175ba3bfa4b90f4ad5d06483">connectTo</a>(OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"D"</span>));</div>
|
||
<div class="line"></div>
|
||
<div class="line"> <span class="comment">// schematic</span></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_schematic.html">OpenChams::Schematic</a>* schematic = circuit-><a class="code" href="class_open_chams_1_1_circuit.html#a57a79a9916df4512648bb195decb7250">createSchematic</a>();</div>
|
||
<div class="line"> schematic-><a class="code" href="class_open_chams_1_1_schematic.html#ac7fc9f5cdf1e22c53d42e6606e1af8ef">addInstance</a>(OpenChams::Name(<span class="stringliteral">"nmos1"</span>), 2490, 2600, OpenChams::Name(<span class="stringliteral">"ID"</span>));</div>
|
||
<div class="line"> schematic-><a class="code" href="class_open_chams_1_1_schematic.html#ac7fc9f5cdf1e22c53d42e6606e1af8ef">addInstance</a>(OpenChams::Name(<span class="stringliteral">"pmos1"</span>), 2490, 2300, OpenChams::Name(<span class="stringliteral">"ID"</span>));</div>
|
||
<div class="line"> _vdd-><a class="code" href="class_open_chams_1_1_net.html#af395a7c9d6f3c2b24500b91260873664">addPort</a>(OpenChams::Name(<span class="stringliteral">"inV"</span>), 0, 2490, 2100, OpenChams::Name(<span class="stringliteral">"ID"</span>));</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_wire.html">OpenChams::Wire</a>* wVdd = _vdd-><a class="code" href="class_open_chams_1_1_net.html#a643a969f62770301b8b70ed63c36a55e">addWire</a>();</div>
|
||
<div class="line"> wVdd->setStartPoint(OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> wVdd->setEndPoint (0);</div>
|
||
<div class="line"> _vss-><a class="code" href="class_open_chams_1_1_net.html#af395a7c9d6f3c2b24500b91260873664">addPort</a>(OpenChams::Name(<span class="stringliteral">"inV"</span>), 0, 2490, 2800, OpenChams::Name(<span class="stringliteral">"MY"</span>));</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_wire.html">OpenChams::Wire</a>* wVss = _vss-><a class="code" href="class_open_chams_1_1_net.html#a643a969f62770301b8b70ed63c36a55e">addWire</a>();</div>
|
||
<div class="line"> wVss->setStartPoint(OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"S"</span>));</div>
|
||
<div class="line"> wVss->setEndPoint (0);</div>
|
||
<div class="line"> _in-><a class="code" href="class_open_chams_1_1_net.html#af395a7c9d6f3c2b24500b91260873664">addPort</a>(OpenChams::Name(<span class="stringliteral">"inH"</span>), 0, 2190, 2500, OpenChams::Name(<span class="stringliteral">"ID"</span>));</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_wire.html">OpenChams::Wire</a>* wIn = _in-><a class="code" href="class_open_chams_1_1_net.html#a643a969f62770301b8b70ed63c36a55e">addWire</a>();</div>
|
||
<div class="line"> wIn->setStartPoint(OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"G"</span>));</div>
|
||
<div class="line"> wIn->setEndPoint (OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"G"</span>));</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_wire.html">OpenChams::Wire</a>* wIn1 = _in-><a class="code" href="class_open_chams_1_1_net.html#a643a969f62770301b8b70ed63c36a55e">addWire</a>();</div>
|
||
<div class="line"> wIn1->setStartPoint(0);</div>
|
||
<div class="line"> wIn1->setEndPoint (OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"G"</span>));</div>
|
||
<div class="line"> _out-><a class="code" href="class_open_chams_1_1_net.html#af395a7c9d6f3c2b24500b91260873664">addPort</a>(OpenChams::Name(<span class="stringliteral">"outH"</span>), 0, 2600, 2500, OpenChams::Name(<span class="stringliteral">"ID"</span>));</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_wire.html">OpenChams::Wire</a>* wOut = _out-><a class="code" href="class_open_chams_1_1_net.html#a643a969f62770301b8b70ed63c36a55e">addWire</a>();</div>
|
||
<div class="line"> wOut->setStartPoint(OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"D"</span>));</div>
|
||
<div class="line"> wOut->setEndPoint (OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"D"</span>));</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_wire.html">OpenChams::Wire</a>* wOut1 = _out-><a class="code" href="class_open_chams_1_1_net.html#a643a969f62770301b8b70ed63c36a55e">addWire</a>();</div>
|
||
<div class="line"> wOut1->setStartPoint(OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"D"</span>));</div>
|
||
<div class="line"> wOut1->setEndPoint (0);</div>
|
||
<div class="line"></div>
|
||
<div class="line"> <span class="comment">// sizing</span></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_sizing.html">OpenChams::Sizing</a>* sizing = circuit->createSizing();</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_operator.html">OpenChams::Operator</a>* op_pmos1 = sizing-><a class="code" href="class_open_chams_1_1_sizing.html#a712e045c11e463cff8411b3d0fd7f732">addOperator</a>(OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"OPVG(Veg)"</span>), OpenChams::Name(<span class="stringliteral">"BSIM3V3"</span>));</div>
|
||
<div class="line"> op_pmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Temp"</span>), OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"temp"</span>));</div>
|
||
<div class="line"> op_pmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Ids"</span>) , OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"Ids"</span>) );</div>
|
||
<div class="line"> op_pmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"L"</span>) , OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"L"</span>) );</div>
|
||
<div class="line"> op_pmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Veg"</span>) , OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"Veg"</span>) );</div>
|
||
<div class="line"> op_pmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Vd"</span>) , OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"Vdd"</span>) , 0.5);</div>
|
||
<div class="line"> op_pmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Vs"</span>) , OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"Vdd"</span>) );</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_operator.html">OpenChams::Operator</a>* op_nmos1 = sizing-><a class="code" href="class_open_chams_1_1_sizing.html#a712e045c11e463cff8411b3d0fd7f732">addOperator</a>(OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"OPW(Vg,Vs)"</span>), OpenChams::Name(<span class="stringliteral">"BSIM3V3"</span>));</div>
|
||
<div class="line"> op_nmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Temp"</span>), OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"temp"</span>));</div>
|
||
<div class="line"> op_nmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Ids"</span>) , OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"Ids"</span> ));</div>
|
||
<div class="line"> op_nmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"L"</span>) , OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"L"</span> ));</div>
|
||
<div class="line"> op_nmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Vs"</span>) , OpenChams::Name(<span class="stringliteral">"design"</span>), OpenChams::Name(<span class="stringliteral">"Vdd"</span> ));</div>
|
||
<div class="line"> op_nmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Vg"</span>) , OpenChams::Name(<span class="stringliteral">"pmos1"</span>) , OpenChams::Name(<span class="stringliteral">"Vg"</span> ));</div>
|
||
<div class="line"> op_nmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"Vd"</span>) , OpenChams::Name(<span class="stringliteral">"pmos1"</span>) , OpenChams::Name(<span class="stringliteral">"Vd"</span> ));</div>
|
||
<div class="line"> op_nmos1->addConstraint(OpenChams::Name(<span class="stringliteral">"another"</span>), OpenChams::Name(<span class="stringliteral">"myEq"</span>), -2.5 );</div>
|
||
<div class="line"> <span class="comment">// layout</span></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_layout.html">OpenChams::Layout</a>* layout = circuit-><a class="code" href="class_open_chams_1_1_circuit.html#a725a691b0117c4b913b54e7bfd92832f">createLayout</a>();</div>
|
||
<div class="line"> layout-><a class="code" href="class_open_chams_1_1_layout.html#a4cc1899e9b782de44700fa0e4ac477ef">addInstance</a>(OpenChams::Name(<span class="stringliteral">"pmos1"</span>), OpenChams::Name(<span class="stringliteral">"Common transistor"</span>));</div>
|
||
<div class="line"> layout-><a class="code" href="class_open_chams_1_1_layout.html#a4cc1899e9b782de44700fa0e4ac477ef">addInstance</a>(OpenChams::Name(<span class="stringliteral">"nmos1"</span>), OpenChams::Name(<span class="stringliteral">"Rotate transistor"</span>));</div>
|
||
<div class="line"> <span class="comment">// create hbtree</span></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_group.html">OpenChams::Group</a>* g1 = <span class="keyword">new</span> <a class="code" href="class_open_chams_1_1_group.html">OpenChams::Group</a>(<span class="stringliteral">"g1"</span>); <span class="comment">// default position is NONE and default parent is NULL</span></div>
|
||
<div class="line"> g1-><a class="code" href="class_open_chams_1_1_group.html#a9fc27b2bc4da99c723102153c4fbf1c0">setAlign</a>(OpenChams::Group::VERTICAL);</div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_bloc.html">OpenChams::Bloc</a>* b1 = <span class="keyword">new</span> <a class="code" href="class_open_chams_1_1_bloc.html">OpenChams::Bloc</a>(<span class="stringliteral">"nmos1"</span>, OpenChams::Node::NONE, g1);</div>
|
||
<div class="line"> g1-><a class="code" href="class_open_chams_1_1_group.html#adc93b900e943312e905182fe44f21225">setRootNode</a>(b1); <span class="comment">// b1 is root node of group g1</span></div>
|
||
<div class="line"> <a class="code" href="class_open_chams_1_1_bloc.html">OpenChams::Bloc</a>* b2 = <span class="keyword">new</span> <a class="code" href="class_open_chams_1_1_bloc.html">OpenChams::Bloc</a>(<span class="stringliteral">"pmos1"</span>, OpenChams::Node::TOP, b1);</div>
|
||
<div class="line"> b1-><a class="code" href="class_open_chams_1_1_node.html#a32e2fbbb73c6b7ee4a30189cc30106bf">setTop</a>(b2); <span class="comment">// b2 is on top of b1</span></div>
|
||
<div class="line"> layout-><a class="code" href="class_open_chams_1_1_layout.html#a6d828958e0faf1346b27276eab101858">setHBTreeRoot</a>(g1); <span class="comment">// g1 is the root of the tree</span></div>
|
||
<div class="line"></div>
|
||
<div class="line"> circuit-><a class="code" href="class_open_chams_1_1_circuit.html#a2eb07935ec946a07edcee2255b781193">writeToFile</a>(<span class="stringliteral">"./myInverter.xml"</span>);</div>
|
||
<div class="line"> <span class="keywordflow">return</span> 0;</div>
|
||
<div class="line">}</div>
|
||
<div class="line"></div>
|
||
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>In order to compile these codes, a CMakeLists.txt file is provided. User must set the $VLSISAPD_TOP variable before running these commands in the directory containing the CMakeLists.txt file: <div class="fragment"><div class="line">%> mkdir build; cd build</div>
|
||
<div class="line">%> cmake ..</div>
|
||
<div class="line">%> make</div>
|
||
</div><!-- fragment --></dd></dl>
|
||
<h2><a class="anchor" id="openChamsPython"></a>
|
||
Python</h2>
|
||
<h3><a class="anchor" id="openChamsParsePython"></a>
|
||
Parser</h3>
|
||
<p>The following python script (<code>parseOpenChams.py</code>) is an example of how to parse a OPENCHAMS file using python module. </p>
|
||
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="keyword">import</span> sys</div>
|
||
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> </div>
|
||
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="keyword">from</span> OPENCHAMS <span class="keyword">import</span> *</div>
|
||
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> </div>
|
||
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="keyword">def </span>printHBTree(node, indent):</div>
|
||
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>  <span class="keywordflow">if</span> node == <span class="keywordtype">None</span>:</div>
|
||
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>  <span class="keywordflow">return</span></div>
|
||
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>  <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(indent):</div>
|
||
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>  <span class="keywordflow">print</span> <span class="stringliteral">" |"</span>,</div>
|
||
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>  <span class="keywordflow">if</span> isinstance(node, Bloc):</div>
|
||
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>  <span class="keywordflow">print</span> <span class="stringliteral">" bloc:"</span>, node.getName(), <span class="stringliteral">"-"</span>, node.getPosition()</div>
|
||
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>  printHBTree(node.top , indent+1)</div>
|
||
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>  printHBTree(node.right, indent+1)</div>
|
||
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  <span class="keywordflow">return</span></div>
|
||
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>  <span class="keywordflow">if</span> isinstance(node, Group):</div>
|
||
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  <span class="keywordflow">print</span> <span class="stringliteral">" group:"</span>, node.getName(), <span class="stringliteral">"-"</span>, node.getPosition(), <span class="stringliteral">"-"</span>, node.align, <span class="stringliteral">"-"</span>, node.isolated, <span class="stringliteral">"-"</span>, node.paired</div>
|
||
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  printHBTree(node.rootNode, indent+1)</div>
|
||
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  printHBTree(node.top , indent+1)</div>
|
||
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  printHBTree(node.right , indent+1)</div>
|
||
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <span class="keywordflow">return</span></div>
|
||
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> </div>
|
||
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">def </span>printContents(circuit):</div>
|
||
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keywordflow">print</span> circuit.name</div>
|
||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="comment"># circuit parameters</span></div>
|
||
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordflow">print</span> <span class="stringliteral">" + parameters"</span></div>
|
||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordflow">for</span> param <span class="keywordflow">in</span> circuit.parameters.getValues():</div>
|
||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | |"</span>, param.key, <span class="stringliteral">":"</span>, param.value</div>
|
||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keywordflow">for</span> param <span class="keywordflow">in</span> circuit.parameters.getEqValues():</div>
|
||
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | |"</span>, param.key, <span class="stringliteral">":"</span>, param.value</div>
|
||
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="comment"># netlist</span></div>
|
||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordflow">print</span> <span class="stringliteral">" + netlist"</span></div>
|
||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="comment"># instances</span></div>
|
||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | + instances"</span></div>
|
||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordflow">for</span> instance <span class="keywordflow">in</span> circuit.netlist.getInstances():</div>
|
||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">if</span> isinstance(instance, Device): </div>
|
||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | +"</span>, instance.name, <span class="stringliteral">":"</span>, instance.model, instance.order, instance.mosType, instance.sourceBulkConnected</div>
|
||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keywordflow">else</span>:</div>
|
||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | +"</span>, instance.name, <span class="stringliteral">":"</span>, instance.model, instance.order</div>
|
||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | | + connectors"</span></div>
|
||
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">for</span> conn <span class="keywordflow">in</span> instance.getConnectors():</div>
|
||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | | |"</span>, conn.key, <span class="stringliteral">":"</span>, conn.value.name</div>
|
||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordflow">if</span> isinstance(instance, Device): </div>
|
||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | | + transistors"</span></div>
|
||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordflow">for</span> tr <span class="keywordflow">in</span> instance.getTransistors():</div>
|
||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | | | name:"</span>, tr.name, <span class="stringliteral">"- gate:"</span>, tr.gate, <span class="stringliteral">"- source:"</span>, tr.source, <span class="stringliteral">"- drain:"</span>, tr.drain, <span class="stringliteral">"- bulk:"</span>, tr.bulk</div>
|
||
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="comment"># nets</span></div>
|
||
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | + nets"</span></div>
|
||
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  schematicNet = <span class="keyword">False</span></div>
|
||
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keywordflow">for</span> net <span class="keywordflow">in</span> circuit.netlist.getNets():</div>
|
||
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | +"</span>, net.name, <span class="stringliteral">":"</span>, net.type, net.external</div>
|
||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | | + connections"</span></div>
|
||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordflow">for</span> conn <span class="keywordflow">in</span> net.getConnections():</div>
|
||
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | | | %s.%s"</span>%(conn.instanceName, conn.connectorName)</div>
|
||
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keywordflow">if</span> <span class="keywordflow">not</span> net.hasNoPorts() <span class="keywordflow">or</span> <span class="keywordflow">not</span> net.hasNoWires():</div>
|
||
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  schematicNet = <span class="keyword">True</span></div>
|
||
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="comment"># schematic</span></div>
|
||
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordflow">if</span> (circuit.schematic):</div>
|
||
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keywordflow">print</span> <span class="stringliteral">" + schematic"</span></div>
|
||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordflow">for</span> instance <span class="keywordflow">in</span> circuit.schematic.getInstances():</div>
|
||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | + instance name:"</span>, instance.key, <span class="stringliteral">"- x:"</span>, instance.value.x, <span class="stringliteral">"- y:"</span>, instance.value.y, <span class="stringliteral">"- orientation:"</span>, instance.value.orientation </div>
|
||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keywordflow">if</span> schematicNet:</div>
|
||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">for</span> net <span class="keywordflow">in</span> circuit.netlist.getNets():</div>
|
||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">if</span> net.hasNoPorts() <span class="keywordflow">and</span> net.hasNoWires():</div>
|
||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordflow">continue</span></div>
|
||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | + net name:"</span>, net.name</div>
|
||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordflow">for</span> port <span class="keywordflow">in</span> net.getPorts():</div>
|
||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | + port type:"</span>, port.type, <span class="stringliteral">"- idx:"</span>, port.index, <span class="stringliteral">"- x:"</span>, port.x, <span class="stringliteral">"- y:"</span>, port.y, <span class="stringliteral">"- orientation:"</span>, port.orientation</div>
|
||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordflow">for</span> wire <span class="keywordflow">in</span> net.getWires():</div>
|
||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keywordflow">if</span> isinstance(wire.startPoint, InstancePoint):</div>
|
||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | + wire <"</span> + wire.startPoint.name.getString() + <span class="stringliteral">","</span> + wire.startPoint.plug.getString() +<span class="stringliteral">">"</span></div>
|
||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">elif</span> isinstance(wire.startPoint, PortPoint):</div>
|
||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | + wire <"</span> + str(wire.startPoint.index) + <span class="stringliteral">">"</span></div>
|
||
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">else</span>:</div>
|
||
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="keywordflow">print</span> <span class="stringliteral">" - - UNKNOWN START POINT"</span></div>
|
||
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">for</span> point <span class="keywordflow">in</span> wire.getIntermediatePoints():</div>
|
||
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | <"</span> + str(point.x) + <span class="stringliteral">","</span> + str(point.y) + <span class="stringliteral">">"</span></div>
|
||
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="keywordflow">if</span> isinstance(wire.endPoint, InstancePoint):</div>
|
||
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | <"</span> + wire.endPoint.name.getString() + <span class="stringliteral">","</span> + wire.endPoint.plug.getString() +<span class="stringliteral">">"</span></div>
|
||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">elif</span> isinstance(wire.endPoint, PortPoint):</div>
|
||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | <"</span> + str(wire.endPoint.index) + <span class="stringliteral">">"</span></div>
|
||
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keywordflow">else</span>:</div>
|
||
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">print</span> <span class="stringliteral">" - - UNKNOWN END POINT"</span></div>
|
||
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="comment"># sizing</span></div>
|
||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keywordflow">if</span> (circuit.sizing):</div>
|
||
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">print</span> <span class="stringliteral">" + sizing"</span></div>
|
||
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keywordflow">for</span> op <span class="keywordflow">in</span> circuit.sizing.getOperators():</div>
|
||
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | + instance name:"</span>, op.key, <span class="stringliteral">"- operator:"</span>, op.value.name, <span class="stringliteral">"- simulModel:"</span>, op.value.simulModel</div>
|
||
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordflow">for</span> constraint <span class="keywordflow">in</span> op.value.getConstraints():</div>
|
||
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | + param:"</span>, constraint.key, <span class="stringliteral">"- ref:"</span>, constraint.value.ref, <span class="stringliteral">"- refParam:"</span>, constraint.value.refParam, <span class="stringliteral">"- factor:"</span>, constraint.value.factor</div>
|
||
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | + equations"</span></div>
|
||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">for</span> eq <span class="keywordflow">in</span> circuit.sizing.getEquations():</div>
|
||
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | |"</span>, eq.key, <span class="stringliteral">":"</span>, eq.value</div>
|
||
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="comment"># layout</span></div>
|
||
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordflow">if</span> (circuit.layout):</div>
|
||
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="keywordflow">print</span> <span class="stringliteral">" + layout"</span></div>
|
||
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">for</span> inst <span class="keywordflow">in</span> circuit.layout.getInstances():</div>
|
||
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | | instance name:"</span>, inst.key, <span class="stringliteral">"- style:"</span>, inst.value</div>
|
||
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keywordflow">if</span> circuit.layout.hbTreeRoot != <span class="keywordtype">None</span>:</div>
|
||
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordflow">print</span> <span class="stringliteral">" | + hbtree"</span></div>
|
||
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  printHBTree(circuit.layout.hbTreeRoot, 2)</div>
|
||
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> </div>
|
||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="keyword">def </span>usage():</div>
|
||
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">print</span> <span class="stringliteral">"usage:"</span>, sys.argv[0], <span class="stringliteral">"[filename]"</span></div>
|
||
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  sys.exit(48)</div>
|
||
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span> </div>
|
||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span> <span class="keyword">def </span>main():</div>
|
||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordflow">if</span> len(sys.argv) == 1:</div>
|
||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  filename = <span class="stringliteral">"./inverter.xml"</span></div>
|
||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordflow">elif</span> len(sys.argv) == 2:</div>
|
||
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  filename = sys.argv[1]</div>
|
||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordflow">else</span>:</div>
|
||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  usage()</div>
|
||
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div>
|
||
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  circuit = Circuit.readFromFile(filename)</div>
|
||
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  printContents(circuit)</div>
|
||
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div>
|
||
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span> </div>
|
||
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> <span class="keywordflow">if</span> __name__ == <span class="stringliteral">"__main__"</span>:</div>
|
||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  main()</div>
|
||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> </div>
|
||
</div><!-- fragment --><h3><a class="anchor" id="openChamsDrivePython"></a>
|
||
Driver</h3>
|
||
<p>This python script (<code>driveOpenChams.py</code>) generates an inverter.xml file equivalent to the included one. </p>
|
||
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="keyword">from</span> OPENCHAMS <span class="keyword">import</span> *</div>
|
||
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> </div>
|
||
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> circuit = Circuit(<a class="code" href="class_name.html">Name</a>(<span class="stringliteral">"design"</span>), <a class="code" href="class_name.html">Name</a>(<span class="stringliteral">"myTech"</span>))</div>
|
||
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"># value parameters</span></div>
|
||
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> circuit.addParameter(<a class="code" href="class_name.html">Name</a>(<span class="stringliteral">"temp"</span>), 27.0 )</div>
|
||
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> circuit.addParameter(<a class="code" href="class_name.html">Name</a>(<span class="stringliteral">"Vdd"</span>) , 1.2 )</div>
|
||
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> circuit.addParameter(<a class="code" href="class_name.html">Name</a>(<span class="stringliteral">"Vss"</span>) , 0.0 )</div>
|
||
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> circuit.addParameter(<a class="code" href="class_name.html">Name</a>(<span class="stringliteral">"L"</span>) , 0.1e-6)</div>
|
||
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> circuit.addParameter(<a class="code" href="class_name.html">Name</a>(<span class="stringliteral">"Ids"</span>) , 30e-6 )</div>
|
||
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> circuit.addParameter(<a class="code" href="class_name.html">Name</a>(<span class="stringliteral">"Veg"</span>) , 0.12 )</div>
|
||
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"># equation parameters</span></div>
|
||
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> circuit.addParameter(<a class="code" href="class_name.html">Name</a>(<span class="stringliteral">"complex"</span>), <span class="stringliteral">"myEq"</span>)</div>
|
||
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div>
|
||
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"># netlist :</span></div>
|
||
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> netlist = circuit.createNetlist()</div>
|
||
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"># instances</span></div>
|
||
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"># nmos1</span></div>
|
||
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> inst_nmos1 = netlist.addDevice(<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"Transistor"</span>, 1, <span class="stringliteral">"NMOS"</span>, <span class="keyword">True</span>)</div>
|
||
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> inst_nmos1.addConnector(<span class="stringliteral">"G"</span>)</div>
|
||
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> inst_nmos1.addConnector(<span class="stringliteral">"S"</span>)</div>
|
||
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> inst_nmos1.addConnector(<span class="stringliteral">"D"</span>)</div>
|
||
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> tr_nmos1 = inst_nmos1.addTransistor(<span class="stringliteral">"m1"</span>)</div>
|
||
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> tr_nmos1.gate = <span class="stringliteral">"G"</span> <span class="comment"># the name of the connector of inst_nmos1</span></div>
|
||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> tr_nmos1.source = <span class="stringliteral">"S"</span></div>
|
||
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> tr_nmos1.drain = <span class="stringliteral">"D"</span></div>
|
||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> tr_nmos1.bulk = <span class="stringliteral">"S"</span></div>
|
||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment"># pmos1</span></div>
|
||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> inst_pmos1 = netlist.addDevice(<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"Transistor"</span>, 2, <span class="stringliteral">"PMOS"</span>, <span class="keyword">True</span>)</div>
|
||
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> inst_pmos1.addConnector(<span class="stringliteral">"G"</span>)</div>
|
||
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> inst_pmos1.addConnector(<span class="stringliteral">"S"</span>)</div>
|
||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> inst_pmos1.addConnector(<span class="stringliteral">"D"</span>)</div>
|
||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> tr_pmos1 = inst_pmos1.addTransistor(<span class="stringliteral">"m1"</span>)</div>
|
||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> tr_pmos1.gate = <span class="stringliteral">"G"</span> <span class="comment"># the name of the connector of inst_pmos1</span></div>
|
||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> tr_pmos1.source = <span class="stringliteral">"S"</span></div>
|
||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> tr_pmos1.drain = <span class="stringliteral">"D"</span></div>
|
||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> tr_pmos1.bulk = <span class="stringliteral">"S"</span></div>
|
||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="comment"># nets</span></div>
|
||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> _vdd = netlist.addNet(<span class="stringliteral">"vdd"</span>, <span class="stringliteral">"power"</span> , <span class="keyword">True</span>)</div>
|
||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> _vss = netlist.addNet(<span class="stringliteral">"vss"</span>, <span class="stringliteral">"ground"</span> , <span class="keyword">True</span>)</div>
|
||
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span> _in = netlist.addNet(<span class="stringliteral">"in"</span> , <span class="stringliteral">"logical"</span>, <span class="keyword">True</span>)</div>
|
||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> _out = netlist.addNet(<span class="stringliteral">"out"</span>, <span class="stringliteral">"logical"</span>, <span class="keyword">True</span>)</div>
|
||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> _vdd.connectTo(<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"S"</span>)</div>
|
||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> _vss.connectTo(<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"S"</span>)</div>
|
||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> _in.connectTo (<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"G"</span>)</div>
|
||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> _in.connectTo (<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"G"</span>)</div>
|
||
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> _out.connectTo(<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"D"</span>)</div>
|
||
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> _out.connectTo(<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"D"</span>)</div>
|
||
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="comment"># schematic</span></div>
|
||
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> schematic = circuit.createSchematic()</div>
|
||
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> schematic.addInstance(<span class="stringliteral">"nmos1"</span>, 2490, 2600, <span class="stringliteral">"ID"</span>)</div>
|
||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> schematic.addInstance(<span class="stringliteral">"pmos1"</span>, 2490, 2300, <span class="stringliteral">"ID"</span>)</div>
|
||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> _vdd.addPort(<span class="stringliteral">"inV"</span> , 0, 2490, 2100, <span class="stringliteral">"ID"</span>)</div>
|
||
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> _vss.addPort(<span class="stringliteral">"inV"</span> , 0, 2490, 2800, <span class="stringliteral">"MY"</span>)</div>
|
||
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span> _in.addPort (<span class="stringliteral">"inH"</span> , 0, 2190, 2500, <span class="stringliteral">"ID"</span>)</div>
|
||
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span> _out.addPort(<span class="stringliteral">"outH"</span>, 0, 2600, 2500, <span class="stringliteral">"ID"</span>)</div>
|
||
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span> wireVdd = _vdd.addWire()</div>
|
||
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span> wireVdd.setStartPoint(<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"S"</span>)</div>
|
||
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> wireVdd.setEndPoint(0)</div>
|
||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span> wireVss = _vss.addWire()</div>
|
||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> wireVss.setStartPoint(<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"S"</span>)</div>
|
||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span> wireVss.setEndPoint(0)</div>
|
||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span> wireIn0 = _in.addWire()</div>
|
||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span> wireIn1 = _in.addWire()</div>
|
||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span> wireIn0.setStartPoint(<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"G"</span>)</div>
|
||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> wireIn0.setEndPoint (<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"G"</span>)</div>
|
||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span> wireIn1.setStartPoint(0)</div>
|
||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span> wireIn1.setEndPoint (<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"G"</span>)</div>
|
||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span> wireOut0 = _out.addWire()</div>
|
||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> wireOut1 = _out.addWire()</div>
|
||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span> wireOut0.setStartPoint(<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"D"</span>)</div>
|
||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> wireOut0.setEndPoint (<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"D"</span>)</div>
|
||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> wireOut1.setStartPoint(<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"D"</span>)</div>
|
||
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> wireOut1.setEndPoint (0)</div>
|
||
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> <span class="comment"># sizing</span></div>
|
||
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> sizing = circuit.createSizing()</div>
|
||
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span> op_pmos1 = sizing.addOperator(<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"OPVG(Veg)"</span> , <span class="stringliteral">"BSIM3V3"</span>)</div>
|
||
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span> op_pmos1.addConstraint(<span class="stringliteral">"Temp"</span>, <span class="stringliteral">"design"</span>, <span class="stringliteral">"temp"</span>)</div>
|
||
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> op_pmos1.addConstraint(<span class="stringliteral">"Ids"</span> , <span class="stringliteral">"design"</span>, <span class="stringliteral">"Ids"</span> )</div>
|
||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span> op_pmos1.addConstraint(<span class="stringliteral">"L"</span> , <span class="stringliteral">"design"</span>, <span class="stringliteral">"L"</span> )</div>
|
||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> op_pmos1.addConstraint(<span class="stringliteral">"Veg"</span> , <span class="stringliteral">"design"</span>, <span class="stringliteral">"Veg"</span> )</div>
|
||
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> op_pmos1.addConstraint(<span class="stringliteral">"Vd"</span> , <span class="stringliteral">"design"</span>, <span class="stringliteral">"Vdd"</span>, 0.5)</div>
|
||
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> op_pmos1.addConstraint(<span class="stringliteral">"Vs"</span> , <span class="stringliteral">"design"</span>, <span class="stringliteral">"Vdd"</span> )</div>
|
||
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> op_nmos1 = sizing.addOperator(<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"OPW(Vg,Vs)"</span>, <span class="stringliteral">"BSIM3V3"</span>)</div>
|
||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> op_nmos1.addConstraint(<span class="stringliteral">"Temp"</span>, <span class="stringliteral">"design"</span>, <span class="stringliteral">"temp"</span>)</div>
|
||
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> op_nmos1.addConstraint(<span class="stringliteral">"Ids"</span> , <span class="stringliteral">"design"</span>, <span class="stringliteral">"Ids"</span> )</div>
|
||
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> op_nmos1.addConstraint(<span class="stringliteral">"L"</span> , <span class="stringliteral">"design"</span>, <span class="stringliteral">"L"</span> )</div>
|
||
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> op_nmos1.addConstraint(<span class="stringliteral">"Vs"</span> , <span class="stringliteral">"design"</span>, <span class="stringliteral">"Vdd"</span> )</div>
|
||
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span> op_nmos1.addConstraint(<span class="stringliteral">"Vg"</span> , <span class="stringliteral">"pmos1"</span> , <span class="stringliteral">"Vg"</span> )</div>
|
||
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span> op_nmos1.addConstraint(<span class="stringliteral">"Vd"</span> , <span class="stringliteral">"pmos1"</span> , <span class="stringliteral">"Vd"</span> )</div>
|
||
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> op_nmos1.addConstraint(<span class="stringliteral">"another"</span>, <span class="stringliteral">"myEq"</span>, -2.5 )</div>
|
||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="comment"># layout</span></div>
|
||
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span> layout = circuit.createLayout()</div>
|
||
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span> layout.addInstance(<span class="stringliteral">"pmos1"</span>, <span class="stringliteral">"Common transistor"</span>)</div>
|
||
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span> layout.addInstance(<span class="stringliteral">"nmos1"</span>, <span class="stringliteral">"Rotate transistor"</span>)</div>
|
||
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> <span class="comment"># create hbtree</span></div>
|
||
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span> g1 = Group(<span class="stringliteral">"g1"</span>)</div>
|
||
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span> g1.align = Group.Align.VERTICAL</div>
|
||
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> b1 = Bloc(<span class="stringliteral">"nmos1"</span>, Node.Position.NONE, g1)</div>
|
||
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span> g1.rootNode = b1 </div>
|
||
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> b2 = Bloc(<span class="stringliteral">"pmos1"</span>, Node.Position.TOP, b1)</div>
|
||
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> b1.top = b2</div>
|
||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> layout.hbTreeRoot = g1</div>
|
||
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div>
|
||
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span> circuit.writeToFile(<span class="stringliteral">"./myInverter.xml"</span>)</div>
|
||
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>In order to run these two scripts (<code>parseOpenChams.py</code> & driveOpenChams.py), user must ensure that $PYTHONPATH variable points to the directory containing OPENCHAMS.so module. </dd></dl>
|
||
</div></div><!-- contents -->
|
||
<br>
|
||
<hr>
|
||
<table class="footer1">
|
||
<tr>
|
||
<td class="LFooter"><small>Generated by doxygen 1.8.5 on Mon Oct 1 2018</small></td>
|
||
<td class="RFooter"><a href='#pagetop'><small>Return to top of page</small></a></td>
|
||
</tr>
|
||
</table>
|
||
<table class="footer2">
|
||
<tr>
|
||
<td class="LFooter">VLSI SAPD Documentation</td>
|
||
<td class="RFooter"><small>Copyright © 2010 - 2011 <a href="http://www.upmc.fr">UPMC</a> All rights reserved</small></td>
|
||
</tr>
|
||
</table>
|
||
</body>
|
||
</html>
|