From 3300433f40906e7bc8bf5c330aefa9471eae47ab Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Fri, 22 Sep 2023 03:26:08 -0300 Subject: [PATCH 01/10] Updated dependencies and added gitattributes --- .gitattributes | 10 +++ base/desktop.Dockerfile | 2 +- compile.bat | 52 +++++++++++++++ run.bat | 139 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 compile.bat create mode 100644 run.bat diff --git a/.gitattributes b/.gitattributes index 2d83761..62e06ab 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,11 @@ +# Auto detect text files and perform LF normalization +* text=auto .png filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.sh text eol=lf +*.bat text eol=crlf +desktopinit text eol=lf +klayout text eol=lf +setwallpaper text eol=lf +startserver text eol=lf +*.desktop text eol=lf diff --git a/base/desktop.Dockerfile b/base/desktop.Dockerfile index 08f7ce1..7bb9ac6 100644 --- a/base/desktop.Dockerfile +++ b/base/desktop.Dockerfile @@ -6,7 +6,7 @@ FROM greyltc/archlinux-aur:paru RUN pacman -Syuq --noconfirm # Install packages -RUN aur-install sudo git git-lfs python python-pip python-pipx xz gnu-free-fonts vim ngspice gedit jupyter-notebook +RUN aur-install sudo git git-lfs python python-pip python-pipx xz gnu-free-fonts vim ngspice gedit jupyter-lab xterm # Clean cache RUN pacman -Scc diff --git a/compile.bat b/compile.bat new file mode 100644 index 0000000..c28922b --- /dev/null +++ b/compile.bat @@ -0,0 +1,52 @@ +@echo off +setlocal + +SET STACK=analog-xk + +SET DOCKER_USER=akilesalreadytaken +SET DOCKER_IMAGE=analog-tools +SET DOCKER_TAG=latest + + +SET CALL=call +:parse + IF /I ""%1""=="""" GOTO run + IF /I ""%1""==""--help"" GOTO documentation + IF /I ""%1""==""-h"" GOTO documentation + IF /I ""%1""==""--dry"" ( SET "CALL=echo" ) + IF /I ""%1""==""-s"" ( SET "CALL=echo" ) + IF /I ""%1""==""--path"" ( SET "DESIGNS=%~2" && SHIFT ) + IF /I ""%1""==""-p"" ( SET "DESIGNS=%~2" && SHIFT ) + SHIFT + GOTO parse + + +:documentation + echo Usage: run.bat %~nx0 [-h^|--help] [-s^|--dry-run] + GOTO end + + +:run + SET TAG=%DOCKER_USER%/%DOCKER_IMAGE% + IF DEFINED DOCKER_TAG SET TAG=%TAG%:%DOCKER_TAG% + + %CALL% docker build --rm -t osicstacks-base-desktop -f base/desktop.Dockerfile . + %CALL% docker build --rm -t osicstacks-base-web -f base/web.Dockerfile . + %CALL% docker build --rm --build-arg BASE_IMG=osicstacks-base-web --target %STACK%-desktop -t %DOCKER_USER%/%STACK%:latest -f stacks/%STACK%.Dockerfile . + ::%CALL% docker build --rm --build-arg BASE_IMG=%DOCKER_USER%/%STACK%:latest -t %TAG% -f stacks/analog/Dockerfile + GOTO end + +:end + endlocal + + +:normalizepath + SET DESIGNS=%~f1 + EXIT /B + + +:: Get DISPLAY from WSL +::wsl --exec bash --norc -c 'echo $DISPLAY' + +:: Get current path of batsh script +::SET BATCH_PATH=%~dpnx0 \ No newline at end of file diff --git a/run.bat b/run.bat new file mode 100644 index 0000000..1b5eccb --- /dev/null +++ b/run.bat @@ -0,0 +1,139 @@ +@echo off +setlocal + +SET IMAGE=akilesalreadytaken/analog-xk:latest + +SET CALL=call +:parse + IF /I ""%1""=="""" GOTO run + IF /I ""%1""==""--help"" GOTO documentation + IF /I ""%1""==""-h"" GOTO documentation + IF /I ""%1""==""--dry"" ( SET "CALL=echo" ) + IF /I ""%1""==""-s"" ( SET "CALL=echo" ) + IF /I ""%1""==""--path"" ( SET "DESIGNS=%~2" && SHIFT ) + IF /I ""%1""==""-p"" ( SET "DESIGNS=%~2" && SHIFT ) + SHIFT + GOTO parse + + +:documentation + echo Usage: run.bat %~nx0 [-h^|--help] [-s^|--dry-run] [-p^|--path PATH] + GOTO end + + +:run + :: Set fixed parameters + ::::::::::::::::::::::::::: + IF NOT DEFINED DESIGNS SET DESIGNS=%CD% + CALL :NORMALIZEPATH %DESIGNS% + + IF NOT DEFINED PDK SET PDK=gf180mcuC + + IF NOT DEFINED DOCKER_USER SET DOCKER_USER=git.1159.cl/mario1159 + IF NOT DEFINED DOCKER_IMAGE SET DOCKER_IMAGE=analog-xk + IF NOT DEFINED DOCKER_TAG SET DOCKER_TAG=latest + + IF NOT DEFINED CONTAINER_USER SET CONTAINER_USER=1000 + IF NOT DEFINED CONTAINER_GROUP SET CONTAINER_GROUP=1000 + + IF NOT DEFINED CONTAINER_NAME SET CONTAINER_NAME=analog-tools + + IF NOT DEFINED JUPYTER_PORT SET JUPYTER_PORT=8888 + IF NOT DEFINED VNC_PORT SET VNC_PORT=8444 + + :: Get parameters from wsl + :::::::::::::::::::::::::: + SET WSL_GET_DISPLAY=wsl --exec bash --norc -c "echo $DISPLAY" + FOR /F "USEBACKQ" %%i IN (`%WSL_GET_DISPLAY%`) DO ( SET "DISPLAY=%%i" ) + + SET WSL_GET_WAYLAND_DISPLAY=wsl --exec bash --norc -c "echo $WAYLAND_DISPLAY" + FOR /F "USEBACKQ" %%i IN (`%WSL_GET_WAYLAND_DISPLAY%`) DO ( SET "WAYLAND_DISPLAY=%%i" ) + + :: Validate parameters + :::::::::::::::::::::: + IF %CONTAINER_USER% NEQ 0 IF %CONTAINER_USER% LSS 1000 ( + echo WARNING: Selected User ID %CONTAINER_USER% is below 1000. This ID might interfere with User-IDs inside the container and cause undefined behaviour! + ) + IF %CONTAINER_GROUP% NEQ 0 IF %CONTAINER_GROUP% LSS 1000 ( + echo WARNING: Selected Group ID %CONTAINER_GROUP% is below 1000. This ID might interfere with Group-IDs inside the container and cause undefined behaviour! + ) + + :: Attach to existing container + ::::::::::::::::::::::::::::::: + docker container inspect %CONTAINER_NAME% 2>&1 | find "Status" | find /i "running" + IF NOT ERRORLEVEL 1 ( + ECHO Container %CONTAINER_NAME% is running! + ECHO Stop with "docker stop %CONTAINER_NAME%" + ECHO Remove with "docker rm %CONTAINER_NAME%" if required. + GOTO attach_shell + ) + docker container inspect %CONTAINER_NAME% 2>&1 | find "Status" | find /i "exited" + IF NOT ERRORLEVEL 1 ( + ECHO Container %CONTAINER_NAME% exists. + ECHO Restart with "docker start %CONTAINER_NAME%" + ECHO Or remove with "docker rm %CONTAINER_NAME%" if required. + GOTO restart_shell + ) + + :: Set environment, variables and run the container + :::::::::::::::::::::::::::::::::::::::::::::::::::: + echo Check requirements + %CALL% wsl --install Ubuntu --no-launch + %CALL% wsl --update + + echo Container does not exist, creating %CONTAINER_NAME% ... + + SET PARAMS=-d + @REM SET PARAMS=%PARAMS% --user %CONTAINER_USER%:%CONTAINER_GROUP% + SET PARAMS=%PARAMS% --name %CONTAINER_NAME% + @REM SET PARAMS=%PARAMS% --security-opt seccomp=unconfined + SET PARAMS=%PARAMS% -p %JUPYTER_PORT%:8888 + SET PARAMS=%PARAMS% -p %VNC_PORT%:8444 + SET PARAMS=%PARAMS% -v "%DESIGNS%":/home/designer/shared + SET PARAMS=%PARAMS% -v \\wsl.localhost\Ubuntu\mnt\wslg:/tmp + SET PARAMS=%PARAMS% -e DISPLAY=%DISPLAY% + SET PARAMS=%PARAMS% -e WAYLAND_DISPLAY=%WAYLAND_DISPLAY% + SET PARAMS=%PARAMS% -e XDG_RUNTIME_DIR=/mnt/wslg + SET PARAMS=%PARAMS% -e PDK=%PDK% + + IF NOT DEFINED IMAGE ( + SET IMAGE=%DOCKER_USER%/%DOCKER_IMAGE% + IF DEFINED DOCKER_TAG SET IMAGE=%IMAGE%:%DOCKER_TAG% + ) + + @REM SET COMMAND=jupyter-lab --no-browser + @REM SET COMMAND=sudo vncserver -select-de xfce + @REM SET COMMAND=sleep infinity + @REM SET COMMAND=bash + + @echo on + %CALL% docker run %PARAMS% %IMAGE% %COMMAND% + @echo off + + GOTO attach_shell + + +:attach_shell + %CALL% docker exec -it %CONTAINER_NAME% bash + GOTO end + + +:restart_shell + %CALL% docker start %CONTAINER_NAME% + GOTO attach_shell + + +:end + endlocal + + +:normalizepath + SET DESIGNS=%~f1 + EXIT /B + + +:: Get DISPLAY from WSL +::wsl --exec bash --norc -c 'echo $DISPLAY' + +:: Get current path of batsh script +::SET BATCH_PATH=%~dpnx0 \ No newline at end of file From 9d7bc55291b0ddf1d4477295516b4e5991a1c697 Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Fri, 22 Sep 2023 04:02:53 -0300 Subject: [PATCH 02/10] Added new image stage --- base/desktop.Dockerfile | 2 +- compile.bat | 4 +- run.bat | 2 +- stacks/analog-tools/Dockerfile | 12 + stacks/analog-tools/scripts/.bashrc | 29 ++ .../scripts/iic-spice-model-red.py | 133 +++++++ .../analog-tools/scripts/install-open-pdks.sh | 63 ++++ stacks/analog-tools/scripts/xschemrc | 336 ++++++++++++++++++ 8 files changed, 577 insertions(+), 4 deletions(-) create mode 100644 stacks/analog-tools/Dockerfile create mode 100644 stacks/analog-tools/scripts/.bashrc create mode 100644 stacks/analog-tools/scripts/iic-spice-model-red.py create mode 100644 stacks/analog-tools/scripts/install-open-pdks.sh create mode 100644 stacks/analog-tools/scripts/xschemrc diff --git a/base/desktop.Dockerfile b/base/desktop.Dockerfile index 7bb9ac6..5648cb1 100644 --- a/base/desktop.Dockerfile +++ b/base/desktop.Dockerfile @@ -6,7 +6,7 @@ FROM greyltc/archlinux-aur:paru RUN pacman -Syuq --noconfirm # Install packages -RUN aur-install sudo git git-lfs python python-pip python-pipx xz gnu-free-fonts vim ngspice gedit jupyter-lab xterm +RUN aur-install sudo git git-lfs python python-pip python-pipx xz gnu-free-fonts vim ngspice gedit jupyterlab xterm # Clean cache RUN pacman -Scc diff --git a/compile.bat b/compile.bat index c28922b..a5971d0 100644 --- a/compile.bat +++ b/compile.bat @@ -32,8 +32,8 @@ SET CALL=call %CALL% docker build --rm -t osicstacks-base-desktop -f base/desktop.Dockerfile . %CALL% docker build --rm -t osicstacks-base-web -f base/web.Dockerfile . - %CALL% docker build --rm --build-arg BASE_IMG=osicstacks-base-web --target %STACK%-desktop -t %DOCKER_USER%/%STACK%:latest -f stacks/%STACK%.Dockerfile . - ::%CALL% docker build --rm --build-arg BASE_IMG=%DOCKER_USER%/%STACK%:latest -t %TAG% -f stacks/analog/Dockerfile + %CALL% docker build --rm --build-arg BASE_IMG=osicstacks-base-web --target %STACK%-web -t %DOCKER_USER%/%STACK%:latest -f stacks/%STACK%.Dockerfile . + %CALL% docker build --rm --build-arg BASE_IMG=%DOCKER_USER%/%STACK%:latest -t %TAG% -f stacks/analog-tools/Dockerfile GOTO end :end diff --git a/run.bat b/run.bat index 1b5eccb..80e7b7a 100644 --- a/run.bat +++ b/run.bat @@ -2,6 +2,7 @@ setlocal SET IMAGE=akilesalreadytaken/analog-xk:latest +SET IMAGE=akilesalreadytaken/analog-tools:latest SET CALL=call :parse @@ -104,7 +105,6 @@ SET CALL=call @REM SET COMMAND=jupyter-lab --no-browser @REM SET COMMAND=sudo vncserver -select-de xfce @REM SET COMMAND=sleep infinity - @REM SET COMMAND=bash @echo on %CALL% docker run %PARAMS% %IMAGE% %COMMAND% diff --git a/stacks/analog-tools/Dockerfile b/stacks/analog-tools/Dockerfile new file mode 100644 index 0000000..18904a0 --- /dev/null +++ b/stacks/analog-tools/Dockerfile @@ -0,0 +1,12 @@ +ARG BASE_IMG=analog-xk +FROM $BASE_IMG as analog-tools + +# Add scripts +COPY scripts/* . + +RUN ./install-open-pdks.sh + +RUN rm *.sh + +# Initialize the enviroment keeping container alive +CMD ["sleep", "infinity"] \ No newline at end of file diff --git a/stacks/analog-tools/scripts/.bashrc b/stacks/analog-tools/scripts/.bashrc new file mode 100644 index 0000000..bb92fd1 --- /dev/null +++ b/stacks/analog-tools/scripts/.bashrc @@ -0,0 +1,29 @@ +[[ $- != *i* ]] && return + +case "$PDK" in +gf180mcuC) + export PDKPATH=$PDK_ROOT/$PDK + export STD_CELL_LIBRARY=gf180mcu_fd_sc_mcu7t5v0 + ;; +sky130A) + export PDKPATH=$PDK_ROOT/$PDK + export STD_CELL_LIBRARY=sky130_fd_sc_hd + ;; +*) + echo "PDK not defined, using default one (gf180mcuC)" + export PDK=gf180mcuC + export PDKPATH=$PDK_ROOT/$PDK + export STD_CELL_LIBRARY=gf180mcu_fd_sc_mcu7t5v0 + ;; +esac + + +alias ls="ls --color=auto -XA" +alias grep="grep --color=auto" + +PS1="[\u@\h \W]\$ " + +## Tools Support + +alias xschem='xschem -b --rcfile $PDKPATH/libs.tech/xschem/xschemrc' +alias xschemtcl='xschem --rcfile $PDKPATH/libs.tech/xschem/xschemrc' \ No newline at end of file diff --git a/stacks/analog-tools/scripts/iic-spice-model-red.py b/stacks/analog-tools/scripts/iic-spice-model-red.py new file mode 100644 index 0000000..544b4e0 --- /dev/null +++ b/stacks/analog-tools/scripts/iic-spice-model-red.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python3 +# ======================================================================== +# SPDX-FileCopyrightText: 2021-2022 Harald Pretl +# Johannes Kepler University, Institute for Integrated Circuits +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# SPDX-License-Identifier: Apache-2.0 +# +# This script traverses SPICE model files (e.g. from SKY130) and +# extracts only the wanted model section, removes all comments and +# empty lines, and resolves all includes so that a flat model file +# results. This should speed up ngspice starts. +# ======================================================================== + +import sys,re,os + +def process_file(file_in_name, top_file): + global is_warning + try: + f_in = open(file_in_name, 'r') + except FileNotFoundError: + print('Warning! File ' + file_in_name + ' not found.') + is_warning = True + return; + + # process_file can be called recursively, so that nested include + # files can be traversed + + # write_active indicates whether we are in the right model section; in + # include files, it is always true + + if top_file == True: + write_active = False + else: + write_active = True + + for line in f_in: + line_trim = (line.lower()).strip() + + if top_file == True: + # we assume that .lib statements are only used in the main file + if '.lib' in line_trim: + if model_section in line_trim: + write_active = True + else: + write_active = False + + if '.endl' == line_trim: + write_active = False + f_out.write(line) + + if len(line_trim) > 0: # write no empty lines + if (line_trim[0] != '*'): # write no comments + if (write_active == True): + if '.include' in line_trim: + # need to save and restore working dir so that nested + # includes work + current_wd = os.getcwd() + newfile = re.findall(r'"(.*?)(? 0: + try: + os.chdir(new_wd) + except OSError: + print('Warning: Could not enter directory ' + new_wd) + is_warning = True + + # traverse into new include file + new_file_name = os.path.basename(newfile[0]) + process_file(new_file_name, False) + + # restore old working dir after return + os.chdir(current_wd) + else: + f_out.write(line) + + f_in.close() + return; + +# main routine + +if len(sys.argv) == 3: + model_section = sys.argv[2] +else: + model_section = 'tt' + +if (len(sys.argv) == 2) or (len(sys.argv) == 3): + infile_name = sys.argv[1] + outfile_name = infile_name + '.' + model_section + '.red' + + try: + f_out = open(outfile_name, 'w') + except OSError: + print('Error: Cannot write file ' + outfile_name + '.') + sys.exit(1) + + is_warning = False + process_file(infile_name, True) + f_out.close() + + print() + print('Model file ' + outfile_name + ' written.') + if is_warning == True: + print('There have been warnings! Please check output log.') + sys.exit(0) + else: + sys.exit(0) +else: + print() + print('iic-spice-model-red.py SPICE model file reducer') + print(' (c) 2021 Harald Pretl, JKU') + print() + print('Usage: iic-spice-model-red [corner] (default corner = tt)') + print() + print('Return codes for script automation:') + print(' 0 = all OK or warnings') + print(' 1 = errors') + print(' 2 = call of script w/o parameters (= showing this message)') + print() + sys.exit(2) diff --git a/stacks/analog-tools/scripts/install-open-pdks.sh b/stacks/analog-tools/scripts/install-open-pdks.sh new file mode 100644 index 0000000..48727d0 --- /dev/null +++ b/stacks/analog-tools/scripts/install-open-pdks.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +set -e + +if [ -d xschemrc ]; then + echo File xschemrc not found + return -1 +fi + +export OPEN_PDKS_VERSION="dd7771c384ed36b91a25e9f8b314355fc26561be" +export SCRIPT_DIR=. + +#################### +# INSTALL SKY130 PDK +#################### + +volare enable "${OPEN_PDKS_VERSION}" --pdk sky130 + +# remove version sky130B to save space (efabless TO use mostly sky130A) +rm -rf "$PDK_ROOT"/volare/sky130/versions/*/sky130B +rm -rf "$PDK_ROOT"/sky130B + +if [ -d "$PDK_ROOT/sky130A" ]; then + # apply SPICE mode file reduction (for the variants that exist) + # add custom IIC bind keys to magicrc + + cd "$PDK_ROOT/sky130A/libs.tech/ngspice" || exit 1 + "$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice tt + "$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ss + "$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ff + + # FIXME: Repair klayout tech file + sed -i 's/>sky130sky130A/c\ ' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt" + # shellcheck disable=SC2016 + sed -i '//c\ $PDK_ROOT/$PDK/libs.tech/klayout' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt" +fi + +###################### +# INSTALL GF180MCU PDK +###################### + +volare enable "${OPEN_PDKS_VERSION}" --pdk gf180mcu + +if [ -d "$PDK_ROOT/sky130A" ]; then + + rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuA + rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuB + rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuD + rm -rf $PDK_ROOT/gf180mcuA + rm -rf $PDK_ROOT/gf180mcuB + rm -rf $PDK_ROOT/gf180mcuD + + mv $KLAYOUT_HOME/pymacros temp + mkdir $KLAYOUT_HOME/pymacros + mv temp $KLAYOUT_HOME/pymacros/cells + mv $KLAYOUT_HOME/tech/gf180mcu.lym $KLAYOUT_HOME/pymacros + + mv xschemrc $PDK_ROOT/$PDK/libs.tech/xschem/xschemrc +fi + +rm -rf $SCRIPT_DIR/iic-spice-model-red.py \ No newline at end of file diff --git a/stacks/analog-tools/scripts/xschemrc b/stacks/analog-tools/scripts/xschemrc new file mode 100644 index 0000000..193a5c4 --- /dev/null +++ b/stacks/analog-tools/scripts/xschemrc @@ -0,0 +1,336 @@ +#### xschemrc system configuration file + +#### values may be overridden by user's ~/.xschem/xschemrc configuration file +#### or by project-local ./xschemrc + +########################################################################### +#### XSCHEM INSTALLATION DIRECTORY: XSCHEM_SHAREDIR +########################################################################### +#### Normally there is no reason to set this variable if using standard +#### installation. Location of files is set at compile time but may be overridden +#### with following line: +# set XSCHEM_SHAREDIR $env(HOME)/share/xschem + +########################################################################### +#### XSCHEM SYSTEM-WIDE DESIGN LIBRARY PATHS: XSCHEM_LIBRARY_PATH +########################################################################### +#### If unset xschem starts with XSCHEM_LIBRARY_PATH set to the default, typically: +# /home/schippes/.xschem/xschem_library +# /home/schippes/share/xschem/xschem_library/devices +# /home/schippes/share/doc/xschem/examples +# /home/schippes/share/doc/xschem/ngspice +# /home/schippes/share/doc/xschem/logic +# /home/schippes/share/doc/xschem/xschem_simulator +# /home/schippes/share/doc/xschem/binto7seg +# /home/schippes/share/doc/xschem/pcb +# /home/schippes/share/doc/xschem/rom8k + +#### Flush any previous definition +set XSCHEM_LIBRARY_PATH {} +#### include devices/*.sym +append XSCHEM_LIBRARY_PATH ${XSCHEM_SHAREDIR}/xschem_library +#### include skywater libraries. Here i use [pwd]. This works if i start xschem from here. +append XSCHEM_LIBRARY_PATH :$env(PDK_ROOT)/$env(PDK)/libs.tech/xschem +# append XSCHEM_LIBRARY_PATH :/mnt/sda7/home/schippes/pdks/sky130A/libs.tech/xschem +#### add ~/.xschem/xschem_library (USER_CONF_DIR is normally ~/.xschem) +append XSCHEM_LIBRARY_PATH :$USER_CONF_DIR/xschem_library + +########################################################################### +#### SET CUSTOM COLORS FOR XSCHEM LIBRARIES MATCHING CERTAIN PATTERNS +########################################################################### +#### each line contains a dircolor(pattern) followed by a color +#### color can be an ordinary name (grey, brown, blue) or a hex code {#77aaff} +#### hex code must be enclosed in braces +array unset dircolor +set dircolor(xschem_examples$) blue +set dircolor(xschem_180MCU_PDK$) blue +set dircolor(xschem_library$) red +set dircolor(devices$) red + +########################################################################### +#### WINDOW TO OPEN ON STARTUP: XSCHEM_START_WINDOW +########################################################################### +#### Start without a design if no filename given on command line: +#### To avoid absolute paths, use a path that is relative to one of the +#### XSCHEM_LIBRARY_PATH directories. Default: empty +set XSCHEM_START_WINDOW {tests/0_top.sch} + +########################################################################### +#### DIRECTORY WHERE SIMULATIONS, NETLIST AND SIMULATOR OUTPUTS ARE PLACED +########################################################################### +#### If unset $USER_CONF_DIR/simulations is assumed (normally ~/.xschem/simulations) +# set netlist_dir $env(HOME)/.xschem/simulations + +########################################################################### +#### NETLIST AND HIERARCHICAL PRINT EXCLUDE PATTERNS +########################################################################### +#### xschem_libs is a list of patterns of cells to exclude from netlisting. +#### Matching is done as regular expression on full cell path +#### Example: +#### set xschem_libs { {/cmoslib/} {/analoglib/.*pass} buffer } +#### in this case all schematic cells of directory cmoslib and cells containing +#### /analoglib/...pass and buffer will be excluded from netlisting +#### default value: empty +# set xschem_libs {} +#### noprint_libs is a list with same rules as for xschem_libs. This +#### variable controls hierarchical print +#### default value: empty +# set noprint_libs {} + +########################################################################### +#### CHANGE DEFAULT [] WITH SOME OTHER CHARACTERS FOR BUSSED SIGNALS +#### IN SPICE NETLISTS (EXAMPLE: DATA[7] --> DATA<7>) +########################################################################### +#### default: empty (use xschem default, [ ]) +# set bus_replacement_char {<>} +#### for XSPICE: replace square brackets as the are used for XSPICE vector nodes. +# set bus_replacement_char {__} + +########################################################################### +#### SOME DEFAULT BEHAVIOR +########################################################################### +#### Allowed values: spice, verilog, vhdl, tedax, default: spice +# set netlist_type spice + +#### Some netlisting options (these are the defaults) +# set hspice_netlist 1 +# set verilog_2001 1 + +#### to use a fixed line with set change_lw to 0 and set some value to line_width +#### these are the defaults +# set line_width 0 +# set change_lw 1 + +#### allow color postscript and svg exports. Default: 1, enable color +# set color_ps 1 + +#### initial size of xschem window you can specify also position with (wxh+x+y) +#### this is the default: +# set initial_geometry {900x600} + +#### if set to 0, when zooming out allow the viewport do drift toward the mouse position, +#### allowing to move away by zooming / unzooming with mouse wheel +#### default setting: 0 +# set unzoom_nodrift 0 + +#### if set to 1 allow to place multiple components with same name. +#### Warning: this is normally not allowed in any simulation netlist. +#### default: 0, do not allow place multiple elements with same name (refdes) +# set disable_unique_names 0 + +#### if set to 1 continue drawing lines / wires after click +#### default: 0 +# set persistent_command 1 + +#### if set to 1 a wire is inserted when separating components that are +#### connected by pins. Default: not enabled (0) +# set connect_by_kissing 1 + +#### if set to 1 automatically join/trim wires while editing +#### this may slow down on rally big designs. Can be disabled via menu +#### default: 0 +# set autotrim_wires 0 + +#### set widget scaling (mainly for font display), this is useful on 4K displays +#### default: unset (tk uses its default) > 1.0 ==> bigger +# set tk_scaling 1.7 + +#### disable some symbol layers. Default: none, all layers are visible. +# set enable_layer(5) 0 ;# example to disable pin red boxes + +#### enable to scale grid point size as done with lines at close zoom, default: 0 +# set big_grid_points 0 + +########################################################################### +#### EXPORT FORMAT TRANSLATORS, PNG AND PDF +########################################################################### +#### command to translate xpm to png; (assumes command takes source +#### and dest file as arguments, example: gm convert plot.xpm plot.png) +#### default: {gm convert} +# set to_png {gm convert} + +#### command to translate ps to pdf; (assumes command takes source +#### and dest file as arguments, example: ps2pdf plot.ps plot.pdf) +#### default: ps2pdf +# set to_pdf ps2pdf +set to_pdf {ps2pdf -dAutoRotatePages=/None} + +########################################################################### +#### UNDO: SAVE ON DISK OR KEEP IN MEMORY +########################################################################### +#### Alloved: 'disk'or 'memory'. +#### Saving undo on disk is safer but slower on extremely big schematics. +#### In most cases you won't notice any delay. Undo on disk allows previous +#### state recovery in case of crashes. In-memory undo is extremely fast +#### but should a crash occur everything is lost. +#### It is highly recommended to keep undo on disk. +#### Default: disk +# set undo_type disk + +########################################################################### +#### CUSTOM GRID / SNAP VALUE SETTINGS +########################################################################### +#### Warning: changing these values will likely break compatibility +#### with existing symbol libraries. Defaults: grid 20, snap 10. +# set grid 20 +# set snap 10 + +########################################################################### +#### CUSTOM COLORS MAY BE DEFINED HERE +########################################################################### +# set cadlayers 22 +# set light_colors { +# "#ffffff" "#0044ee" "#aaaaaa" "#222222" "#229900" +# "#bb2200" "#00ccee" "#ff0000" "#888800" "#00aaaa" +# "#880088" "#00ff00" "#0000cc" "#666600" "#557755" +# "#aa2222" "#7ccc40" "#00ffcc" "#ce0097" "#d2d46b" +# "#ef6158" "#fdb200" } + +# set dark_colors { +# "#000000" "#00ccee" "#3f3f3f" "#cccccc" "#88dd00" +# "#bb2200" "#00ccee" "#ff0000" "#ffff00" "#ffffff" +# "#ff00ff" "#00ff00" "#0000cc" "#aaaa00" "#aaccaa" +# "#ff7777" "#bfff81" "#00ffcc" "#ce0097" "#d2d46b" +# "#ef6158" "#fdb200" } + +########################################################################### +#### CAIRO STUFF +########################################################################### +#### Scale all fonts by this number +# set cairo_font_scale 1.0 + +#### default for following two is 0.85 (xscale) and 0.88 (yscale) to +#### match cairo font spacing +# set nocairo_font_xscale 1.0 +#### set nocairo_font_yscale 1.0 + +#### Scale line spacing by this number +# set cairo_font_line_spacing 1.0 + +#### Specify a font +# set cairo_font_name {Sans-Serif} +# set svg_font_name {Sans-Serif} + +#### Lift up text by some zoom-corrected pixels for +#### better compatibility wrt no cairo version. +#### Useful values in the range [-1, 3] +# set cairo_vert_correct 0 +# set nocairo_vert_correct 0 + +########################################################################### +#### KEYBINDINGS +########################################################################### +#### General format for specifying a replacement for a keybind +#### Replace Ctrl-d with Escape (so you wont kill the program) +# set replace_key(Control-d) Escape + +#### swap w and W keybinds; Always specify Shift for capital letters +# set replace_key(Shift-W) w +# set replace_key(w) Shift-W + +########################################################################### +#### TERMINAL +########################################################################### +#### default for linux: xterm +# set terminal {xterm -geometry 100x35 -fn 9x15 -bg black -fg white -cr white -ms white } +#### lxterminal is not OK since it will not inherit env vars: +#### In order to reduce memory usage and increase the performance, all instances +#### of the lxterminal are sharing a single process. LXTerminal is part of LXDE + +########################################################################### +#### EDITOR +########################################################################### +#### editor must not detach from launching shell (-f mandatory for gvim) +#### default for linux: gvim -f +# set editor {gvim -f -geometry 90x28} +# set editor { xterm -geometry 100x40 -e nano } +# set editor { xterm -geometry 100x40 -e pico } + +#### For Windows +# set editor {notepad.exe} + +########################################################################### +#### SHOW ERC INFO WINDOW (erc errors, warnings etc) +########################################################################### +#### default: 0 (can be enabled by menu) +# set show_infowindow 0 + +########################################################################### +#### CONFIGURE COMPUTER FARM JOB REDIRECTORS FOR SIMULATIONS +########################################################################### +#### RTDA NC +# set computerfarm {nc run -Il} +#### LSF BSUB +# set computerfarm {bsub -Is} + +########################################################################### +#### TCP CONNECTION WITH GAW +########################################################################### +#### set gaw address for socket connection: {host port} +#### default: set to localhost, port 2020 +# set gaw_tcp_address {localhost 2020} + +########################################################################### +#### XSCHEM LISTEN TO TCP PORT +########################################################################### +#### set xschem listening port; default: not enabled +# set xschem_listen_port 2021 + +########################################################################### +#### BESPICE WAVE SOCKET CONNECTION +########################################################################### +#### set bespice wave listening port; default: not enabled +set bespice_listen_port 2022 + +########################################################################### +#### TCL FILES TO LOAD AT STARTUP +########################################################################### +#### list of tcl files to preload. +# lappend tcl_files ${XSCHEM_SHAREDIR}/change_index.tcl +lappend tcl_files ${XSCHEM_SHAREDIR}/ngspice_backannotate.tcl + +########################################################################### +#### XSCHEM TOOLBAR +########################################################################### +#### default: not enabled. +set toolbar_visible 1 +# set toolbar_horiz 1 + +########################################################################### +#### TABBED WINDOWS +########################################################################### +# default: not enabled. Interface can be changed runtime if only one window +# or tab is open. +set tabbed_interface 1 + +########################################################################### +#### SKYWATER PDK SPECIFIC VARIABLES +########################################################################### + +## check if env var PDK_ROOT exists, and use it for building open_pdks paths +if { [info exists env(PDK_ROOT)] && $env(PDK_ROOT) ne {} } { + ## found variable, set tcl PDK_ROOT var + if {![file isdir $env(PDK_ROOT)]} { + puts stderr "Warning: PDK_ROOT environment variable is set but path not found on the system." + } + set PDK_ROOT $env(PDK_ROOT) +} else { + ## not existing or empty. + puts stderr "Warning: PDK_ROOT env. var. not found or empty, trying to find a pdk install" + if {[file isdir [pwd]/..]} { + set PDK_ROOT [file normalize [pwd]/../..] + } else { + puts stderr {No pdk installation found, set PDK_ROOT env. var. and restart xschem} + } +} + +if {[info exists PDK_ROOT]} { + set 180MCU_MODELS $env(PDK_ROOT)/$env(PDK)/libs.tech/ngspice + puts stderr "pdk installation: using $PDK_ROOT" + puts stderr "180MCU_MODELS: $180MCU_MODELS" +} + +# allow a user-specific path add-on (https://github.com/iic-jku/iic-osic-tools/issues/7) +if { [info exists ::env(XSCHEM_USER_LIBRARY_PATH) ] } { + append XSCHEM_LIBRARY_PATH :$env(XSCHEM_USER_LIBRARY_PATH) +} From 8b8395a2f3171c18266d1fb6da4cafc7a88e2631 Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Fri, 22 Sep 2023 05:05:39 -0300 Subject: [PATCH 03/10] Fixed custom container --- .gitattributes | 3 + compile.bat | 2 +- stacks/analog-tools/Dockerfile | 2 +- .../analog-tools/scripts/install-open-pdks.sh | 99 +++++++++++-------- 4 files changed, 61 insertions(+), 45 deletions(-) diff --git a/.gitattributes b/.gitattributes index 62e06ab..571f72e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,9 +3,12 @@ .png filter=lfs diff=lfs merge=lfs -text *.png filter=lfs diff=lfs merge=lfs -text *.sh text eol=lf +*.py text eol=lf *.bat text eol=crlf desktopinit text eol=lf klayout text eol=lf +.bashrc text eol=lf setwallpaper text eol=lf startserver text eol=lf *.desktop text eol=lf +xschemrc text eol=lf \ No newline at end of file diff --git a/compile.bat b/compile.bat index a5971d0..791f938 100644 --- a/compile.bat +++ b/compile.bat @@ -33,7 +33,7 @@ SET CALL=call %CALL% docker build --rm -t osicstacks-base-desktop -f base/desktop.Dockerfile . %CALL% docker build --rm -t osicstacks-base-web -f base/web.Dockerfile . %CALL% docker build --rm --build-arg BASE_IMG=osicstacks-base-web --target %STACK%-web -t %DOCKER_USER%/%STACK%:latest -f stacks/%STACK%.Dockerfile . - %CALL% docker build --rm --build-arg BASE_IMG=%DOCKER_USER%/%STACK%:latest -t %TAG% -f stacks/analog-tools/Dockerfile + %CALL% docker build --rm --build-arg BASE_IMG=%DOCKER_USER%/%STACK%:latest -t %TAG% -f stacks/analog-tools/Dockerfile stacks/analog-tools/ GOTO end :end diff --git a/stacks/analog-tools/Dockerfile b/stacks/analog-tools/Dockerfile index 18904a0..c3b0b0a 100644 --- a/stacks/analog-tools/Dockerfile +++ b/stacks/analog-tools/Dockerfile @@ -2,7 +2,7 @@ ARG BASE_IMG=analog-xk FROM $BASE_IMG as analog-tools # Add scripts -COPY scripts/* . +COPY --chown=designer:designer --chmod=755 scripts/* . RUN ./install-open-pdks.sh diff --git a/stacks/analog-tools/scripts/install-open-pdks.sh b/stacks/analog-tools/scripts/install-open-pdks.sh index 48727d0..423b8b7 100644 --- a/stacks/analog-tools/scripts/install-open-pdks.sh +++ b/stacks/analog-tools/scripts/install-open-pdks.sh @@ -2,62 +2,75 @@ set -e +export OPEN_PDKS_VERSION="dd7771c384ed36b91a25e9f8b314355fc26561be" +export SCRIPT_DIR=$PWD + if [ -d xschemrc ]; then echo File xschemrc not found return -1 fi -export OPEN_PDKS_VERSION="dd7771c384ed36b91a25e9f8b314355fc26561be" -export SCRIPT_DIR=. - -#################### -# INSTALL SKY130 PDK -#################### - -volare enable "${OPEN_PDKS_VERSION}" --pdk sky130 - -# remove version sky130B to save space (efabless TO use mostly sky130A) -rm -rf "$PDK_ROOT"/volare/sky130/versions/*/sky130B -rm -rf "$PDK_ROOT"/sky130B - -if [ -d "$PDK_ROOT/sky130A" ]; then - # apply SPICE mode file reduction (for the variants that exist) - # add custom IIC bind keys to magicrc - - cd "$PDK_ROOT/sky130A/libs.tech/ngspice" || exit 1 - "$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice tt - "$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ss - "$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ff - - # FIXME: Repair klayout tech file - sed -i 's/>sky130sky130A/c\ ' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt" - # shellcheck disable=SC2016 - sed -i '//c\ $PDK_ROOT/$PDK/libs.tech/klayout' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt" +if [ -d $SCRIPT_DIR/iic-spice-model-red.py ]; then + echo File iic-spice-model.red.py not found + return -1 fi ###################### # INSTALL GF180MCU PDK ###################### -volare enable "${OPEN_PDKS_VERSION}" --pdk gf180mcu +export PDK=gf180mcu -if [ -d "$PDK_ROOT/sky130A" ]; then +volare enable "${OPEN_PDKS_VERSION}" --pdk "${PDK}" - rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuA - rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuB - rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuD - rm -rf $PDK_ROOT/gf180mcuA - rm -rf $PDK_ROOT/gf180mcuB - rm -rf $PDK_ROOT/gf180mcuD +rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuA +rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuB +rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuD +rm -rf $PDK_ROOT/gf180mcuA +rm -rf $PDK_ROOT/gf180mcuB +rm -rf $PDK_ROOT/gf180mcuD - mv $KLAYOUT_HOME/pymacros temp - mkdir $KLAYOUT_HOME/pymacros - mv temp $KLAYOUT_HOME/pymacros/cells - mv $KLAYOUT_HOME/tech/gf180mcu.lym $KLAYOUT_HOME/pymacros +export KLAYOUT_HOME="$PDK_ROOT/gf180mcuC/libs.tech/klayout" - mv xschemrc $PDK_ROOT/$PDK/libs.tech/xschem/xschemrc -fi +mv $KLAYOUT_HOME/pymacros temp +mkdir $KLAYOUT_HOME/pymacros +mv temp $KLAYOUT_HOME/pymacros/cells +mv $KLAYOUT_HOME/tech/gf180mcu.lym $KLAYOUT_HOME/pymacros -rm -rf $SCRIPT_DIR/iic-spice-model-red.py \ No newline at end of file +mv "$SCRIPT_DIR/xschemrc" $PDK_ROOT/gf180mcuC/libs.tech/xschem/xschemrc + +rm -rf .scripts/klayout + + +#################### +# INSTALL SKY130 PDK +#################### + +export PDK=sky130 + +volare enable "${OPEN_PDKS_VERSION}" --pdk "${PDK}" + +# remove version sky130B to save space (efabless TO use mostly sky130A) +rm -rf "$PDK_ROOT"/volare/sky130/versions/*/sky130B +rm -rf "$PDK_ROOT"/sky130B + +# apply SPICE mode file reduction (for the variants that exist) +# add custom IIC bind keys to magicrc + +cd "$PDK_ROOT/sky130A/libs.tech/ngspice" || exit 1 +"$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice tt +"$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ss +"$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ff + +# FIXME: Repair klayout tech file +sed -i 's/>sky130sky130A/c\ ' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt" +# shellcheck disable=SC2016 +sed -i '//c\ $PDK_ROOT/$PDK/libs.tech/klayout' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt" + +cd "$SCRIPT_DIR" + + + +rm -rf "$SCRIPT_DIR/iic-spice-model-red.py" \ No newline at end of file From 96f560492393c9ae27bfac2bf0c62a4eb5dcd995 Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Fri, 22 Sep 2023 14:10:10 -0300 Subject: [PATCH 04/10] Fixed klayout home, added vimrc --- stacks/analog-tools/scripts/.bashrc | 32 +++++++++++++++---- stacks/analog-tools/scripts/.vimrc | 26 +++++++++++++++ .../analog-tools/scripts/install-open-pdks.sh | 15 +++++++++ 3 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 stacks/analog-tools/scripts/.vimrc diff --git a/stacks/analog-tools/scripts/.bashrc b/stacks/analog-tools/scripts/.bashrc index bb92fd1..511b22f 100644 --- a/stacks/analog-tools/scripts/.bashrc +++ b/stacks/analog-tools/scripts/.bashrc @@ -17,13 +17,33 @@ sky130A) ;; esac +function git_branch { + branch=$(git symbolic-ref --short HEAD 2>/dev/null) + if [ "$branch" != "" ]; then + echo "[$branch]" + fi +} -alias ls="ls --color=auto -XA" +c_res='\[\033[00m\]' # Reset +c_bla='\[\033[01;30m\]' # Black +c_red='\[\033[01;31m\]' # Red +c_gre='\[\033[01;32m\]' # Green +c_yel='\[\033[01;33m\]' # Yellow +c_blu='\[\033[01;34m\]' # Blue +c_pur='\[\033[01;35m\]' # Purple +c_cya='\[\033[01;36m\]' # Cyan +c_whi='\[\033[01;37m\]' # White + +# export PS1="${c_pur}\w $(git_branch)\n${c_res}\$ " ## This dont work :( +PS1="${c_pur}\w \n${c_res}\$ " ## This dont work :( + +export KLAYOUT_HOME=$PDK_ROOT/$PDK/libs.tech/klayout +export DESIGNS="/home/designer/shared" + +alias ls="ls --color=auto -XF" alias grep="grep --color=auto" -PS1="[\u@\h \W]\$ " +alias xschem='xschem -b --rcfile $PDK_ROOT/$PDK/libs.tech/xschem/xschemrc' +alias xschemtcl='xschem --rcfile $PDK_ROOT/$PDK/libs.tech/xschem/xschemrc' -## Tools Support - -alias xschem='xschem -b --rcfile $PDKPATH/libs.tech/xschem/xschemrc' -alias xschemtcl='xschem --rcfile $PDKPATH/libs.tech/xschem/xschemrc' \ No newline at end of file +git config --global --add safe.directory $DESIGNS \ No newline at end of file diff --git a/stacks/analog-tools/scripts/.vimrc b/stacks/analog-tools/scripts/.vimrc new file mode 100644 index 0000000..bc9b26a --- /dev/null +++ b/stacks/analog-tools/scripts/.vimrc @@ -0,0 +1,26 @@ +set nocompatible +filetype plugin on +filetype indent on +syntax on + +set number relativenumber +set autoindent expandtab tabstop=4 shiftwidth=4 +set cursorline +set mouse=a +set showcmd +set showmatch +set lazyredraw +set ttyfast + + +set clipboard="unnamedplus" +set showmatch +set wildmenu +set backspace=indent,eol,start + + +let &t_SI="\e[6 q" +let &t_EI="\e[2 q" +let &t_ut='' + + diff --git a/stacks/analog-tools/scripts/install-open-pdks.sh b/stacks/analog-tools/scripts/install-open-pdks.sh index 423b8b7..ef2ab48 100644 --- a/stacks/analog-tools/scripts/install-open-pdks.sh +++ b/stacks/analog-tools/scripts/install-open-pdks.sh @@ -46,6 +46,21 @@ rm -rf .scripts/klayout # INSTALL SKY130 PDK #################### +# I don't know about pcell support, maybe with pip install sky130? +# pip install sky130 --upgrade --break-system-packages + +# Still having troubles with this: +# ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6 +# ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6 +# ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6 + +# Fixing the above, the cells indicates the following: +# ERROR: /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/via_generator.py:23: ModuleNotFoundError: No module named 'gdsfactory.types' +# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/via_generator.py:23 +# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/vias.py:20 +# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/__init__.py:21 +# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym:9 (class ModuleNotFoundError) + export PDK=sky130 volare enable "${OPEN_PDKS_VERSION}" --pdk "${PDK}" From 38823890b216a3c518beb8c1d169941b613b9142 Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Mon, 25 Sep 2023 17:12:42 -0300 Subject: [PATCH 05/10] Updated run.bat --- run.bat | 57 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/run.bat b/run.bat index 80e7b7a..ec6f042 100644 --- a/run.bat +++ b/run.bat @@ -3,22 +3,34 @@ setlocal SET IMAGE=akilesalreadytaken/analog-xk:latest SET IMAGE=akilesalreadytaken/analog-tools:latest +::SET IMAGE=git.1159.cl/mario1159/analog-xk-web:latest SET CALL=call :parse - IF /I ""%1""=="""" GOTO run - IF /I ""%1""==""--help"" GOTO documentation - IF /I ""%1""==""-h"" GOTO documentation - IF /I ""%1""==""--dry"" ( SET "CALL=echo" ) - IF /I ""%1""==""-s"" ( SET "CALL=echo" ) - IF /I ""%1""==""--path"" ( SET "DESIGNS=%~2" && SHIFT ) - IF /I ""%1""==""-p"" ( SET "DESIGNS=%~2" && SHIFT ) + IF /I ""%~1""=="""" GOTO run + IF /I ""%~1""==""--help"" GOTO documentation + IF /I ""%~1""==""-h"" GOTO documentation + IF /I ""%~1""==""--dry"" ( SET "CALL=echo" ) + IF /I ""%~1""==""-s"" ( SET "CALL=echo" ) + IF /I ""%~1""==""--vnc"" ( SET "ENABLE_VNC=" ) + IF /I ""%~1""==""--path"" ( SET "DESIGNS=%~2" && SHIFT ) + IF /I ""%~1""==""-p"" ( SET "DESIGNS=%~2" && SHIFT ) + IF /I ""%~1""==""--pdk"" ( SET "PDK=%~2" && SHIFT ) SHIFT GOTO parse :documentation - echo Usage: run.bat %~nx0 [-h^|--help] [-s^|--dry-run] [-p^|--path PATH] + echo Usage: run.bat %~nx0 [ OPTIONS ] + echo. + echo -h --help Show usage information + echo -s --dry See the commands to be executed + echo -p --path PATH Link to a directory + echo --vnc Enable the vnc in port "https:\\localhost:8444" + echo If vnc is not working, execute: + echo $ xfce4-session --display=:1 & + echo --pdk PDK Set the PDK to be used (gf180mcuC | sky130A) + echo By default: gf180mcuC GOTO end @@ -77,7 +89,7 @@ SET CALL=call ) :: Set environment, variables and run the container - :::::::::::::::::::::::::::::::::::::::::::::::::::: + ::::::::::::::::::::::::::::::::::::::::::::::::::: echo Check requirements %CALL% wsl --install Ubuntu --no-launch %CALL% wsl --update @@ -85,17 +97,21 @@ SET CALL=call echo Container does not exist, creating %CONTAINER_NAME% ... SET PARAMS=-d - @REM SET PARAMS=%PARAMS% --user %CONTAINER_USER%:%CONTAINER_GROUP% SET PARAMS=%PARAMS% --name %CONTAINER_NAME% - @REM SET PARAMS=%PARAMS% --security-opt seccomp=unconfined - SET PARAMS=%PARAMS% -p %JUPYTER_PORT%:8888 - SET PARAMS=%PARAMS% -p %VNC_PORT%:8444 - SET PARAMS=%PARAMS% -v "%DESIGNS%":/home/designer/shared - SET PARAMS=%PARAMS% -v \\wsl.localhost\Ubuntu\mnt\wslg:/tmp - SET PARAMS=%PARAMS% -e DISPLAY=%DISPLAY% - SET PARAMS=%PARAMS% -e WAYLAND_DISPLAY=%WAYLAND_DISPLAY% - SET PARAMS=%PARAMS% -e XDG_RUNTIME_DIR=/mnt/wslg SET PARAMS=%PARAMS% -e PDK=%PDK% + ::SET PARAMS=%PARAMS% --user %CONTAINER_USER%:%CONTAINER_GROUP% + ::SET PARAMS=%PARAMS% --security-opt seccomp=unconfined + SET PARAMS=%PARAMS% -p %JUPYTER_PORT%:8888 + SET PARAMS=%PARAMS% -v "%DESIGNS%":/home/designer/shared + + IF NOT DEFINED ENABLE_VNC ( + SET PARAMS=%PARAMS% -v \\wsl.localhost\Ubuntu\mnt\wslg:/tmp + SET PARAMS=%PARAMS% -e DISPLAY=%DISPLAY% + SET PARAMS=%PARAMS% -e WAYLAND_DISPLAY=%WAYLAND_DISPLAY% + SET PARAMS=%PARAMS% -e XDG_RUNTIME_DIR=/mnt/wslg + ) ELSE ( + SET PARAMS=%PARAMS% -p %VNC_PORT%:8444 + ) IF NOT DEFINED IMAGE ( SET IMAGE=%DOCKER_USER%/%DOCKER_IMAGE% @@ -103,12 +119,9 @@ SET CALL=call ) @REM SET COMMAND=jupyter-lab --no-browser - @REM SET COMMAND=sudo vncserver -select-de xfce @REM SET COMMAND=sleep infinity - @echo on %CALL% docker run %PARAMS% %IMAGE% %COMMAND% - @echo off GOTO attach_shell @@ -136,4 +149,4 @@ SET CALL=call ::wsl --exec bash --norc -c 'echo $DISPLAY' :: Get current path of batsh script -::SET BATCH_PATH=%~dpnx0 \ No newline at end of file +::SET BATCH_PATH=%~dpnx0 From e87649e3f2840e1780974a265f6b2234a98dbd1a Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Mon, 25 Sep 2023 17:15:02 -0300 Subject: [PATCH 06/10] Fix run.bat --- run.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/run.bat b/run.bat index ec6f042..4087e12 100644 --- a/run.bat +++ b/run.bat @@ -138,6 +138,7 @@ SET CALL=call :end endlocal + EXIT :normalizepath From b2d32d43ee0845f6d55d82d1e3d88cd41d9ef2d8 Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Mon, 25 Sep 2023 20:36:14 -0300 Subject: [PATCH 07/10] Created run.sh and updated compile.bat --- compile.bat | 7 +-- run.sh | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+), 4 deletions(-) create mode 100644 run.sh diff --git a/compile.bat b/compile.bat index 791f938..ff73b26 100644 --- a/compile.bat +++ b/compile.bat @@ -7,6 +7,8 @@ SET DOCKER_USER=akilesalreadytaken SET DOCKER_IMAGE=analog-tools SET DOCKER_TAG=latest +SET BASE_IMG=git.1159.cl/mario1159/analog-xk-web:latest + SET CALL=call :parse @@ -30,10 +32,7 @@ SET CALL=call SET TAG=%DOCKER_USER%/%DOCKER_IMAGE% IF DEFINED DOCKER_TAG SET TAG=%TAG%:%DOCKER_TAG% - %CALL% docker build --rm -t osicstacks-base-desktop -f base/desktop.Dockerfile . - %CALL% docker build --rm -t osicstacks-base-web -f base/web.Dockerfile . - %CALL% docker build --rm --build-arg BASE_IMG=osicstacks-base-web --target %STACK%-web -t %DOCKER_USER%/%STACK%:latest -f stacks/%STACK%.Dockerfile . - %CALL% docker build --rm --build-arg BASE_IMG=%DOCKER_USER%/%STACK%:latest -t %TAG% -f stacks/analog-tools/Dockerfile stacks/analog-tools/ + %CALL% docker build --rm --build-arg BASE_IMG=%BASE_IMG% -t %TAG% -f stacks/analog-tools/Dockerfile stacks/analog-tools/ GOTO end :end diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..7d65979 --- /dev/null +++ b/run.sh @@ -0,0 +1,155 @@ +#!/bin/bash +set -e + +# IMAGE=akilesalreadytaken/analog-xk:latest +IMAGE=akilesalreadytaken/analog-tools:latest +# IMAGE=git.1159.cl/mario1159/analog-xk-web:latest + +CALL= +function parse () { + while getopts ":hsvp:k:" option; do + case $option in + h) documentation ;; + s) CALL="echo [CMD] " ;; + #v) ENABLE_VNC=1 ;; # VNC not working rigth now + p) DESIGNS=$OPTARG ;; + k) PDK=$OPTARG ;; + \?) echo "Error: Invalid option"; documentation ;; + esac + done +} + +function documentation () { + echo "Usage: run.bat [ OPTIONS ]" + echo "" + echo " -h Show usage information" + echo " -s See the commands to be executed" + echo " -p PATH Link to a directory" + # echo " -v Enable the vnc in port "https:\\localhost:8444"" + # echo " If vnc is not working, execute:" + # echo " $ xfce4-session --display=:1 &" + echo " -k PDK Set the PDK to be used (gf180mcuC | sky130A)" + echo " By default: gf180mcuC" + exit +} + +function run () { + # Set fixed parameters + #################### + [ -z "${DESIGNS+x}" ] && DESIGNS=$PWD + DESIGNS=$( realpath $DESIGNS ) + + [ -z "${PDK+x}" ] && PDK=gf180mcuC + + [ -z "${DOCKER_USER+x}" ] && DOCKER_USER=git.1159.cl/mario1159 + [ -z "${DOCKER_IMAGE+x}" ] && DOCKER_IMAGE=analog-xk + [ -z "${DOCKER_TAG+x}" ] && DOCKER_TAG=latest + + [ -z "${CONTAINER_USER+x}" ] && CONTAINER_USER=$(id -u) + [ -z "${CONTAINER_GROUP+x}" ] && CONTAINER_GROUP=$(id -g) + + [ -z "${CONTAINER_NAME+x}" ] && CONTAINER_NAME=analog-tools + + [ -z "${JUPYTER_PORT+x}" ] && JUPYTER_PORT=8888 + [ -z "${VNC_PORT+x}" ] && VNC_PORT=8444 + + # Validate parameters + ##################### + if [[ ${CONTAINER_USER} -ne 0 ]] && [[ ${CONTAINER_USER} -lt 1000 ]]; then + prt_str="# [WARNING] Selected User ID ${CONTAINER_USER} is below 1000. This ID might interfere with User-IDs inside the container and cause undefined behavior! #" + printf -- '#%.0s' $(seq 1 ${#prt_str}) + echo + echo "${prt_str}" + printf -- '#%.0s' $(seq 1 ${#prt_str}) + echo + fi + + if [[ ${CONTAINER_GROUP} -ne 0 ]] && [[ ${CONTAINER_GROUP} -lt 1000 ]]; then + prt_str="# [WARNING] Selected Group ID ${CONTAINER_GROUP} is below 1000. This ID might interfere with Group-IDs inside the container and cause undefined behavior! #" + printf -- '#%.0s' $(seq 1 ${#prt_str}) + echo + echo "${prt_str}" + printf -- '#%.0s' $(seq 1 ${#prt_str}) + echo + fi + + # Check if the container exists and if it is running. + if [ "$(docker ps -q -f name="${CONTAINER_NAME}")" ]; then + echo "[WARNING] Container is running!" + echo "[HINT] It can also be stopped with \"docker stop ${CONTAINER_NAME}\" and removed with \"docker rm ${CONTAINER_NAME}\" if required." + echo + echo -n "Press \"s\" to stop, and \"r\" to stop & remove: " + read -r -n 1 k <&1 + echo + if [[ $k = s ]] ; then + $CALL docker stop "${CONTAINER_NAME}" + elif [[ $k = r ]] ; then + $CALL docker stop "${CONTAINER_NAME}" + $CALL docker rm "${CONTAINER_NAME}" + fi + exit + fi + + # If the container exists but is exited, it is restarted. + if [ "$(docker ps -aq -f name="${CONTAINER_NAME}")" ]; then + echo "[WARNING] Container ${CONTAINER_NAME} exists." + echo "[HINT] It can also be restarted with \"docker start ${CONTAINER_NAME}\" or removed with \"docker rm ${CONTAINER_NAME}\" if required." + echo + echo -n "Press \"s\" to start, and \"r\" to remove: " + read -r -n 1 k <&1 + echo + if [[ $k = s ]] ; then + $CALL docker start "${CONTAINER_NAME}" + elif [[ $k = r ]] ; then + $CALL docker rm "${CONTAINER_NAME}" + fi + exit + fi + + # Set environment, variables and run the container + ################################################## + + echo "[INFO] Container does not exist, creating ${CONTAINER_NAME} ..." + + PARAMS="-d" + PARAMS="$PARAMS --name $CONTAINER_NAME" + PARAMS="$PARAMS -e PDK=$PDK" + PARAMS="$PARAMS --user ${CONTAINER_USER}:${CONTAINER_GROUP}" + PARAMS="$PARAMS --security-opt seccomp=unconfined" + PARAMS="$PARAMS -p $JUPYTER_PORT:8888" + PARAMS="$PARAMS -v $DESIGNS:/home/designer/shared" + PARAMS="$PARAMS -v /tmp/.X11-unix:/tmp/.X11-unix" + + if [ -z "${ENABLE_VNC+x}" ]; then + PARAMS="$PARAMS -e DISPLAY=$DISPLAY" + PARAMS="$PARAMS -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY" + PARAMS="$PARAMS -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" + else + PARAMS="$PARAMS -p $VNC_PORT:8444" + # Should use WSL_DISTRO_NAME ? + PARAMS="$PARAMS -v /mnt/wslg:/mnt/wsl" + fi + + if [ -z "${IMAGE+x}" ]; then + IMAGE=$DOCKER_USER/$DOCKER_IMAGE:$DOCKER_TAG + fi + + echo "[INFO] Container based on $IMAGE" + + $CALL docker run $PARAMS $IMAGE $COMMAND + + attach_shell +} + +function attach_shell () { + $CALL docker exec -it $CONTAINER_NAME bash +} + + +function restart_shell () { + $CALL docker start $CONTAINER_NAME + attach_shell +} + +parse $@ +run \ No newline at end of file From 8861a8ca58e8b74ab30f1875005ec67d092aac3d Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Wed, 27 Sep 2023 17:15:01 -0300 Subject: [PATCH 08/10] Container without vnc for simplicity --- compile.bat | 18 +- run.bat | 43 ++- stacks/analog-tools/Dockerfile | 6 +- .../analog-tools/scripts/install-open-pdks.sh | 66 +--- .../analog-tools/scripts/patch-open-pdks.sh | 131 +++++++ stacks/analog-tools/scripts/xschemrc | 336 ------------------ 6 files changed, 171 insertions(+), 429 deletions(-) create mode 100644 stacks/analog-tools/scripts/patch-open-pdks.sh delete mode 100644 stacks/analog-tools/scripts/xschemrc diff --git a/compile.bat b/compile.bat index ff73b26..1491b51 100644 --- a/compile.bat +++ b/compile.bat @@ -1,14 +1,9 @@ @echo off setlocal -SET STACK=analog-xk - -SET DOCKER_USER=akilesalreadytaken -SET DOCKER_IMAGE=analog-tools -SET DOCKER_TAG=latest - -SET BASE_IMG=git.1159.cl/mario1159/analog-xk-web:latest - +@REM SET BASE_IMG=git.1159.cl/mario1159/analog-xk-web:latest +SET BASE_IMG=git.1159.cl/mario1159/analog-xk-desktop:latest +SET RESULT_IMAGE=akilesalreadytaken/analog-tools:latest SET CALL=call :parse @@ -29,10 +24,7 @@ SET CALL=call :run - SET TAG=%DOCKER_USER%/%DOCKER_IMAGE% - IF DEFINED DOCKER_TAG SET TAG=%TAG%:%DOCKER_TAG% - - %CALL% docker build --rm --build-arg BASE_IMG=%BASE_IMG% -t %TAG% -f stacks/analog-tools/Dockerfile stacks/analog-tools/ + %CALL% docker build --build-arg BASE_IMG=%BASE_IMG% -t %RESULT_IMAGE% -f stacks/analog-tools/Dockerfile stacks/analog-tools/ GOTO end :end @@ -48,4 +40,4 @@ SET CALL=call ::wsl --exec bash --norc -c 'echo $DISPLAY' :: Get current path of batsh script -::SET BATCH_PATH=%~dpnx0 \ No newline at end of file +::SET BATCH_PATH=%~dpnx0 diff --git a/run.bat b/run.bat index 4087e12..732c3d3 100644 --- a/run.bat +++ b/run.bat @@ -56,11 +56,17 @@ SET CALL=call :: Get parameters from wsl :::::::::::::::::::::::::: - SET WSL_GET_DISPLAY=wsl --exec bash --norc -c "echo $DISPLAY" - FOR /F "USEBACKQ" %%i IN (`%WSL_GET_DISPLAY%`) DO ( SET "DISPLAY=%%i" ) + SET WSL_GET_PARAMETER=wsl --exec bash --norc -c "echo $DISPLAY" + @REM SET WSL_GET_PARAMETER=wsl -d docker-desktop --exec ash -c "echo $DISPLAY" + FOR /F "USEBACKQ" %%i IN (`%WSL_GET_PARAMETER%`) DO ( SET "DISPLAY=%%i" ) - SET WSL_GET_WAYLAND_DISPLAY=wsl --exec bash --norc -c "echo $WAYLAND_DISPLAY" - FOR /F "USEBACKQ" %%i IN (`%WSL_GET_WAYLAND_DISPLAY%`) DO ( SET "WAYLAND_DISPLAY=%%i" ) + SET WSL_GET_PARAMETER=wsl --exec bash --norc -c "echo $WAYLAND_DISPLAY" + @REM SET WSL_GET_PARAMETER=wsl -d docker-desktop --exec ash -c "echo $WAYLAND_DISPLAY" + FOR /F "USEBACKQ" %%i IN (`%WSL_GET_PARAMETER%`) DO ( SET "WAYLAND_DISPLAY=%%i" ) + + SET WSL_GET_PARAMETER=wsl --exec bash --norc -c "echo $XDG_RUNTIME_DIR" + @REM SET WSL_GET_PARAMETER=wsl -d docker-desktop --exec ash -c "echo $XDG_RUNTIME_DIR" + FOR /F "USEBACKQ" %%i IN (`%WSL_GET_PARAMETER%`) DO ( SET "XDG_RUNTIME_DIR=%%i" ) :: Validate parameters :::::::::::::::::::::: @@ -98,20 +104,25 @@ SET CALL=call SET PARAMS=-d SET PARAMS=%PARAMS% --name %CONTAINER_NAME% - SET PARAMS=%PARAMS% -e PDK=%PDK% ::SET PARAMS=%PARAMS% --user %CONTAINER_USER%:%CONTAINER_GROUP% - ::SET PARAMS=%PARAMS% --security-opt seccomp=unconfined - SET PARAMS=%PARAMS% -p %JUPYTER_PORT%:8888 - SET PARAMS=%PARAMS% -v "%DESIGNS%":/home/designer/shared + SET PARAMS=%PARAMS% --security-opt seccomp=unconfined - IF NOT DEFINED ENABLE_VNC ( - SET PARAMS=%PARAMS% -v \\wsl.localhost\Ubuntu\mnt\wslg:/tmp - SET PARAMS=%PARAMS% -e DISPLAY=%DISPLAY% - SET PARAMS=%PARAMS% -e WAYLAND_DISPLAY=%WAYLAND_DISPLAY% - SET PARAMS=%PARAMS% -e XDG_RUNTIME_DIR=/mnt/wslg - ) ELSE ( - SET PARAMS=%PARAMS% -p %VNC_PORT%:8444 - ) + SET PARAMS=%PARAMS% -p %JUPYTER_PORT%:8888 + SET PARAMS=%PARAMS% -p %VNC_PORT%:8444 + + SET PARAMS=%PARAMS% -v "%DESIGNS%":/home/designer/shared + SET PARAMS=%PARAMS% -v "\\wsl.localhost\Ubuntu\mnt\wslg":/tmp + SET PARAMS=%PARAMS% -v "\\wsl.localhost\Ubuntu\mnt\wslg\runtime-dir":%XDG_RUNTIME_DIR% + @REM SET PARAMS=%PARAMS% -v "\\wsl.localhost\docker-desktop\mnt\host\wslg":/tmp + @REM SET PARAMS=%PARAMS% -v "\\wsl.localhost\docker-desktop\mnt\host\wslg\runtime-dir":%XDG_RUNTIME_DIR% + + SET PARAMS=%PARAMS% -e PDK=%PDK% + SET PARAMS=%PARAMS% -e DISPLAY=%DISPLAY% + SET PARAMS=%PARAMS% -e WAYLAND_DISPLAY=%WAYLAND_DISPLAY% + SET PARAMS=%PARAMS% -e XDG_RUNTIME_DIR=%XDG_RUNTIME_DIR% + @REM IF NOT DEFINED ENABLE_VNC ( + @REM ) ELSE ( + @REM ) IF NOT DEFINED IMAGE ( SET IMAGE=%DOCKER_USER%/%DOCKER_IMAGE% diff --git a/stacks/analog-tools/Dockerfile b/stacks/analog-tools/Dockerfile index c3b0b0a..28a1003 100644 --- a/stacks/analog-tools/Dockerfile +++ b/stacks/analog-tools/Dockerfile @@ -2,10 +2,12 @@ ARG BASE_IMG=analog-xk FROM $BASE_IMG as analog-tools # Add scripts -COPY --chown=designer:designer --chmod=755 scripts/* . - +COPY --chown=designer:designer --chmod=755 scripts/install-open-pdks.sh . RUN ./install-open-pdks.sh +COPY --chown=designer:designer --chmod=755 scripts/* . +RUN ./patch-open-pdks.sh + RUN rm *.sh # Initialize the enviroment keeping container alive diff --git a/stacks/analog-tools/scripts/install-open-pdks.sh b/stacks/analog-tools/scripts/install-open-pdks.sh index ef2ab48..719dff1 100644 --- a/stacks/analog-tools/scripts/install-open-pdks.sh +++ b/stacks/analog-tools/scripts/install-open-pdks.sh @@ -5,23 +5,11 @@ set -e export OPEN_PDKS_VERSION="dd7771c384ed36b91a25e9f8b314355fc26561be" export SCRIPT_DIR=$PWD -if [ -d xschemrc ]; then - echo File xschemrc not found - return -1 -fi - -if [ -d $SCRIPT_DIR/iic-spice-model-red.py ]; then - echo File iic-spice-model.red.py not found - return -1 -fi - ###################### # INSTALL GF180MCU PDK ###################### -export PDK=gf180mcu - -volare enable "${OPEN_PDKS_VERSION}" --pdk "${PDK}" +volare enable "${OPEN_PDKS_VERSION}" --pdk gf180mcu rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuA rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuB @@ -30,62 +18,16 @@ rm -rf $PDK_ROOT/gf180mcuA rm -rf $PDK_ROOT/gf180mcuB rm -rf $PDK_ROOT/gf180mcuD -export KLAYOUT_HOME="$PDK_ROOT/gf180mcuC/libs.tech/klayout" - -mv $KLAYOUT_HOME/pymacros temp -mkdir $KLAYOUT_HOME/pymacros -mv temp $KLAYOUT_HOME/pymacros/cells -mv $KLAYOUT_HOME/tech/gf180mcu.lym $KLAYOUT_HOME/pymacros - -mv "$SCRIPT_DIR/xschemrc" $PDK_ROOT/gf180mcuC/libs.tech/xschem/xschemrc - -rm -rf .scripts/klayout - - #################### # INSTALL SKY130 PDK #################### -# I don't know about pcell support, maybe with pip install sky130? -# pip install sky130 --upgrade --break-system-packages +pip install sky130 --upgrade --break-system-packages -# Still having troubles with this: -# ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6 -# ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6 -# ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6 +volare enable "${OPEN_PDKS_VERSION}" --pdk sky130 -# Fixing the above, the cells indicates the following: -# ERROR: /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/via_generator.py:23: ModuleNotFoundError: No module named 'gdsfactory.types' -# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/via_generator.py:23 -# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/vias.py:20 -# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/__init__.py:21 -# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym:9 (class ModuleNotFoundError) - -export PDK=sky130 - -volare enable "${OPEN_PDKS_VERSION}" --pdk "${PDK}" +# ADD PCELL SUPPORT # remove version sky130B to save space (efabless TO use mostly sky130A) rm -rf "$PDK_ROOT"/volare/sky130/versions/*/sky130B rm -rf "$PDK_ROOT"/sky130B - -# apply SPICE mode file reduction (for the variants that exist) -# add custom IIC bind keys to magicrc - -cd "$PDK_ROOT/sky130A/libs.tech/ngspice" || exit 1 -"$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice tt -"$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ss -"$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ff - -# FIXME: Repair klayout tech file -sed -i 's/>sky130sky130A/c\ ' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt" -# shellcheck disable=SC2016 -sed -i '//c\ $PDK_ROOT/$PDK/libs.tech/klayout' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt" - -cd "$SCRIPT_DIR" - - - -rm -rf "$SCRIPT_DIR/iic-spice-model-red.py" \ No newline at end of file diff --git a/stacks/analog-tools/scripts/patch-open-pdks.sh b/stacks/analog-tools/scripts/patch-open-pdks.sh new file mode 100644 index 0000000..a06d0da --- /dev/null +++ b/stacks/analog-tools/scripts/patch-open-pdks.sh @@ -0,0 +1,131 @@ +#!/bin/bash +set -e + +SCRIPT_DIR=$PWD +DROPDOWN_REPO="https://github.com/mabrains/globalfoundries-pdk-libs-gf180mcu_fd_pr" + +# This files can be downloaded directly +# - sky130A_mr.drc +# - gf180mcuC_mr.drc +PRECHECK_REPO=https://raw.githubusercontent.com/efabless/mpw_precheck/main/checks/tech-files/ +PRECHECK_GF_FILE=gf180mcuC_mr.drc +PRECHECK_SKY_FILE=sky130A_mr.drc + +if [ -d $SCRIPT_DIR/iic-spice-model-red.py ]; then + echo File iic-spice-model.red.py not found + return -1 +fi + +sudo aur-install wget +pip install docopt --upgrade --break-system-packages + +###################### +# PATCH GF180MCU PDK +###################### + +function gf180_patch_xschemrc() { + FILEPATH=$PDK_ROOT/gf180mcuC/libs.tech/xschem/xschemrc + + ORIGINAL='append XSCHEM_LIBRARY_PATH :$env(PWD)' + REPLACE='append XSCHEM_LIBRARY_PATH :$env(PDK_ROOT)/$env(PDK)/libs.tech/xschem' + sed -i "s\\$ORIGINAL\\$REPLACE\g" $FILEPATH + + ORIGINAL='set 180MCU_MODELS ${PDK_ROOT}/models/ngspice' + REPLACE='set 180MCU_MODELS $env(PDK_ROOT)/$env(PDK)/libs.tech/ngspice' + sed -i "s\\$ORIGINAL\\$REPLACE\g" $FILEPATH +} + +function gf180_patch_klayout_pcells() { + KLAYOUT_HOME="$PDK_ROOT/gf180mcuC/libs.tech/klayout" + + mv $KLAYOUT_HOME/pymacros $KLAYOUT_HOME/cells + mkdir $KLAYOUT_HOME/pymacros + mv $KLAYOUT_HOME/cells $KLAYOUT_HOME/pymacros + mv $KLAYOUT_HOME/tech/gf180mcu.lym $KLAYOUT_HOME/pymacros + + rm -rf .scripts/klayout +} + +function gf180_patch_klayout_dropdown() { + # 27:00 & 36:40 + KLAYOUT_HOME="$PDK_ROOT/gf180mcuC/libs.tech/klayout" + DROPDOWN_DIRECTORY="globalfoundries" + + git clone $DROPDOWN_REPO $DROPDOWN_DIRECTORY + + cp -r $DROPDOWN_DIRECTORY/rules/klayout/macros $KLAYOUT_HOME + + # There's no directories + # cp -r $DROPDOWN_DIRECTORY/rules/klayout/drc/*.drc $KLAYOUT_HOME/drc + # cp -r $DROPDOWN_DIRECTORY/rules/klayout/lvs/*.lvs $KLAYOUT_HOME/lvs + + rm -rf $DROPDOWN_DIRECTORY +} + +function gf180_patch_klayout_precheck_drc() { + KLAYOUT_HOME="$PDK_ROOT/gf180mcuC/libs.tech/klayout" + #curl -o $KLAYOUT_HOME/drc/rule_decks/$PRECHECK_GF_FILE $PRECHECK_REPO/$PRECHECK_GF_FILE + wget -O $KLAYOUT_HOME/drc/rule_decks/$PRECHECK_GF_FILE $PRECHECK_REPO/$PRECHECK_GF_FILE +} + +#################### +# PATCH SKY130 PDK +#################### + +function sky130_patch_reduced_models() { + cd "$PDK_ROOT/sky130A/libs.tech/ngspice" || exit 1 + "$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice tt + "$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ss + "$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ff + + cd "$SCRIPT_DIR" + rm -rf "iic-spice-model-red.py" +} + +function sky130_patch_klayout_lyt() { + KLAYOUT_HOME="$PDK_ROOT/sky130A/libs.tech/klayout" + FILEPATH="$KLAYOUT_HOME/tech/sky130A.lyt" + + sed -i 's/>sky130sky130A/c\ ' $FILEPATH + sed -i '//c\ $PDK_ROOT/$PDK/libs.tech/klayout' $FILEPATH +} + +function sky130_patch_klayout_lym () { + KLAYOUT_HOME="$PDK_ROOT/sky130A/libs.tech/klayout" + # ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6 + # ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6 + # ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6 + FILENAME="$KLAYOUT_HOME/pymacros/sky130.lym" + LINE=17 + ( sed -n ${LINE}' {p;q}' $FILENAME ; sed "${LINE}d" $FILENAME ) > $FILENAME +} + +function sky130_patch_klayout_pcells() { + KLAYOUT_HOME="$PDK_ROOT/sky130A/libs.tech/klayout" + # Fixing the above, the cells indicates the following: + # ERROR: /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/via_generator.py:23: ModuleNotFoundError: No module named 'gdsfactory.types' + # /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/via_generator.py:23 + # /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/vias.py:20 + # /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/__init__.py:21 + # /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym:9 (class ModuleNotFoundError) + echo hola +} + +function sky130_patch_klayout_precheck_drc() { + KLAYOUT_HOME="$PDK_ROOT/sky130A/libs.tech/klayout" + wget -O $KLAYOUT_HOME/drc/$PRECHECK_SKY_FILE $PRECHECK_REPO/$PRECHECK_SKY_FILE +} + +gf180_patch_xschemrc +gf180_patch_klayout_pcells +gf180_patch_klayout_dropdown +gf180_patch_klayout_precheck_drc +sky130_patch_reduced_models +sky130_patch_klayout_lyt +sky130_patch_klayout_lym +sky130_patch_klayout_pcells +sky130_patch_klayout_precheck_drc + +aur-install gedit xterm gvim \ No newline at end of file diff --git a/stacks/analog-tools/scripts/xschemrc b/stacks/analog-tools/scripts/xschemrc deleted file mode 100644 index 193a5c4..0000000 --- a/stacks/analog-tools/scripts/xschemrc +++ /dev/null @@ -1,336 +0,0 @@ -#### xschemrc system configuration file - -#### values may be overridden by user's ~/.xschem/xschemrc configuration file -#### or by project-local ./xschemrc - -########################################################################### -#### XSCHEM INSTALLATION DIRECTORY: XSCHEM_SHAREDIR -########################################################################### -#### Normally there is no reason to set this variable if using standard -#### installation. Location of files is set at compile time but may be overridden -#### with following line: -# set XSCHEM_SHAREDIR $env(HOME)/share/xschem - -########################################################################### -#### XSCHEM SYSTEM-WIDE DESIGN LIBRARY PATHS: XSCHEM_LIBRARY_PATH -########################################################################### -#### If unset xschem starts with XSCHEM_LIBRARY_PATH set to the default, typically: -# /home/schippes/.xschem/xschem_library -# /home/schippes/share/xschem/xschem_library/devices -# /home/schippes/share/doc/xschem/examples -# /home/schippes/share/doc/xschem/ngspice -# /home/schippes/share/doc/xschem/logic -# /home/schippes/share/doc/xschem/xschem_simulator -# /home/schippes/share/doc/xschem/binto7seg -# /home/schippes/share/doc/xschem/pcb -# /home/schippes/share/doc/xschem/rom8k - -#### Flush any previous definition -set XSCHEM_LIBRARY_PATH {} -#### include devices/*.sym -append XSCHEM_LIBRARY_PATH ${XSCHEM_SHAREDIR}/xschem_library -#### include skywater libraries. Here i use [pwd]. This works if i start xschem from here. -append XSCHEM_LIBRARY_PATH :$env(PDK_ROOT)/$env(PDK)/libs.tech/xschem -# append XSCHEM_LIBRARY_PATH :/mnt/sda7/home/schippes/pdks/sky130A/libs.tech/xschem -#### add ~/.xschem/xschem_library (USER_CONF_DIR is normally ~/.xschem) -append XSCHEM_LIBRARY_PATH :$USER_CONF_DIR/xschem_library - -########################################################################### -#### SET CUSTOM COLORS FOR XSCHEM LIBRARIES MATCHING CERTAIN PATTERNS -########################################################################### -#### each line contains a dircolor(pattern) followed by a color -#### color can be an ordinary name (grey, brown, blue) or a hex code {#77aaff} -#### hex code must be enclosed in braces -array unset dircolor -set dircolor(xschem_examples$) blue -set dircolor(xschem_180MCU_PDK$) blue -set dircolor(xschem_library$) red -set dircolor(devices$) red - -########################################################################### -#### WINDOW TO OPEN ON STARTUP: XSCHEM_START_WINDOW -########################################################################### -#### Start without a design if no filename given on command line: -#### To avoid absolute paths, use a path that is relative to one of the -#### XSCHEM_LIBRARY_PATH directories. Default: empty -set XSCHEM_START_WINDOW {tests/0_top.sch} - -########################################################################### -#### DIRECTORY WHERE SIMULATIONS, NETLIST AND SIMULATOR OUTPUTS ARE PLACED -########################################################################### -#### If unset $USER_CONF_DIR/simulations is assumed (normally ~/.xschem/simulations) -# set netlist_dir $env(HOME)/.xschem/simulations - -########################################################################### -#### NETLIST AND HIERARCHICAL PRINT EXCLUDE PATTERNS -########################################################################### -#### xschem_libs is a list of patterns of cells to exclude from netlisting. -#### Matching is done as regular expression on full cell path -#### Example: -#### set xschem_libs { {/cmoslib/} {/analoglib/.*pass} buffer } -#### in this case all schematic cells of directory cmoslib and cells containing -#### /analoglib/...pass and buffer will be excluded from netlisting -#### default value: empty -# set xschem_libs {} -#### noprint_libs is a list with same rules as for xschem_libs. This -#### variable controls hierarchical print -#### default value: empty -# set noprint_libs {} - -########################################################################### -#### CHANGE DEFAULT [] WITH SOME OTHER CHARACTERS FOR BUSSED SIGNALS -#### IN SPICE NETLISTS (EXAMPLE: DATA[7] --> DATA<7>) -########################################################################### -#### default: empty (use xschem default, [ ]) -# set bus_replacement_char {<>} -#### for XSPICE: replace square brackets as the are used for XSPICE vector nodes. -# set bus_replacement_char {__} - -########################################################################### -#### SOME DEFAULT BEHAVIOR -########################################################################### -#### Allowed values: spice, verilog, vhdl, tedax, default: spice -# set netlist_type spice - -#### Some netlisting options (these are the defaults) -# set hspice_netlist 1 -# set verilog_2001 1 - -#### to use a fixed line with set change_lw to 0 and set some value to line_width -#### these are the defaults -# set line_width 0 -# set change_lw 1 - -#### allow color postscript and svg exports. Default: 1, enable color -# set color_ps 1 - -#### initial size of xschem window you can specify also position with (wxh+x+y) -#### this is the default: -# set initial_geometry {900x600} - -#### if set to 0, when zooming out allow the viewport do drift toward the mouse position, -#### allowing to move away by zooming / unzooming with mouse wheel -#### default setting: 0 -# set unzoom_nodrift 0 - -#### if set to 1 allow to place multiple components with same name. -#### Warning: this is normally not allowed in any simulation netlist. -#### default: 0, do not allow place multiple elements with same name (refdes) -# set disable_unique_names 0 - -#### if set to 1 continue drawing lines / wires after click -#### default: 0 -# set persistent_command 1 - -#### if set to 1 a wire is inserted when separating components that are -#### connected by pins. Default: not enabled (0) -# set connect_by_kissing 1 - -#### if set to 1 automatically join/trim wires while editing -#### this may slow down on rally big designs. Can be disabled via menu -#### default: 0 -# set autotrim_wires 0 - -#### set widget scaling (mainly for font display), this is useful on 4K displays -#### default: unset (tk uses its default) > 1.0 ==> bigger -# set tk_scaling 1.7 - -#### disable some symbol layers. Default: none, all layers are visible. -# set enable_layer(5) 0 ;# example to disable pin red boxes - -#### enable to scale grid point size as done with lines at close zoom, default: 0 -# set big_grid_points 0 - -########################################################################### -#### EXPORT FORMAT TRANSLATORS, PNG AND PDF -########################################################################### -#### command to translate xpm to png; (assumes command takes source -#### and dest file as arguments, example: gm convert plot.xpm plot.png) -#### default: {gm convert} -# set to_png {gm convert} - -#### command to translate ps to pdf; (assumes command takes source -#### and dest file as arguments, example: ps2pdf plot.ps plot.pdf) -#### default: ps2pdf -# set to_pdf ps2pdf -set to_pdf {ps2pdf -dAutoRotatePages=/None} - -########################################################################### -#### UNDO: SAVE ON DISK OR KEEP IN MEMORY -########################################################################### -#### Alloved: 'disk'or 'memory'. -#### Saving undo on disk is safer but slower on extremely big schematics. -#### In most cases you won't notice any delay. Undo on disk allows previous -#### state recovery in case of crashes. In-memory undo is extremely fast -#### but should a crash occur everything is lost. -#### It is highly recommended to keep undo on disk. -#### Default: disk -# set undo_type disk - -########################################################################### -#### CUSTOM GRID / SNAP VALUE SETTINGS -########################################################################### -#### Warning: changing these values will likely break compatibility -#### with existing symbol libraries. Defaults: grid 20, snap 10. -# set grid 20 -# set snap 10 - -########################################################################### -#### CUSTOM COLORS MAY BE DEFINED HERE -########################################################################### -# set cadlayers 22 -# set light_colors { -# "#ffffff" "#0044ee" "#aaaaaa" "#222222" "#229900" -# "#bb2200" "#00ccee" "#ff0000" "#888800" "#00aaaa" -# "#880088" "#00ff00" "#0000cc" "#666600" "#557755" -# "#aa2222" "#7ccc40" "#00ffcc" "#ce0097" "#d2d46b" -# "#ef6158" "#fdb200" } - -# set dark_colors { -# "#000000" "#00ccee" "#3f3f3f" "#cccccc" "#88dd00" -# "#bb2200" "#00ccee" "#ff0000" "#ffff00" "#ffffff" -# "#ff00ff" "#00ff00" "#0000cc" "#aaaa00" "#aaccaa" -# "#ff7777" "#bfff81" "#00ffcc" "#ce0097" "#d2d46b" -# "#ef6158" "#fdb200" } - -########################################################################### -#### CAIRO STUFF -########################################################################### -#### Scale all fonts by this number -# set cairo_font_scale 1.0 - -#### default for following two is 0.85 (xscale) and 0.88 (yscale) to -#### match cairo font spacing -# set nocairo_font_xscale 1.0 -#### set nocairo_font_yscale 1.0 - -#### Scale line spacing by this number -# set cairo_font_line_spacing 1.0 - -#### Specify a font -# set cairo_font_name {Sans-Serif} -# set svg_font_name {Sans-Serif} - -#### Lift up text by some zoom-corrected pixels for -#### better compatibility wrt no cairo version. -#### Useful values in the range [-1, 3] -# set cairo_vert_correct 0 -# set nocairo_vert_correct 0 - -########################################################################### -#### KEYBINDINGS -########################################################################### -#### General format for specifying a replacement for a keybind -#### Replace Ctrl-d with Escape (so you wont kill the program) -# set replace_key(Control-d) Escape - -#### swap w and W keybinds; Always specify Shift for capital letters -# set replace_key(Shift-W) w -# set replace_key(w) Shift-W - -########################################################################### -#### TERMINAL -########################################################################### -#### default for linux: xterm -# set terminal {xterm -geometry 100x35 -fn 9x15 -bg black -fg white -cr white -ms white } -#### lxterminal is not OK since it will not inherit env vars: -#### In order to reduce memory usage and increase the performance, all instances -#### of the lxterminal are sharing a single process. LXTerminal is part of LXDE - -########################################################################### -#### EDITOR -########################################################################### -#### editor must not detach from launching shell (-f mandatory for gvim) -#### default for linux: gvim -f -# set editor {gvim -f -geometry 90x28} -# set editor { xterm -geometry 100x40 -e nano } -# set editor { xterm -geometry 100x40 -e pico } - -#### For Windows -# set editor {notepad.exe} - -########################################################################### -#### SHOW ERC INFO WINDOW (erc errors, warnings etc) -########################################################################### -#### default: 0 (can be enabled by menu) -# set show_infowindow 0 - -########################################################################### -#### CONFIGURE COMPUTER FARM JOB REDIRECTORS FOR SIMULATIONS -########################################################################### -#### RTDA NC -# set computerfarm {nc run -Il} -#### LSF BSUB -# set computerfarm {bsub -Is} - -########################################################################### -#### TCP CONNECTION WITH GAW -########################################################################### -#### set gaw address for socket connection: {host port} -#### default: set to localhost, port 2020 -# set gaw_tcp_address {localhost 2020} - -########################################################################### -#### XSCHEM LISTEN TO TCP PORT -########################################################################### -#### set xschem listening port; default: not enabled -# set xschem_listen_port 2021 - -########################################################################### -#### BESPICE WAVE SOCKET CONNECTION -########################################################################### -#### set bespice wave listening port; default: not enabled -set bespice_listen_port 2022 - -########################################################################### -#### TCL FILES TO LOAD AT STARTUP -########################################################################### -#### list of tcl files to preload. -# lappend tcl_files ${XSCHEM_SHAREDIR}/change_index.tcl -lappend tcl_files ${XSCHEM_SHAREDIR}/ngspice_backannotate.tcl - -########################################################################### -#### XSCHEM TOOLBAR -########################################################################### -#### default: not enabled. -set toolbar_visible 1 -# set toolbar_horiz 1 - -########################################################################### -#### TABBED WINDOWS -########################################################################### -# default: not enabled. Interface can be changed runtime if only one window -# or tab is open. -set tabbed_interface 1 - -########################################################################### -#### SKYWATER PDK SPECIFIC VARIABLES -########################################################################### - -## check if env var PDK_ROOT exists, and use it for building open_pdks paths -if { [info exists env(PDK_ROOT)] && $env(PDK_ROOT) ne {} } { - ## found variable, set tcl PDK_ROOT var - if {![file isdir $env(PDK_ROOT)]} { - puts stderr "Warning: PDK_ROOT environment variable is set but path not found on the system." - } - set PDK_ROOT $env(PDK_ROOT) -} else { - ## not existing or empty. - puts stderr "Warning: PDK_ROOT env. var. not found or empty, trying to find a pdk install" - if {[file isdir [pwd]/..]} { - set PDK_ROOT [file normalize [pwd]/../..] - } else { - puts stderr {No pdk installation found, set PDK_ROOT env. var. and restart xschem} - } -} - -if {[info exists PDK_ROOT]} { - set 180MCU_MODELS $env(PDK_ROOT)/$env(PDK)/libs.tech/ngspice - puts stderr "pdk installation: using $PDK_ROOT" - puts stderr "180MCU_MODELS: $180MCU_MODELS" -} - -# allow a user-specific path add-on (https://github.com/iic-jku/iic-osic-tools/issues/7) -if { [info exists ::env(XSCHEM_USER_LIBRARY_PATH) ] } { - append XSCHEM_LIBRARY_PATH :$env(XSCHEM_USER_LIBRARY_PATH) -} From 72910a3d5bb6eb741160b04a0e00b09be669b000 Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Wed, 27 Sep 2023 17:41:25 -0300 Subject: [PATCH 09/10] Fixed run.bat and patches --- run.bat | 8 ++++-- .../analog-tools/scripts/patch-open-pdks.sh | 28 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/run.bat b/run.bat index 732c3d3..db1b222 100644 --- a/run.bat +++ b/run.bat @@ -12,9 +12,11 @@ SET CALL=call IF /I ""%~1""==""-h"" GOTO documentation IF /I ""%~1""==""--dry"" ( SET "CALL=echo" ) IF /I ""%~1""==""-s"" ( SET "CALL=echo" ) + IF /I ""%~1""==""-v"" ( SET "ENABLE_VNC=" ) IF /I ""%~1""==""--vnc"" ( SET "ENABLE_VNC=" ) IF /I ""%~1""==""--path"" ( SET "DESIGNS=%~2" && SHIFT ) IF /I ""%~1""==""-p"" ( SET "DESIGNS=%~2" && SHIFT ) + IF /I ""%~1""==""-k"" ( SET "PDK=%~2" && SHIFT ) IF /I ""%~1""==""--pdk"" ( SET "PDK=%~2" && SHIFT ) SHIFT GOTO parse @@ -26,10 +28,10 @@ SET CALL=call echo -h --help Show usage information echo -s --dry See the commands to be executed echo -p --path PATH Link to a directory - echo --vnc Enable the vnc in port "https:\\localhost:8444" + echo -v --vnc Enable the vnc in port "https:\\localhost:8444" echo If vnc is not working, execute: - echo $ xfce4-session --display=:1 & - echo --pdk PDK Set the PDK to be used (gf180mcuC | sky130A) + echo ^$ xfce4-session --display=:1 ^& + echo -k --pdk PDK Set the PDK to be used: gf180mcuC ^| sky130A echo By default: gf180mcuC GOTO end diff --git a/stacks/analog-tools/scripts/patch-open-pdks.sh b/stacks/analog-tools/scripts/patch-open-pdks.sh index a06d0da..f1c7311 100644 --- a/stacks/analog-tools/scripts/patch-open-pdks.sh +++ b/stacks/analog-tools/scripts/patch-open-pdks.sh @@ -68,6 +68,13 @@ function gf180_patch_klayout_precheck_drc() { wget -O $KLAYOUT_HOME/drc/rule_decks/$PRECHECK_GF_FILE $PRECHECK_REPO/$PRECHECK_GF_FILE } +function gf180_patch() { + gf180_patch_xschemrc + gf180_patch_klayout_pcells + gf180_patch_klayout_dropdown + gf180_patch_klayout_precheck_drc +} + #################### # PATCH SKY130 PDK #################### @@ -118,14 +125,15 @@ function sky130_patch_klayout_precheck_drc() { wget -O $KLAYOUT_HOME/drc/$PRECHECK_SKY_FILE $PRECHECK_REPO/$PRECHECK_SKY_FILE } -gf180_patch_xschemrc -gf180_patch_klayout_pcells -gf180_patch_klayout_dropdown -gf180_patch_klayout_precheck_drc -sky130_patch_reduced_models -sky130_patch_klayout_lyt -sky130_patch_klayout_lym -sky130_patch_klayout_pcells -sky130_patch_klayout_precheck_drc +function sky130_patch() { + sky130_patch_reduced_models + sky130_patch_klayout_lyt + # sky130_patch_klayout_lym # TODO: The file disappears + # sky130_patch_klayout_pcells # TODO: Before fixing lym, this explodes + sky130_patch_klayout_precheck_drc +} -aur-install gedit xterm gvim \ No newline at end of file +gf180_patch +sky130_patch + +sudo aur-install gedit xterm gvim \ No newline at end of file From e9c4c8ffdd088d2c0e463623f8810a845d09bfca Mon Sep 17 00:00:00 2001 From: Aquiles Viza Date: Fri, 29 Sep 2023 16:04:17 -0300 Subject: [PATCH 10/10] changed analog-tools to chipathon-tools. Using heavy container --- compile.bat | 6 +++--- run.bat | 4 ++-- run.sh | 4 ++-- stacks/{analog-tools => chipathon-tools}/Dockerfile | 4 ++-- stacks/{analog-tools => chipathon-tools}/scripts/.bashrc | 0 stacks/{analog-tools => chipathon-tools}/scripts/.vimrc | 0 .../scripts/iic-spice-model-red.py | 0 .../scripts/install-open-pdks.sh | 0 .../scripts/patch-open-pdks.sh | 1 + 9 files changed, 10 insertions(+), 9 deletions(-) rename stacks/{analog-tools => chipathon-tools}/Dockerfile (82%) rename stacks/{analog-tools => chipathon-tools}/scripts/.bashrc (100%) rename stacks/{analog-tools => chipathon-tools}/scripts/.vimrc (100%) rename stacks/{analog-tools => chipathon-tools}/scripts/iic-spice-model-red.py (100%) rename stacks/{analog-tools => chipathon-tools}/scripts/install-open-pdks.sh (100%) rename stacks/{analog-tools => chipathon-tools}/scripts/patch-open-pdks.sh (99%) diff --git a/compile.bat b/compile.bat index 1491b51..48c6e1a 100644 --- a/compile.bat +++ b/compile.bat @@ -2,8 +2,8 @@ setlocal @REM SET BASE_IMG=git.1159.cl/mario1159/analog-xk-web:latest -SET BASE_IMG=git.1159.cl/mario1159/analog-xk-desktop:latest -SET RESULT_IMAGE=akilesalreadytaken/analog-tools:latest +SET BASE_IMG=git.1159.cl/mario1159/heavy-desktop:latest +SET RESULT_IMAGE=akilesalreadytaken/chipathon-tools:latest SET CALL=call :parse @@ -24,7 +24,7 @@ SET CALL=call :run - %CALL% docker build --build-arg BASE_IMG=%BASE_IMG% -t %RESULT_IMAGE% -f stacks/analog-tools/Dockerfile stacks/analog-tools/ + %CALL% docker build --build-arg BASE_IMG=%BASE_IMG% -t %RESULT_IMAGE% -f stacks/chipathon-tools/Dockerfile stacks/chipathon-tools/ GOTO end :end diff --git a/run.bat b/run.bat index db1b222..423e04d 100644 --- a/run.bat +++ b/run.bat @@ -2,7 +2,7 @@ setlocal SET IMAGE=akilesalreadytaken/analog-xk:latest -SET IMAGE=akilesalreadytaken/analog-tools:latest +SET IMAGE=akilesalreadytaken/chipathon-tools:latest ::SET IMAGE=git.1159.cl/mario1159/analog-xk-web:latest SET CALL=call @@ -51,7 +51,7 @@ SET CALL=call IF NOT DEFINED CONTAINER_USER SET CONTAINER_USER=1000 IF NOT DEFINED CONTAINER_GROUP SET CONTAINER_GROUP=1000 - IF NOT DEFINED CONTAINER_NAME SET CONTAINER_NAME=analog-tools + IF NOT DEFINED CONTAINER_NAME SET CONTAINER_NAME=chipathon-tools IF NOT DEFINED JUPYTER_PORT SET JUPYTER_PORT=8888 IF NOT DEFINED VNC_PORT SET VNC_PORT=8444 diff --git a/run.sh b/run.sh index 7d65979..5ab132e 100644 --- a/run.sh +++ b/run.sh @@ -2,7 +2,7 @@ set -e # IMAGE=akilesalreadytaken/analog-xk:latest -IMAGE=akilesalreadytaken/analog-tools:latest +IMAGE=akilesalreadytaken/chipathon-tools:latest # IMAGE=git.1159.cl/mario1159/analog-xk-web:latest CALL= @@ -48,7 +48,7 @@ function run () { [ -z "${CONTAINER_USER+x}" ] && CONTAINER_USER=$(id -u) [ -z "${CONTAINER_GROUP+x}" ] && CONTAINER_GROUP=$(id -g) - [ -z "${CONTAINER_NAME+x}" ] && CONTAINER_NAME=analog-tools + [ -z "${CONTAINER_NAME+x}" ] && CONTAINER_NAME=chipathon-tools [ -z "${JUPYTER_PORT+x}" ] && JUPYTER_PORT=8888 [ -z "${VNC_PORT+x}" ] && VNC_PORT=8444 diff --git a/stacks/analog-tools/Dockerfile b/stacks/chipathon-tools/Dockerfile similarity index 82% rename from stacks/analog-tools/Dockerfile rename to stacks/chipathon-tools/Dockerfile index 28a1003..8b44771 100644 --- a/stacks/analog-tools/Dockerfile +++ b/stacks/chipathon-tools/Dockerfile @@ -1,5 +1,5 @@ -ARG BASE_IMG=analog-xk -FROM $BASE_IMG as analog-tools +ARG BASE_IMG=heavy-desktop +FROM $BASE_IMG as chipathon-tools # Add scripts COPY --chown=designer:designer --chmod=755 scripts/install-open-pdks.sh . diff --git a/stacks/analog-tools/scripts/.bashrc b/stacks/chipathon-tools/scripts/.bashrc similarity index 100% rename from stacks/analog-tools/scripts/.bashrc rename to stacks/chipathon-tools/scripts/.bashrc diff --git a/stacks/analog-tools/scripts/.vimrc b/stacks/chipathon-tools/scripts/.vimrc similarity index 100% rename from stacks/analog-tools/scripts/.vimrc rename to stacks/chipathon-tools/scripts/.vimrc diff --git a/stacks/analog-tools/scripts/iic-spice-model-red.py b/stacks/chipathon-tools/scripts/iic-spice-model-red.py similarity index 100% rename from stacks/analog-tools/scripts/iic-spice-model-red.py rename to stacks/chipathon-tools/scripts/iic-spice-model-red.py diff --git a/stacks/analog-tools/scripts/install-open-pdks.sh b/stacks/chipathon-tools/scripts/install-open-pdks.sh similarity index 100% rename from stacks/analog-tools/scripts/install-open-pdks.sh rename to stacks/chipathon-tools/scripts/install-open-pdks.sh diff --git a/stacks/analog-tools/scripts/patch-open-pdks.sh b/stacks/chipathon-tools/scripts/patch-open-pdks.sh similarity index 99% rename from stacks/analog-tools/scripts/patch-open-pdks.sh rename to stacks/chipathon-tools/scripts/patch-open-pdks.sh index f1c7311..864b99e 100644 --- a/stacks/analog-tools/scripts/patch-open-pdks.sh +++ b/stacks/chipathon-tools/scripts/patch-open-pdks.sh @@ -11,6 +11,7 @@ PRECHECK_REPO=https://raw.githubusercontent.com/efabless/mpw_precheck/main/check PRECHECK_GF_FILE=gf180mcuC_mr.drc PRECHECK_SKY_FILE=sky130A_mr.drc +# TODO: DOWNLOAD WITH WGET, DONT HAVE IT STATIC if [ -d $SCRIPT_DIR/iic-spice-model-red.py ]; then echo File iic-spice-model.red.py not found return -1