<p>The <b>Caltech Intermediate Format (CIF)</b> consists in a limited set of graphic primitives used to describe the shapes on each layer of an integrated circuit (see <ahref="http://en.wikipedia.org/wiki/Caltech_Intermediate_Form">http://en.wikipedia.org/wiki/Caltech_Intermediate_Form</a> for more informations). <br/>
<p>Although the CIF format allows hierarchical description and supports several shapes, in this driver, we do not use hierarchy and only use Polygons.</p>
<li><aclass="el"href="class_c_i_f_1_1_circuit.html">CIF::Circuit</a> contains all CIF circuit informations such as the name, the unit used, the scale and the list of all Polygons.</li>
<li><aclass="el"href="class_c_i_f_1_1_polygon.html">CIF::Polygon</a> describes a Polygon (a set of points).</li>
<p>To drive a CIF file, user has to create one <aclass="el"href="class_c_i_f_1_1_circuit.html">CIF::Circuit</a> and as many <aclass="el"href="class_c_i_f_1_1_polygon.html">CIF::Polygon</a> as the number of shapes of the layout. The <aclass="el"href="class_c_i_f_1_1_polygon.html">CIF::Polygon</a> objects can be created independently from for the <aclass="el"href="class_c_i_f_1_1_circuit.html">CIF::Circuit</a> but must be finally added to the <aclass="el"href="class_c_i_f_1_1_circuit.html">CIF::Circuit</a> using <aclass="el"href="class_c_i_f_1_1_circuit.html#a5b37e86206e2a128ba6db4987dc09a39"title="adds a Polygon to the Circuit. ">CIF::Circuit::addPolygon()</a>.<br/>
Once the <aclass="el"href="class_c_i_f_1_1_circuit.html">CIF::Circuit</a> is complete, simply call the <aclass="el"href="class_c_i_f_1_1_circuit.html#a90c823b70c4984f302c19ceca604d101"title="writes the database to file. ">CIF::Circuit::writeToFile()</a> method to drive the database to file.</p>
<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 two simple code examples to drive a CIF file using C++ or Python. These two examples drive the same file <code>transistor.cif:</code></p><divclass="fragment"><divclass="line">(CIF file written on 11-Jun-2010 13:49:44 by VLSISAPD_CIF_DRIVER);</div><divclass="line">(Units: micro - UU/DB Scale: 0.001);</div><divclass="line">DS 1 1 1;</div><divclass="line">9 Transistor;</div><divclass="line">L 6; P 130,290 540,290 540,690 130,690;</div><divclass="line">L 17; P 305,150 365,150 365,830 305,830;</div><divclass="line">DF;</div><divclass="line">C 1;</div><divclass="line">E</div></div><!-- fragment --><divclass="image">
<p>Here is the C++ code (<code>driveCif.cpp</code>) used to generate the transistor.cif file. (Source is available in examples directory). </p><divclass="fragment"><divclass="line"><spanclass="preprocessor">#include <string></span></div><divclass="line"><spanclass="keyword">using namespace </span><aclass="code"href="namespacestd.html">std</a>;</div><divclass="line"></div><divclass="line"><spanclass="preprocessor">#include "vlsisapd/cif/Circuit.h"</span></div><divclass="line"><spanclass="preprocessor">#include "vlsisapd/cif/Polygon.h"</span></div><divclass="line"></div><divclass="line"><spanclass="keywordtype">int</span> main(<spanclass="keywordtype">int</span> argc, <spanclass="keywordtype">char</span> * argv[]) {</div><divclass="line"><aclass="code"href="class_c_i_f_1_1_circuit.html">CIF::Circuit</a>* circuit = <spanclass="keyword">new</span><aclass="code"href="class_c_i_f_1_1_circuit.html">CIF::Circuit</a>(<spanclass="keywordtype">string</span>(<spanclass="stringliteral">"Transistor"</span>), <spanclass="keywordtype">string</span>(<spanclass="stringliteral">"micro"</span>), 0.001);</div><divclass="line"></div><divclass="line"><spanclass="comment">// Layer #6 corresponds to active</span></div><divclass="line"><aclass="code"href="class_c_i_f_1_1_polygon.html">CIF::Polygon</a>* poly = <spanclass="keyword">new</span><aclass="code"href="class_c_i_f_1_1_polygon.html">CIF::Polygon</a>(6);</div><divclass="line"> poly-><aclass="code"href="class_c_i_f_1_1_polygon.html#ab3047469780327f18539907e1303ea15">addPoint</a>(130, 290);</div><divclass="line"> poly-><aclass="code"href="class_c_i_f_1_1_polygon.html#ab3047469780327f18539907e1303ea15">addPoint</a>(540, 290);</div><divclass="line"> poly-><aclass="code"href="class_c_i_f_1_1_polygon.html#ab3047469780327f18539907e1303ea15">addPoint</a>(540, 690);</div><divclass="line"> poly-><aclass="code"href="class_c_i_f_1_1_polygon.html#ab3047469780327f18539907e1303ea15">addPoint</a>(130, 690);</div><divclass="line"> circuit-><aclass="code"href="class_c_i_f_1_1_circuit.html#a5b37e86206e2a128ba6db4987dc09a39">addPolygon</a>(poly);</div><divclass="line"></div><divclass="line"><spanclass="comment">// Layer #17 corresponds to polysilicium</span></div><divclass="line"> poly = <spanclass="keyword">new</span><aclass="code"href="class_c_i_f_1_1_polygon.html">CIF::Polygon</a>(17);</div><divclass="line"> poly-><aclass="code"href="class_c_i_f_1_1_polygon.html#ab3047469780327f18539907e1303ea15">addPoint</a>(305, 150);</div><divclass="line"> poly-><aclass="code"href="class_c_i_f_1_1_polygon.html#ab3047469780327f18539907e1303ea15">addPoint</a>(365, 150);</div><divclass="line"> poly-><aclass="code"href="class_c_i_f_1_1_polygon.html#ab3047469780327f18539907e1303ea15">addPoint</a>(365, 830);</div><divclass="line"> poly-><aclass="code"href="class_c_i_f_1_1_polygon.html#ab3047469780327f18539907e1303ea15">addPoint</a>(305, 830);</div><divclass="line"> circuit-><aclass="code"href="class_c_i_f_1_1_circuit.html#a5b37e86206e2a128ba6db4987dc09a39">addPolygon</a>(poly);</div><divclass="line"></div><divclass="line"> circuit-><aclass="code"href="class_c_i_f_1_1_circuit.html#a90c823b70c4984f302c19ceca604d101">writeToFile</a>(<spanclass="stringliteral">"./transistor.cif"</span>);</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">return</span> 0;</div><divclass="line">}</div><divclass="line"></div></div><!-- fragment --><dlclass="section note"><dt>Note</dt><dd>In order to compile this code, 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: <divclass="fragment"><divclass="line">%> mkdir build; cd build</div><divclass="line">%> cmake ..</div><divclass="line">%> make</div></div><!-- fragment --></dd></dl>
<p>Here is the Python code (<code>driveCif.py</code>) used to generate the transistor.cif file. (Source is available in examples directory). </p><divclass="fragment"><divclass="line"><spanclass="keyword">import</span> CIF</div><divclass="line">circuit = <aclass="code"href="class_c_i_f_1_1_circuit.html">CIF.Circuit</a>(<spanclass="stringliteral">"Transistor"</span>, <spanclass="stringliteral">"micro"</span>, 0.001)</div><divclass="line">poly1 = <aclass="code"href="class_c_i_f_1_1_polygon.html">CIF.Polygon</a>(6)</div><divclass="line">poly1.addPoint(130, 290)</div><divclass="line">poly1.addPoint(540, 290)</div><divclass="line">poly1.addPoint(540, 690)</div><divclass="line">poly1.addPoint(130, 690)</div><divclass="line">circuit.addPolygon(poly1)</div><divclass="line"></div><divclass="line">poly2 = <aclass="code"href="class_c_i_f_1_1_polygon.html">CIF.Polygon</a>(17)</div><divclass="line">poly2.addPoint(305, 150);</div><divclass="line">poly2.addPoint(365, 150);</div><divclass="line">poly2.addPoint(365, 830);</div><divclass="line">poly2.addPoint(305, 830);</div><divclass="line">circuit.addPolygon(poly2)</div><divclass="line"></div><divclass="line">circuit.writeToFile(<spanclass="stringliteral">"./transistor.cif"</span>)</div></div><!-- fragment --><dlclass="section note"><dt>Note</dt><dd>In order to run the <code>driveCif.py</code> script, user must ensure that $PYTHONPATH variable points to the directory containing CIF.so module. </dd></dl>