diff --git a/ihp/ihp-install-script.sh b/ihp/ihp-install-script.sh new file mode 100755 index 000000000..9d3996803 --- /dev/null +++ b/ihp/ihp-install-script.sh @@ -0,0 +1,337 @@ +#!/bin/bash +#===================================================================== +# FILE: install-ihp-openpdk.sh +# +# USAGE: ./install-ihp-openpdk.sh --install +# ./install-ihp-openpdk.sh --uninstall +# +# DESCRIPTION: Installation script for IHP Open PDK with OpenVAF +# This script is designed to be called from install-eSim.sh +# or can be run standalone after eSim/NGHDL is installed. +# +# OPTIONS: --install, --uninstall +# REQUIREMENTS: eSim/NGHDL must be installed first (for ngspice with OSDI) +# BUGS: --- +# NOTES: --- +# MENTORS: Sumanto Kar, Varad Patil, Shanti Priya K, Aditya M +# INTERNS: Akshay Rukade, Haripriyan R +# ORGANIZATION: eSim Team, FOSSEE, IIT Bombay +# CREATED: 2026-01-15 +# REVISION: 2026-01-15 +#===================================================================== + +### CONFIG ### +PDK_DIR="$HOME/ihp" +PDK_ROOT="$PDK_DIR/IHP-Open-PDK" +OPENVAF_DIR="$PDK_DIR/openvaf" +BASHRC="$HOME/.bashrc" +SPICEINIT="$HOME/.spiceinit" +NGHDL_SPINIT="$HOME/nghdl-simulator/install_dir/share/ngspice/scripts/spinit" + +export PDK_DIR PDK_ROOT OPENVAF_DIR BASHRC SPICEINIT NGHDL_SPINIT + +# Timestamp for backups +sysdate="$(date)" +timestamp=$(echo "$sysdate" | awk '{print $3"_"$2"_"$6"_"$4}') + + +### ERROR HANDLERS ### +error_exit() { + echo -e "\n\nโŒ Error! Kindly resolve above error(s) and try again." + echo -e "\nAborting IHP PDK Installation...\n" +} + +log() { + echo -e "\n๐Ÿ‘‰ $1\n" +} + + +### HELPER FUNCTIONS ### + +# Force reset directory (bulldozer mode) +force_reset_dir() { + local dir="$1" + if [[ -d "$dir" ]]; then + echo "โš ๏ธ Removing existing directory: $dir" + rm -rf "$dir" + fi + mkdir -p "$dir" +} + + +# Check if ngspice has OSDI support +check_ngspice_osdi() { + log "Checking if ngspice has OSDI support..." + + if ! command -v ngspice &> /dev/null; then + echo "โŒ ngspice not found. Please install eSim/NGHDL first." + return 1 + fi + + # Check ngspice version and OSDI support + if ngspice -v 2>&1 | grep -qi "osdi\|45"; then + log "โœ… ngspice with OSDI support detected" + return 0 + else + echo "โš ๏ธ Warning: ngspice may not have OSDI support." + echo " IHP PDK requires ngspice compiled with --enable-osdi" + read -p " Continue anyway? (y/n): " choice + if [[ "$choice" != "y" && "$choice" != "Y" ]]; then + return 1 + fi + fi + return 0 +} + + +### INSTALLATION FUNCTIONS ### + +# Install IHP-specific dependencies +install_ihp_dependencies() { + log "Installing IHP PDK dependencies..." + + sudo apt-get update -y + sudo apt-get install -y \ + build-essential cmake libtool clang \ + python3 python3-dev python3-venv \ + ruby ruby-dev tree git wget \ + klayout + + # Install Python packages in eSim's virtualenv if available + if [[ -d "$HOME/.esim/env" ]]; then + log "Using existing eSim Python virtualenv" + source "$HOME/.esim/env/bin/activate" + else + log "โš ๏ธ eSim venv not found. Installing packages globally." + fi + + pip install --upgrade pip + pip install pandas h5py PDKMaster || true + + log "โœ… IHP dependencies installed." +} + + +# Clone IHP Open PDK +install_openpdk() { + log "Cloning IHP Open-PDK..." + + force_reset_dir "$PDK_DIR" + cd "$PDK_DIR" + + git clone --recursive https://github.com/IHP-GmbH/IHP-Open-PDK.git "$PDK_ROOT" + cd "$PDK_ROOT" + git checkout dev + + # Add environment variables to .bashrc (if not already present) + if ! grep -q "IHP Open PDK" "$BASHRC"; then + echo ' +# --- IHP Open PDK Environment Variables --- +export PDK_ROOT="'"$PDK_ROOT"'" +export PDK="ihp-sg13g2" +export KLAYOUT_PATH="$HOME/.klayout:$PDK_ROOT/$PDK/libs.tech/klayout" +export KLAYOUT_HOME="$HOME/.klayout" +# --- End IHP Open PDK --- +' >> "$BASHRC" + log "Added IHP PDK environment variables to ~/.bashrc" + fi + + log "โœ… IHP Open PDK cloned successfully." +} + + +# Install OpenVAF (Verilog-A compiler) +install_openvaf() { + log "Installing OpenVAF..." + + mkdir -p "$OPENVAF_DIR" + cd "$OPENVAF_DIR" + + # Download OpenVAF binary + wget -q https://openva.fra1.cdn.digitaloceanspaces.com/openvaf_23_5_0_linux_amd64.tar.gz + tar -xzf openvaf_23_5_0_linux_amd64.tar.gz + rm openvaf_23_5_0_linux_amd64.tar.gz + + OPENVAF_BIN="$OPENVAF_DIR/openvaf" + + if [[ ! -f "$OPENVAF_BIN" ]]; then + echo "โŒ OpenVAF binary not found after extraction" + find "$OPENVAF_DIR" -type f + exit 1 + fi + + # Create symlink (remove old one first) + sudo rm -rf /usr/bin/openvaf + sudo ln -s "$OPENVAF_BIN" /usr/bin/openvaf + + # Verify installation + if openvaf --version &> /dev/null; then + log "โœ… OpenVAF installed successfully" + log " Symlink: /usr/bin/openvaf โ†’ $OPENVAF_BIN" + else + echo "โŒ OpenVAF installation verification failed" + exit 1 + fi +} + + +# Compile Verilog-A models to OSDI +compile_verilog_models() { + log "Compiling Verilog-A models to OSDI format..." + + cd "$PDK_ROOT/ihp-sg13g2/libs.tech/verilog-a" + + # Make compile script executable + chmod +x openvaf-compile-va.sh + ./openvaf-compile-va.sh + + # Verify OSDI files were created + OSDI_DIR="$PDK_ROOT/ihp-sg13g2/libs.tech/ngspice/osdi" + if ls "$OSDI_DIR"/*.osdi &> /dev/null; then + osdi_count=$(ls -1 "$OSDI_DIR"/*.osdi 2>/dev/null | wc -l) + log "โœ… Compiled $osdi_count OSDI models successfully" + else + echo "โŒ OSDI compilation failed - no .osdi files found" + exit 1 + fi +} + + +# Configure ngspice to load IHP OSDI models (adds to NGHDL spinit only) +configure_spiceinit() { + log "Configuring ngspice to load IHP OSDI models..." + + # Add to NGHDL's spinit if it exists + if [[ -f "$NGHDL_SPINIT" ]]; then + # Enable OSDI if not already enabled + if grep -q "^unset osdi_enabled" "$NGHDL_SPINIT" 2>/dev/null; then + sed -i 's/^unset osdi_enabled/set osdi_enabled/' "$NGHDL_SPINIT" + log "Enabled OSDI support in spinit" + fi + + if ! grep -q "IHP-Open-PDK" "$NGHDL_SPINIT" 2>/dev/null; then + # Add OSDI loading after the existing osdi block + echo "" >> "$NGHDL_SPINIT" + echo "* ========== IHP-Open-PDK OSDI Models ==========" >> "$NGHDL_SPINIT" + echo "if \$?osdi_enabled" >> "$NGHDL_SPINIT" + + # Add each OSDI file from IHP + for osdi_file in "$PDK_ROOT/ihp-sg13g2/libs.tech/ngspice/osdi"/*.osdi; do + if [[ -f "$osdi_file" ]]; then + echo " osdi $osdi_file" >> "$NGHDL_SPINIT" + fi + done + + echo "end" >> "$NGHDL_SPINIT" + echo "* ========== End IHP-Open-PDK ==========" >> "$NGHDL_SPINIT" + log "Added IHP OSDI models to NGHDL spinit" + else + log "IHP models already configured in NGHDL spinit" + fi + else + log "โš ๏ธ NGHDL spinit not found at $NGHDL_SPINIT" + log " Please install NGHDL first, then re-run IHP installation" + fi + + log "โœ… Spiceinit configuration complete" +} + + +### UNINSTALL FUNCTION ### + +uninstall_ihp() { + log "๐Ÿงน Removing IHP Open PDK installation..." + + # Remove PDK directory + if [[ -d "$PDK_DIR" ]]; then + rm -rf "$PDK_DIR" + echo "Removed $PDK_DIR" + fi + + # Remove OpenVAF symlink + if [[ -L "/usr/bin/openvaf" ]]; then + sudo rm -f /usr/bin/openvaf + echo "Removed /usr/bin/openvaf symlink" + fi + + # Clean up .bashrc (remove IHP section) + if grep -q "IHP Open PDK" "$BASHRC"; then + sed -i '/# --- IHP Open PDK/,/# --- End IHP Open PDK ---/d' "$BASHRC" + echo "Removed IHP entries from ~/.bashrc" + fi + + # Clean up NGHDL spinit (remove IHP section) + if [[ -f "$NGHDL_SPINIT" ]] && grep -q "IHP-Open-PDK" "$NGHDL_SPINIT"; then + sed -i '/IHP-Open-PDK/,/End IHP-Open-PDK/d' "$NGHDL_SPINIT" + echo "Removed IHP entries from NGHDL spinit" + fi + + log "โœ… IHP Open PDK uninstalled successfully" +} + + +##################################################################### +# MAIN ENTRY POINT # +##################################################################### + +# Check command line arguments +if [[ "$#" -ne 1 ]]; then + echo "USAGE:" + echo " ./install-ihp-openpdk.sh --install" + echo " ./install-ihp-openpdk.sh --uninstall" + exit 1 +fi + +case "$1" in + --install) + set -e # Exit on error + set -E # Inherit ERR trap + trap error_exit ERR + + echo "" + echo "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—" + echo "โ•‘ IHP Open PDK Installation for eSim โ•‘" + echo "โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" + echo "" + + # Check prerequisites + check_ngspice_osdi || exit 1 + + # Run installation steps + install_ihp_dependencies + install_openpdk + install_openvaf + compile_verilog_models + configure_spiceinit + + # Deactivate virtualenv if active + [[ -n "$VIRTUAL_ENV" ]] && deactivate + + echo "" + echo "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—" + echo "โ•‘ ๐ŸŽ‰ IHP Open PDK Installed Successfully! ๐ŸŽ‰ โ•‘" + echo "โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" + echo "" + echo "โžก๏ธ Reload your terminal: source ~/.bashrc" + echo "โžก๏ธ Or restart your terminal" + echo "" + echo "To test IHP PDK in ngspice:" + echo " 1. Open ngspice" + echo " 2. Load an IHP testbench" + echo "" + ;; + + --uninstall) + uninstall_ihp + ;; + + *) + echo "Invalid option: $1" + echo "USAGE:" + echo " ./install-ihp-openpdk.sh --install" + echo " ./install-ihp-openpdk.sh --uninstall" + exit 1 + ;; +esac + +exit 0 diff --git a/library/kicadLibrary/eSim-symbols/eSim_IHP.kicad_sym b/library/kicadLibrary/eSim-symbols/eSim_IHP.kicad_sym new file mode 100644 index 000000000..4bf014c20 --- /dev/null +++ b/library/kicadLibrary/eSim-symbols/eSim_IHP.kicad_sym @@ -0,0 +1,327 @@ +(kicad_symbol_lib + (version 20231120) + (generator "kicad_symbol_editor") + (generator_version "8.0") + + (symbol "sg13_lv_nmos" (pin_names (offset 0.254)) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 2.54 2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "sg13_lv_nmos" (at 2.54 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=d 2=g 3=s 4=b" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "sg13_lv_nmos_0_1" + (polyline (pts (xy 0.254 -2.54) (xy -2.032 -2.54)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 0) (xy -2.032 0)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 2.54) (xy -2.032 2.54)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy -2.032 -3.302) (xy -2.032 3.302)) (stroke (width 0.254) (type default)) (fill (type none))) + (polyline (pts (xy -2.794 -3.302) (xy -2.794 3.302)) (stroke (width 0.254) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 -2.54) (xy 0.254 -3.81) (xy 2.54 -3.81)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 2.54) (xy 0.254 3.81) (xy 2.54 3.81) (xy 2.54 5.08)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 0) (xy 2.54 0) (xy 2.54 -5.08)) (stroke (width 0) (type default)) (fill (type none))) + (circle (center 1.27 0) (radius 3.302) (stroke (width 0.254) (type default)) (fill (type background)))) + (symbol "sg13_lv_nmos_1_1" + (pin passive line (at -5.08 0 0) (length 2.286) (name "G" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))) + (pin passive line (at 2.54 7.62 270) (length 2.54) (name "D" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 2.54 -7.62 90) (length 2.54) (name "S" (effects (font (size 1.27 1.27)))) (number "3" (effects (font (size 1.27 1.27))))) + (pin passive line (at 5.08 -3.81 180) (length 2.54) (name "B" (effects (font (size 1.27 1.27)))) (number "4" (effects (font (size 1.27 1.27))))))) + + (symbol "sg13_lv_pmos" (pin_names (offset 0.254)) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 2.54 2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "sg13_lv_pmos" (at 2.54 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=d 2=g 3=s 4=b" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "sg13_lv_pmos_0_1" + (polyline (pts (xy 0.254 -2.54) (xy -2.032 -2.54)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 0) (xy -2.032 0)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 2.54) (xy -2.032 2.54)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy -2.032 -3.302) (xy -2.032 3.302)) (stroke (width 0.254) (type default)) (fill (type none))) + (polyline (pts (xy -2.794 -3.302) (xy -2.794 3.302)) (stroke (width 0.254) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 2.54) (xy 0.254 3.81) (xy 2.54 3.81)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 -2.54) (xy 0.254 -3.81) (xy 2.54 -3.81) (xy 2.54 -5.08)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.254 0) (xy 2.54 0) (xy 2.54 5.08)) (stroke (width 0) (type default)) (fill (type none))) + (circle (center -3.556 0) (radius 0.508) (stroke (width 0) (type default)) (fill (type none))) + (circle (center 1.27 0) (radius 3.302) (stroke (width 0.254) (type default)) (fill (type background)))) + (symbol "sg13_lv_pmos_1_1" + (pin passive line (at -5.08 0 0) (length 1.27) (name "G" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))) + (pin passive line (at 2.54 -7.62 90) (length 2.54) (name "D" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 2.54 7.62 270) (length 2.54) (name "S" (effects (font (size 1.27 1.27)))) (number "3" (effects (font (size 1.27 1.27))))) + (pin passive line (at 5.08 3.81 180) (length 2.54) (name "B" (effects (font (size 1.27 1.27)))) (number "4" (effects (font (size 1.27 1.27))))))) + + (symbol "sg13_hv_nmos" (extends "sg13_lv_nmos") + (property "Reference" "ihp" (at 2.54 2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "sg13_hv_nmos" (at 2.54 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "sg13_hv_pmos" (extends "sg13_lv_pmos") + (property "Reference" "ihp" (at 2.54 2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "sg13_hv_pmos" (at 2.54 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "npn13G2" (pin_names (offset 1.016) hide) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 5.08 1.905 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "npn13G2" (at 5.08 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=c 2=b 3=e 4=bn" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "npn13G2_0_1" + (polyline (pts (xy 2.54 2.54) (xy 0.508 1.27)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.508 -1.27) (xy 2.54 -2.54)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.508 -1.27) (xy 1.778 -1.778) (xy 1.27 -2.286)) (stroke (width 0) (type default)) (fill (type outline))) + (polyline (pts (xy 0.508 -2.032) (xy 0.508 2.032)) (stroke (width 0.254) (type default)) (fill (type none))) + (circle (center 1.27 0) (radius 2.8194) (stroke (width 0.254) (type default)) (fill (type background)))) + (symbol "npn13G2_1_1" + (pin passive line (at 2.54 5.08 270) (length 2.54) (name "C" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin input line (at -2.54 0 0) (length 3.048) (name "B" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))) + (pin passive line (at 2.54 -5.08 90) (length 2.54) (name "E" (effects (font (size 1.27 1.27)))) (number "3" (effects (font (size 1.27 1.27))))) + (pin passive line (at 5.08 0 180) (length 2.54) (name "BN" (effects (font (size 1.27 1.27)))) (number "4" (effects (font (size 1.27 1.27))))))) + + (symbol "npn13G2_5t" (pin_names (offset 1.016) hide) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 5.08 1.905 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "npn13G2_5t" (at 5.08 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=c 2=b 3=e 4=bn 5=t" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "npn13G2_5t_0_1" + (polyline (pts (xy 2.54 2.54) (xy 0.508 1.27)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.508 -1.27) (xy 2.54 -2.54)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.508 -1.27) (xy 1.778 -1.778) (xy 1.27 -2.286)) (stroke (width 0) (type default)) (fill (type outline))) + (polyline (pts (xy 0.508 -2.032) (xy 0.508 2.032)) (stroke (width 0.254) (type default)) (fill (type none))) + (circle (center 1.27 0) (radius 2.8194) (stroke (width 0.254) (type default)) (fill (type background)))) + (symbol "npn13G2_5t_1_1" + (pin passive line (at 2.54 5.08 270) (length 2.54) (name "C" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin input line (at -2.54 0 0) (length 3.048) (name "B" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))) + (pin passive line (at 2.54 -5.08 90) (length 2.54) (name "E" (effects (font (size 1.27 1.27)))) (number "3" (effects (font (size 1.27 1.27))))) + (pin passive line (at 5.08 1.27 180) (length 2.54) (name "BN" (effects (font (size 1.27 1.27)))) (number "4" (effects (font (size 1.27 1.27))))) + (pin passive line (at 5.08 -1.27 180) (length 2.54) (name "T" (effects (font (size 1.27 1.27)))) (number "5" (effects (font (size 1.27 1.27))))))) + + (symbol "npn13G2l" (extends "npn13G2") + (property "Reference" "ihp" (at 5.08 1.905 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "npn13G2l" (at 5.08 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "npn13G2l_5t" (extends "npn13G2_5t") + (property "Reference" "ihp" (at 5.08 1.905 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "npn13G2l_5t" (at 5.08 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "npn13G2v" (extends "npn13G2") + (property "Reference" "ihp" (at 5.08 1.905 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "npn13G2v" (at 5.08 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "npn13G2v_5t" (extends "npn13G2_5t") + (property "Reference" "ihp" (at 5.08 1.905 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "npn13G2v_5t" (at 5.08 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "pnpMPA" (pin_names (offset 1.016) hide) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 5.08 1.905 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "pnpMPA" (at 5.08 0 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=c 2=b 3=e" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "pnpMPA_0_1" + (polyline (pts (xy 0.508 1.27) (xy 2.54 2.54)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 2.54 -2.54) (xy 0.508 -1.27)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 0.508 1.27) (xy 1.27 2.286) (xy 1.778 1.778)) (stroke (width 0) (type default)) (fill (type outline))) + (polyline (pts (xy 0.508 -2.032) (xy 0.508 2.032)) (stroke (width 0.254) (type default)) (fill (type none))) + (circle (center 1.27 0) (radius 2.8194) (stroke (width 0.254) (type default)) (fill (type background)))) + (symbol "pnpMPA_1_1" + (pin passive line (at 2.54 -5.08 90) (length 2.54) (name "C" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin input line (at -2.54 0 0) (length 3.048) (name "B" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))) + (pin passive line (at 2.54 5.08 270) (length 2.54) (name "E" (effects (font (size 1.27 1.27)))) (number "3" (effects (font (size 1.27 1.27))))))) + + (symbol "cap_cmim" (pin_numbers hide) (pin_names (offset 0.254) hide) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 0.635 2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "cap_cmim" (at 0.635 -2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=PLUS 2=MINUS" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "cap_cmim_0_1" + (polyline (pts (xy -2.032 -0.762) (xy 2.032 -0.762)) (stroke (width 0.508) (type default)) (fill (type none))) + (polyline (pts (xy -2.032 0.762) (xy 2.032 0.762)) (stroke (width 0.508) (type default)) (fill (type none)))) + (symbol "cap_cmim_1_1" + (pin passive line (at 0 3.81 270) (length 2.794) (name "~" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -3.81 90) (length 2.794) (name "~" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))))) + + (symbol "cap_rfcmim" (pin_numbers hide) (pin_names (offset 0.254) hide) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 0.635 2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "cap_rfcmim" (at 0.635 -2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=PLUS 2=MINUS 3=bn" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "cap_rfcmim_0_1" + (polyline (pts (xy -2.032 -0.762) (xy 2.032 -0.762)) (stroke (width 0.508) (type default)) (fill (type none))) + (polyline (pts (xy -2.032 0.762) (xy 2.032 0.762)) (stroke (width 0.508) (type default)) (fill (type none)))) + (symbol "cap_rfcmim_1_1" + (pin passive line (at 0 3.81 270) (length 2.794) (name "+" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -3.81 90) (length 2.794) (name "-" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))) + (pin passive line (at 3.81 0 180) (length 2.54) (name "BN" (effects (font (size 1.27 1.27)))) (number "3" (effects (font (size 1.27 1.27))))))) + + (symbol "cparasitic" (extends "cap_cmim") + (property "Reference" "ihp" (at 0.635 2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Value" "cparasitic" (at 0.635 -2.54 0) (effects (font (size 1.27 1.27)) (justify left))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "rsil" (pin_numbers hide) (pin_names (offset 0)) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 2.032 0 90) (effects (font (size 1.27 1.27)))) + (property "Value" "rsil" (at -1.524 0 90) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=1 2=2 3=bn" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "rsil_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) (stroke (width 0.254) (type default)) (fill (type none)))) + (symbol "rsil_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) (name "~" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -3.81 90) (length 1.27) (name "~" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))) + (pin passive line (at 3.81 0 180) (length 2.794) (name "BN" (effects (font (size 1.27 1.27)))) (number "3" (effects (font (size 1.27 1.27))))))) + + (symbol "rhigh" (extends "rsil") + (property "Reference" "ihp" (at 2.032 0 90) (effects (font (size 1.27 1.27)))) + (property "Value" "rhigh" (at -1.524 0 90) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "rppd" (extends "rsil") + (property "Reference" "ihp" (at 2.032 0 90) (effects (font (size 1.27 1.27)))) + (property "Value" "rppd" (at -1.524 0 90) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "Rparasitic" (pin_numbers hide) (pin_names (offset 0)) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 2.032 0 90) (effects (font (size 1.27 1.27)))) + (property "Value" "Rparasitic" (at -1.524 0 90) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=1 2=2" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "Rparasitic_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) (stroke (width 0.254) (type default)) (fill (type none)))) + (symbol "Rparasitic_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) (name "~" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -3.81 90) (length 1.27) (name "~" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))))) + + (symbol "ptap1" (extends "Rparasitic") + (property "Reference" "ihp" (at 2.032 0 90) (effects (font (size 1.27 1.27)))) + (property "Value" "ptap1" (at -1.524 0 90) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "ntap1" (extends "Rparasitic") + (property "Reference" "ihp" (at 2.032 0 90) (effects (font (size 1.27 1.27)))) + (property "Value" "ntap1" (at -1.524 0 90) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "dantenna" (pin_numbers hide) (pin_names (offset 1.016) hide) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 0 2.54 0) (effects (font (size 1.27 1.27)))) + (property "Value" "dantenna" (at 0 -2.54 0) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=1 2=2" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "dantenna_0_1" + (polyline (pts (xy -1.27 1.27) (xy -1.27 -1.27)) (stroke (width 0.254) (type default)) (fill (type none))) + (polyline (pts (xy 1.27 0) (xy -1.27 0)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 1.27 1.27) (xy 1.27 -1.27) (xy -1.27 0) (xy 1.27 1.27)) (stroke (width 0.254) (type default)) (fill (type none)))) + (symbol "dantenna_1_1" + (pin passive line (at 3.81 0 180) (length 2.54) (name "A" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at -3.81 0 0) (length 2.54) (name "C" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))))) + + (symbol "dpantenna" (extends "dantenna") + (property "Reference" "ihp" (at 0 2.54 0) (effects (font (size 1.27 1.27)))) + (property "Value" "dpantenna" (at 0 -2.54 0) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "ddnwpsub" (pin_numbers hide) (pin_names (offset 1.016)) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 0 2.54 0) (effects (font (size 1.27 1.27)))) + (property "Value" "ddnwpsub" (at 0 -2.54 0) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=NWell 2=bn" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "ddnwpsub_0_1" + (polyline (pts (xy -1.27 1.27) (xy -1.27 -1.27)) (stroke (width 0.254) (type default)) (fill (type none))) + (polyline (pts (xy 1.27 0) (xy -1.27 0)) (stroke (width 0) (type default)) (fill (type none))) + (polyline (pts (xy 1.27 1.27) (xy 1.27 -1.27) (xy -1.27 0) (xy 1.27 1.27)) (stroke (width 0.254) (type default)) (fill (type none)))) + (symbol "ddnwpsub_1_1" + (pin passive line (at 3.81 0 180) (length 2.54) (name "NW" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at -3.81 0 0) (length 2.54) (name "BN" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))))) + + (symbol "dpwdnw" (extends "ddnwpsub") + (property "Reference" "ihp" (at 0 2.54 0) (effects (font (size 1.27 1.27)))) + (property "Value" "dpwdnw" (at 0 -2.54 0) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide))) + + (symbol "isolbox" (pin_names (offset 1.016)) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 0 5.08 0) (effects (font (size 1.27 1.27)))) + (property "Value" "isolbox" (at 0 -5.08 0) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=isosub 2=NWell 3=bn" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "isolbox_0_1" + (rectangle (start -3.81 3.81) (end 3.81 -3.81) (stroke (width 0.254) (type default)) (fill (type background)))) + (symbol "isolbox_1_1" + (pin passive line (at -6.35 1.27 0) (length 2.54) (name "ISUB" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at -6.35 -1.27 0) (length 2.54) (name "NW" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))) + (pin passive line (at 6.35 0 180) (length 2.54) (name "BN" (effects (font (size 1.27 1.27)))) (number "3" (effects (font (size 1.27 1.27))))))) + + (symbol "nmoscl_2" (pin_names (offset 1.016)) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 0 5.08 0) (effects (font (size 1.27 1.27)))) + (property "Value" "nmoscl_2" (at 0 -5.08 0) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=VDD 2=VSS" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "nmoscl_2_0_1" + (rectangle (start -3.81 3.81) (end 3.81 -3.81) (stroke (width 0.254) (type default)) (fill (type background))) + (text "CL2" (at 0 0 0) (effects (font (size 1.27 1.27))))) + (symbol "nmoscl_2_1_1" + (pin power_in line (at 0 6.35 270) (length 2.54) (name "VDD" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin power_in line (at 0 -6.35 90) (length 2.54) (name "VSS" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))))) + + (symbol "nmoscl_4" (pin_names (offset 1.016)) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 0 5.08 0) (effects (font (size 1.27 1.27)))) + (property "Value" "nmoscl_4" (at 0 -5.08 0) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=VDD 2=VSS" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "nmoscl_4_0_1" + (rectangle (start -3.81 3.81) (end 3.81 -3.81) (stroke (width 0.254) (type default)) (fill (type background))) + (text "CL4" (at 0 0 0) (effects (font (size 1.27 1.27))))) + (symbol "nmoscl_4_1_1" + (pin power_in line (at 0 6.35 270) (length 2.54) (name "VDD" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))) + (pin power_in line (at 0 -6.35 90) (length 2.54) (name "VSS" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))))) + + (symbol "bondpad" (pin_names (offset 1.016)) (exclude_from_sim no) (in_bom yes) (on_board yes) + (property "Reference" "ihp" (at 0 3.81 0) (effects (font (size 1.27 1.27)))) + (property "Value" "bondpad" (at 0 -3.81 0) (effects (font (size 1.27 1.27)))) + (property "Footprint" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Device" "SUBCKT" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (property "Sim.Pins" "1=PAD" (at 0 0 0) (effects (font (size 1.27 1.27)) hide)) + (symbol "bondpad_0_1" + (rectangle (start -2.54 2.54) (end 2.54 -2.54) (stroke (width 0.254) (type default)) (fill (type background)))) + (symbol "bondpad_1_1" + (pin passive line (at -5.08 0 0) (length 2.54) (name "PAD" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))))) +) diff --git a/library/kicadLibrary/template/sym-lib-table b/library/kicadLibrary/template/sym-lib-table index bfc9be70e..8920e291f 100644 --- a/library/kicadLibrary/template/sym-lib-table +++ b/library/kicadLibrary/template/sym-lib-table @@ -214,6 +214,7 @@ (lib (name "eSim_Ngveri")(type "KiCad")(uri "${KICAD6_SYMBOL_DIR}/eSim_Ngveri.kicad_sym")(options "")(descr "")) (lib (name "eSim_Plot")(type "KiCad")(uri "${KICAD6_SYMBOL_DIR}/eSim_Plot.kicad_sym")(options "")(descr "")) (lib (name "eSim_Power")(type "KiCad")(uri "${KICAD6_SYMBOL_DIR}/eSim_Power.kicad_sym")(options "")(descr "")) + (lib (name "eSim_IHP")(type "KiCad")(uri "${KICAD6_SYMBOL_DIR}/eSim_IHP.kicad_sym")(options "")(descr "IHP SG13G2 Open PDK Symbols")) (lib (name "eSim_SKY130")(type "KiCad")(uri "${KICAD6_SYMBOL_DIR}/eSim_SKY130.kicad_sym")(options "")(descr "")) (lib (name "eSim_SKY130_Subckts")(type "KiCad")(uri "${KICAD6_SYMBOL_DIR}/eSim_SKY130_Subckts.kicad_sym")(options "")(descr "")) (lib (name "eSim_Sources")(type "KiCad")(uri "${KICAD6_SYMBOL_DIR}/eSim_Sources.kicad_sym")(options "")(descr "")) diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 66f8a7c0f..8f9240f88 100755 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -641,6 +641,55 @@ def addDeviceLibrary(self, schematicInfo, kicadFile): # print("Found Library line") index = schematicInfo.index(eachline) completeLibPath = deviceLibList[words[0]] + + # Handle IHP components + # Detection: ihp prefix, sg13/npn13 in model, or known IHP device names + model_name = words[-1].lower() if len(words) > 1 else "" + ihp_known_devices = ['rppd', 'rhigh', 'rsil', 'ptap1', 'ntap1', + 'dantenna', 'dpantenna', 'isolbox', 'pnpmpa', + 'nmoscl_2', 'nmoscl_4', 'cparasitic', 'dpwdnw', 'ddnwpsub'] + is_ihp_device = ( + eachline[0:3] == 'ihp' or + 'sg13' in model_name or + 'npn13' in model_name or + model_name.startswith('cap_') or + model_name in ihp_known_devices + ) + + if is_ihp_device and eachline[0:7] != 'ihpmode': + # Parse the per-device tracking data: lib_path:corner:params + ihp_parts = completeLibPath.split(':') + ihp_lib_path = ihp_parts[0] if len(ihp_parts) > 0 else "" + ihp_corner = ihp_parts[1] if len(ihp_parts) > 1 else "mos_tt" + ihp_params = ihp_parts[2] if len(ihp_parts) > 2 else "" + + print("==============================================") + print(f"IHP Device: {words[0]}") + print(f" Library: {ihp_lib_path}") + print(f" Corner: {ihp_corner}") + print(f" Params: {ihp_params}") + + # Add .lib include for this device's corner + if ihp_lib_path and os.path.exists(ihp_lib_path): + lib_include = f'.lib "{ihp_lib_path}" {ihp_corner}' + if lib_include not in includeLine: + includeLine.append(lib_include) + print(f" Added: {lib_include}") + + # Convert ihp prefix to xihp and add params + words[0] = words[0].replace('ihp', 'xihp') + if ihp_params: + words.append(ihp_params) + deviceLine[index] = words + print("==============================================") + continue + + # Legacy ihpmode handling (for backward compatibility) + if eachline[0:7] == 'ihpmode': + deviceLine[index] = "*ihpmode (legacy)" + continue + + # Standard processing for non-IHP components (libpath, libname) = os.path.split(completeLibPath) # print("Library Path :", libpath) # Copying library from devicemodelLibrary to Project Path diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index ccbe89865..07adce3ac 100755 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -68,7 +68,24 @@ def __init__(self, schematicInfo, clarg1): self.grid = QtWidgets.QGridLayout() self.setLayout(self.grid) # print("Reading Device model details from Schematic") - if "sky130" in " ".join(schematicInfo): + # Check for IHP SG13G2 PDK first - be specific to avoid false matches + # Look for component lines starting with 'ihp' or models containing 'sg13_' + has_ihp = False + for line in schematicInfo: + words = line.split() + if len(words) >= 2: + # Check if reference starts with 'ihp' (ihp1, ihp2, etc.) + if words[0].startswith('ihp'): + has_ihp = True + break + # Check if model name contains 'sg13_' (sg13_lv_nmos, etc.) + if 'sg13_' in words[-1].lower(): + has_ihp = True + break + + if has_ihp: + self.eSim_ihp(schematicInfo) + elif "sky130" in " ".join(schematicInfo): self.eSim_sky130(schematicInfo) else: self.eSim_general_libs(schematicInfo) @@ -246,6 +263,310 @@ def eSim_sky130(self, schematicInfo): self.show() + def eSim_ihp(self, schematicInfo): + """ + Handle IHP SG13G2 PDK components. + Each IHP device gets its own library selection UI with: + - Library path + Add/Add Default buttons + - Corner selection dropdown + - Device parameters (W, L, nf) + """ + # IHP Corner options for different device types + self.ihp_corner_options = { + 'mos': ['mos_tt', 'mos_ff', 'mos_ss', 'mos_sf', 'mos_fs'], + 'res': ['res_typ', 'res_bcs', 'res_wcs'], + 'cap': ['cap_typ', 'cap_bcs', 'cap_wcs'], + 'dio': ['dio_tt', 'dio_ss', 'dio_ff'], + 'hbt': ['hbt_typ', 'hbt_bcs', 'hbt_wcs'], + } + + # Map model names to (corner_file, corner_type) + # This enables auto-detection of the correct corner library + self.ihp_model_to_corner = { + # MOS Low-Voltage + 'sg13_lv_nmos': ('cornerMOSlv.lib', 'mos'), + 'sg13_lv_pmos': ('cornerMOSlv.lib', 'mos'), + 'nmoscl_2': ('cornerMOSlv.lib', 'mos'), + 'nmoscl_4': ('cornerMOSlv.lib', 'mos'), + # MOS High-Voltage + 'sg13_hv_nmos': ('cornerMOShv.lib', 'mos'), + 'sg13_hv_pmos': ('cornerMOShv.lib', 'mos'), + # Resistors + 'rppd': ('cornerRES.lib', 'res'), + 'rhigh': ('cornerRES.lib', 'res'), + 'rsil': ('cornerRES.lib', 'res'), + 'ptap1': ('cornerRES.lib', 'res'), + 'ntap1': ('cornerRES.lib', 'res'), + 'rparasitic': ('cornerRES.lib', 'res'), + # Capacitors + 'cap_cmim': ('cornerCAP.lib', 'cap'), + 'cap_rfcmim': ('cornerCAP.lib', 'cap'), + 'cparasitic': ('cornerCAP.lib', 'cap'), + # Diodes + 'dantenna': ('cornerDIO.lib', 'dio'), + 'dpantenna': ('cornerDIO.lib', 'dio'), + 'dpwdnw': ('cornerDIO.lib', 'dio'), + 'ddnwpsub': ('cornerDIO.lib', 'dio'), + 'isolbox': ('cornerDIO.lib', 'dio'), + # HBT (Bipolar) + 'npn13g2': ('cornerHBT.lib', 'hbt'), + 'npn13g2_5t': ('cornerHBT.lib', 'hbt'), + 'npn13g2l': ('cornerHBT.lib', 'hbt'), + 'npn13g2l_5t': ('cornerHBT.lib', 'hbt'), + 'npn13g2v': ('cornerHBT.lib', 'hbt'), + 'npn13g2v_5t': ('cornerHBT.lib', 'hbt'), + 'pnpmpa': ('cornerHBT.lib', 'hbt'), + } + + # Process each IHP component + for eachline in schematicInfo: + words = eachline.split() + if len(words) < 2: + continue + + # Skip non-IHP components and comments + if eachline[0] == '*' or eachline[0] == '.': + continue + + # Check if this is an IHP device + # Detection methods: + # 1. Reference starts with 'ihp' prefix + # 2. Model name is in our mapping dictionary + # 3. Model contains 'sg13' or 'npn13' or known IHP names + model_name = words[-1].lower() if len(words) > 1 else "" + is_ihp_device = ( + eachline[0:3] == 'ihp' or # Reference prefix + model_name in self.ihp_model_to_corner or # Known model + 'sg13' in model_name or # SG13 MOS + 'npn13' in model_name or # HBT + model_name.startswith('cap_') or # Capacitors + model_name in ['rppd', 'rhigh', 'rsil', 'ptap1', 'ntap1', + 'dantenna', 'dpantenna', 'isolbox', 'pnpmpa'] + ) + + # Skip ihpmode marker lines (legacy support) + if eachline[0:7] == 'ihpmode': + continue + + if not is_ihp_device: + continue + + print("=========================================") + print("IHP Device found:", eachline) + + device_ref = words[0] # e.g., ihp1 + device_model = words[-1] # e.g., sg13_lv_pmos + + # Determine corner file based on model + corner_file, corner_type = self.ihp_model_to_corner.get( + device_model.lower(), ('cornerMOSlv.lib', 'mos')) + + # Create device panel + self.devicemodel_dict_beg[device_ref] = self.count + self.deviceDetail[self.count] = device_ref + + ihpbox = QtWidgets.QGroupBox() + ihpgrid = QtWidgets.QGridLayout() + beg = self.count + + ihpbox.setTitle(f"IHP Device: {device_ref} ({device_model})") + + row = 0 + + # Row 1: Library Path with Add and Add Default buttons + self.parameterLabel[self.count] = QtWidgets.QLabel("Library Path:") + ihpgrid.addWidget(self.parameterLabel[self.count], row, 0) + + self.entry_var[self.count] = QtWidgets.QLineEdit() + self.entry_var[self.count].setReadOnly(True) + self.entry_var[self.count].setObjectName(f"{beg}") + + # Store corner file info for this device + self.entry_var[self.count].setProperty("corner_file", corner_file) + self.entry_var[self.count].setProperty("device_ref", device_ref) + + # Load previous value OR set default + lib_path_set = False + for child in self.root: + if child.tag == device_ref: + try: + if child[0].text and os.path.exists(child[0].text): + self.entry_var[self.count].setText(child[0].text) + lib_path_set = True + except: + pass + + # If no previous value, auto-fill with default path + if not lib_path_set: + pdk_root = os.environ.get('PDK_ROOT', + os.path.expanduser('~/ihp/IHP-Open-PDK')) + default_lib_path = os.path.join(pdk_root, + "ihp-sg13g2/libs.tech/ngspice/models", corner_file) + if os.path.exists(default_lib_path): + self.entry_var[self.count].setText(default_lib_path) + + ihpgrid.addWidget(self.entry_var[self.count], row, 1) + + # Add button + addbtn = QtWidgets.QPushButton("Add") + addbtn.setObjectName(f"{beg}") + addbtn.clicked.connect(self.trackIHPDeviceLibrary) + ihpgrid.addWidget(addbtn, row, 2) + + # Add Default button + adddefaultbtn = QtWidgets.QPushButton("Default") + adddefaultbtn.setObjectName(f"{beg}") + adddefaultbtn.setProperty("corner_file", corner_file) + adddefaultbtn.clicked.connect(self.trackDefaultIHPDeviceLib) + ihpgrid.addWidget(adddefaultbtn, row, 3) + + self.count += 1 + row += 1 + + # Row 2: Corner Selection Dropdown + self.parameterLabel[self.count] = QtWidgets.QLabel("Corner:") + ihpgrid.addWidget(self.parameterLabel[self.count], row, 0) + + corner_combo = QtWidgets.QComboBox() + corner_combo.setObjectName(f"{beg}") + corner_combo.addItems(self.ihp_corner_options.get(corner_type, ['mos_tt'])) + corner_combo.setCurrentIndex(0) # Default to first (typ/tt) + + # Load previous corner if exists + for child in self.root: + if child.tag == device_ref: + try: + if child[1].text: + idx = corner_combo.findText(child[1].text) + if idx >= 0: + corner_combo.setCurrentIndex(idx) + except: + pass + + corner_combo.currentTextChanged.connect(self.ihpCornerChanged) + self.entry_var[self.count] = corner_combo + ihpgrid.addWidget(corner_combo, row, 1) + + self.count += 1 + row += 1 + + # Row 3: Device Parameters (W, L, nf) + self.parameterLabel[self.count] = QtWidgets.QLabel("Parameters:") + ihpgrid.addWidget(self.parameterLabel[self.count], row, 0) + + param_entry = QtWidgets.QLineEdit() + param_entry.setPlaceholderText("e.g., W=1u L=130n nf=1") + param_entry.setObjectName(f"{beg}") + + # Load previous parameters if exists + for child in self.root: + if child.tag == device_ref: + try: + if child[2].text: + param_entry.setText(child[2].text) + except: + pass + + param_entry.textChanged.connect(self.ihpParamChanged) + self.entry_var[self.count] = param_entry + ihpgrid.addWidget(param_entry, row, 1, 1, 3) + + # Track this device with default values + lib_path = self.entry_var[beg].text() + corner = corner_combo.currentText() + params = param_entry.text() + if lib_path: + self.obj_trac.deviceModelTrack[device_ref] = f"{lib_path}:{corner}:{params}" + + ihpbox.setLayout(ihpgrid) + ihpbox.setStyleSheet(""" + QGroupBox { border: 1px solid #4a86c7; border-radius: 9px; + margin-top: 0.5em; background-color: #f0f8ff; } + QGroupBox::title { subcontrol-origin: margin; left: 10px; + padding: 0 3px 0 3px; color: #2c5aa0; } + """) + self.grid.addWidget(ihpbox) + + self.row += 1 + self.devicemodel_dict_end[device_ref] = self.count + self.count += 1 + + self.show() + + def trackDefaultIHPDeviceLib(self): + """Set default IHP PDK library path for a specific device.""" + sending_btn = self.sender() + self.widgetObjCount = int(sending_btn.objectName()) + corner_file = sending_btn.property("corner_file") + + # Build default path + pdk_root = os.environ.get('PDK_ROOT', + os.path.expanduser('~/ihp/IHP-Open-PDK')) + lib_path = os.path.join(pdk_root, + "ihp-sg13g2/libs.tech/ngspice/models", corner_file) + + self.entry_var[self.widgetObjCount].setText(lib_path) + self.deviceName = self.deviceDetail[self.widgetObjCount] + + # Get corner from combo (next widget) + corner = self.entry_var[self.widgetObjCount + 1].currentText() + # Get params (next next widget) + params = self.entry_var[self.widgetObjCount + 2].text() + + self.obj_trac.deviceModelTrack[self.deviceName] = f"{lib_path}:{corner}:{params}" + print(f"IHP Default set: {self.deviceName} -> {self.obj_trac.deviceModelTrack[self.deviceName]}") + + def trackIHPDeviceLibrary(self): + """Browse for IHP PDK library file for a specific device.""" + sending_btn = self.sender() + self.widgetObjCount = int(sending_btn.objectName()) + + self.libfile = QtCore.QDir.toNativeSeparators( + QtWidgets.QFileDialog.getOpenFileName( + self, "Select IHP Corner Library File", + os.path.expanduser("~/ihp"), + "Library Files (*.lib);;All Files (*)" + )[0] + ) + + if not self.libfile: + return + + self.entry_var[self.widgetObjCount].setText(self.libfile) + self.deviceName = self.deviceDetail[self.widgetObjCount] + + # Get corner and params + corner = self.entry_var[self.widgetObjCount + 1].currentText() + params = self.entry_var[self.widgetObjCount + 2].text() + + self.obj_trac.deviceModelTrack[self.deviceName] = f"{self.libfile}:{corner}:{params}" + print(f"IHP Library set: {self.deviceName} -> {self.obj_trac.deviceModelTrack[self.deviceName]}") + + def ihpCornerChanged(self, corner): + """Handle IHP corner selection change.""" + sending_combo = self.sender() + beg = int(sending_combo.objectName()) + self.deviceName = self.deviceDetail[beg] + + lib_path = self.entry_var[beg].text() + params = self.entry_var[beg + 2].text() + + if lib_path: + self.obj_trac.deviceModelTrack[self.deviceName] = f"{lib_path}:{corner}:{params}" + print(f"IHP Corner changed: {self.deviceName} -> {corner}") + + def ihpParamChanged(self, params): + """Handle IHP parameter change.""" + sending_entry = self.sender() + beg = int(sending_entry.objectName()) + self.deviceName = self.deviceDetail[beg] + + lib_path = self.entry_var[beg].text() + corner = self.entry_var[beg + 1].currentText() + + if lib_path: + self.obj_trac.deviceModelTrack[self.deviceName] = f"{lib_path}:{corner}:{params}" + def eSim_general_libs(self, schematicInfo): for eachline in schematicInfo: print("=========================================") @@ -703,7 +1024,18 @@ def textChange(self): # str(self.entry_var[self.widgetObjCount].text()) + \ # ":" + "W=" + width + " L=" + length + " M=" + multifactor - if self.deviceName[0:6] == 'scmode': + if self.deviceName[0:7] == 'ihpmode': + # IHP mode: path:corner format + self.obj_trac.deviceModelTrack[self.deviceName] = \ + self.entry_var[self.widgetObjCount].text() + \ + ":" + str(self.entry_var[self.widgetObjCount + 1].text()) + print("IHP mode tracked:", self.obj_trac.deviceModelTrack[self.deviceName]) + elif self.deviceName[0:3] == 'ihp': + # IHP component: store parameters directly (e.g., W=1u L=130n nf=1) + self.obj_trac.deviceModelTrack[self.deviceName] = str( + self.entry_var[self.widgetObjCount].text()) + print("IHP component tracked:", self.obj_trac.deviceModelTrack[self.deviceName]) + elif self.deviceName[0:6] == 'scmode': self.obj_trac.deviceModelTrack[self.deviceName] = \ self.entry_var[self.widgetObjCount].text() + \ ":" + str(self.entry_var[self.widgetObjCount + 1].text()) diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index e018143fe..8f371637a 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -612,8 +612,13 @@ def callConvert(self): end = obj_devicemodel.devicemodel_dict_end[device] while it <= end: - ET.SubElement(attr_var, "field").text = \ - str(obj_devicemodel.entry_var[it].text()) + widget = obj_devicemodel.entry_var[it] + # Handle both QComboBox (uses currentText) and QLineEdit (uses text) + if hasattr(widget, 'currentText'): + widget_text = str(widget.currentText()) + else: + widget_text = str(widget.text()) + ET.SubElement(attr_var, "field").text = widget_text it = it + 1 # Writing Subcircuit values diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py index 11c95965c..94de9440c 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -138,7 +138,8 @@ def insertSpecialSourceParam(self, schematicInfo, sourcelist): words = compline.split() compName = words[0] # Ask for parameters of source - if compName[0] == 'v' or compName[0] == 'i': + # Skip IHP components that start with 'ihp' (not current sources) + if (compName[0] == 'v' or compName[0] == 'i') and not compName.startswith('ihp'): # Find the index component from circuit index = schematicInfo.index(compline) if words[3] == "pulse":