Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

14 changed files with 193 additions and 2641 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 562 KiB

View File

@ -312,43 +312,4 @@ jobs:
tags: git.1159.cl/mario1159/heavy-web
platforms: linux/amd64
context: .
file: ./stacks/heavy.Dockerfile
build-chipathon-tools:
needs: build-heavy
runs-on: [ubuntu-latest, amd64]
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Authentication
uses: docker/login-action@v2
with:
registry: git.1159.cl
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build chipathon-tools desktop
uses: docker/build-push-action@v4
with:
push: true
build-args: BASE_IMG=git.1159.cl/mario1159/heavy-desktop
tags: git.1159.cl/mario1159/chipathon-tools-desktop
platforms: linux/amd64
context: .
file: ./stacks/chipathon-tools/Dockerfile
- name: Build chipathon-tools web
uses: docker/build-push-action@v4
with:
push: true
build-args: BASE_IMG=git.1159.cl/mario1159/heavy-web
tags: git.1159.cl/mario1159/chipathon-tools-web
platforms: linux/amd64
context: .
file: ./stacks/chipathon-tools/Dockerfile
file: ./stacks/heavy.Dockerfile

View File

@ -50,9 +50,9 @@ These scripts automate the binding of graphics environment variables to the cont
Execute the next script in powershell and follow the container initialization prompt.
```pwsh
& ([scriptblock]::Create((irm https://git.1159.cl/Mario1159/osic-stacks/raw/branch/main/run.ps1))) -pull -download
& ([scriptblock]::Create((irm https://git.1159.cl/Mario1159/osic-stacks/raw/branch/main/run.ps1))) -remote
```
This script will run the container inside WSL and bind the enviroments variables for [WSLg](https://github.com/microsoft/wslg/blob/main/samples/container/Containers.md). Also, it will download itself so it will exists locally.
This script will run the container inside WSL and bind the enviroments variables for [WSLg](https://github.com/microsoft/wslg/blob/main/samples/container/Containers.md).
##### Linux
Execute the next script in your terminal replacing `<container_name>` by any name and `<stack>` by an stack from the previous [stack list](#stacks).

View File

@ -6,7 +6,7 @@ FROM greyltc/archlinux-aur:paru as osicstacks-base-desktop
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 xterm wget
RUN aur-install sudo git git-lfs python python-pip python-pipx xz gnu-free-fonts vim ngspice gedit jupyter-notebook xterm
ENV TERM=xterm EDITOR=gedit
# Clean cache

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 744 KiB

314
run.ps1
View File

@ -1,275 +1,89 @@
param(
[switch] $pull = $false,
[switch] $interactive = $false,
[switch] $silent = $false,
[switch] $attach = $false,
[switch] $download = $false
param([switch] $remote = $false)
Write-Host "OSIC-Stacks Container Creation" -ForegroundColor Green
Write-Host "Checking requirements and WSL updates" -ForegroundColor DarkGray
Write-Host ""
wsl --install Ubuntu --no-launch
wsl --update
Write-Host ""
Write-Host "Please select an image index:"
$stacks_options = @(
'analog-xk'
'analog-xm'
'analog-heavy'
'digital-ator'
'digital-icarus'
'digital-heavy'
'heavy'
)
$global:STACK_OPTIONS = [ordered]@{
1 = 'analog-xk'
2 = 'analog-xm'
3 = 'analog-heavy'
4 = 'digital-ator'
5 = 'digital-icarus'
6 = 'digital-heavy'
7 = 'heavy'
8 = "chipathon-tools"
for($i = 0; $i -lt $stacks_options.Length; $i++) {
$stack_option = $stacks_options[$i]
Write-Host "[$($i+1)] - $stack_option" -ForegroundColor Cyan
}
$global:SELECTED_STACK='chipathon-tools'
$global:CONTAINER_NAME=$global:SELECTED_STACK
$global:EXECMODE='desktop'
$global:PDK="gf180mcuD"
$global:DIRECTORY=Get-Location | Foreach-Object { $_.Path }
$global:WSL_DISTRO="NO DISTRO"
$stack_index = Read-Host -Prompt "Container image to initialize [1-$($stacks_options.Length)]"
$selected_stack = $stacks_options[$stack_index-1]
$container_name = Read-Host -Prompt "Container instance name [default=$selected_stack]"
if (!$container_name) { $container_name = $selected_stack }
$global:PARAMS = ""
New-Alias Call Invoke-Expression
function debug($fname, $message) {
Write-Host "[$fname] $message" -ForegroundColor Green
}
function get-ubuntu-distro() {
# Identify if distro has (Predeterminado) or something like that
Invoke-Expression "wsl --list" | ForEach-Object {
if ($_ -match '\)' ) {
$global:WSL_DISTRO=$_.split('(')[0].replace(" ","")
}
}
debug "get-ubuntu-distro" "Linux distribution: $global:WSL_DISTRO"
}
function validate-environment() {
Write-Host "Checking requirements and WSL updates" -ForegroundColor DarkGray
Write-Host ""
Call "wsl --install Ubuntu --no-launch"
Call "wsl --update"
Write-Host ""
}
function select-stack() {
Write-Host "Please select an stack index:"
$STACK_OPTIONS.GetEnumerator() | ForEach-Object {
Write-Host "[$($_.Key)] - $($_.Value)" -ForegroundColor Cyan
}
$response = Read-Host -Prompt "Container stack to initialize [1-$($STACK_OPTIONS.Count)]"
if ($response) {
$global:SELECTED_STACK = $STACK_OPTIONS[$response-1]
}
$response = Read-Host -Prompt "Container instance name [default=$global:CONTAINER_NAME]"
if ($response) {
$global:CONTAINER_NAME = $response
}
}
function select-execmode() {
$execmode = ''
while(!$execmode) {
Write-Host "Please select an execution mode index"
Write-Host '[1] - desktop' -ForegroundColor Cyan
Write-Host '[2] - web' -ForegroundColor Cyan
$response = Read-Host "Execution mode [1-2] [default=$global:EXECMODE]"
$response = Read-Host "Execution mode [1-2]"
if ($response -eq '1') {
$global:EXECMODE = 'desktop'
$execmode = 'desktop'
} elseif ($response -eq '2') {
$global:EXECMODE = 'web'
$execmode = 'web'
} else {
Write-Host "Using default mode ($global:EXECMODE)"
Write-Host "Unexpected respose, please try again" -ForegroundColor Red
}
}
function bind-to-directory() {
$response = Read-Host "Do you want to bind the container home directory into a windows directory? [N/y]"
if ($response -eq 'y') {
$global:DIRECTORY = Read-Host "Write the windows directory destination , for example `"C:\Users\Username\Desktop\ExampleFolder`"`n"
}
$additional_options = ''
if($remote) {
$image = "git.1159.cl/mario1159/$selected_stack-$execmode"
$additional_options = '--pull always '
} else {
$image = "$selected_stack-$execmode"
}
function set-aditional-parameters() {
$response = Read-Host -Prompt "Do you want to set additional arguments for the container instantiation? [N/y]"
$response = Read-Host "Do you want to bind the container home directory into a windows directory? [N/y]"
if ($response -eq 'y') {
$response = Read-Host -Prompt "Write the additional arguments, for example -v <wsl_path>:<container_path>."
$global:PARAMS += " $response"
}
if ($response -eq 'y') {
$directory = Read-Host "Write the windows directory destination relative to WSL, for example `"/mnt/c/Users/Username/Desktop/ExampleFolder`"`n"
$additionaloptions = -join($additionaloptions, "-v ${directory}:/home/designer/shared ")
}
function force-pull() {
$response = Read-Host -Prompt "Do you want to pull latest image? [N/y] [default=N]"
$response = Read-Host -Prompt "Do you want to set additional arguments for the container instantiation? [N/y]"
if ($response -eq 'y') {
$global:PARAMS += " --pull always"
}
if ($response -eq 'y') {
$response = Read-Host -Prompt "Write the additional arguments, for example -v <wsl_path>:<container_path>."
$additionaloptions = -join($additionaloptions, $response)
}
function select-pdk() {
Write-Host "Please select a pdk"
Write-Host '[1] - gf180mcuC' -ForegroundColor Cyan
Write-Host '[2] - sky130A' -ForegroundColor Cyan
$response = Read-Host "Execution mode [1-2] [default=$global:PDK]"
Write-Host ""
if ($response -eq '1') {
$global:PDK = 'gf180mcuC'
} elseif ($response -eq '2') {
$global:PDK = 'sky130A'
} else {
Write-Host "Using default pdk ($global:PDK)"
}
}
$dockercommand = ("docker run -d " +
"--name $container_name " +
"-v /tmp/.X11-unix:/tmp/.X11-unix " +
"-v /mnt/wslg:/mnt/wsl " +
"-e WAYLAND_DISPLAY=`$WAYLAND_DISPLAY " +
"-e DISPLAY=`$DISPLAY " +
"-e XDG_RUNTIME_DIR=/mnt/wslg " +
"$additional_options "+
$image)
function attach-shell () {
Call "docker exec -it $global:CONTAINER_NAME bash"
}
wsl -d Ubuntu bash -ic $dockercommand
function path-conversion() {
$directory, $other = $args
$drive, $path = $directory.split(":")
echo "/mnt/$($drive.tolower())$($path.replace("\","/"))"
}
function get-value-from-wsl() {
$variable, $other = $args
$cmd = "wsl bash -c `'echo `$$variable`'"
# Simple replacement
#$cmd = "wsl -d $global:WSL_DISTRO bash -c `'echo `$$variable`'"
#$cmd = "wsl -d `'$global:WSL_DISTRO`' bash -c `'echo `$$variable`'"
# Using parenthesis
#$cmd = "wsl -d $($global:WSL_DISTRO) bash -c `'echo `$$variable`'"
#$cmd = "wsl -d `'$($global:WSL_DISTRO)`' bash -c `'echo `$$variable`'"
#$cmd = "wsl -d `"$($global:WSL_DISTRO)`" bash -c `'echo `$$variable`'"
# Using curly braces
#$cmd = "wsl -d ${global:WSL_DISTRO} bash -c `'echo `$$variable`'"
#$cmd = "wsl -d '${global:WSL_DISTRO}' bash -c `'echo `$$variable`'"
# Using here strings (Never worked)
# @"
# "wsl -d $global:WSL_DISTRO bash -c `'echo `$$variable`'"
# "@
debug "get-value-from-wsl" "Command: $cmd"
$response = Invoke-Expression "$cmd"
debug "get-value-from-wsl" "Response: $response"
return $response
}
function set-common-parameters () {
$global:IMAGE = "git.1159.cl/mario1159/$SELECTED_STACK-$EXECMODE"
if ($attach) {
$global:PARAMS += " -it --rm"
$global:COMMAND = "bash"
} else {
$global:PARAMS += " -d"
$global:COMMAND = ""
}
if ($pull) {
$global:PARAMS += " --pull always"
}
$global:PARAMS += " --name $global:CONTAINER_NAME"
$global:PARAMS += " --security-opt seccomp=unconfined"
# $global:PARAMS += " -p '8888:8888'"
# $global:PARAMS += " -p '8082:8082'"
$global:PARAMS += " -e PDK=$global:PDK"
$global:PARAMS += " -e DISPLAY=$(get-value-from-wsl "DISPLAY")"
$global:PARAMS += " -e WAYLAND_DISPLAY=$(get-value-from-wsl "WAYLAND_DISPLAY")"
$global:PARAMS += " -e XDG_RUNTIME_DIR=$(get-value-from-wsl "XDG_RUNTIME_DIR")"
}
function run-docker-wsl() {
$global:DIRECTORY = path-conversion $global:DIRECTORY
$global:PARAMS += " -v /tmp/.X11-unix:/tmp/.X11-unix"
$global:PARAMS += " -v /mnt/wslg:/mnt/wsl"
$global:PARAMS += " -v ${global:DIRECTORY}:/home/designer/shared "
#Call "wsl -d $global:WSL_DISTRO bash --noprofile --norc -ic `"docker run $global:PARAMS $global:IMAGE $global:COMMAND`""
Call "wsl bash --noprofile --norc -ic `"docker run $global:PARAMS $global:IMAGE $global:COMMAND`""
if ($?) {
Write-Host "Container created successfully!" -ForegroundColor Green
Write-Host "Enter the container with `"docker exec -it $global:CONTAINER_NAME bash`"" -ForegroundColor DarkGray
attach-shell
} else {
Write-Host "Container creation failed, see logs above" -ForegroundColor Red
}
}
function run-docker-win() {
$global:PARAMS += " -v '\\wsl.localhost\$global:WSL_DISTRO\mnt\wslg:/tmp'"
$global:PARAMS += " -v ${global:DIRECTORY}:/home/designer/shared"
#$global:PARAMS += " -v '\\wsl.localhost\$global:WSL_DISTRO\mnt\wslg\runtime-dir'%XDG_RUNTIME_DIR%"
Call "docker run $global:PARAMS $global:IMAGE $global:COMMAND"
if ($?) {
Write-Host "Container created successfully!" -ForegroundColor Green
Write-Host "Enter the container with `"docker exec -it $global:CONTAINER_NAME bash`"" -ForegroundColor DarkGray
attach-shell
} else {
Write-Host "Container creation failed, see logs above" -ForegroundColor Red
}
}
function download-run-bat () {
if (!$download) { return }
try {
$response = Call "Invoke-WebRequest -URI https://git.1159.cl/Mario1159/osic-stacks/raw/branch/main/run.ps1 -OutFile run.ps1"
} catch {
$StatusCode = $_.Exception.Response.StatusCode.value__
Write-Host "Error downloading file :( ($($StatusCode))" -ForegroundColor Red
return
}
Write-Host "run.bat updated successfully" -ForegroundColor Green
}
function run(){
if ($silent) {
Write-Host "[Silent Mode]" -ForegroundColor Yellow
Remove-Alias Call
New-Alias Call Write-Host
}
Write-Host "OSIC-Stacks Container Creation" -ForegroundColor Green
download-run-bat
validate-environment
get-ubuntu-distro
if ($interactive) {
select-stack
select-execmode
bind-to-directory
set-aditional-parameters
force-pull
}
set-common-parameters
#run-docker-win
run-docker-wsl
}
run
if ($?) {
Write-Host "Container created successfully!" -ForegroundColor Green
Write-Host "Enter the container with `"docker exec -it $container_name bash`"" -ForegroundColor DarkGray
} else {
Write-Host "Container creation failed, see logs above" -ForegroundColor Red
}

View File

@ -12,6 +12,9 @@ RUN sudo aur-install \
klayout \
netgen-lvs-git
RUN pip install gdsfactory --break-system-packages
RUN pip install gf180 --upgrade --break-system-packages
# Clean cache
RUN sudo pacman -Scc

View File

@ -2,16 +2,13 @@ ARG BASE_IMG=heavy-desktop
FROM $BASE_IMG as chipathon-tools
# Add scripts
COPY --chown=designer:designer --chmod=755 stacks/chipathon-tools/scripts/global-variables.sh .
COPY --chown=designer:designer --chmod=755 stacks/chipathon-tools/scripts/install-open-pdks.sh .
COPY --chown=designer:designer --chmod=755 scripts/install-open-pdks.sh .
RUN ./install-open-pdks.sh
COPY --chown=designer:designer --chmod=755 stacks/chipathon-tools/scripts/* .
RUN ./patch-open-pdks-gf180.sh
RUN ./patch-open-pdks-sky130.sh
COPY --chown=designer:designer --chmod=755 scripts/* .
RUN ./patch-open-pdks.sh
RUN rm *.sh
# Initialize the enviroment keeping container alive
CMD ["sleep", "infinity"]
CMD ["sleep", "infinity"]

View File

@ -1,33 +1,22 @@
[[ $- != *i* ]] && return
# ------------------
# SET PDK PARAMETERS
# ------------------
if [ "$PDK" == "" ]; then
echo "PDK not defined, using default one (gf180mcuD)"
PDK=gf180mcuD
fi
case "$PDK" in
gf180mcuC) echo "gf180mcuC is not supported, only D variant [default one]" ;;
gf180mcuD) export STD_CELL_LIBRARY=gf180mcu_fd_sc_mcu7t5v0 ;;
sky130A) export STD_CELL_LIBRARY=sky130_fd_sc_hd ;;
*) echo "PDK $PDK NOT RECOGNIZED";;
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
export PDKPATH=$PDK_ROOT/$PDK
export KLAYOUT_HOME=$PDK_ROOT/$PDK/libs.tech/klayout
alias xschem='xschem -b --rcfile $PDK_ROOT/$PDK/libs.tech/xschem/xschemrc'
alias xschemtcl='xschem --rcfile $PDK_ROOT/$PDK/libs.tech/xschem/xschemrc'
#alias magic='magic --rcfile $PDK_ROOT/$PDK/libs.tech/magic/*.magicrc'
# ------------------
# SET PROMPT
# ------------------
function git_branch {
branch=$(git symbolic-ref --short HEAD 2>/dev/null)
if [ "$branch" != "" ]; then
@ -48,12 +37,13 @@ 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 :(
# --------------------------------
# USEFUL ENV VARIABLES AND ALIASES
# --------------------------------
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"
git config --global --add safe.directory /home/designer/shared
git config --global --add safe.directory /workspaces/*
alias xschem='xschem -b --rcfile $PDK_ROOT/$PDK/libs.tech/xschem/xschemrc'
alias xschemtcl='xschem --rcfile $PDK_ROOT/$PDK/libs.tech/xschem/xschemrc'
git config --global --add safe.directory $DESIGNS

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
export PDK_ROOT=/home/designer/.volare
#export OPEN_PDKS_COMMIT="cd1748bb197f9b7af62a54507de6624e30363943"
export OPEN_PDKS_COMMIT="bdc9412b3e468c102d01b7cf6337be06ec6e9c9a"
# This files can be downloaded directly
# - sky130A_mr.drc
# - gf180mcuD_mr.drc
export PRECHECK_REPO=https://raw.githubusercontent.com/efabless/mpw_precheck/main/checks/tech-files/
export PRECHECK_GF_FILE=gf180mcuD_mr.drc
export PRECHECK_SKY_FILE=sky130A_mr.drc
export SCRIPT_DIR=$PWD

View File

@ -1,32 +1,32 @@
#!/bin/bash
set -ex
set -e
source ./global-variables.sh
#pip install git+https://github.com/gdsfactory/skywater130.git git+https://github.com/gdsfactory/gf180.git --upgrade --break-system-packages
# pip install gf180 --upgrade --break-system-packages
# pip install sky130 --upgrade --break-system-packages
pip install gdsfactory[cad]==7.3.0 --break-system-packages
export OPEN_PDKS_VERSION="dd7771c384ed36b91a25e9f8b314355fc26561be"
export SCRIPT_DIR=$PWD
######################
# INSTALL GF180MCU PDK
######################
volare enable "${OPEN_PDKS_COMMIT}" --pdk gf180mcu
volare enable "${OPEN_PDKS_VERSION}" --pdk gf180mcu
rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuA
rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuB
rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuC
rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuD
rm -rf $PDK_ROOT/gf180mcuA
rm -rf $PDK_ROOT/gf180mcuB
rm -rf $PDK_ROOT/gf180mcuC
rm -rf $PDK_ROOT/gf180mcuD
####################
# INSTALL SKY130 PDK
####################
volare enable "${OPEN_PDKS_COMMIT}" --pdk sky130
pip install sky130 --upgrade --break-system-packages
volare enable "${OPEN_PDKS_VERSION}" --pdk sky130
# ADD PCELL SUPPORT
# remove version sky130B to save space (efabless TO use mostly sky130A)
rm -rf "$PDK_ROOT"/volare/sky130/versions/*/sky130B

View File

@ -1,168 +0,0 @@
#!/bin/bash
set -ex
function _gf180mcuD_clean_install() {
# Re-installs gf180mcuD
rm -rf $PDK_ROOT/gf180mcu*
rm -rf $PDK_ROOT/volare/gf180mcu/versions/$OPEN_PDKS_COMMIT
volare enable --pdk gf180mcu $OPEN_PDKS_COMMIT
rm -rf $PDK_ROOT/gf180mcuA
rm -rf $PDK_ROOT/gf180mcuB
rm -rf $PDK_ROOT/gf180mcuC
rm -rf $PDK_ROOT/volare/gf180mcu/versions/$OPEN_PDKS_COMMIT/gf180mcuA
rm -rf $PDK_ROOT/volare/gf180mcu/versions/$OPEN_PDKS_COMMIT/gf180mcuB
rm -rf $PDK_ROOT/volare/gf180mcu/versions/$OPEN_PDKS_COMMIT/gf180mcuC
}
function gf180_delete_repos() {
rm -rf globalfoundries-pdk-libs-gf180mcu_fd_pr
rm -rf globalfoundries-pdk-libs-gf180mcu_fd_pv
}
function gf180_download_repos() {
gf180_delete_repos
git clone --depth 1 https://github.com/efabless/globalfoundries-pdk-libs-gf180mcu_fd_pr.git
git clone --depth 1 https://github.com/efabless/globalfoundries-pdk-libs-gf180mcu_fd_pv.git
}
function gf180_patch_ngspice_primitives() {
NGSPICE_TECH=$PDK_ROOT/gf180mcuD/libs.tech/ngspice
rm -rf $NGSPICE_TECH
mv globalfoundries-pdk-libs-gf180mcu_fd_pr/models/ngspice $NGSPICE_TECH
}
function gf180_patch_xyce_primitives() {
XYCE_TECH=$PDK_ROOT/gf180mcuD/libs.tech/xyce
rm -rf $XYCE_TECH
mv globalfoundries-pdk-libs-gf180mcu_fd_pr/models/xyce $XYCE_TECH
}
function gf180_patch_xschem_primitives() {
# Replace volare xschem dir with efabless one
XSCHEM_TECH=$PDK_ROOT/gf180mcuD/libs.tech/xschem
rm -rf $XSCHEM_TECH
mv globalfoundries-pdk-libs-gf180mcu_fd_pr/cells/xschem $XSCHEM_TECH
}
function gf180_patch_xschem_xschemrc() {
FILEPATH=$PDK_ROOT/gf180mcuD/libs.tech/xschem/xschemrc
# Add gf180mcuD symbols to xschem path
ORIGINAL='append XSCHEM_LIBRARY_PATH :$env(PWD)'
REPLACE='append XSCHEM_LIBRARY_PATH :$env(PDK_ROOT)/gf180mcuD/libs.tech/xschem'
sed -i "s\\$ORIGINAL\\$REPLACE\g" $FILEPATH
# Update 180MCU_MODELS
ORIGINAL='set 180MCU_MODELS ${PDK_ROOT}/models/ngspice'
REPLACE='set 180MCU_MODELS $env(PDK_ROOT)/gf180mcuD/libs.tech/ngspice'
sed -i "s\\$ORIGINAL\\$REPLACE\g" $FILEPATH
# Allow setting of symbol paths with XSCHEM_USER_LIBRARY_PATH env variable
echo '' >> $FILEPATH
echo '# open_pdks-specific' >> $FILEPATH
echo 'set XSCHEM_START_WINDOW ${PDK_ROOT}/gf180mcuD/libs.tech/xschem/tests/0_top.sch' >> $FILEPATH
echo 'append XSCHEM_LIBRARY_PATH :${PDK_ROOT}/gf180mcuD/libs.tech/xschem' >> $FILEPATH
echo '' >> $FILEPATH
echo '# allow a user-specific path add-on' >> $FILEPATH
echo 'if { [info exists ::env(XSCHEM_USER_LIBRARY_PATH) ] } {' >> $FILEPATH
echo ' append XSCHEM_LIBRARY_PATH :$env(XSCHEM_USER_LIBRARY_PATH)' >> $FILEPATH
echo '}' >> $FILEPATH
}
function gf180_patch_klayout_pcells() {
# Delete old volare pymacros, use the pcells from efabless repo.
rm -rf $KLAYOUT_HOME/pymacros
mv globalfoundries-pdk-libs-gf180mcu_fd_pr/cells/klayout/pymacros $KLAYOUT_HOME
}
function gf180_patch_klayout_tech_clean() {
# DRC and LVS is obsolete, and the copy is made on $KLAYOUT_HOME/
rm -rf $KLAYOUT_HOME/tech/drc
rm -rf $KLAYOUT_HOME/tech/lvs
# .lym should be on $KLAYOUT_HOME/pymacros
rm -rf $KLAYOUT_HOME/tech/gf180mcu.lym
}
function gf180_patch_klayout_drc_lvs() {
rm -rf $KLAYOUT_HOME/drc
rm -rf $KLAYOUT_HOME/lvs
mv globalfoundries-pdk-libs-gf180mcu_fd_pv/klayout/drc $KLAYOUT_HOME
mv globalfoundries-pdk-libs-gf180mcu_fd_pv/klayout/lvs $KLAYOUT_HOME
}
function gf180_patch_klayout_dropdown() {
# dropdown menu should live on $KLAYOUT_HOME/macro
# Depends on $KLAYOUT_HOME/drc $KLAYOUT_HOME/lvs
mv globalfoundries-pdk-libs-gf180mcu_fd_pr/rules/klayout/macros $KLAYOUT_HOME
# Make D the default variant in {drc lvs}_options.yml
FILEPATH=$KLAYOUT_HOME/macros/*_options.yml
ORIGINAL='variant: C'
REPLACE='variant: D'
sed -i "s\\$ORIGINAL\\$REPLACE\g" $FILEPATH
# Make D default on .lym
FILEPATH=$KLAYOUT_HOME/macros/gf180mcu_options.lym
ORIGINAL=';"C"'
REPLACE=';"D"'
sed -i "s\\$ORIGINAL\\$REPLACE\g" $FILEPATH
ORIGINAL='], 2)'
REPLACE='], 3)'
sed -i "s\\$ORIGINAL\\$REPLACE\g" $FILEPATH
}
function gf180_patch_klayout_precheck_drc() {
wget -O $KLAYOUT_HOME/drc/$PRECHECK_GF_FILE $PRECHECK_REPO/$PRECHECK_GF_FILE
}
function gf180_patch_klayout_lyp() {
# If $KLAYOUT_HOME/tech is not modified, this has no dependencies
mv gf180mcu.lyp $KLAYOUT_HOME/tech/gf180mcu.lyp
}
function gf180_patch() {
# volare pdk should be installed with ./volare_install.sh
export KLAYOUT_HOME="$PDK_ROOT/gf180mcuD/libs.tech/klayout"
gf180_download_repos
gf180_patch_ngspice_primitives
gf180_patch_xyce_primitives
gf180_patch_xschem_primitives
gf180_patch_xschem_xschemrc
gf180_patch_klayout_pcells
gf180_patch_klayout_tech_clean
gf180_patch_klayout_drc_lvs
gf180_patch_klayout_dropdown
gf180_patch_klayout_precheck_drc
gf180_patch_klayout_lyp
gf180_delete_repos
}
source ./global-variables.sh
#_gf180mcuD_clean_install
pip install docopt --upgrade --break-system-packages
gf180_patch

View File

@ -1,5 +1,84 @@
#!/bin/bash
set -ex
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
# 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
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
}
function gf180_patch() {
gf180_patch_xschemrc
gf180_patch_klayout_pcells
gf180_patch_klayout_dropdown
gf180_patch_klayout_precheck_drc
}
####################
# PATCH SKY130 PDK
####################
function sky130_patch_reduced_models() {
cd "$PDK_ROOT/sky130A/libs.tech/ngspice" || exit 1
@ -12,6 +91,7 @@ function sky130_patch_reduced_models() {
}
function sky130_patch_klayout_lyt() {
KLAYOUT_HOME="$PDK_ROOT/sky130A/libs.tech/klayout"
FILEPATH="$KLAYOUT_HOME/tech/sky130A.lyt"
sed -i 's/>sky130</>sky130A</g' $FILEPATH
@ -21,6 +101,7 @@ function sky130_patch_klayout_lyt() {
}
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
@ -30,6 +111,7 @@ function sky130_patch_klayout_lym () {
}
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
@ -40,11 +122,11 @@ function sky130_patch_klayout_pcells() {
}
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
}
function sky130_patch() {
export KLAYOUT_HOME="$PDK_ROOT/sky130A/libs.tech/klayout"
sky130_patch_reduced_models
sky130_patch_klayout_lyt
# sky130_patch_klayout_lym # TODO: The file disappears
@ -52,12 +134,7 @@ function sky130_patch() {
sky130_patch_klayout_precheck_drc
}
source ./global-variables.sh
gf180_patch
sky130_patch
# 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
fi
sky130_patch
sudo aur-install gedit xterm gvim