Simple framework for physical chip design (place & route) based on KLayout.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

74 lines
2.0 KiB

<?xml version="1.0" encoding="utf-8"?>
<klayout-macro>
<description/>
<version/>
<category>pymacros</category>
<prolog/>
<epilog/>
<doc/>
<autorun>false</autorun>
<autorun-early>false</autorun-early>
<shortcut/>
<show-in-menu>false</show-in-menu>
<group-name/>
<menu-path/>
<interpreter>python</interpreter>
<dsl-interpreter-name/>
<text>"""
Load Python libraries and setup logging.
"""
import pya
import pya as db
import sys
import importlib
try:
# Test if the klayout-pnr Python package can be found.
import kpnr
importlib.reload(kpnr)
except ImportError as e:
python_version = sys.version[0:3]
pya.MessageBox.warning("Error", """`klayout-pnr` python module not installed (or not in the required version).
Please install with:
git clone https://codeberg.org/libreda/klayout-pnr
cd klayout-pnr
python{} setup.py develop --user
""".format(python_version), pya.MessageBox.Ok)
exit()
from liberty.parser import parse_liberty
from typing import Dict, List, Tuple
from kpnr.placer.quadratic_placer import QuadraticPlacer
from kpnr.placer.quadratic_placer_with_density_penalty import QuadraticDensityPlacer
from kpnr.legalizer.tetris import TetrisLegalizer
from kpnr.legalizer.annealing_legalizer import AnnealingLegalizer
from kpnr.netlist.verilog_reader import VerilogNetlistReader
from kpnr.netlist.liberty_reader import LibertyNetlistReader
from kpnr.test_data import *
from kpnr.netlist import util as net_util
from kpnr.layout import pin_detection
from kpnr.layout import polygon_label
from kpnr.simple_design import SimpleDesign
import math
import itertools
import collections
import os
import logging
import numpy as np
# Set up logging.
try:
logger
except:
# Setup logger if it does not yet exist.
logger = logging.getLogger(__name__)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
handler.setFormatter(logging.Formatter(fmt='%(module)s %(levelname)s\t%(message)s'))
logger.addHandler(handler)</text>
</klayout-macro>