Run Example Code

Goal : Generate a D Flip-Flop layout

In this tutorial, we are going to generate a D Flip-Flop cell with laygo2 and magic.

As the D Flip-Flop is composed of multiple subcells such as inverter and tri-state inverter, we should generate the subcell layouts before generating the DFF layout.

Step 1 : Subcell layout generation

Running the following commands in ipython generates magic TCL scripts.

ln [1]: run laygo2_example/
ln [2]: run laygo2_example/
ln [3]: run laygo2_example/
ln [4]: exit

If the generators ran successfully, you should see the highlighted files in the following figure:


The actual layouts are generated by running the TCL scripts in magic by typing the following commands:

$ ./
% source logic_generated_inv_2x.tcl
% source logic_generated_inv_4x.tcl
% source logic_generated_tinv_2x.tcl
% source logic_generated_tinv_4x.tcl
% source logic_generated_tinv_small_1x.tcl

Turn off magic if you confirmed that the subcell layouts are generated (You may see warning messages about saving the designs. You can ignore the messages, as the cells are actually generated/saved).

Step 2: DFF layout generation

Now, you can generate the DFF layout by running the following Python and TCL commands.

ln [1]: run laygo2_example/
ln [2]: exit
% source logic_generated_dff_2x.tcl
% source logic_generated_dff_4x.tcl
% load logic_generated_dff_2x
% select top cell
% expand

Now, you can see a layout of DFF as shown in the following figure.