The pins must be listed in the same order as they were added to the
submodule. Also, an assertion error will occur if there is a
mismatch in the number of net connections.
\item Do whatever else needs to be done. Add rectangles for
power/ground rails or routing, add labels, etc...
\item Every module needs to have ``self'' height and width variable
that can be accessed from outside of the module class. These
paramaters are commonly used for placing instances modules in a
layout. For library cells, the \verb|self.width| and
\verb|self.height| variables are automatically parsed from the GDSII
layout using the \verb|cell_size()| function in \verb|vlsi_layout|.
Users must define the width and height of dynamically generated
designs.
\item Add a call to the \verb|DRC_LVS()| function.
\end{itemize}
\subsection{GDSII Files and GdsMill)}
\label{sec:gds}
GDSII is the standard file used in indusrty to store the layout
information of an integrated circuit. The GDSII file is a stream file
that consists of records and data types that hold the data for the
various instances, shapes, labels, etc.. in the layout. In OpenRAM, we
utlize a nifty tool, called gdsMill, to read, write, and manipulate
GDSII files. GdsMill was developed by Michael Wieckowski at the
University of Michigan.
\subsubsection{GDSII File Format}
\label{sec:format}
The format of gds file contains several parts, as it could be shown in
Figure~\ref{fig:gds_file}.
\begin{figure}[htb]
\centering
\includegraphics[width=10cm]{./figs/gds_file}
\caption{example of a GDSII file}
\label{fig:gds_file}
\end{figure}
The first part is the gds file header, which the contains GDSII
version number, date modified, date last accessed, library, user
units, and database units.
The second part is the list of structures. These structures contain
geometries or references to other structures of the layout in
heirarchical form. Within a structure there are several kinds of
records:
\begin{itemize}
\item Rectangle - basic geometry unit in a design, represent one layer
of material in a circuit(i.e. a metal pin). Five coordinates and
layer number are stored in rectangle record.
\item Structure Reference - a structure that is used in this
structure. The information about this reference will be used store
as a structure in the same gds file.
\item Text - a text record used for labels.
\item Path - used to represent a wire.
\item Boundary - defines a filled polygon.
\item Array Reference - specifies an array of structure instances
\item Node - Electrical nets may be specified with the NODE record
\end{itemize}
The last part is the tail of the GDSII file which ends the GDS
Library.
\fixme{Provide a link to the complete GDSII specification.}
\subsubsection{GdsMill}
\label{sec:gdsmill}
As previously stated, GdsMill is a set of scripts that can be used to read, write, and manipulate GDSII files.
\paragraph{The gds2\_reader and gds2\_writer:}
In GdsMill, the \verb|gds2_reader| and \verb|gds2_writer| classes contain the various functions used to convert data between GDSII files and the \verb|vlsilayout| class. These classes process the data by iterating through every record in the GDS structures and check or write every data record. The record type (see Section~\ref{sec:format}),is tracked and identified using flags.
\fixme{Do we need more information of these classes, or should we just point to the GdsMill documentation?}
\paragraph{The VlsiLayout Class:}
\label{sec:vlsilayout}
After the \verb|gds2_reader| class reads in the records, the data has to be stored in a
way that can be easily used by our code. Thus, the
\verb|VlsiLayout| class is made to represent the layout.
\verb|VlsiLayout| contains the same information as GDSII file but in a
different way. \verb|VlsiLayout| stores records in data structures, which
are defined in \verb|gdsPrimitives.py|. Each record type has a corresponding class defined in \verb|gdsPrimitives|. Thus, a vlsilayout should at least
contains following member data:
\begin{itemize}
\item\verb|self.rootStructureName| - name of the top design.
\item\verb|self.structures| -list of structure that are used in the class.
\item\verb|self.xyTree| - contains a list of all structure names that appeared in the design.
\end{itemize}
The \verb|VlsiLayout| class also contains many functions for adding
structures and records to a layout class, but the important and most
useful functions have been aggregated into a wrapper file. This
wrapper is called \verb|geometry.py| and is located in the
\verb|compiler| directory.
\subsubsection{OpenRAM-GdsMill Interface}
\label{sec:wrapper}
Dynamically generated cells and arrays each need to build a
\verb|VlsiLayout| data structure to represent the hierarchical layout.
This is performed using various functions from the \verb|VlsiLayout|
class in GdsMill, but the GdsMill file is very large and can be
difficult to understand. To make things easier, OpenRAM has its own
wrapper class called \verb|geometry| in \verb|geometry.py|. This
wrapper class initializes data structures for the
instances and objects that will be added to the \verb|VlsiLayout|
class. The functions \verb|add_inst()|, \verb|add_rect()|,
\verb|add_label()| in \verb|hierarchy_layout|, add the structures to
the \verb|geometry| class, which is then written out to a GDSII file
using \verb|VlsiLayout| and the \verb|gds2_writer|.
User included library cells, which should be in gds files, can be used
as dynamically generated cells by using GDSMill.
Cell information such as cell size and pin location can be obtained by using
built in functions in the \verb|VlsiLayout| class.
Cell size can be finded by using the \verb|readLayoutBorder| function of the \verb|VlsiLayout| class.
A boundary layer should be drawn in each library cell to indicate the cell area.
The \verb|readLayoutBorder| function will return the width and height of the boundary.
If a boundary layer do not exist in the layout, then \verb|measureSize| can find the physical
size cell.
The first method is used as primary method in \verb|auto_Measure_libcell| the lib\_utility.py,
while the second method is used as a back up one.
Each technolgy setup will import this utility function and read the library cell.
Pin location can be find by using the \verb|readPin| function of the \verb|VlsiLayout| class.
The \verb|readPin| function will return the biggest boundary which covers the label and
is at the same layer as the label is.
\subsection{Technology Directory}
\label{sec:techdir}
The aim of creating technology directory is to make OpenRAM portable
to different technologies. This directory contains all the information
related to the specific process/technology that is being used. In
OpenRAM, the default technology is FreePDK45, which has it own
technolony directory in the trunk. The technology-specific directory