<p>The <b>Ascii Graphic Database System (AGDS)</b> format is an ascii (text) version of the wellknown and industry standard GDS II binary format. This format hierarchicaly represents geometric shapes, labels and other layout informations (see <ahref="http://en.wikipedia.org/wiki/GDSII">http://en.wikipedia.org/wiki/GDSII</a> for more informations). <br/>
The ascii format has several advantages versus binary format:</p><ul>
<p>The conversion from Ascii GDS to binary GDS and vice versa can be done with <b>OwlVision GDSII Viewer</b> available at <ahref="http://owlvision.org">http://owlvision.org</a><br/>
<li><aclass="el"href="class_a_g_d_s_1_1_library.html">AGDS::Library</a> contains all AGDS library informations such as the name, the units used (user and physical) and the list of all Structures.</li>
<li><aclass="el"href="class_a_g_d_s_1_1_structure.html">AGDS::Structure</a> describes a GDS Structure with a name and a list of Elements.</li>
<li><aclass="el"href="class_a_g_d_s_1_1_element.html">AGDS::Element</a> is an abstract class from which derived the <aclass="el"href="class_a_g_d_s_1_1_rectangle.html">AGDS::Rectangle</a>.</li>
<li><aclass="el"href="class_a_g_d_s_1_1_rectangle.html">AGDS::Rectangle</a> describes a rectangle element of a structure.</li>
<p>To drive an AGDS file, user has to create one <aclass="el"href="class_a_g_d_s_1_1_library.html">AGDS::Library</a> and add <aclass="el"href="class_a_g_d_s_1_1_structure.html">AGDS::Structure</a> objects to it with the <aclass="el"href="class_a_g_d_s_1_1_library.html#a93d333a20154e0b688ff3ff213039171"title="adds a Structure to the Library. ">AGDS::Library::addStructure()</a> method. Each <aclass="el"href="class_a_g_d_s_1_1_structure.html">AGDS::Structure</a> contains at least one <aclass="el"href="class_a_g_d_s_1_1_element.html">AGDS::Element</a> added with <aclass="el"href="class_a_g_d_s_1_1_structure.html#a2dd203e6770f7d15d6f706867c919a60"title="adds an Element to the Structure. ">AGDS::Structure::addElement()</a> method.<br/>
All objects can be independently created as far as they are correctly added to their parent. <br/>
Once the library is completely specified, simply call the <aclass="el"href="class_a_g_d_s_1_1_library.html#a33b9d989b84857f46034085664ff3fa2"title="writes the database to file. ">AGDS::Library::writeToFile()</a> method to drive the database to file.</p>
<p>Here is the C++ code (<code>driveAgds.cpp</code>) used to generate the transistor.agds 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/agds/Library.h"</span></div><divclass="line"><spanclass="preprocessor">#include "vlsisapd/agds/Structure.h"</span></div><divclass="line"><spanclass="preprocessor">#include "vlsisapd/agds/Rectangle.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_a_g_d_s_1_1_library.html">AGDS::Library</a>* lib = <spanclass="keyword">new</span><aclass="code"href="class_a_g_d_s_1_1_library.html">AGDS::Library</a>(<spanclass="keywordtype">string</span>(<spanclass="stringliteral">"myTestLib"</span>));</div><divclass="line"></div><divclass="line"> lib-><aclass="code"href="class_a_g_d_s_1_1_library.html#a0d0e972bb142f892c462bb8d7f04a50b">setUserUnits</a>(0.001);</div><divclass="line"> lib-><aclass="code"href="class_a_g_d_s_1_1_library.html#a938acb6eb8d14aade9dba7331c75ff0a">setPhysUnits</a>(1.0E-9);</div><divclass="line"></div><divclass="line"><aclass="code"href="class_a_g_d_s_1_1_rectangle.html">AGDS::Rectangle</a>* poly = <spanclass="keyword">new</span><aclass="code"href="class_a_g_d_s_1_1_rectangle.html">AGDS::Rectangle</a>( 17, 305, 150, 365, 830 );</div><divclass="line"><aclass="code"href="class_a_g_d_s_1_1_rectangle.html">AGDS::Rectangle</a>* active = <spanclass="keyword">new</span><aclass="code"href="class_a_g_d_s_1_1_rectangle.html">AGDS::Rectangle</a>( 6, 130, 290, 540, 690 );</div><divclass="line"></div><divclass="line"><aclass="code"href="class_a_g_d_s_1_1_structure.html">AGDS::Structure</a>* str = <spanclass="keyword">new</span><aclass="code"href="class_a_g_d_s_1_1_structure.html">AGDS::Structure</a>(<spanclass="stringliteral">"Transistor"</span>);</div><divclass="line"></div><divclass="line"> str-><aclass="code"href="class_a_g_d_s_1_1_structure.html#a2dd203e6770f7d15d6f706867c919a60">addElement</a>(poly);</div><divclass="line"> str-><aclass="code"href="class_a_g_d_s_1_1_structure.html#a2dd203e6770f7d15d6f706867c919a60">addElement</a>(active);</div><divclass="line"></div><divclass="line"> lib-><aclass="code"href="class_a_g_d_s_1_1_library.html#a93d333a20154e0b688ff3ff213039171">addStructure</a>(str);</div><divclass="line"></div><divclass="line"> lib-><aclass="code"href="class_a_g_d_s_1_1_library.html#a33b9d989b84857f46034085664ff3fa2">writeToFile</a>(<spanclass="stringliteral">"./transistor.agds"</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>driveAgds.py</code>) used to generate the transistor.agds file. (Source is available in examples directory). </p><divclass="fragment"><divclass="line">import AGDS</div><divclass="line">lib = <aclass="code"href="class_a_g_d_s_1_1_library.html">AGDS.Library</a>(<spanclass="stringliteral">"myTestLib"</span>)</div><divclass="line">lib.setUserUnits(0.001)</div><divclass="line">lib.setPhysUnits(1.0e-9)</div><divclass="line"></div><divclass="line">active = <aclass="code"href="class_a_g_d_s_1_1_rectangle.html">AGDS.Rectangle</a>( 6, 120, 290, 540, 690) <spanclass="comment"># layer 6 corresponds to active</span></div><divclass="line">poly = <aclass="code"href="class_a_g_d_s_1_1_rectangle.html">AGDS.Rectangle</a>(17, 305, 150, 365, 830) <spanclass="comment"># layer 17 corresponds to polysilicium</span></div><divclass="line"></div><divclass="line">str = <aclass="code"href="class_a_g_d_s_1_1_structure.html">AGDS.Structure</a>(<spanclass="stringliteral">"Transistor"</span>)</div><divclass="line">str.addElement(active)</div><divclass="line">str.addElement(poly)</div><divclass="line"></div><divclass="line">lib.addStructure(str)</div><divclass="line">lib.writeToFile(<spanclass="stringliteral">"./transistor.agds"</span>)</div></div><!-- fragment --><dlclass="section note"><dt>Note</dt><dd>In order to run the <code>driveAgds.py</code> script, user must ensure that $PYTHONPATH variable points to the directory containing AGDS.so module. </dd></dl>