.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_openfpga_clock_tree/02_create_simple_htree.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_openfpga_clock_tree_02_create_simple_htree.py: ================================== Create H-Tree Connectivity pattern ================================== This example demonstrate how to genrate different connection pattern for routing global signals. By default this library support basic fishbone and HTree patterns, which can be extended to create desired connectivity usng transformations like ``rotate``, ``transalate``, ``margin``, ``merge``, ``scale`` and ``sample`` **Output** .. image:: ../../../examples/OpenFPGA_clock_tree/_htree_pattern.svg :width: 500px :align: center .. GENERATED FROM PYTHON SOURCE LINES 20-49 .. code-block:: Python from spydrnet_physical.util import ConnectionPattern WIDTH = 33 WIDTH_F = 33 HEIGHT = 33 p_manager = ConnectionPattern(WIDTH, HEIGHT) htree_pattern = p_manager.connections htree_pattern.cursor = (int(WIDTH/2)+1, 0) htree_pattern.move_y(steps=int(WIDTH/2)+1) htree_pattern.merge(p_manager.get_htree(WIDTH)) while WIDTH > 6: for x in range(int(WIDTH/4)+1, WIDTH_F, int(WIDTH/2)): for y in range(int(WIDTH/4)+1, WIDTH_F, int(WIDTH/2)): htree_pattern.merge(p_manager.get_htree( int(WIDTH/2)).translate(x-int(WIDTH/4), y-int(WIDTH/4))) WIDTH = int(WIDTH/2)+1 svg = p_manager.render_pattern(title="HTree Pattern") # Highlight the clock sink point for y in range(2, WIDTH_F, 2): for x in range(2, WIDTH_F, 2): p_manager.svg_main.add(svg.rect( color="red", opacity="0.1", insert=(x*20 - 10, y*20 - 10), size=(20, 20))) svg.saveas("_htree_pattern.svg", pretty=True, indent=4) .. _sphx_glr_download_auto_openfpga_clock_tree_02_create_simple_htree.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 02_create_simple_htree.ipynb <02_create_simple_htree.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 02_create_simple_htree.py <02_create_simple_htree.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 02_create_simple_htree.zip <02_create_simple_htree.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_