├── .github └── workflows │ ├── docker-image.yml │ └── documentation.yaml ├── .gitignore ├── .gitmodules ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── Doxyfile ├── LICENSE ├── Makefile ├── README.md ├── bashrc.config ├── bin ├── cic ├── cic-gui ├── json2lyp └── start_script.sh ├── cic-core ├── cic-core.pro ├── external │ └── libgds_dist │ │ ├── INSTALL │ │ ├── libgds.c │ │ ├── libgds.h │ │ └── write_gds_examples.c └── src │ ├── cells │ ├── capcell.cpp │ ├── capcell.h │ ├── capcellv2.cpp │ ├── capcellv2.h │ ├── cdac.cpp │ ├── cdac.h │ ├── cells.h │ ├── phcapcell.cpp │ ├── phcapcell.h │ ├── resistorcell.cpp │ ├── resistorcell.h │ ├── sar.cpp │ └── sar.h │ ├── cic-core.h │ ├── core │ ├── cell.cpp │ ├── cell.h │ ├── console.cpp │ ├── console.h │ ├── consoleoutput.cpp │ ├── consoleoutput.h │ ├── cut.cpp │ ├── cut.h │ ├── design.cpp │ ├── design.h │ ├── graph.cpp │ ├── graph.h │ ├── guard.cpp │ ├── guard.h │ ├── instance.cpp │ ├── instance.h │ ├── instancecut.h │ ├── instanceport.cpp │ ├── instanceport.h │ ├── layer.cpp │ ├── layer.h │ ├── layoutcell.cpp │ ├── layoutcell.h │ ├── layoutrotatecell.cpp │ ├── layoutrotatecell.h │ ├── patterncapacitor.cpp │ ├── patterncapacitor.h │ ├── patternhighresistor.cpp │ ├── patternhighresistor.h │ ├── patternhighresistornobulk.cpp │ ├── patternhighresistornobulk.h │ ├── patternresistor.cpp │ ├── patternresistor.h │ ├── patterntile.cpp │ ├── patterntile.h │ ├── patterntransistor.cpp │ ├── patterntransistor.h │ ├── point.h │ ├── port.cpp │ ├── port.h │ ├── rect.cpp │ ├── rect.h │ ├── route.cpp │ ├── route.h │ ├── routering.cpp │ ├── routering.h │ ├── rules.cpp │ ├── rules.h │ ├── text.cpp │ └── text.h │ ├── decorator │ ├── connectsourcedrain.cpp │ ├── connectsourcedrain.h │ ├── layoutcelldecorator.cpp │ └── layoutcelldecorator.h │ ├── printer │ ├── cics.cpp │ ├── cics.h │ ├── designprinter.cpp │ └── designprinter.h │ └── spice │ ├── capacitor.cpp │ ├── capacitor.h │ ├── mosfet.cpp │ ├── mosfet.h │ ├── resistor.cpp │ ├── resistor.h │ ├── spicedevice.cpp │ ├── spicedevice.h │ ├── spiceobject.cpp │ ├── spiceobject.h │ ├── spiceparser.cpp │ ├── spiceparser.h │ ├── subckt.cpp │ ├── subckt.h │ ├── subcktinstance.cpp │ └── subcktinstance.h ├── cic-gui ├── ALGIC003_STDLIB.icns ├── cic-gui.pro └── src │ ├── cellpainter.cpp │ ├── cellpainter.h │ ├── glwidget.cpp │ ├── glwidget.h │ ├── main.cpp │ ├── widget.cpp │ ├── widget.h │ ├── window.cpp │ └── window.h ├── cic ├── cic.pro └── src │ └── main.cpp ├── ciccreator.code-workspace ├── ciccreator.pro ├── config.yaml ├── docs ├── Makefile ├── make.bat └── source │ ├── api.rst │ ├── basics │ ├── basics.rst │ ├── netlist.rst │ ├── object.rst │ └── technology.rst │ ├── cells │ ├── cell.rst │ ├── cells.rst │ ├── layoutcell.rst │ ├── patterncapacitor.rst │ ├── patternresistor.rst │ ├── patterntile.rst │ └── patterntransistor.rst │ ├── conf.py │ ├── graphics │ ├── Connectivity_AB.png │ ├── Connectivity_B.png │ ├── DirectedRoute.png │ ├── Options_3cuts.png │ ├── Options_5cuts.png │ ├── Options_offsethigh.png │ ├── Options_offsethighend.png │ ├── Options_offsetlow.png │ ├── Options_offsetlowend.png │ ├── Options_onTopB.png │ ├── Options_onTopL.png │ ├── Options_onTopR.png │ ├── Options_onTopT.png │ ├── Options_track4.png │ ├── Options_track8.png │ ├── StartLeft_Left.png │ ├── StartLeft_Right.png │ ├── StartRight_Left.png │ ├── StartRight_Right.png │ ├── TEST.png │ ├── TESTVIA.png │ ├── U_Left.png │ ├── U_Right.png │ └── Vertical.png │ ├── index.rst │ ├── routing │ ├── con_route.rst │ ├── dir_route.rst │ ├── options.rst │ ├── route.rst │ ├── type.rst │ └── via.rst │ └── svg │ ├── Connectivity_A_-|--.svg │ ├── Connectivity_A|B_-.svg │ ├── Connectivity_B_-|--.svg │ ├── DDD.svg │ ├── Directed_StartLeft_Left(-|--).svg │ ├── Directed_StartLeft_Right(--|-).svg │ ├── Directed_StartRight_Left(-|--).svg │ ├── Directed_StartRight_Right(--|-).svg │ ├── Directed_U_Left(|-).svg │ ├── Directed_U_Right(-|).svg │ ├── Directed_Vertical(||).svg │ └── TEST.svg ├── etc ├── console_config.pro └── mac_sdk.pro ├── examples ├── LICENSE ├── SAR_ESSCIRC16_28N.json ├── SAR_ESSCIRC16_28N.spi ├── SAR_ESSCIRC16_28NBULK.spi ├── legend.json ├── routes.json ├── routes.spi ├── tech.json ├── tech.json.lyp ├── tech.json.lyt ├── tech_gds3d.txt ├── tech_gds3d_light.txt └── tech_svg.json ├── lay └── Makefile ├── schema.json └── tests ├── routes └── Makefile ├── sar └── Makefile └── sun_sar9b ├── Makefile ├── capacitor.json ├── dmos_sky130nm_core.json ├── ip.json ├── ip.spi ├── ref.cic └── sky130.tech /.github/workflows/docker-image.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | container: 15 | image: wulffern/cic_qt:latest 16 | options: --user root 17 | steps: 18 | - name: ciccreator 19 | uses: actions/checkout@v2 20 | - name: Compile 21 | run: | 22 | pip install cicpy 23 | make compile 24 | make test 25 | -------------------------------------------------------------------------------- /.github/workflows/documentation.yaml: -------------------------------------------------------------------------------- 1 | name: Docs 2 | on: [push, pull_request, workflow_dispatch] 3 | jobs: 4 | docs: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v2 8 | - uses: actions/setup-python@v2 9 | - name: Install dependencies 10 | run: | 11 | pip install sphinx sphinx_rtd_theme 12 | 13 | - name: Install doxygen 14 | run: | 15 | sudo apt-get update 16 | sudo apt-get install -y doxygen 17 | - name: Install breathe and run doxygen 18 | run: | 19 | git clone https://github.com/wulffern/breathe.git 20 | cd breathe 21 | python3 -m pip install . 22 | cd .. 23 | doxygen 24 | - name: Sphinx build 25 | run: | 26 | sphinx-build docs/source _build 27 | - name: Deploy 28 | uses: peaceiris/actions-gh-pages@v3 29 | if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} 30 | with: 31 | publish_branch: gh-pages 32 | github_token: ${{ secrets.GITHUB_TOKEN }} 33 | publish_dir: _build/ 34 | force_orphan: true 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *# 2 | *~ 3 | .#* 4 | .vscode 5 | bin 6 | version.h 7 | *.autosave 8 | lay 9 | build 10 | moc_* 11 | qmake.make 12 | *.o 13 | .DS_Store 14 | .qmake.* 15 | *.svg 16 | *.pro.user.* 17 | *.pro.user 18 | Makefile 19 | 20 | # Compiled Object files 21 | *.slo 22 | *.lo 23 | *.o 24 | *.obj 25 | 26 | # Precompiled Headers 27 | *.gch 28 | *.pch 29 | 30 | # Compiled Dynamic libraries 31 | *.so 32 | *.dylib 33 | *.dll 34 | 35 | # Fortran module files 36 | *.mod 37 | 38 | # Compiled Static libraries 39 | *.lai 40 | *.la 41 | *.a 42 | *.lib 43 | 44 | # Executables 45 | *.exe 46 | *.out 47 | *.app 48 | doxygen 49 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "release"] 2 | path = release 3 | url = https://github.com/wulffern/ciccreator-bin 4 | branch = main 5 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at carsten@wulff.no. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Ask for access, I'd be happy to give you access to a branch. Contact me at carsten@ciccreator.com 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | ENV DEBIAN_FRONTEND noninteractive 4 | 5 | RUN apt-get -qq update && apt-get install -qq -y --no-install-recommends \ 6 | git \ 7 | make \ 8 | openssh-client \ 9 | ca-certificates \ 10 | 11 | build-essential \ 12 | pkg-config \ 13 | libgl1-mesa-dev \ 14 | libsm6 \ 15 | libice6 \ 16 | libxext6 \ 17 | libxrender1 \ 18 | libfontconfig1 \ 19 | qt6-base-dev \ 20 | python3 python3-pip jq\ 21 | && apt-get -qq clean 22 | 23 | RUN python3 -m pip install matplotlib numpy click svgwrite pyyaml pandas tabulate wheel setuptools tikzplotlib 24 | 25 | ENTRYPOINT /bin/bash 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | [![Docker Image CI](https://github.com/wulffern/ciccreator/actions/workflows/docker-image.yml/badge.svg?branch=master)](https://github.com/wulffern/ciccreator/actions/workflows/docker-image.yml) 4 | [![Documentation Status](https://github.com/wulffern/ciccreator/actions/workflows/documentation.yaml/badge.svg?branch=master)](https://github.com/wulffern/ciccreator/actions/workflows/documentation.yaml) 5 | 6 | # ciccreator 7 | Back in 2013 I started playing with the thought of generating a SAR ADC with a 8 | script, such that it would be easy to port between technologies. The prototype 9 | was written in Perl, and contained 16k lines of code. The Perl compiler is 10 | closed source, and not available outside NTNU. cIcCreator is the C++ version, 11 | it's been written from scratch to support the same input files as the Perl 12 | compiler, but with a vastly improved performance. 13 | 14 | # Documentation 15 | 16 | Head over to 17 | [wulffern.github.io/ciccreator](http://wulffern.github.io/ciccreator/index.html) 18 | or [ciccreator.readthedocs.io](https://ciccreator.readthedocs.io/en/latest/index.html) 19 | 20 | # Master plan 21 | :white_check_mark: Create prototype of compiler in Perl that can compile SAR ADCs (Aug 2014) 22 | 23 | :white_check_mark: Tapeout SAR ADC in 28nm FDSOI (Jan 2015) 24 | 25 | :white_check_mark: Demonstrate effectiveness of compiled approach ([ESSCIRC 2016](http://ieeexplore.ieee.org/document/7598271/),[JSSC 2017](http://ieeexplore.ieee.org/document/7906479/)) (Sept 2016, April 2017) 26 | 27 | :white_check_mark: Rewrite the compiler in C++ under a GPL license and compile equivalent GDS with Perl compiler (Nov 2016) 28 | 29 | # Compile and run, the easy version 30 | 31 | Although it's possible to run "make" to compile ciccreator on most platforms, 32 | the compile does require QT. Head over to ciccreator-bin repository for latest binaries. 33 | 34 | For simulation in Skywater 130 nm PDK, head over to [aicex](https://github.com/wulffern/aicex) 35 | 36 | # Test 37 | Have a look at the SAR 38 | 39 | ``` bash 40 | make esscirc 41 | make view 42 | ``` 43 | 44 | Or the route tests 45 | 46 | ``` bash 47 | make routes 48 | make viewroutes 49 | ``` 50 | 51 | 52 | # Videos 53 | 54 | Minecraft video - https://youtu.be/J9lhEt0f3Wk 55 | cIcCreator in action - https://youtu.be/hv9u9aQGHQc 56 | 57 | 58 | # Comments/Questions 59 | Should you find issues, don't hesitate to add an issue on gitub. 60 | 61 | 62 | 63 | 64 | 65 | # Changelog 66 | 67 | ## v0.1.5 68 | * Added verticalMultiplyVector to patterntile to simplify analog transistor generation 69 | * Route, RouteRing, Guard will be loaded as LayoutCell to fix view problem of cuts. 70 | * Fixed issue rotateAngle in LayoutRotateCell. Seems like QJsonValue is no 71 | longer automatically casted to QString. 72 | * removed GDS and SPICE output. Only *.cic will be supported from now on. Use 73 | cicpy to convert to other formats 74 | 75 | ## v0.1.4 76 | * layoutcell: Added ability to route to rails. 77 | With addDirectedRoute one can do ["M1","AVSS","xa:S-|--rail_r_AVSS","strap"], which will strap all mosfet sources to right route rail. 78 | The rails are named rail_(t|b|r|l)_(NAME) 79 | * cic-gui: Increased step size for arrow keys 80 | * cic-gui: Added rubber band zoom. 81 | -------------------------------------------------------------------------------- /bashrc.config: -------------------------------------------------------------------------------- 1 | 2 | #- Change to your installation of Qt5.4 3 | export QTDIR=~/Qt5.4.2/5.4/gcc_64 4 | 5 | #- No need to change these 6 | export QTVER=qt5 7 | export PATH=$QTDIR/bin/:$PATH 8 | export LD_LIBRARY_PATH=$QTDIR/lib/:$LD_LIBRARY_PATH 9 | export PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig/:$PKG_CONFIG_PATH 10 | export QT_PLUGIN_PATH=$QTDIR/lib/plugins/ 11 | -------------------------------------------------------------------------------- /bin/cic: -------------------------------------------------------------------------------- 1 | start_script.sh -------------------------------------------------------------------------------- /bin/cic-gui: -------------------------------------------------------------------------------- 1 | start_script.sh -------------------------------------------------------------------------------- /bin/start_script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ###################################################################### 3 | ## Copyright (c) 2015 Carsten Wulff Software, Norway 4 | ## ################################################################### 5 | ## Created : wulff at 2015-7-23 6 | ## ################################################################### 7 | ## This program is free software: you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License as published by 9 | ## the Free Software Foundation, either version 3 of the License, or 10 | ## (at your option) any later version. 11 | ## 12 | ## This program is distributed in the hope that it will be useful, 13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ## GNU General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU General Public License 18 | ## along with this program. If not, see . 19 | ###################################################################### 20 | platform=`uname -a | awk '{ print tolower($1)}'` 21 | 22 | appname=`basename $0 | sed s,\.sh$,,` 23 | 24 | dirname=`dirname $0` 25 | tmp="${dirname#?}" 26 | 27 | if [ "${dirname%$tmp}" != "/" ]; then 28 | dirname=$PWD/$dirname 29 | fi 30 | 31 | #- Setup LD library path on linux 32 | if [ $platform == "linux" ] ; then 33 | 34 | LD_LIBRARY_PATH=$dirname 35 | export LD_LIBRARY_PATH 36 | 37 | execfile=$dirname/${platform}/${appname} 38 | 39 | if [ ! -f "$execfile" ]; then 40 | echo "INFO: Trying pre-compiled " 41 | execfile=${dirname}/../release/${appname}.${platform}-latest 42 | fi 43 | 44 | echo $execfile "$@" 45 | 46 | $execfile "$@" 47 | 48 | else 49 | 50 | if [ $platform == "darwin" ]; then 51 | 52 | 53 | execfile=$dirname/${platform}/${appname}.app/Contents/MacOS/${appname} 54 | if [ ! -f "$execfile" ]; then 55 | execfile=$dirname/${platform}/${appname} 56 | fi 57 | 58 | if [ ! -f "$execfile" ]; then 59 | echo "INFO: Trying pre-compiled " 60 | execfile=${dirname}/../release/${appname}.${platform}-latest 61 | fi 62 | 63 | echo $execfile "$@" 64 | $execfile "$@" 65 | 66 | 67 | 68 | else 69 | echo "Looks like your on windows. Windows no longer supported, use linux in WSL" 70 | fi 71 | fi 72 | -------------------------------------------------------------------------------- /cic-core/external/libgds_dist/INSTALL: -------------------------------------------------------------------------------- 1 | 2 | libgds A library of C functions which read and write GDSII pattern format. 3 | M. Rooks, Yale University 4 | Look at libgds.c for more details on GDS format. 5 | Look at write_gds_examples.c obviously. 6 | 7 | Simply type "make" to compile the library and the example program. 8 | Run the example program to create the file stuff.gds 9 | then use your favorite CAD program to display the GDS file. 10 | 11 | To install the library for general use, copy libgds.a to 12 | somewhere in LD_LIBRARY_PATH, such as /usr/local/lib 13 | and copy libgds.h to somewhere like /usr/local/include 14 | 15 | 16 | -------------------------------------------------------------------------------- /cic-core/src/cells/capcell.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-3 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | 23 | #ifndef CIC_CELLS_CAPCELL_H 24 | #define CIC_CELLS_CAPCELL_H 25 | 26 | #include "core/layoutcell.h" 27 | 28 | namespace cIcCells{ 29 | 30 | class CapCell: public cIcCore::LayoutCell 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | virtual void place(); 36 | virtual Rect calcBoundingRect(); 37 | void addContacts(QString name, QString node,int y,QList array, Rect* r); 38 | Rect* getAvssConnectRect(Rect* rect); 39 | 40 | Q_INVOKABLE 41 | /** 42 | * @brief Use Metal 3 43 | */ 44 | void usem3(QJsonValue obj); 45 | 46 | Q_INVOKABLE 47 | /** 48 | * @brief Use Metal 5 shield 49 | */ 50 | void usem5(QJsonValue obj); 51 | 52 | Q_INVOKABLE 53 | /** 54 | * @brief Increase multiplier height 55 | */ 56 | void heightIncreaseMult(QJsonValue obj); 57 | 58 | private: 59 | int msw = 0; 60 | int xorg = 0; 61 | int yMax = 0; 62 | bool usem3_ = true; 63 | bool usem5_ = false; 64 | int heightIncreaseMult_ = 1; 65 | 66 | 67 | }; 68 | 69 | 70 | }; 71 | Q_DECLARE_METATYPE(cIcCells::CapCell) 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /cic-core/src/cells/capcellv2.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-3 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | 23 | #ifndef CIC_CELLS_CAPCELLV2_H 24 | #define CIC_CELLS_CAPCELLV2_H 25 | 26 | #include "core/layoutcell.h" 27 | 28 | namespace cIcCells{ 29 | 30 | class CapCellV2: public cIcCore::LayoutCell 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | virtual void place(); 36 | virtual Rect calcBoundingRect(); 37 | void addContacts(QString name, QString node,int y,QList array); 38 | Rect* getAvssConnectRect(Rect* rect); 39 | 40 | 41 | private: 42 | int msw = 0; 43 | int xorg = 0; 44 | int yMax = 0; 45 | 46 | 47 | }; 48 | 49 | 50 | }; 51 | Q_DECLARE_METATYPE(cIcCells::CapCellV2) 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /cic-core/src/cells/cdac.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-4 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #ifndef CIC_CELLS_CDAC_H 22 | #define CIC_CELLS_CDAC_H 23 | 24 | #include "core/layoutcell.h" 25 | #include "cells/capcell.h" 26 | 27 | namespace cIcCells{ 28 | 29 | class CDAC: public cIcCore::LayoutCell 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | virtual void place(); 35 | virtual void route(); 36 | virtual void paint(); 37 | 38 | 39 | private: 40 | cIcCore::Instance* firstinst; 41 | cIcCore::Instance* inst; 42 | 43 | 44 | 45 | }; 46 | 47 | 48 | }; 49 | Q_DECLARE_METATYPE(cIcCells::CDAC) 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /cic-core/src/cells/cells.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-4 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_CELLS_CELLS_H 21 | #define CIC_CELLS_CELLS_H 22 | 23 | #include "cells/sar.h" 24 | #include "cells/cdac.h" 25 | #include "cells/capcell.h" 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /cic-core/src/cells/phcapcell.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2019-06-02 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_CELLS_PHCAPCELL_H 21 | #define CIC_CELLS_PHCAPCELL_H 22 | 23 | #include "core/layoutcell.h" 24 | 25 | namespace cIcCells{ 26 | 27 | class PhCapCell: public cIcCore::LayoutCell 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | 33 | Q_INVOKABLE void binaryBits(QJsonValue obj); 34 | Q_INVOKABLE void unaryBits(QJsonValue obj); 35 | 36 | virtual void place(); 37 | virtual Rect calcBoundingRect(); 38 | int addFinger(int x, int y, int msw, int mw, int mh,int i,string name); 39 | 40 | 41 | private: 42 | int _binaryBits = 1; 43 | int _unaryBits = 1; 44 | int _top_length = 1; 45 | int _finger_length = 1; 46 | }; 47 | 48 | 49 | }; 50 | Q_DECLARE_METATYPE(cIcCells::PhCapCell) 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /cic-core/src/cells/resistorcell.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-4 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #include "cells/resistorcell.h" 22 | -------------------------------------------------------------------------------- /cic-core/src/cells/resistorcell.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-4 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | #ifndef CIC_CELLS_RESISTORCELL_H 23 | #define CIC_CELLS_RESISTORCELL_H 24 | 25 | #include 26 | #include "cell.h" 27 | #include "patterntile.h" 28 | #include "spice/resistor.h" 29 | 30 | 31 | 32 | namespace cIcCore{ 33 | 34 | using namespace cIcSpice; 35 | 36 | class ResistorCell : public PatternTile 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | virtual void paintRect(Rect*, QChar ,int , int ); 42 | ResistorCell(); 43 | ResistorCell(const ResistorCell& mos); 44 | ~ResistorCell(); 45 | 46 | protected: 47 | Resistor * res_; 48 | }; 49 | 50 | } 51 | 52 | Q_DECLARE_METATYPE(cIcCore::ResistorCell) 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /cic-core/src/cells/sar.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-8-2 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | 23 | 24 | #ifndef CIC_CELLS_SAR_H 25 | #define CIC_CELLS_SAR_H 26 | 27 | #include "core/layoutcell.h" 28 | 29 | 30 | typedef QMap> SARgroup; 31 | 32 | 33 | 34 | namespace cIcCells{ 35 | 36 | class SAR : public cIcCore::LayoutCell 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | 42 | virtual void place(); 43 | virtual void route(); 44 | 45 | Q_INVOKABLE 46 | /** 47 | * @brief Use Metal 5 shield 48 | */ 49 | void usem5(QJsonValue obj); 50 | 51 | int getCellWidth(SARgroup groups,QString group); 52 | cIcCore::Instance* placeAlternateMirror(SARgroup groups,QString group, int i, int x ,int y, int xoffset); 53 | int addSarRouting(int y,int msw,int mw); 54 | 55 | static bool sortGraph(cIcCore::Graph* a, cIcCore:: Graph *b); 56 | 57 | 58 | private: 59 | 60 | Rect* sarn = NULL; 61 | Rect* sarp = NULL; 62 | bool usem5_ = true; 63 | 64 | }; 65 | 66 | 67 | } 68 | 69 | Q_DECLARE_METATYPE(cIcCells::SAR) 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /cic-core/src/cic-core.h: -------------------------------------------------------------------------------- 1 | #include "core/design.h" 2 | #include "core/rules.h" 3 | #include "core/consoleoutput.h" 4 | #include "printer/cics.h" 5 | #include "core/consoleoutput.h" 6 | #include "decorator/layoutcelldecorator.h" 7 | -------------------------------------------------------------------------------- /cic-core/src/core/console.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-12-26 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "core/console.h" 21 | 22 | 23 | namespace cIcCore{ 24 | 25 | Console::Console(int argc, char* argv[]) 26 | { 27 | 28 | this->initialize(argc, argv); 29 | } 30 | 31 | void Console::initialize(int argc, char* argv[]) 32 | { 33 | this->initialize(); 34 | } 35 | 36 | void Console::initialize() 37 | { 38 | } 39 | 40 | 41 | void Console::addOption(Option* o) 42 | { 43 | options.insert(make_pair(o->name,o)); 44 | } 45 | 46 | Option* Console::option(string name) 47 | { 48 | auto iter = options.find(name); 49 | if(iter != options.end()){ 50 | return options[name]; 51 | }else{ 52 | Option* o = new Option(); 53 | o->type = Option::valueType::EMPTY; 54 | return o; 55 | } 56 | 57 | } 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /cic-core/src/core/console.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-12-26 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CONSOLE_H 21 | #define CONSOLE_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace cIcCore{ 29 | using namespace std; 30 | 31 | class Option 32 | { 33 | public: 34 | enum valueType{INT,DOUBLE,STRING,EMPTY}; 35 | 36 | valueType type; 37 | int ival; 38 | double dval; 39 | string sval; 40 | string name; 41 | string getopt; 42 | 43 | Option() 44 | { 45 | type = EMPTY; 46 | 47 | } 48 | 49 | 50 | Option(string getopt, string name, int val) 51 | { 52 | getopt = getopt; 53 | name = name; 54 | ival = val; 55 | type = INT; 56 | } 57 | 58 | Option(string getopt, string name, double val) 59 | { 60 | getopt = getopt; 61 | name = name; 62 | dval = val; 63 | type = DOUBLE; 64 | } 65 | 66 | Option(string getopt, string name, string val) 67 | { 68 | getopt = getopt; 69 | name = name; 70 | sval = val; 71 | type = STRING; 72 | } 73 | }; 74 | 75 | 76 | 77 | class Console 78 | { 79 | 80 | public: 81 | Console(int argc, char* argv[]); 82 | ~Console(); 83 | virtual void initialize(int argc, char* argv[]); 84 | virtual void initialize(); 85 | void addOption(Option* o ); 86 | Option* option(string name); 87 | 88 | private: 89 | map options; 90 | 91 | }; 92 | 93 | } 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /cic-core/src/core/consoleoutput.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CONSOLEOUTPUT_H 21 | #define CONSOLEOUTPUT_H 22 | 23 | #include 24 | #include 25 | 26 | namespace cIcCore{ 27 | 28 | class ConsoleOutput : public QObject 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit ConsoleOutput(QObject *parent = 0); 33 | ~ConsoleOutput(); 34 | 35 | enum AnsiColor{ black = 30, red = 31, green = 32, brown = 33, blue = 34, magenta = 35, cyan = 36, lightgray = 37}; 36 | 37 | void commentInvokeMethod(QString cell, QString theme, QString method); 38 | void commentStartClass(QString cell); 39 | void comment(QString cell, AnsiColor color = green); 40 | void error(QString str); 41 | void commentSetProperty(QString cell, QString theme, QString property); 42 | void errorMethodNotFound(QString cell, QString theme, QString method); 43 | void increaseIndent(); 44 | void decreaseIndent(); 45 | void startComment(QTextStream &out, AnsiColor color = green); 46 | void endComment(QTextStream &out); 47 | 48 | private: 49 | int indent; 50 | 51 | 52 | signals: 53 | 54 | public slots: 55 | }; 56 | 57 | } 58 | 59 | #endif // CONSOLEOUTPUT_H 60 | -------------------------------------------------------------------------------- /cic-core/src/core/cut.h: -------------------------------------------------------------------------------- 1 | #ifndef CIC_CORE_CUT_H 2 | #define CIC_CORE_CUT_H 3 | 4 | #include "instancecut.h" 5 | 6 | namespace cIcCore{ 7 | 8 | class Cut: public Cell 9 | { 10 | public: 11 | Cut(QString layer1,QString layer2,int horizontal_cuts, int vertical_cuts); 12 | Cut(QString layer1,QString layer2,Rect* r); 13 | 14 | 15 | static QString makeName(QString layer1, QString layer2, int horizontal_cuts, int vertical_cuts); 16 | 17 | static Instance * getInstance(QString layer1, QString layer2, int horizontal_cuts, int vertical_cuts); 18 | ~Cut(); 19 | 20 | static QList getCutsForRects(QString layer1, QList, int horizontal_cuts,int vertical_cuts); 21 | static QList getCutsForRects(QString layer1, QList, int horizontal_cuts,int vertical_cuts,bool alignLeft); 22 | 23 | static QList getVerticalFillCutsForRects(QString layer1, QList rects, int horizontal_cuts); 24 | 25 | 26 | static QList getCuts(); 27 | 28 | 29 | 30 | protected: 31 | static QMap cuts_; 32 | 33 | }; 34 | 35 | } 36 | 37 | #endif // CUT_H 38 | -------------------------------------------------------------------------------- /cic-core/src/core/graph.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-3-22 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "graph.h" 21 | 22 | namespace cIcCore{ 23 | 24 | QJsonObject Graph::toJson(){ 25 | QJsonObject o; 26 | o["node"] = name; 27 | QJsonArray pa; 28 | foreach(auto * p, this->ports){ 29 | QJsonObject op; 30 | 31 | if(p->isInstancePort()){ 32 | InstancePort * pi = static_cast(p); 33 | Instance* i = static_cast(pi->parent()); 34 | op["node"] = pi->childName(); 35 | op["inst"] = i->instanceName(); 36 | pa.append(op); 37 | } 38 | 39 | } 40 | o["instances"] = pa; 41 | 42 | return o; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /cic-core/src/core/graph.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-3-22 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_CORE_GRAPH_H 21 | #define CIC_CORE_GRAPH_H 22 | 23 | #include "instance.h" 24 | 25 | namespace cIcCore{ 26 | 27 | class Graph{ 28 | 29 | 30 | public: 31 | QList ports; 32 | QString name; 33 | void append(Port * p){ 34 | 35 | //- Don't add a port to the graph if it's already there 36 | if(!ports.contains(p)){ 37 | ports.append(p); 38 | } 39 | 40 | } 41 | 42 | QJsonObject toJson(); 43 | 44 | 45 | QList getRectangles(QString excludeInstances,QString includeInstances, QString layer){ 46 | QList rects; 47 | foreach(Port *p, ports){ 48 | Rect * r = p->parent(); 49 | if(r == NULL) continue; 50 | if(!r->isInstance()) continue; 51 | Instance *i = static_cast(r); 52 | 53 | QString instanceName = i->instanceName(); 54 | 55 | if(excludeInstances != "" && (instanceName.contains(QRegularExpression(excludeInstances)) 56 | || i->name().contains(QRegularExpression(excludeInstances)) )) continue; 57 | 58 | if(includeInstances != "" && !(i->name().contains(QRegularExpression(includeInstances)) 59 | || instanceName.contains(QRegularExpression(includeInstances)) ) ) continue; 60 | Rect * rp = p->get(layer); 61 | 62 | if(rp == NULL) rp = p->get(); 63 | if(rp != NULL) { 64 | rects.append(rp); 65 | 66 | } 67 | } 68 | return rects; 69 | } 70 | 71 | 72 | 73 | 74 | }; 75 | 76 | }; 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /cic-core/src/core/guard.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2017 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2017-1-8 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "guard.h" 21 | 22 | namespace cIcCore{ 23 | 24 | 25 | Guard::Guard(Rect* r,QList layers) 26 | { 27 | //this->setBoundaryIgnoreRouting(false); 28 | 29 | 30 | auto d1 = new Cut("OD","M1",2,1); 31 | if(!d1) return; 32 | 33 | auto od = d1->getRect("OD"); 34 | 35 | if(!od){ 36 | qDebug() << "Could not find OD rectangle in Cut"; 37 | qDebug() << d1->toString(); 38 | return; 39 | 40 | } 41 | 42 | 43 | int xod = od->x1() - d1->x1(); 44 | int yod = od->y1() - d1->y1(); 45 | int odw = od->height(); 46 | 47 | d1->addEnclosingLayers(layers); 48 | 49 | r->adjust(d1->height()); 50 | 51 | 52 | //this->add(d1); 53 | 54 | 55 | QList rects; 56 | 57 | auto * c_bot = new Cell(); 58 | c_bot->add(new Rect("OD",r->x1() + xod, r->y1() + yod, r->width() - xod*2,odw)); 59 | c_bot->add(new Rect("M1",r->x1() + xod, r->y1() + yod, r->width() - xod*2,odw)); 60 | auto * c_left = new Cell(); 61 | c_left->add(new Rect("OD",r->x1() + xod, r->y1() + yod,odw,r->height() - yod*2)); 62 | c_left->add(new Rect("M1",r->x1() + xod, r->y1() + yod,odw,r->height() - yod*2)); 63 | auto * c_top = new Cell(); 64 | c_top->add(new Rect("OD",r->x1() + xod, r->y1() + r->height() - yod - odw, r->width() - xod*2,odw)); 65 | c_top->add(new Rect("M1",r->x1() + xod, r->y1() + r->height() - yod - odw, r->width() - xod*2,odw)); 66 | auto * c_right = new Cell(); 67 | c_right->add(new Rect("OD",r->x1() + r->width() - xod - odw, r->y1() + yod, odw, r->height() - yod*2)); 68 | c_right->add(new Rect("M1",r->x1() + r->width() - xod - odw, r->y1() + yod, odw, r->height() - yod*2)); 69 | 70 | rects.append(c_bot); 71 | rects.append(c_top); 72 | rects.append(c_left); 73 | rects.append(c_right); 74 | 75 | Rect * b = new Rect("M1",r->x1() + xod, r->y1() + yod, r->width() - xod*2,odw); 76 | this->add(b); 77 | 78 | foreach( Cell* c2, rects){ 79 | 80 | //TODO Need to write a fill-cut function to add cuts 81 | 82 | //Adjust size 83 | auto* rcp = c2->getCopy(); 84 | if(rcp->isVertical()){ 85 | rcp->adjust(0,odw,0,-odw); 86 | }else{ 87 | rcp->adjust(odw,0,-odw,0); 88 | } 89 | 90 | Cut* c= new Cut("OD","M1",rcp); 91 | this->add(c); 92 | 93 | c2->addEnclosingLayers(layers); 94 | this->add(c2); 95 | 96 | } 97 | 98 | 99 | 100 | } 101 | 102 | Guard::~Guard() 103 | { 104 | 105 | } 106 | 107 | 108 | 109 | 110 | } 111 | -------------------------------------------------------------------------------- /cic-core/src/core/guard.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-6-13 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | #ifndef CIC_CORE_GUARD_H 20 | #define CIC_CORE_GUARD_H 21 | 22 | #include 23 | #include "cell.h" 24 | #include "instance.h" 25 | #include "cut.h" 26 | #include "text.h" 27 | #include 28 | 29 | 30 | namespace cIcCore{ 31 | 32 | class Guard : public Cell 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | Guard(Rect* r,QList layers); 38 | ~Guard(); 39 | 40 | protected: 41 | 42 | }; 43 | 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /cic-core/src/core/instance.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-7-14 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | #ifndef CIC_CORE_INSTANCE_H 20 | #define CIC_CORE_INSTANCE_H 21 | 22 | #include 23 | #include "cell.h" 24 | #include "port.h" 25 | #include "spice/spiceobject.h" 26 | #include 27 | 28 | namespace cIcCore{ 29 | 30 | class Instance : public Cell 31 | { 32 | 33 | Q_OBJECT 34 | 35 | public: 36 | Instance(); 37 | Instance(const Instance&); 38 | ~Instance(); 39 | Cell * cell(){return _cell;} 40 | QString instanceName(){return instanceName_;} 41 | QString id() 42 | { 43 | return name() + instanceName_; 44 | } 45 | 46 | Rect calcBoundingRect() override; 47 | QString angle(){return angle_;} 48 | void setAngle(QString angle); 49 | 50 | // Cell * addInstance(QString cell); 51 | static Instance * getInstance(QString cell); 52 | void setCell(Cell*cell){_cell = cell;} 53 | cIcSpice::SubcktInstance *subcktInstance(){return ckt_inst_;} 54 | void setSubcktInstance(cIcSpice::SubcktInstance *inst); 55 | 56 | QList findRectanglesByRegex(QString regex,QString layer) override; 57 | QList findRectanglesByNode(QString node, QString filterChild); 58 | QString toString() override; 59 | 60 | void transform(Rect* r); 61 | 62 | Rect* getRect(QString layer); 63 | Point* getCellPoint(); 64 | 65 | QJsonObject toJson() override; 66 | void fromJson(QJsonObject o) override; 67 | void setCell(QString cell); 68 | void updateUsedChildren() override; 69 | 70 | private: 71 | Cell * _cell; 72 | cIcSpice::SubcktInstance * ckt_inst_; 73 | QMap instancePorts_; 74 | QString angle_; 75 | int xcell; 76 | int ycell; 77 | QList instance_ports_; 78 | 79 | 80 | }; 81 | 82 | } 83 | 84 | Q_DECLARE_METATYPE(cIcCore::Instance) 85 | 86 | #endif // INSTANCE_H 87 | -------------------------------------------------------------------------------- /cic-core/src/core/instancecut.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-7-14 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | #ifndef CIC_CORE_INSTANCECUT_H 20 | #define CIC_CORE_INSTANCECUT_H 21 | 22 | #include "instance.h" 23 | 24 | 25 | namespace cIcCore{ 26 | 27 | class InstanceCut : public Instance 28 | { 29 | 30 | Q_OBJECT 31 | 32 | public: 33 | InstanceCut():Instance(){}; 34 | explicit InstanceCut(const Instance& inst):Instance(inst){}; 35 | ~InstanceCut(){}; 36 | }; 37 | 38 | } 39 | 40 | Q_DECLARE_METATYPE(cIcCore::InstanceCut) 41 | 42 | #endif // INSTANCECUT_H 43 | -------------------------------------------------------------------------------- /cic-core/src/core/instanceport.cpp: -------------------------------------------------------------------------------- 1 | #include "instanceport.h" 2 | 3 | namespace cIcCore{ 4 | 5 | 6 | void InstancePort::mirrorX(int ay) 7 | { 8 | Rect::mirrorX(ay); 9 | } 10 | 11 | void InstancePort::mirrorY(int ax) 12 | { 13 | Rect::mirrorY(ax); 14 | } 15 | 16 | InstancePort::InstancePort(QString name, Port * p, Rect * parent):Port(name) 17 | { 18 | childport_ = p; 19 | parent_ = parent; 20 | Rect *r = p->get(); 21 | if(r){ 22 | Layer * l = rules->getLayer(r->layer()); 23 | routeLayer_ = l; 24 | this->setRect(r->layer(), r->x1(), r->y1(),r->width(),r->height()); 25 | 26 | } 27 | } 28 | 29 | 30 | 31 | 32 | InstancePort::~InstancePort() 33 | { 34 | 35 | } 36 | 37 | 38 | QString InstancePort::childName(){ 39 | if(childport_){ 40 | return childport_->name(); 41 | }else{ 42 | return QString(""); 43 | } 44 | 45 | } 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /cic-core/src/core/instanceport.h: -------------------------------------------------------------------------------- 1 | #ifndef CIC_CORE_INSTANCEPORT_H 2 | #define CIC_CORE_INSTANCEPORT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "rect.h" 9 | #include "port.h" 10 | 11 | namespace cIcCore{ 12 | class InstancePort: public Port{ 13 | 14 | 15 | Q_OBJECT 16 | 17 | public: 18 | InstancePort(QString name, Port * p, Rect * parent); 19 | ~InstancePort(); 20 | void mirrorX(int ay) override; 21 | void mirrorY(int ax) override; 22 | Rect * parent(){return parent_;} 23 | 24 | 25 | QString childName(); 26 | 27 | 28 | protected: 29 | //! Parent, does this rectangle belong to any particular instance 30 | Rect * parent_; 31 | 32 | //! Link to a child port, provides connectivity through a hierarchy 33 | Port * childport_; 34 | 35 | 36 | }; 37 | 38 | } 39 | 40 | #endif // INSTANCEPORT_H 41 | -------------------------------------------------------------------------------- /cic-core/src/core/layer.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "core/layer.h" 21 | 22 | namespace cIcCore{ 23 | 24 | Layer::Layer(){ 25 | name = "M1"; 26 | number = 0; 27 | material = diffusion; 28 | previous = "CO"; 29 | next = "VIA1"; 30 | pin = "M1_pin"; 31 | res = "M1_res"; 32 | color = ""; 33 | nofill = false; 34 | visible = true; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /cic-core/src/core/layer.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_CORE_LAYER_H 21 | #define CIC_CORE_LAYER_H 22 | 23 | //#include 24 | //#include 25 | #include 26 | #include 27 | 28 | 29 | namespace cIcCore{ 30 | 31 | /*! 32 | Defines a layer, data for this object is usually loaded from the "layers" section in the technology file 33 | */ 34 | class Layer 35 | { 36 | public: 37 | 38 | //!Name of layer, for example "M1" 39 | QString name; 40 | 41 | //!GDS layer number 42 | int number; 43 | 44 | //!GDS layer datatype 45 | int datatype; 46 | 47 | QMap datatypes; 48 | 49 | enum MATERIAL_TYPE {diffusion, poly, metal, cut, metalres,other,marker,implant}; 50 | 51 | //!Type of material 52 | MATERIAL_TYPE material; 53 | 54 | //!Previous layer in routing stack, i.e CO for M1 55 | QString previous; 56 | 57 | //!Next layer in routing stack, i.e VIA1 for M1 58 | QString next; 59 | 60 | //!Name of pin layer for this layer, i.e. M1_pin 61 | QString pin; 62 | 63 | //!Name of resistor layer for this layer, i.e. M1_res 64 | QString res; 65 | 66 | //!Color of this layer to use in GUI, QColor names can be used 67 | QString color; 68 | 69 | //!Fill rectangle of this layer in GUI 70 | bool nofill; 71 | 72 | //!Whether this layer is visible in GUI 73 | bool visible; 74 | 75 | Layer(); 76 | 77 | //!Makes a small icon of this layer that can be used in GUI 78 | // QPixmap icon(); 79 | 80 | private: 81 | // QImage icon(int size); 82 | // void drawColorIcon(QPainter & p, QColor color, const QImage & alpha); 83 | // QImage drawColorIconProof(QColor color, const QImage & alpha) ; 84 | }; 85 | 86 | } 87 | #endif // LAYER_H 88 | -------------------------------------------------------------------------------- /cic-core/src/core/layoutrotatecell.cpp: -------------------------------------------------------------------------------- 1 | #include "layoutrotatecell.h" 2 | 3 | namespace cIcCore{ 4 | LayoutRotateCell::LayoutRotateCell() 5 | { 6 | 7 | } 8 | 9 | LayoutRotateCell::~LayoutRotateCell() 10 | { 11 | 12 | } 13 | 14 | void LayoutRotateCell::rotateAngle(QString s){ 15 | rotateAngle_ = s; 16 | this->noPowerRoute(0); 17 | 18 | } 19 | 20 | void LayoutRotateCell::rotateAngle(QJsonValue s){ 21 | this->rotateAngle(s.toString()); 22 | } 23 | 24 | void LayoutRotateCell::place(){ 25 | 26 | foreach(cIcSpice::SubcktInstance * ckt_inst,_subckt->instances()){ 27 | //The chain of events is important here, ports get defined in the setSubckInstance 28 | Instance * inst = Instance::getInstance(ckt_inst->subcktName()); 29 | inst->setSubcktInstance(ckt_inst); 30 | inst->moveTo(0,0); 31 | inst->setAngle(rotateAngle_); 32 | // inst->updateBoundingRect(); 33 | 34 | this->add(inst); 35 | 36 | } 37 | } 38 | 39 | 40 | void LayoutRotateCell::paint(){ 41 | LayoutCell::paint(); 42 | } 43 | 44 | 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /cic-core/src/core/layoutrotatecell.h: -------------------------------------------------------------------------------- 1 | #ifndef CIC_CORE_LAYOUTROTATECELL_H 2 | #define CIC_CORE_LAYOUTROTATECELL_H 3 | 4 | #include "layoutcell.h" 5 | 6 | namespace cIcCore{ 7 | 8 | 9 | class LayoutRotateCell : public LayoutCell 10 | { 11 | 12 | Q_OBJECT 13 | 14 | 15 | public: 16 | LayoutRotateCell(); 17 | ~LayoutRotateCell(); 18 | 19 | Q_INVOKABLE 20 | void rotateAngle(QJsonValue s); 21 | void rotateAngle(QString s); 22 | void place() override; 23 | 24 | void paint() override; 25 | 26 | protected: 27 | QString rotateAngle_; 28 | }; 29 | 30 | } 31 | 32 | Q_DECLARE_METATYPE(cIcCore::LayoutRotateCell) 33 | 34 | #endif // LAYOUTROTATECELL_H 35 | -------------------------------------------------------------------------------- /cic-core/src/core/patterncapacitor.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-04-03 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #ifndef CIC_CORE_PATTERNCAPACITOR_H 22 | #define CIC_CORE_PATTERNCAPACITOR_H 23 | 24 | #include 25 | #include "cell.h" 26 | #include "patterntile.h" 27 | #include "spice/resistor.h" 28 | 29 | 30 | 31 | namespace cIcCore{ 32 | 33 | using namespace cIcSpice; 34 | 35 | class PatternCapacitor : public PatternTile 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | virtual void paintRect(Rect*, QChar ,int , int ); 41 | PatternCapacitor(); 42 | ~PatternCapacitor(); 43 | void onPaintEnd(); 44 | virtual QJsonObject toJson(); 45 | virtual void fromJson(QJsonObject o); 46 | 47 | void onFillCoordinate(QChar c, QString layer, int x, int y, QMap &data); 48 | 49 | 50 | protected: 51 | QList resistors; 52 | int rindex; 53 | int rcounter; 54 | QStringList nodes; 55 | }; 56 | } 57 | Q_DECLARE_METATYPE(cIcCore::PatternCapacitor) 58 | 59 | #endif // PATTERNCAPACITOR_H 60 | -------------------------------------------------------------------------------- /cic-core/src/core/patternhighresistor.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-04-03 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "core/patternhighresistor.h" 21 | 22 | namespace cIcCore{ 23 | 24 | PatternHighResistor::PatternHighResistor() 25 | { 26 | res = new Resistor(); 27 | res->setDeviceName("rppo"); 28 | res->setNodes(QStringList() << "N" << "P" << "B") ; 29 | Subckt * ckt = new Subckt(); 30 | ckt->setNodes(res->nodes()); 31 | ckt->add(res); 32 | this->setSubckt(ckt); 33 | 34 | 35 | } 36 | 37 | PatternHighResistor::PatternHighResistor(const PatternHighResistor& mos) 38 | { 39 | } 40 | 41 | 42 | PatternHighResistor::~PatternHighResistor() 43 | { 44 | 45 | } 46 | 47 | void PatternHighResistor::onFillCoordinate(QChar c, QString layer, int x, int y, QMap &data){ 48 | 49 | 50 | 51 | if(layer.startsWith("PO")){ 52 | 53 | int pofinger = data["pofinger"].toInt(); 54 | if(pofinger < x){ 55 | data["nf"] = data["nf"].toInt() + 1; 56 | data["pofinger"] = x; 57 | } 58 | 59 | 60 | res->setProperty("width",this->rules->toMicron(xspace_)); 61 | } 62 | } 63 | 64 | 65 | void PatternHighResistor::onPaintEnclosure(Rect* r) 66 | { 67 | if(r->layer() == "OP"){ 68 | res->setProperty("length",this->rules->toMicron( r->height() ) ); 69 | } 70 | 71 | } 72 | 73 | 74 | void PatternHighResistor::paintRect(Rect* r, QChar c ,int x , int y ){ 75 | 76 | if(c != 'r' || r == 0) return; 77 | 78 | Layer* l = this->rules->getLayer(r->layer()); 79 | QString res = l->res; 80 | if(res == "") return; //Return if resistor layer is undefined 81 | 82 | Rect * rc = new Rect(res,translateX(x),translateY(y),xspace_,currentHeight_); 83 | this->add(rc); 84 | } 85 | 86 | void PatternHighResistor::endFillCoordinate(QMap &data) 87 | { 88 | 89 | if(data.contains("nf")){ 90 | int nf = data["nf"].toInt(); 91 | res->setProperty("nf",nf); 92 | } 93 | 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /cic-core/src/core/patternhighresistor.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-4 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | #ifndef CIC_CORE_PATTERNHIGHRESISTOR_H 23 | #define CIC_CORE_PATTERNHIGHRESISTOR_H 24 | 25 | #include 26 | #include "cell.h" 27 | #include "patterntile.h" 28 | #include "spice/resistor.h" 29 | 30 | 31 | 32 | namespace cIcCore{ 33 | 34 | using namespace cIcSpice; 35 | 36 | class PatternHighResistor : public PatternTile 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | virtual void paintRect(Rect*, QChar ,int , int ); 42 | PatternHighResistor(); 43 | PatternHighResistor(const PatternHighResistor& mos); 44 | ~PatternHighResistor(); 45 | virtual void onFillCoordinate(QChar c, QString layer, int x, int y, QMap &data); 46 | void onPaintEnclosure(Rect* r); 47 | void endFillCoordinate(QMap &data); 48 | 49 | protected: 50 | Resistor * res; 51 | }; 52 | 53 | } 54 | 55 | Q_DECLARE_METATYPE(cIcCore::PatternHighResistor) 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /cic-core/src/core/patternhighresistornobulk.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-04-03 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "core/patternhighresistornobulk.h" 21 | 22 | namespace cIcCore{ 23 | 24 | PatternHighResistorNoBulk::PatternHighResistorNoBulk() 25 | { 26 | res = new Resistor(); 27 | res->setDeviceName("rppo"); 28 | res->setNodes(QStringList() << "N" << "P") ; 29 | Subckt * ckt = new Subckt(); 30 | ckt->setNodes(res->nodes()); 31 | ckt->add(res); 32 | this->setSubckt(ckt); 33 | 34 | 35 | } 36 | 37 | PatternHighResistorNoBulk::PatternHighResistorNoBulk(const PatternHighResistorNoBulk& mos) 38 | { 39 | } 40 | 41 | 42 | PatternHighResistorNoBulk::~PatternHighResistorNoBulk() 43 | { 44 | 45 | } 46 | 47 | void PatternHighResistorNoBulk::onFillCoordinate(QChar c, QString layer, int x, int y, QMap &data){ 48 | 49 | 50 | 51 | if(layer.startsWith("PO")){ 52 | 53 | int pofinger = data["pofinger"].toInt(); 54 | if(pofinger < x){ 55 | data["nf"] = data["nf"].toInt() + 1; 56 | data["pofinger"] = x; 57 | } 58 | 59 | 60 | res->setProperty("width",this->rules->toMicron(xspace_)); 61 | } 62 | } 63 | 64 | 65 | void PatternHighResistorNoBulk::onPaintEnclosure(Rect* r) 66 | { 67 | if(r->layer() == "OP"){ 68 | res->setProperty("length",this->rules->toMicron( r->height() ) ); 69 | } 70 | 71 | } 72 | 73 | 74 | void PatternHighResistorNoBulk::paintRect(Rect* r, QChar c ,int x , int y ){ 75 | 76 | if(c != 'r' || r == 0) return; 77 | 78 | Layer* l = this->rules->getLayer(r->layer()); 79 | QString res = l->res; 80 | if(res == "") return; //Return if resistor layer is undefined 81 | 82 | Rect * rc = new Rect(res,translateX(x),translateY(y),xspace_,currentHeight_); 83 | this->add(rc); 84 | } 85 | 86 | void PatternHighResistorNoBulk::endFillCoordinate(QMap &data) 87 | { 88 | 89 | if(data.contains("nf")){ 90 | int nf = data["nf"].toInt(); 91 | res->setProperty("nf",nf); 92 | } 93 | 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /cic-core/src/core/patternhighresistornobulk.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-4 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | #ifndef CIC_CORE_PATTERNHIGHRESISTORNOBULK_H 23 | #define CIC_CORE_PATTERNHIGHRESISTORNOBULK_H 24 | 25 | #include 26 | #include "cell.h" 27 | #include "patterntile.h" 28 | #include "spice/resistor.h" 29 | 30 | 31 | 32 | namespace cIcCore{ 33 | 34 | using namespace cIcSpice; 35 | 36 | class PatternHighResistorNoBulk : public PatternTile 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | virtual void paintRect(Rect*, QChar ,int , int ); 42 | PatternHighResistorNoBulk(); 43 | PatternHighResistorNoBulk(const PatternHighResistorNoBulk& mos); 44 | ~PatternHighResistorNoBulk(); 45 | virtual void onFillCoordinate(QChar c, QString layer, int x, int y, QMap &data); 46 | void onPaintEnclosure(Rect* r); 47 | void endFillCoordinate(QMap &data); 48 | 49 | protected: 50 | Resistor * res; 51 | }; 52 | 53 | } 54 | 55 | Q_DECLARE_METATYPE(cIcCore::PatternHighResistorNoBulk) 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /cic-core/src/core/patternresistor.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-04-03 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "core/patternresistor.h" 21 | 22 | namespace cIcCore{ 23 | 24 | PatternResistor::PatternResistor() 25 | { 26 | res = new Resistor(QStringList() << "A" << "B"); 27 | Subckt * ckt = new Subckt(); 28 | ckt->setNodes(res->nodes()); 29 | ckt->add(res); 30 | this->setSubckt(ckt); 31 | 32 | 33 | } 34 | 35 | QMap PatternResistor::initFillCoordinates(){ 36 | QMap data; 37 | data["wmin"] = std::numeric_limits::max(); 38 | data["wmax"] = -std::numeric_limits::max(); 39 | data["nf"] = 0; 40 | data["pofinger"] = 0; 41 | return data; 42 | } 43 | 44 | void PatternResistor::onFillCoordinate(QChar c, QString layer, int x, int y, QMap &data){ 45 | 46 | 47 | int pofinger = data["pofinger"].toInt(); 48 | if(pofinger < x){ 49 | data["nf"] = data["nf"].toInt() + 1; 50 | data["pofinger"] = x; 51 | } 52 | 53 | if(layer == "PO"){ 54 | res->setProperty("width",this->rules->toMicron(xspace_)); 55 | } 56 | 57 | 58 | } 59 | 60 | void PatternResistor::endFillCoordinate(QMap &data){ 61 | 62 | } 63 | 64 | 65 | 66 | 67 | PatternResistor::PatternResistor(const PatternResistor& mos) 68 | { 69 | } 70 | 71 | 72 | PatternResistor::~PatternResistor() 73 | { 74 | 75 | } 76 | 77 | void PatternResistor::paintRect(Rect* r, QChar c ,int x , int y ){ 78 | 79 | if(c != 'r' || r == 0) return; 80 | 81 | Layer* l = this->rules->getLayer(r->layer()); 82 | QString res_ss = l->res; 83 | if(res_ss == "") return; //Return if resistor layer is undefined 84 | 85 | Rect * rc = new Rect(res_ss,translateX(x),translateY(y),xspace_,currentHeight_); 86 | this->add(rc); 87 | 88 | 89 | if(c =='r'){ 90 | this->res->setProperty("width",this->rules->toMicron( currentHeight_ ) ); 91 | this->res->setProperty("length",this->rules->toMicron( xspace_ ) ); 92 | this->res->setProperty("layer",r->layer()); 93 | } 94 | 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /cic-core/src/core/patternresistor.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-4 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | #ifndef CIC_CORE_PATTERNRESISTOR_H 23 | #define CIC_CORE_PATTERNRESISTOR_H 24 | 25 | #include 26 | #include "cell.h" 27 | #include "patterntile.h" 28 | #include "spice/resistor.h" 29 | 30 | 31 | 32 | namespace cIcCore{ 33 | 34 | using namespace cIcSpice; 35 | 36 | class PatternResistor : public PatternTile 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | virtual void paintRect(Rect*, QChar ,int , int ); 42 | PatternResistor(); 43 | PatternResistor(const PatternResistor& mos); 44 | ~PatternResistor(); 45 | virtual QMap initFillCoordinates(); 46 | virtual void onFillCoordinate(QChar c, QString layer, int x, int y, QMap &data); 47 | virtual void endFillCoordinate(QMap &data); 48 | 49 | 50 | protected: 51 | Resistor * res; 52 | }; 53 | 54 | } 55 | 56 | Q_DECLARE_METATYPE(cIcCore::PatternResistor) 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /cic-core/src/core/patterntransistor.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-04-03 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_CORE_PATTERNTRANSISTOR_H 21 | #define CIC_CORE_PATTERNTRANSISTOR_H 22 | 23 | #include 24 | #include "cell.h" 25 | #include "patterntile.h" 26 | #include "spice/mosfet.h" 27 | 28 | namespace cIcCore{ 29 | using namespace cIcSpice; 30 | class PatternTransistor : public PatternTile 31 | { 32 | Q_OBJECT 33 | Q_PROPERTY(QString mosType READ mosType WRITE setMosType) 34 | 35 | 36 | public: 37 | PatternTransistor(); 38 | ~PatternTransistor(); 39 | 40 | QString mosType(){return mos->deviceName();} 41 | void setMosType(QString mosType){mos->setDeviceName( mosType); } 42 | 43 | 44 | virtual QMap initFillCoordinates(); 45 | virtual void onFillCoordinate(QChar c, QString layer, int x, int y, QMap &data); 46 | virtual void endFillCoordinate(QMap &data); 47 | virtual void paintRect(Rect *r, QChar c,int x,int y); 48 | 49 | virtual QJsonObject toJson(); 50 | virtual void fromJson(QJsonObject o); 51 | 52 | private: 53 | Mosfet * mos; 54 | 55 | }; 56 | } 57 | 58 | Q_DECLARE_METATYPE(cIcCore::PatternTransistor) 59 | 60 | #endif // PATTERNTRANSISTOR_H 61 | -------------------------------------------------------------------------------- /cic-core/src/core/point.h: -------------------------------------------------------------------------------- 1 | #ifndef CIC_CORE_POINT_H 2 | #define CIC_CORE_POINT_H 3 | 4 | #include 5 | 6 | namespace cIcCore{ 7 | 8 | class Point{ 9 | 10 | public: 11 | int x; 12 | int y; 13 | 14 | Point(){ 15 | x =0; 16 | y = 0; 17 | 18 | } 19 | 20 | Point(int xa, int ya){ 21 | x = xa; 22 | y = ya; 23 | } 24 | 25 | void setPoint(Point p){ 26 | x = p.x; 27 | y = p.y; 28 | 29 | } 30 | 31 | void setPoint(int xa, int ya){ 32 | x = xa; 33 | y = ya; 34 | } 35 | 36 | void rotate(int org_x,int org_y, int angle){ 37 | double angle_ = angle * 2 * asin(1) / 180.0; 38 | int x1,y1; 39 | 40 | x1 = cos(angle_)*(x - org_x) - sin(angle_)*(y - org_y) + org_x; 41 | y1 = sin(angle_) *(x - org_x) + cos(angle_) * (y- org_y) + org_y; 42 | 43 | x = x1; 44 | y = y1; 45 | } 46 | 47 | void translate(int dx, int dy){ 48 | x = x + dx; 49 | y = y + dy; 50 | } 51 | 52 | bool leftOf(const Point& p){ 53 | if(p.x < x){ 54 | return true; 55 | } 56 | return false; 57 | } 58 | 59 | bool over(const Point& p){ 60 | if(p.y > y){ 61 | return true; 62 | } 63 | return false; 64 | } 65 | 66 | int swapX(int x2){ 67 | int xx = x; 68 | x = x2; 69 | return xx; 70 | } 71 | 72 | int swapY(int y2){ 73 | y = y2; 74 | return y; 75 | } 76 | 77 | QString toString() 78 | { 79 | QString s = "x=%1, y=%2"; 80 | return s.arg(x).arg(y); 81 | 82 | } 83 | 84 | 85 | 86 | bool operator==(Point p ){ 87 | if(p.x == x && p.y == y){ 88 | return true; 89 | }else{ 90 | return false; 91 | } 92 | 93 | 94 | } 95 | 96 | }; 97 | 98 | } 99 | 100 | #endif // POINT_H 101 | -------------------------------------------------------------------------------- /cic-core/src/core/port.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_CORE_PORT 21 | #define CIC_CORE_PORT 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "rect.h" 28 | 29 | 30 | namespace cIcCore{ 31 | 32 | /*! 33 | Port is a net name attached to a rectangle 34 | */ 35 | class Port: public Rect 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | 41 | Port(); 42 | ~Port(); 43 | explicit Port(QString name); 44 | // Port(string name):Port(QString::fromLocal8Bit(name.c_str())){} 45 | 46 | //! Net name 47 | QString name(); 48 | void setName(QString name); 49 | QString pinLayer(); 50 | 51 | bool spicePort; 52 | 53 | 54 | virtual void set(Rect * r ); 55 | virtual Rect* get() ; 56 | virtual Rect* get(QString layer) ; 57 | virtual QList getAll(QString layer); 58 | void mirrorX(int ay) override; 59 | void mirrorY(int ax) override; 60 | 61 | QString toString(); 62 | 63 | void add(Rect* r); 64 | 65 | bool isInstancePort(){ 66 | if(strcmp(this->metaObject()->className(),"cIcCore::InstancePort") == 0){ 67 | return true; 68 | }else if(this->inherits("cIcCore::InstancePort")){ 69 | return true; 70 | } 71 | return false; 72 | } 73 | 74 | QJsonObject toJson() override; 75 | void fromJson(QJsonObject o) override; 76 | 77 | 78 | protected: 79 | QString name_; 80 | 81 | Layer * routeLayer_; 82 | Rect* rect_; 83 | 84 | QList alternates_rectangles_; 85 | 86 | public slots: 87 | void updateRect(); 88 | 89 | }; 90 | 91 | 92 | 93 | } 94 | 95 | Q_DECLARE_METATYPE(cIcCore::Port) 96 | 97 | #endif // PORT 98 | 99 | -------------------------------------------------------------------------------- /cic-core/src/core/routering.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-6-13 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | #ifndef CIC_CORE_ROUTE_RING_H 20 | #define CIC_CORE_ROUTE_RING_H 21 | 22 | #include 23 | #include "cell.h" 24 | #include "instance.h" 25 | #include "cut.h" 26 | #include "text.h" 27 | #include 28 | 29 | 30 | namespace cIcCore{ 31 | 32 | class RouteRing : public Cell 33 | { 34 | 35 | 36 | Q_OBJECT 37 | 38 | public: 39 | 40 | RouteRing(); 41 | RouteRing(QString layer,QString name, Rect* size,QString location,int xgrid, int ygrid, int width ); 42 | ~RouteRing(); 43 | void addRoute(Rect* r, QString layer, QString options, QString location); 44 | void trimRouteRing(QString location,QString whichEndToTrim); 45 | void translate(int dx, int dy) override; 46 | void moveTo(int ax,int ay) override; 47 | Rect* get(QString location); 48 | Rect* getDefault(); 49 | Rect* getPointer(QString location); 50 | 51 | 52 | protected: 53 | Rect* bottom = NULL; 54 | Rect* left = NULL; 55 | Rect* right = NULL; 56 | Rect* top = NULL; 57 | Rect* default_rectangle = NULL; 58 | 59 | }; 60 | 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /cic-core/src/core/rules.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-4-6 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_CORE_RULES_H 21 | #define CIC_CORE_RULES_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "layer.h" 30 | #include "consoleoutput.h" 31 | 32 | namespace cIcCore{ 33 | 34 | class Device{ 35 | public: 36 | QString name; 37 | QString devicetype; 38 | QStringList ports; 39 | 40 | }; 41 | 42 | class Rules: public QObject 43 | { 44 | 45 | Q_OBJECT 46 | 47 | public: 48 | Rules(); 49 | 50 | ~Rules(){} 51 | Rules(const Rules&); 52 | 53 | static void loadRules(QString path); 54 | 55 | static Rules* getRules(){return myRules_;} 56 | 57 | QList getConnectStack(QString layer1, QString layer2); 58 | 59 | 60 | 61 | Device * getDevice(QString dev); 62 | qreal get(QString layer, QString rule); 63 | bool hasRule(QString layer, QString rule); 64 | double spiceUnit(); 65 | QString layerToColor(QString name); 66 | int layerToNumber(QString name); 67 | int layerToDataType(QString name); 68 | int gamma(){return gamma_;} 69 | int grid(){return grid_;} 70 | void setRules(QJsonObject job); 71 | Layer * getLayer(QString string); 72 | QMap layers(){ return layers_;} 73 | bool isLayerBeforeLayer(QString layer1, QString layer2); 74 | QString getNextLayer(QString lay); 75 | QString getPreviousLayer(QString lay); 76 | double toMicron(int val); 77 | QString removeDataType(QString layer); 78 | QString getDataType(QString layer); 79 | 80 | 81 | private: 82 | static Rules * myRules_; 83 | QMap layers_; 84 | QMap > rules_; 85 | QMap devices_; 86 | int gamma_; 87 | int grid_; 88 | double spiceunit_; 89 | 90 | }; 91 | 92 | 93 | 94 | } 95 | 96 | #endif // RULES_H 97 | -------------------------------------------------------------------------------- /cic-core/src/core/text.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-4-30 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #include "core/text.h" 22 | 23 | namespace cIcCore{ 24 | 25 | Text::Text(){ 26 | name_ = ""; 27 | this->setLayer("TXT"); 28 | } 29 | 30 | Text::~Text(){ 31 | } 32 | 33 | Text::Text(QString name){ 34 | name_ = name; 35 | this->setLayer("TXT"); 36 | } 37 | 38 | QString Text::name(){return name_;} 39 | 40 | void Text::setName(QString name){name_ = name;} 41 | 42 | void Text::fromJson(QJsonObject o){ 43 | Rect::fromJson(o); 44 | name_ = o["name"].toString(); 45 | } 46 | 47 | QJsonObject Text::toJson(){ 48 | QJsonObject o = Rect::toJson(); 49 | o["class"] = "Text"; 50 | o["name"] = name_; 51 | return o; 52 | } 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /cic-core/src/core/text.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_CORE_TEXT 21 | #define CIC_CORE_TEXT 22 | 23 | #include 24 | #include 25 | #include 26 | #include "rect.h" 27 | 28 | namespace cIcCore{ 29 | 30 | /*! 31 | Text is just a text 32 | */ 33 | class Text: public Rect 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | 39 | Text(); 40 | ~Text(); 41 | explicit Text(QString name); 42 | 43 | //! Net name 44 | QString name(); 45 | void setName(QString name); 46 | 47 | QJsonObject toJson() override; 48 | void fromJson(QJsonObject o) override; 49 | 50 | protected: 51 | QString name_; 52 | }; 53 | 54 | 55 | 56 | } 57 | 58 | Q_DECLARE_METATYPE(cIcCore::Text) 59 | 60 | #endif // Text 61 | 62 | -------------------------------------------------------------------------------- /cic-core/src/decorator/connectsourcedrain.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2018 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2018-3-11 5 | // =================================================================== 6 | // The MIT License (MIT) 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | // SOFTWARE. 25 | // 26 | //==================================================================== 27 | 28 | #ifndef CIC_DECORATOR_CONNECTSD_H 29 | #define CIC_DECORATOR_CONNECTSD_H 30 | 31 | #include "decorator/layoutcelldecorator.h" 32 | #include "core/patterntransistor.h" 33 | 34 | namespace cIcCore{ 35 | 36 | /*! Decorator to find all transistors of same group, and connect 37 | * the source to the drain. It serves a similar purpose as 38 | * overlapping source and drain, like what is usually done in i.e 39 | * NAND cell 40 | */ 41 | class ConnectSourceDrain : public LayoutCellDecorator 42 | { 43 | Q_OBJECT 44 | 45 | public: 46 | ConnectSourceDrain(){}; 47 | ~ConnectSourceDrain(){}; 48 | ConnectSourceDrain(const ConnectSourceDrain&){}; 49 | virtual void parseOptions(); 50 | virtual void beforeRoute(); 51 | 52 | QString layer; 53 | QString routeType; 54 | QString options; 55 | 56 | 57 | }; 58 | 59 | 60 | }; 61 | 62 | 63 | Q_DECLARE_METATYPE(cIcCore::ConnectSourceDrain) 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /cic-core/src/decorator/layoutcelldecorator.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2018 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2018-3-11 5 | // =================================================================== 6 | // The MIT License (MIT) 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | // SOFTWARE. 25 | // 26 | //==================================================================== 27 | 28 | #include "decorator/layoutcelldecorator.h" 29 | 30 | namespace cIcCore{ 31 | 32 | LayoutCellDecorator::LayoutCellDecorator() 33 | { 34 | 35 | } 36 | 37 | 38 | LayoutCellDecorator::LayoutCellDecorator(const LayoutCellDecorator& ) 39 | { 40 | 41 | } 42 | 43 | 44 | LayoutCellDecorator::LayoutCellDecorator(LayoutCell * lc) 45 | { 46 | this->layoutcell = lc; 47 | 48 | } 49 | 50 | LayoutCellDecorator::~LayoutCellDecorator() 51 | { 52 | 53 | } 54 | 55 | 56 | 57 | 58 | 59 | 60 | } 61 | 62 | -------------------------------------------------------------------------------- /cic-core/src/decorator/layoutcelldecorator.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2018 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2018-3-11 5 | // =================================================================== 6 | // The MIT License (MIT) 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | // SOFTWARE. 25 | // 26 | //==================================================================== 27 | 28 | #ifndef CIC_DECORATOR_LAYOUTCELL_H 29 | #define CIC_DECORATOR_LAYOUTCELL_H 30 | 31 | #include "core/layoutcell.h" 32 | 33 | namespace cIcCore{ 34 | 35 | class LayoutCellDecorator: public QObject 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | LayoutCellDecorator(); 41 | LayoutCellDecorator(const LayoutCellDecorator &); 42 | LayoutCellDecorator(LayoutCell* lc); 43 | ~LayoutCellDecorator(); 44 | 45 | void setOptions(QJsonValue & job) 46 | { 47 | jsonval = job; 48 | parseOptions(); 49 | } 50 | 51 | void setCell(LayoutCell* lc) 52 | { 53 | layoutcell = lc; 54 | 55 | } 56 | virtual void parseOptions(){}; 57 | 58 | virtual void afterNew(){}; 59 | virtual void beforePlace(){}; 60 | virtual void afterPlace(){}; 61 | virtual void beforeRoute(){}; 62 | virtual void afterRoute(){}; 63 | virtual void place(){}; 64 | virtual void route(){}; 65 | virtual void paint(){}; 66 | virtual void beforePaint(){}; 67 | virtual void afterPaint(){}; 68 | 69 | 70 | protected: 71 | LayoutCell * layoutcell; 72 | QJsonValue jsonval; 73 | 74 | }; 75 | 76 | } 77 | 78 | Q_DECLARE_METATYPE(cIcCore::LayoutCellDecorator) 79 | #endif 80 | -------------------------------------------------------------------------------- /cic-core/src/printer/cics.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "cics.h" 21 | 22 | namespace cIcPrinter{ 23 | 24 | Cics::Cics(QString name):DesignPrinter(name + ".cics") 25 | { 26 | subcktInPrint = false; 27 | } 28 | 29 | Cics::~Cics() 30 | { 31 | } 32 | 33 | 34 | void Cics::startLib(QString name) 35 | { 36 | DesignPrinter::startLib(name); 37 | } 38 | 39 | void Cics::endLib() 40 | { 41 | 42 | QTextStream ts(&file); 43 | QJsonDocument d(ar); 44 | ts << d.toJson(); 45 | DesignPrinter::endLib(); 46 | 47 | } 48 | 49 | 50 | void Cics::startCell(Cell * cell){ 51 | 52 | if(!cell){return;} 53 | if(cell->isCut()){return;}; 54 | cIcSpice::Subckt * ckt = cell->subckt(); 55 | 56 | if(!ckt){return;} 57 | 58 | QTextStream ts(&file); 59 | QJsonObject o = ckt->toJson(); 60 | o["class"] = cell->metaObject()->className(); 61 | ar.append(o); 62 | this->subcktInPrint = true; 63 | 64 | } 65 | 66 | void Cics::endCell(){ 67 | subcktInPrint = false; 68 | 69 | } 70 | 71 | void Cics::printRect(Rect *rect){ 72 | } 73 | 74 | void Cics::printPort(Port *){ 75 | } 76 | 77 | void Cics::printReference(Cell *c){ 78 | } 79 | 80 | 81 | 82 | } 83 | -------------------------------------------------------------------------------- /cic-core/src/printer/cics.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_PRINTER_CICS_H 21 | #define CIC_PRINTER_CICS_H 22 | 23 | #include "designprinter.h" 24 | #include "core/cell.h" 25 | 26 | namespace cIcPrinter{ 27 | 28 | class Cics : public DesignPrinter 29 | { 30 | public: 31 | explicit Cics(QString name); 32 | ~Cics(); 33 | 34 | void startCell(Cell * cell) override; 35 | void endCell() override; 36 | void printRect(Rect *rect) override; 37 | void printReference(Cell *c) override; 38 | void printPort(Port *) override; 39 | void endLib() override; 40 | void startLib(QString name) override; 41 | 42 | 43 | 44 | protected: 45 | bool subcktInPrint; 46 | QJsonArray ar; 47 | 48 | 49 | }; 50 | 51 | } 52 | 53 | #endif // SPICE_H 54 | -------------------------------------------------------------------------------- /cic-core/src/printer/designprinter.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-7-15 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_PRINTER_DESIGNPRINTER 21 | #define CIC_PRINTER_DESIGNPRINTER 22 | 23 | #include 24 | #include 25 | #include 26 | #include "core/design.h" 27 | #include 28 | #include "core/text.h" 29 | 30 | namespace cIcPrinter{ 31 | using namespace cIcCore; 32 | 33 | class DesignPrinter : public QObject{ 34 | 35 | public: 36 | 37 | protected: 38 | Cell * current_cell; 39 | QString filename; 40 | QFile file; 41 | QString stopcell; 42 | 43 | public: 44 | explicit DesignPrinter(QString filename); 45 | ~DesignPrinter(); 46 | char * toChar(QString str); 47 | bool isEmpty(Cell * c); 48 | void print(Design * o); 49 | void print(Design * o,QString stopcell); 50 | 51 | virtual void openFile(QString file); 52 | virtual void closeFile(); 53 | virtual void printCell(Cell * c); 54 | 55 | virtual void startCell(Cell * ){}; 56 | virtual void endCell() {}; 57 | virtual void printPort(Port *) {} ; 58 | virtual void printText(Text *) {} ; 59 | virtual void printRect(Rect * ) {}; 60 | virtual void printReference(Cell *) {}; 61 | virtual void printChildren(QList children); 62 | 63 | virtual void startLib(QString name); 64 | virtual void endLib(); 65 | // virtual void printText(Text & text) = 0; 66 | 67 | 68 | 69 | 70 | }; 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /cic-core/src/spice/capacitor.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-5-19 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #include "spice/capacitor.h" 22 | namespace cIcSpice{ 23 | 24 | 25 | 26 | 27 | Capacitor::Capacitor() 28 | { 29 | init(QStringList()<< "A" << "B"); 30 | } 31 | 32 | Capacitor::Capacitor(QStringList nodes){ 33 | init(nodes); 34 | 35 | } 36 | 37 | void Capacitor::init(QStringList nodes) 38 | { 39 | 40 | this->deviceName_ = "mres"; 41 | this->spiceType_ = "X"; 42 | this->setNodes(nodes); 43 | 44 | 45 | for(int i=0;i< nodes.count();i++){ 46 | QString node = _nodes[i]; 47 | SubcktInstance* ins = new SubcktInstance(); 48 | QStringList sn; 49 | sn.append(node); 50 | sn.append(QString("%1%2").arg("NC").arg(i)); 51 | ins->setNodes(sn); 52 | ins->setName(QString("%1%2").arg("R").arg(i)); 53 | ins->setDeviceName("resistor"); 54 | instances.append(ins); 55 | } 56 | 57 | } 58 | 59 | 60 | Capacitor::Capacitor(const Capacitor& cap){ 61 | 62 | } 63 | 64 | Capacitor::~Capacitor(){ 65 | 66 | } 67 | 68 | 69 | QString Capacitor::toSpice( QString instance, QStringList nodes){ 70 | QString s; 71 | QTextStream ts(&s); 72 | 73 | cIcCore::Rules * rules = cIcCore::Rules::getRules(); 74 | cIcCore::Device * mtype = rules->getDevice(this->deviceName()); 75 | 76 | 77 | for(int i=0;i< nodes.count();i++){ 78 | QString node = nodes[i]; 79 | 80 | ts << "R" << instance << i << " " << node << " NC" << i << " " << mtype->name << "\n"; 81 | 82 | 83 | } 84 | return s; 85 | } 86 | 87 | QJsonObject Capacitor::toJson() 88 | { 89 | 90 | 91 | cIcCore::Rules * rules = cIcCore::Rules::getRules(); 92 | cIcCore::Device * mtype = rules->getDevice(this->deviceName()); 93 | 94 | 95 | foreach(SubcktInstance* ins,instances){ 96 | ins->setSubcktName(mtype->name); 97 | } 98 | 99 | 100 | QJsonObject o = SpiceDevice::toJson(); 101 | 102 | 103 | return o; 104 | } 105 | 106 | 107 | } 108 | -------------------------------------------------------------------------------- /cic-core/src/spice/capacitor.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-5-19 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #ifndef CIC_SPICE_CAPACITOR 22 | #define CIC_SPICE_CAPACITOR 23 | 24 | #include 25 | #include 26 | #include "spice/subcktinstance.h" 27 | #include "core/rules.h" 28 | #include "spice/spicedevice.h" 29 | 30 | namespace cIcSpice{ 31 | 32 | class Capacitor : public SpiceDevice 33 | { 34 | 35 | Q_OBJECT 36 | 37 | public: 38 | Capacitor(QStringList n); 39 | Capacitor(); 40 | 41 | void init(QStringList n); 42 | 43 | Capacitor(const Capacitor& mos); 44 | ~Capacitor(); 45 | virtual QString toSpice( QString instance, QStringList nodes); 46 | virtual QJsonObject toJson(); 47 | }; 48 | 49 | } 50 | 51 | Q_DECLARE_METATYPE(cIcSpice::Capacitor) 52 | 53 | #endif // MOSFET 54 | -------------------------------------------------------------------------------- /cic-core/src/spice/mosfet.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "spice/mosfet.h" 21 | 22 | namespace cIcSpice{ 23 | 24 | Mosfet::Mosfet(){ 25 | this->setDeviceName("nch"); 26 | this->setSpiceType("M"); 27 | this->setName("M1"); 28 | QStringList n; 29 | n << "D" << "G" << "S" << "B"; 30 | this->setNodes(n); 31 | setProperty("width",1); 32 | setProperty("length",1); 33 | setProperty("nf",1); 34 | setProperty("multiplier",1); 35 | } 36 | 37 | Mosfet::Mosfet(const Mosfet& mos){ 38 | 39 | } 40 | 41 | Mosfet::~Mosfet(){ 42 | 43 | } 44 | 45 | 46 | QString Mosfet::toSpice(){ 47 | return this->toSpice("1",nodes()); 48 | } 49 | 50 | 51 | QString Mosfet::toSpice( QString instance, QStringList nodes){ 52 | QString s; 53 | QTextStream ts(&s); 54 | 55 | cIcCore::Rules * rules = cIcCore::Rules::getRules(); 56 | cIcCore::Device * mtype = rules->getDevice(this->deviceName()); 57 | 58 | 59 | if(mtype){ 60 | ts << mtype->devicetype << instance << " " << nodes.join(' ') << " " << mtype->name ; 61 | }else{ 62 | ts << "M" << instance << " " << nodes.join(' ') << " " << this->deviceName() ; 63 | 64 | } 65 | 66 | double w = _properties["width"].toDouble()*rules->spiceUnit(); 67 | double l = _properties["length"].toDouble()*rules->spiceUnit(); 68 | 69 | ts << " w=" << w << " l=" << l << " nf=" << getPropertyString("nf") << " M=" << getPropertyString("multiplier") << "\n"; 70 | 71 | return s; 72 | } 73 | 74 | QJsonObject Mosfet::toJson() 75 | { 76 | 77 | // cIcCore::Rules * rules = cIcCore::Rules::getRules(); 78 | // cIcCore::Device * mtype = rules->getDevice(this->deviceName()); 79 | QJsonObject o = SpiceDevice::toJson(); 80 | return o; 81 | } 82 | 83 | void Mosfet::fromJson(QJsonObject o){ 84 | SpiceDevice::fromJson(o); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /cic-core/src/spice/mosfet.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_SPICE_MOSFET 21 | #define CIC_SPICE_MOSFET 22 | 23 | #include 24 | #include "core/rules.h" 25 | #include "spice/spicedevice.h" 26 | 27 | 28 | namespace cIcSpice{ 29 | 30 | class Mosfet : public SpiceDevice 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | Mosfet(); 36 | Mosfet(const Mosfet& mos); 37 | ~Mosfet(); 38 | virtual QString toSpice( QString instance, QStringList nodes); 39 | virtual QJsonObject toJson(); 40 | virtual void fromJson(QJsonObject o); 41 | virtual QString toSpice(); 42 | 43 | }; 44 | 45 | 46 | 47 | } 48 | 49 | Q_DECLARE_METATYPE(cIcSpice::Mosfet) 50 | 51 | #endif // MOSFET 52 | -------------------------------------------------------------------------------- /cic-core/src/spice/resistor.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-4 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | #include "spice/resistor.h" 23 | namespace cIcSpice{ 24 | 25 | Resistor::Resistor(QStringList n){ 26 | init(n); 27 | } 28 | 29 | Resistor::Resistor(){ 30 | init(QStringList() << "A" << "B"); 31 | } 32 | 33 | 34 | Resistor::Resistor(const Resistor& cap){ 35 | 36 | } 37 | 38 | void Resistor::init(QStringList n) 39 | { 40 | this->deviceName_ = "mres"; 41 | this->spiceType_ = "X"; 42 | this->setNodes(n); 43 | this->setName("R1"); 44 | 45 | } 46 | 47 | 48 | Resistor::~Resistor(){ 49 | 50 | } 51 | 52 | QString Resistor::toSpice( ){ 53 | return toSpice(this->name(),nodes()); 54 | } 55 | 56 | QString Resistor::toSpice( QString instance, QStringList nodes){ 57 | QString s; 58 | QTextStream ts(&s); 59 | 60 | cIcCore::Rules * rules = cIcCore::Rules::getRules(); 61 | 62 | QString deviceName = this->deviceName(); 63 | if(this->hasProperty("layer")){ 64 | deviceName += this->getPropertyString("layer"); 65 | } 66 | 67 | cIcCore::Device * mtype = rules->getDevice(deviceName); 68 | 69 | QString type = this->deviceName(); 70 | QString dtype = "X"; 71 | if(!mtype){ 72 | qWarning() << "ERROR: Could not find resistor type for " << this->deviceName() << " in rule file"; 73 | }else{ 74 | dtype = mtype->devicetype; 75 | type = mtype->name; 76 | } 77 | 78 | 79 | 80 | ts << dtype << instance << " " << nodes.join(" ") << " "<< type << " w=" << this->getPropertyString("width") << " l=" << this->getPropertyString("length")<< "\n"; 81 | 82 | return s; 83 | } 84 | 85 | QJsonObject Resistor::toJson() 86 | { 87 | 88 | QList instances; 89 | SubcktInstance* ins = new SubcktInstance(); 90 | QStringList sn; 91 | sn.append("A"); 92 | sn.append("B"); 93 | ins->setNodes(sn); 94 | ins->setName("R1"); 95 | ins->setDeviceName("resistor"); 96 | instances.append(ins); 97 | 98 | QJsonObject o = SpiceDevice::toJson(); 99 | 100 | return o; 101 | } 102 | 103 | void Resistor::fromJson(QJsonObject o){ 104 | SpiceDevice::fromJson(o); 105 | } 106 | 107 | 108 | } 109 | -------------------------------------------------------------------------------- /cic-core/src/spice/resistor.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-9-4 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | #ifndef CIC_SPICE_RESISTOR 23 | #define CIC_SPICE_RESISTOR 24 | 25 | #include 26 | #include "core/rules.h" 27 | #include "spice/spicedevice.h" 28 | #include "spice/subcktinstance.h" 29 | 30 | namespace cIcSpice{ 31 | 32 | class Resistor : public SpiceDevice 33 | { 34 | 35 | Q_OBJECT 36 | 37 | public: 38 | 39 | Resistor(QStringList n ); 40 | Resistor(); 41 | 42 | void init(QStringList n); 43 | 44 | Resistor(const Resistor& mos); 45 | ~Resistor(); 46 | virtual QString toSpice( QString instance, QStringList nodes); 47 | virtual QJsonObject toJson(); 48 | virtual void fromJson(QJsonObject o); 49 | virtual QString toSpice( ); 50 | 51 | double width; 52 | 53 | }; 54 | 55 | } 56 | 57 | Q_DECLARE_METATYPE(cIcSpice::Resistor) 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /cic-core/src/spice/spicedevice.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2017 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2017-3-11 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "spice/spicedevice.h" 21 | namespace cIcSpice{ 22 | 23 | SpiceDevice::SpiceDevice() 24 | { 25 | 26 | } 27 | 28 | SpiceDevice::SpiceDevice(const SpiceDevice &d) 29 | { 30 | 31 | } 32 | 33 | SpiceDevice::~SpiceDevice() 34 | { 35 | 36 | } 37 | 38 | QString SpiceDevice::toSpice() 39 | { 40 | } 41 | 42 | 43 | QString SpiceDevice::toSpice( QString instance, QStringList nodes) 44 | { 45 | 46 | } 47 | 48 | 49 | QJsonObject SpiceDevice::toJson() 50 | { 51 | 52 | QJsonObject o = SpiceObject::toJson(); 53 | 54 | QJsonArray ar; 55 | // foreach(SubcktInstance* i, instances){ 56 | // QJsonObject oi = i->toJson(); 57 | //ar.append(oi); 58 | // } 59 | 60 | // o["instances"] = ar; 61 | // o.remove("deviceName"); 62 | 63 | return o; 64 | 65 | 66 | } 67 | 68 | void SpiceDevice::fromJson(QJsonObject o){ 69 | SpiceObject::fromJson(o); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /cic-core/src/spice/spicedevice.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2017 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2017-3-11 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | #ifndef CIC_SPICE_DEVICE_H 20 | #define CIC_SPICE_DEVICE_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "spice/spiceobject.h" 28 | #include "spice/subcktinstance.h" 29 | 30 | namespace cIcSpice{ 31 | 32 | class SpiceDevice: public SpiceObject 33 | { 34 | 35 | Q_OBJECT 36 | 37 | public: 38 | SpiceDevice(); 39 | SpiceDevice(const SpiceDevice&); 40 | ~SpiceDevice(); 41 | 42 | virtual QJsonObject toJson(); 43 | virtual QString toSpice( QString instance, QStringList nodes); 44 | virtual QString toSpice(); 45 | virtual void fromJson(QJsonObject o); 46 | 47 | 48 | protected: 49 | QList instances; 50 | 51 | private: 52 | 53 | }; 54 | 55 | 56 | } 57 | 58 | Q_DECLARE_METATYPE(cIcSpice::SpiceDevice) 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /cic-core/src/spice/spiceobject.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-7-6 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #ifndef CIC_SPICE_SPICEOBJECT_H 22 | #define CIC_SPICE_SPICEOBJECT_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | namespace cIcSpice{ 32 | 33 | class SpiceObject: public QObject 34 | { 35 | 36 | Q_OBJECT 37 | Q_PROPERTY(QString name READ name WRITE setName) 38 | Q_PROPERTY(QStringList spiceStr READ spiceStr WRITE setSpiceStr) 39 | Q_PROPERTY(QStringList nodes READ nodes WRITE setNodes) 40 | Q_PROPERTY(int lineNumber READ lineNumber WRITE setLineNumber) 41 | 42 | public: 43 | SpiceObject(); 44 | SpiceObject(const SpiceObject&); 45 | ~SpiceObject(); 46 | 47 | QString name(); 48 | 49 | virtual QJsonObject toJson(); 50 | void fromJson(QJsonObject o); 51 | 52 | virtual QString setName(QString val); 53 | 54 | int lineNumber(); 55 | int setLineNumber(int val); 56 | 57 | QList spiceStr(); QList setSpiceStr(QList val); 58 | 59 | QStringList nodes(); QStringList setNodes(QStringList val); 60 | 61 | QVariantMap properties(); 62 | 63 | QString spiceType(); 64 | void setSpiceType(QString type); 65 | 66 | 67 | QString deviceName(); void setDeviceName(QString name); 68 | 69 | virtual QString toSpice( QString instance, QStringList nodes); 70 | 71 | 72 | virtual void setProperty(QString key, int val); 73 | virtual void setProperty(QString key, QString val); 74 | virtual void setProperty(QString key, double val); 75 | virtual bool hasProperty(QString key); 76 | //QVariant getProperty(QString key); 77 | virtual QString getPropertyString(QString key); 78 | void setPrefix(QString prefix); 79 | 80 | 81 | protected: 82 | QString spiceType_; 83 | QString deviceName_; 84 | QList _spice_str; 85 | QVariantMap _properties; 86 | QStringList _nodes; 87 | QString prefix_; 88 | 89 | private: 90 | 91 | QString _name; 92 | 93 | QList _children; 94 | int _line_number; 95 | 96 | 97 | 98 | 99 | }; 100 | 101 | 102 | } 103 | 104 | Q_DECLARE_METATYPE(cIcSpice::SpiceObject) 105 | 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /cic-core/src/spice/spiceparser.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-7-6 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #include "spice/spiceparser.h" 22 | 23 | namespace cIcSpice{ 24 | 25 | SpiceParser::SpiceParser(){ 26 | 27 | } 28 | 29 | SpiceParser::~SpiceParser(){ 30 | 31 | } 32 | 33 | SpiceParser::SpiceParser(const SpiceParser&){ 34 | 35 | } 36 | 37 | 38 | void SpiceParser::parseSubckt(int line_number, QList subckt_buffer) 39 | { 40 | Subckt * ckt = new Subckt(); 41 | ckt->parse(subckt_buffer,line_number); 42 | this->_subckt[ckt->name()] = ckt; 43 | } 44 | 45 | void SpiceParser::parseFile(QString filename){ 46 | 47 | QFile file; 48 | file.setFileName(filename); 49 | if(file.open(QIODevice::ReadOnly | QIODevice::Text)){ 50 | 51 | QTextStream in(&file); 52 | bool isSubckt = false; 53 | 54 | QRegularExpression re_subckt_start("^\\s*.subckt"); 55 | re_subckt_start.setPatternOptions(QRegularExpression::CaseInsensitiveOption); 56 | QRegularExpression re_subckt_end("^\\s*.ends"); 57 | re_subckt_end.setPatternOptions(QRegularExpression::CaseInsensitiveOption); 58 | 59 | 60 | QRegularExpression re_plus("^\\s*\\+"); 61 | 62 | int line_number = 0; 63 | QList subckt_buffer; 64 | while (!in.atEnd()) 65 | { 66 | QString line = in.readLine(); 67 | line = line.trimmed(); 68 | line_number++; 69 | 70 | //Handle plus 71 | QRegularExpressionMatch m_hasPlus = re_plus.match(line); 72 | if(m_hasPlus.hasMatch()){ 73 | line.replace(re_plus,""); 74 | subckt_buffer.last().append(line); 75 | continue; 76 | } 77 | 78 | //Capture start of subckt 79 | QRegularExpressionMatch m_start = re_subckt_start.match(line); 80 | if(m_start.hasMatch()){ 81 | isSubckt = true; 82 | subckt_buffer.clear(); 83 | } 84 | 85 | if(isSubckt){ 86 | subckt_buffer.append(line); 87 | } 88 | 89 | //Capture end of subckt 90 | QRegularExpressionMatch m_end = re_subckt_end.match(line); 91 | if(m_end.hasMatch()){ 92 | isSubckt = false; 93 | parseSubckt(line_number, subckt_buffer); 94 | } 95 | } 96 | file.close(); 97 | 98 | } 99 | 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /cic-core/src/spice/spiceparser.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-7-6 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #ifndef CIC_SPICE_SPICEPARSER_H 22 | #define CIC_SPICE_SPICEPARSER_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "subckt.h" 32 | 33 | namespace cIcSpice{ 34 | 35 | class SpiceParser: public QObject 36 | { 37 | Q_OBJECT 38 | // Q_PROPERTY(QMap subckt READ subckt) 39 | public: 40 | SpiceParser(); 41 | SpiceParser(const SpiceParser&); 42 | ~SpiceParser(); 43 | void parseFile(QString filename); 44 | 45 | QMap subckt(){ 46 | return _subckt; 47 | } 48 | 49 | Subckt* getSubckt(QString name){ 50 | if(_subckt.contains(name)){ 51 | return _subckt[name]; 52 | }else{ 53 | return NULL; 54 | } 55 | } 56 | 57 | void parseSubckt(int line_number, QList subckt_buffer); 58 | private: 59 | QMap _subckt; 60 | 61 | }; 62 | 63 | 64 | } 65 | 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /cic-core/src/spice/subckt.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-7-6 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #ifndef CIC_SPICE_SUBCKT_H 22 | #define CIC_SPICE_SUBCKT_H 23 | 24 | #include 25 | #include 26 | #include "spiceobject.h" 27 | #include "subcktinstance.h" 28 | #include "spicedevice.h" 29 | #include "mosfet.h" 30 | #include "resistor.h" 31 | #include 32 | #include 33 | #include 34 | 35 | namespace cIcSpice{ 36 | using namespace std; 37 | class Subckt: public SpiceObject 38 | { 39 | Q_OBJECT 40 | Q_PROPERTY(QString name READ name WRITE setName) 41 | 42 | public: 43 | Subckt(); 44 | Subckt(QList buffer); 45 | Subckt(const Subckt&); 46 | ~Subckt(); 47 | 48 | virtual QJsonObject toJson(); 49 | virtual void fromJson(QJsonObject o); 50 | 51 | 52 | static Subckt* getInstanceSubckt(SubcktInstance*); 53 | void parse(QList buffer, int line); 54 | QList instances(){ return _instances;} 55 | QList devices(){ return _devices;} 56 | void setLibPath(QString path){_lib_path = path; } 57 | QString libPath(){return _lib_path;} 58 | 59 | void add(SubcktInstance* s) 60 | { 61 | _instances.append(s); 62 | } 63 | 64 | void add(SpiceDevice* s) 65 | { 66 | _devices.append(s); 67 | } 68 | 69 | SubcktInstance* getInstance(QString name); 70 | 71 | 72 | void addSubckt() 73 | { 74 | _allsubckt[this->name()] = this; 75 | } 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | protected: 85 | static QMap _allsubckt; 86 | 87 | private: 88 | QHash _inst_index; 89 | QList _instances; 90 | QList _devices; 91 | QString _lib_path; 92 | 93 | 94 | }; 95 | 96 | 97 | } 98 | 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /cic-core/src/spice/subcktinstance.cpp: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-7-6 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #include "spice/subcktinstance.h" 21 | 22 | namespace cIcSpice{ 23 | 24 | QString SubcktInstance::setName(QString val){ 25 | QRegularExpression re_group("^([^\\d<>]+)(\\S+)?$"); 26 | QRegularExpressionMatch m_group = re_group.match(val); 27 | if(m_group.hasMatch()){ 28 | this->_group_name = m_group.captured(1); 29 | this->_group_tag = m_group.captured(2); 30 | 31 | } 32 | 33 | setDeviceName("subckt"); 34 | spiceType_ = "X"; 35 | 36 | return SpiceObject::setName(val); 37 | } 38 | 39 | SubcktInstance::SubcktInstance(){ 40 | 41 | 42 | } 43 | 44 | SubcktInstance::SubcktInstance(QString buffer){ 45 | 46 | } 47 | 48 | SubcktInstance::~SubcktInstance(){ 49 | 50 | } 51 | 52 | SubcktInstance::SubcktInstance(const SubcktInstance&){ 53 | 54 | } 55 | 56 | void SubcktInstance::parse(QString buffer,int line_number){ 57 | 58 | this->setLineNumber(line_number); 59 | this->spiceStr().append(buffer); 60 | 61 | //Remove parameters 62 | QRegularExpression re_params("\\s+(\\S+)\\s*=\\s*(\\S+)"); 63 | QRegularExpressionMatchIterator it= re_params.globalMatch(buffer); 64 | while (it.hasNext()) { 65 | 66 | QRegularExpressionMatch m_params = it.next(); 67 | // cout << m_params.captured(1).toStdString() << " " << m_params.captured(2).toStdString() <<"\n"; 68 | _properties[m_params.captured(1)] = m_params.captured(2); 69 | } 70 | 71 | 72 | buffer.replace(re_params,""); 73 | 74 | //Split on space 75 | const QRegularExpression re_space("\\s+"); 76 | QStringList nodes = buffer.split(re_space); 77 | 78 | //First element should be instance name 79 | this->setName(nodes.first()); 80 | nodes.removeFirst(); 81 | 82 | //Last element should be subckt name 83 | this->_subckt_name = nodes.last(); 84 | nodes.removeLast(); 85 | 86 | 87 | //The rest should be nodes 88 | this->setNodes(nodes); 89 | } 90 | 91 | void SubcktInstance::fromJson(QJsonObject o) 92 | { 93 | SpiceObject::fromJson(o); 94 | 95 | _subckt_name = o["subcktName"].toString(); 96 | _group_name = o["groupName"].toString(); 97 | 98 | } 99 | 100 | 101 | QJsonObject SubcktInstance::toJson() 102 | { 103 | QJsonObject o = SpiceObject::toJson(); 104 | o["subcktName"] = this->prefix_ + _subckt_name; 105 | o["groupName"] = _group_name; 106 | // o["groupTag"] = _group_name; 107 | 108 | return o; 109 | 110 | 111 | } 112 | 113 | 114 | } 115 | -------------------------------------------------------------------------------- /cic-core/src/spice/subcktinstance.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-7-6 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | #ifndef CIC_SPICE_SUBCKTINSTANCE_H 22 | #define CIC_SPICE_SUBCKTINSTANCE_H 23 | 24 | #include 25 | #include "spiceobject.h" 26 | #include 27 | #include 28 | 29 | namespace cIcSpice{ 30 | using namespace std; 31 | class SubcktInstance: public SpiceObject 32 | { 33 | Q_OBJECT 34 | Q_PROPERTY(QString subcktName READ subcktName WRITE setSubcktName) 35 | 36 | 37 | public: 38 | SubcktInstance(); 39 | SubcktInstance(QString buffer); 40 | SubcktInstance(const SubcktInstance&); 41 | ~SubcktInstance(); 42 | virtual QString setName(QString val); 43 | QString subcktName(){return _subckt_name;} 44 | QString setSubcktName(QString val){ _subckt_name = val; 45 | return _subckt_name;} 46 | QString groupName(){return _group_name;} 47 | QString groupTag(){return _group_tag;} 48 | void parse(QString buffer,int line_number); 49 | virtual QJsonObject toJson(); 50 | virtual void fromJson(QJsonObject o); 51 | 52 | private: 53 | 54 | QString _subckt_name; 55 | QString _group_name; 56 | QString _group_tag; 57 | 58 | 59 | }; 60 | 61 | 62 | } 63 | 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /cic-gui/ALGIC003_STDLIB.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/cic-gui/ALGIC003_STDLIB.icns -------------------------------------------------------------------------------- /cic-gui/cic-gui.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2016-03-12T18:50:58 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core widgets 8 | CONFIG += qt console 9 | TEMPLATE = app 10 | mac { 11 | ICON = ALGIC003_STDLIB.icns 12 | } 13 | 14 | TARGET = cic-gui 15 | 16 | SOURCES += src/cellpainter.cpp src/widget.cpp \ 17 | src/window.cpp 18 | 19 | 20 | HEADERS += src/cellpainter.h src/widget.h \ 21 | src/window.h 22 | 23 | include(../etc/console_config.pro) 24 | include(../etc/mac_sdk.pro) 25 | -------------------------------------------------------------------------------- /cic-gui/src/cellpainter.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2016 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2016-12-5 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | 21 | 22 | #ifndef CIC_CORE_CELLPAINTER_H 23 | #define CIC_CORE_CELLPAINTER_H 24 | 25 | #include "core/layoutcell.h" 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace cIcPainter{ 36 | using namespace cIcCore; 37 | 38 | 39 | class CellPainter : public QObject{ 40 | public: 41 | CellPainter(){ 42 | } 43 | ~CellPainter(){ 44 | } 45 | 46 | virtual void startCell(QPainter &painter,Cell*); 47 | virtual void endCell(QPainter &painter); 48 | virtual void paintChildren(QPainter &painter, QList children,QString hierarchy); 49 | 50 | virtual void paintPort(QPainter &painter,Port *); 51 | virtual void paintText(QPainter &painter,Text *); 52 | 53 | //virtual void paint(QPainter &painter, Cell *,int x, int y, int width, int height,QString instanceName); 54 | //virtual void paint(QPainter &painter, Cell *,int x, int y, int width, int height); 55 | virtual void paintCell(QPainter &painter, Cell *,QString hierarchy); 56 | virtual void paintRect(QPainter &painter, Rect * rect); 57 | virtual void paintReference(QPainter &painter,Instance *,QString hiearchy); 58 | void paintMyText(QPainter &painter,int x, int y, QString txt, QString colorName,int size); 59 | double toUnit(int angstrom); 60 | int unit = 1; 61 | 62 | 63 | private: 64 | QString _instanceName = ""; 65 | bool _paint = true; 66 | QString _hasPainted = ""; 67 | 68 | 69 | 70 | }; 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /cic-gui/src/glwidget.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2017 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2017-1-30 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_GLWIDGET_H 21 | #define CIC_GLWIDGET_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include "cic-core.h" 27 | 28 | using namespace cIcCore; 29 | using namespace cIcPainter; 30 | 31 | 32 | struct VisibleArea 33 | { 34 | 35 | Rect rect; 36 | double zoom; 37 | }; 38 | 39 | 40 | 41 | 42 | class GLWidget : public QOpenGLWidget 43 | { 44 | 45 | Q_OBJECT 46 | 47 | public: 48 | explicit GLWidget(QWidget * parent); 49 | void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; 50 | void setCell(Cell* c); 51 | void zoomOut(); 52 | void zoomIn(); 53 | void moveLeft(); 54 | void moveRight(); 55 | void moveUp(); 56 | void moveDown(); 57 | virtual void update(); 58 | 59 | protected: 60 | 61 | 62 | 63 | private: 64 | Cell* cell; 65 | CellPainter* cellPainter; 66 | VisibleArea visibleArea; 67 | 68 | int step = 10; 69 | 70 | double xcenter = 0; 71 | double ycenter = 0; 72 | 73 | 74 | }; 75 | 76 | 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /cic-gui/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "window.h" 2 | #include "version.h" 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | 8 | int error =0; 9 | if(argc >= 2){ 10 | 11 | QString file = argv[1]; 12 | QString rules = argv[2]; 13 | 14 | //Load rules 15 | cIcCore::Rules::loadRules(rules); 16 | 17 | 18 | QApplication app(argc, argv); 19 | app.setWindowIcon(QIcon(":/ALGIC003_STLIB.icns")); 20 | cIcGui::Window window; 21 | window.loadFile(file); 22 | window.show(); 23 | 24 | return app.exec(); 25 | 26 | }else{ 27 | qWarning() << "Usage: cic-gui "; 28 | qWarning() << "Example: cic-gui SAR_ESSCIRC16_28N.cic examples/tech.json "; 29 | qWarning() << "About: \n\tcIcCreator GUI reads .cic file and shows the cells in a GUI" << 30 | "\n\tVersion" << CICVERSION << 31 | "\n\tHash" << CICHASH << "\n"; 32 | error = 1; 33 | } 34 | 35 | return error; 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /cic-gui/src/widget.h: -------------------------------------------------------------------------------- 1 | 2 | //==================================================================== 3 | // Copyright (c) 2017 Carsten Wulff Software, Norway 4 | // =================================================================== 5 | // Created : wulff at 2017-1-30 6 | // =================================================================== 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | //==================================================================== 20 | 21 | #ifndef CIC_WIDGET_H 22 | #define CIC_WIDGET_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include "cic-core.h" 28 | #include "cellpainter.h" 29 | #include 30 | #include 31 | #include 32 | using namespace cIcCore; 33 | using namespace cIcPainter; 34 | 35 | 36 | struct VisibleArea 37 | { 38 | 39 | Rect rect; 40 | double zoom; 41 | }; 42 | 43 | 44 | 45 | 46 | 47 | class Widget : public QWidget 48 | { 49 | 50 | Q_OBJECT 51 | 52 | public: 53 | explicit Widget(QWidget * parent); 54 | void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; 55 | void setCell(Cell* c); 56 | void zoomOut(); 57 | void zoomIn(); 58 | void moveLeft(); 59 | void moveRight(); 60 | void moveUp(); 61 | void moveDown(); 62 | void fit(); 63 | void zoomArea(Rect r); 64 | QPixmap getIcon(Layer *l); 65 | QImage drawColorIconProof(QColor color, const QImage & alpha); 66 | QImage icon(int size); 67 | void drawColorIcon(QPainter & p, QColor color, const QImage & alpha); 68 | 69 | 70 | virtual void update(); 71 | 72 | 73 | 74 | 75 | protected: 76 | virtual void wheelEvent(QWheelEvent *event); 77 | bool eventFilter(QObject *obj, QEvent *event); 78 | virtual void mousePressEvent(QMouseEvent *event); 79 | virtual void mouseMoveEvent(QMouseEvent *event); 80 | virtual void mouseReleaseEvent(QMouseEvent *event); 81 | 82 | private: 83 | Cell* cell; 84 | CellPainter* cellPainter; 85 | VisibleArea visibleArea; 86 | QRubberBand* rubberBand; 87 | bool rubberBandActive; 88 | 89 | int step; 90 | 91 | double xcenter; 92 | double ycenter; 93 | QPoint origin; 94 | 95 | 96 | 97 | }; 98 | 99 | 100 | #endif 101 | 102 | -------------------------------------------------------------------------------- /cic-gui/src/window.h: -------------------------------------------------------------------------------- 1 | //==================================================================== 2 | // Copyright (c) 2015 Carsten Wulff Software, Norway 3 | // =================================================================== 4 | // Created : wulff at 2015-8-20 5 | // =================================================================== 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | //==================================================================== 19 | 20 | #ifndef CIC_GUI_WINDOW_H 21 | #define CIC_GUI_WINDOW_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include "cic-core.h" 35 | #include "widget.h" 36 | #include 37 | #include 38 | 39 | QT_BEGIN_NAMESPACE 40 | class QComboBox; 41 | class QSlider; 42 | QT_END_NAMESPACE 43 | 44 | 45 | namespace cIcGui{ 46 | using namespace cIcCore; 47 | using namespace cIcPainter; 48 | 49 | 50 | class Window : public QWidget 51 | { 52 | Q_OBJECT 53 | public: 54 | explicit Window(QWidget *parent = 0); 55 | void loadDesign(Design *d); 56 | void loadFile(QString f); 57 | ~Window(); 58 | 59 | signals: 60 | 61 | public slots: 62 | void shapeSelected(int index); 63 | void layerClicked(QModelIndex index); 64 | void reloadFile(); 65 | void toggleVisible(); 66 | 67 | 68 | protected: 69 | // bool eventFilter(QObject *obj, QEvent *event); 70 | private: 71 | static bool layerCompare(Layer * a, Layer * b); 72 | 73 | Widget *widget; 74 | QComboBox *shapeComboBox; 75 | QListWidget * listCells; 76 | QListWidget * listLayers; 77 | Design * designs; 78 | QSplitter * splitter; 79 | QString filename; 80 | QWidget * leftside; 81 | bool showAll = true; 82 | 83 | QShortcut *shift_r; 84 | QShortcut *key_t; 85 | CellPainter *cellPainter; 86 | 87 | }; 88 | 89 | } 90 | 91 | #endif // WINDOW_H 92 | -------------------------------------------------------------------------------- /cic/cic.pro: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | ## Copyright (c) 2015 Carsten Wulff Software, Norway 3 | ## ################################################################### 4 | ## Created : wulff at 2015-8-20 5 | ## ################################################################### 6 | ## This program is free software: you can redistribute it and/or modify 7 | ## it under the terms of the GNU General Public License as published by 8 | ## the Free Software Foundation, either version 3 of the License, or 9 | ## (at your option) any later version. 10 | ## 11 | ## This program is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public License 17 | ## along with this program. If not, see . 18 | ###################################################################### 19 | 20 | CONFIG += qt console 21 | CONFIG += static 22 | TEMPLATE = app 23 | TARGET = cic 24 | 25 | HEADERS += src/version.h \ 26 | 27 | include(../etc/mac_sdk.pro) 28 | include(../etc/console_config.pro) 29 | -------------------------------------------------------------------------------- /ciccreator.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | }, 6 | { 7 | "path": "." 8 | } 9 | ] 10 | } -------------------------------------------------------------------------------- /ciccreator.pro: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | ## Copyright (c) 2016 Carsten Wulff Software, Norway 3 | ## ################################################################### 4 | ## Created : wulff at 2016-3-13 5 | ## ################################################################### 6 | ## This program is free software: you can redistribute it and/or modify 7 | ## it under the terms of the GNU General Public License as published by 8 | ## the Free Software Foundation, either version 3 of the License, or 9 | ## (at your option) any later version. 10 | ## 11 | ## This program is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public License 17 | ## along with this program. If not, see . 18 | ###################################################################### 19 | 20 | QMAKE_CFLAGS += $$(CFLAGS) -g 21 | QMAKE_CXXFLAGS += $$(CCFLAGS) -g 22 | CONFIG += c++11 23 | CONFIG += static 24 | 25 | 26 | 27 | 28 | include(etc/mac_sdk.pro) 29 | 30 | 31 | TEMPLATE=subdirs 32 | CONFIG += ordered 33 | SUBDIRS = cic-core \ 34 | cic \ 35 | cic-gui 36 | 37 | cic.depends = cic-core 38 | cic-gui.depends = cic-core 39 | -------------------------------------------------------------------------------- /config.yaml: -------------------------------------------------------------------------------- 1 | 2 | release: 3 | remote: git@github.com:wulffern/ciccreator-bin.git 4 | revision: main 5 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | %SPHINXBUILD% >NUL 2>NUL 14 | if errorlevel 9009 ( 15 | echo. 16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 17 | echo.installed, then set the SPHINXBUILD environment variable to point 18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 19 | echo.may add the Sphinx directory to PATH. 20 | echo. 21 | echo.If you don't have Sphinx installed, grab it from 22 | echo.https://www.sphinx-doc.org/ 23 | exit /b 1 24 | ) 25 | 26 | if "%1" == "" goto help 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/source/basics/basics.rst: -------------------------------------------------------------------------------- 1 | Basics 2 | ###### 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | technology 8 | object 9 | netlist 10 | -------------------------------------------------------------------------------- /docs/source/basics/netlist.rst: -------------------------------------------------------------------------------- 1 | Netlist 2 | ======= 3 | 4 | The netlist is written in standard SPICE, and the placement is based on 5 | location of items in spice. 6 | -------------------------------------------------------------------------------- /docs/source/basics/object.rst: -------------------------------------------------------------------------------- 1 | Object Definition File 2 | ======================= 3 | 4 | The object definition file contains the almost everything except for the 5 | placement information, and the connectivity, both of which are in the 6 | Netlist. 7 | 8 | An example object definition file can be seen at `ip.json `_ 9 | 10 | 11 | .. code-block:: json 12 | 13 | { 14 | "options" : 15 | { 16 | "ignoreSetYoffsetHalf" : false, 17 | "prefix" : "SUNTR_" 18 | }, 19 | "include" : [ 20 | "dmos_sky130nm_core.json", 21 | "dcap.json", 22 | "tr.json", 23 | "resistors.json", 24 | "dig.json", 25 | "components.json", 26 | "capacitor.json" 27 | 28 | ], 29 | "cells" : [ ] 30 | } 31 | 32 | 33 | Comments 34 | -------- 35 | 36 | Any line starting with `\s*//` (space followed by //), will be ignored by the compiler. 37 | 38 | Options 39 | ------- 40 | 41 | Options are instructions to cic. For example, "ignoreSetYoffsetHalf" is a global 42 | parameter to override overlap of source/drain (custom feature). 43 | 44 | Prefix is the name to prepend to all cells, which is useful for technologies 45 | where one need to have multiple, slightly different, versision of the design. 46 | 47 | Include 48 | ------- 49 | 50 | The include sections link to other object definition files, and is mostly to 51 | avoid having everything in one big file. The array is read sequentially, as 52 | such, the order of the files are important. For example, if `tr.json` has an 53 | instance of a MOSFET from `dmos_sky130nm_core.json` the MOSFET must be created 54 | first. 55 | 56 | Cells 57 | ----- 58 | 59 | ``cells`` is an array of all the cells in the design. The order of the 60 | cells are important, since a cell can’t be referenced until it’s been 61 | created. 62 | 63 | An example of cell definition can be seen in `dig.json `_ 64 | 65 | Each of the cells are read by cic, one by one, in sequence. cic will create an 66 | instance of the class, and run methods on that class. 67 | 68 | .. code-block:: json 69 | 70 | "cells": 71 | [ 72 | { "name": "TAPCELLB_CV", 73 | "class" : "Layout::LayoutDigitalCell", 74 | "meta" : { 75 | "symbol" : "cic_wbulk/tap" 76 | }, 77 | 78 | "boundaryIgnoreRouting" : 1, 79 | "beforeRoute" : { 80 | "addDirectedRoutes" : [ ["M1","AVSS","MN1:B->MN1:G"], 81 | ["M1","AVSS","MN1:G-|--MN1:S"], 82 | ["M1","AVSS","MN1:G-|--MN1:D"], 83 | ["M1","AVDD","MP:S-|--MP:G"], 84 | ["M1","AVDD","MP:D-|--MP:G"], 85 | ["M1","AVDD","MP:G->MP:B"] 86 | ] 87 | 88 | } 89 | 90 | } 91 | ] 92 | 93 | 94 | Name 95 | ^^^^ 96 | 97 | All cells must have a name. The name is used to search the spice file (assumed 98 | to be called `dig.spi` for a `dig.json` file). The name will also be used for 99 | the cell in the output file 100 | 101 | Class 102 | ^^^^^ 103 | 104 | The class correspond to a class inside cic 105 | -------------------------------------------------------------------------------- /docs/source/basics/technology.rst: -------------------------------------------------------------------------------- 1 | Technology File 2 | =============== 3 | 4 | The technology file has sections: layers, technology, rules. 5 | 6 | An example of a technology file for `Skywater 130 nm `_ 7 | 8 | 9 | layers 10 | ------ 11 | cic expect to find some common layers, like "OD" (diffusion, active, the stuff 12 | that is under the poly gates), "PO" (the gate material), "M1" "M2" (meta 13 | layers). 14 | 15 | cic does not care that much about the number, or datatype anymore, but they 16 | still need to be there. The 17 | important parts are the material, previous, next, and pin. 18 | 19 | The color is used by cic-gui. 20 | 21 | :: 22 | 23 | "PO" : { "number" : 7, //SKILL layer number 24 | "datatype" : 0, //SKILL layer datatype 25 | "alias" : "poly", //Name in Skywater 130 nm Magic VLSI 26 | "material" : "poly", //Type of layer [poly,cut,metal,marker,implant] 27 | "previous" : "", //Previous layer in the connect stack. For M1 it would be CO 28 | "next" : "CO", //Layer to used to connect to the next routing layer 29 | "pin" : "PO_pin" , //Layer to be used for pins in this layer (i.e port text) 30 | "color" : "red" //Color of layer in cic-gui 31 | } 32 | 33 | technology 34 | ---------- 35 | 36 | Most of the technology file is irrelevant for cic, but the rule file still 37 | expects to find gamma, grid, spiceunit, devices (name,devicetype,ports). 38 | 39 | The "gamma" keyword is the unit used to translate from "rules" into real numbers 40 | (Ångstrøm). The default gamma is 50 Ångstrøm. 41 | 42 | The "grid" is the minimum snap distance, for example all units will be rounded 43 | to "5 nm" 44 | 45 | The "spiceunit" is no longer applicable, but has not been removed from "core/rules.cpp" 46 | 47 | 48 | 49 | .. code:: json 50 | 51 | "gamma" : 500, 52 | "grid" : 5 53 | "spiceunit": 1, 54 | 55 | rules 56 | ----- 57 | 58 | All rules are defined as a multiplum of the gamma. 59 | 60 | .. code:: json 61 | 62 | "M2" : { // Layer to apply rules for 63 | "space" : 1, // rule name : multiplum of gamma 64 | "width" : 1 65 | }, 66 | 67 | Common rule names are 68 | 69 | * space : distance between two rectangles 70 | * width : default width 71 | * height : default height, common for cut layers 72 | * enclosure : default enclosure of for example OD around this layer 73 | * XXXenclosure : enclosure of current layer around layer XXX 74 | * XXXencOpposite : enclosure of current layer around layer XXX, used when there is more than two cuts on a via 75 | 76 | A special rule is the ‘ROUTE’ layer, which does not correspond to a 77 | layer. It’s used to set the grid for the PatternTile objects, and only 78 | has ‘verticalgrid’ and ‘horizontal grid’ rule names. 79 | 80 | .. code:: json 81 | 82 | "ROUTE": { "horizontalgrid": 18, "verticalgrid" : 22 } 83 | -------------------------------------------------------------------------------- /docs/source/cells/cell.rst: -------------------------------------------------------------------------------- 1 | Cell 2 | ==== 3 | 4 | Cell is the fundamental object of all objects in the layout (Ok, some 5 | object, like Port, inherit only Rect, but most inherit Cell). Cell can 6 | be found in ``cic-core/src/core/cell.cpp`` 7 | 8 | Properties 9 | ^^^^^^^^^^^^^ 10 | 11 | 12 | In the object definition file the Cell can contain certain properties 13 | 14 | * name [mandatory] : Name of the cell, must be uniq 15 | * class [optional] : will use ``LayoutCell`` if it’s not specified. In ``cic-core/src/core/design.cpp`` constructor there is a list of allowedcells 16 | * inherit [optional] : Cell from which this cell will inherit all instructions 17 | * leech [optional] : Cell from which this cell will copy all instructions, but will not follow the inheritance hierarchy. In other words it only cares about the first parent, no grandparents. 18 | * comment [optional] : can occur anywhere, and is ignored by the compiler 19 | 20 | 21 | 22 | Action 23 | ^^^^^^^^^^^^^ 24 | 25 | 26 | Each cell will trigger actions in a specific sequence. The sequence is 27 | as follows: 28 | 29 | * Create object if the class exists 30 | * Set name 31 | * Run ``afterNew`` of all parents, starting with the oldest 32 | * Run ``afterNew`` of the current cell 33 | * Set all properties, and run all custom functions on the object 34 | * Run ``beforePlace`` of all parents, starting with the oldest 35 | * Run ``beforePlace`` of the current cell 36 | * Call place() on the object 37 | * Run ``afterPlace`` of all parents, starting with the oldest 38 | * Run ``afterPlace`` of the current cell 39 | * Run ``beforeRoute`` of all parents, starting with the oldest 40 | * Run ``beforeRoute`` of the current cell 41 | * Call route() 42 | * Run ``afterRoute`` of all parents, starting with the oldest 43 | * Run ``afterRoute`` of the current cell 44 | * Call addAllPorts() on the object, to place remaining Ports. 45 | * Run ``beforePaint`` of all parents, starting with the oldest 46 | * Run ``beforePaint`` of the current cell 47 | * Call paint() on the object 48 | * Run ``afterPaint`` of all parents, starting with the oldest 49 | * Run ``afterPaint`` of the current cell 50 | * Add the object as a child of Design 51 | * Add to the static list of cells 52 | -------------------------------------------------------------------------------- /docs/source/cells/cells.rst: -------------------------------------------------------------------------------- 1 | Cells 2 | ======= 3 | 4 | There are more fundamental building blocks in cIcCreator than a [[Cell]], 5 | however, unless you plan to hack the source, you probably won't use Rect, Port, 6 | Text, etc. 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | cell 12 | patterntile 13 | patterncapacitor 14 | patterntransistor 15 | patternresistor 16 | layoutcell 17 | -------------------------------------------------------------------------------- /docs/source/cells/patterncapacitor.rst: -------------------------------------------------------------------------------- 1 | PatternCapacitor 2 | ================ 3 | PatternCapacitor extends PatternTile, and can create capacitors with 4 | two, and three terminals. PatternCapacitor can be found in 5 | ``cic-core/src/core/patterncapacitor.cpp`` 6 | 7 | Properties 8 | ^^^^^^^^^^^^^ 9 | 10 | - yoffset : number [optional] : Vertical grid offset of the origin 11 | - xoffset : number [optional] : Horizontal grid offset of the origin 12 | - widthoffset : number [optional] : Reduce the width by X grid 13 | 14 | Functions 15 | ^^^^^^^^^^^^^ 16 | -------------------------------------------------------------------------------- /docs/source/cells/patternresistor.rst: -------------------------------------------------------------------------------- 1 | PatternResistor 2 | =============== 3 | -------------------------------------------------------------------------------- /docs/source/cells/patterntile.rst: -------------------------------------------------------------------------------- 1 | PatternTile 2 | ============ 3 | PatternTile is the base functions for all ASCII to Layout objects. 4 | PatternTile can be found in ``cic-core/src/core/patterntile.cpp`` 5 | 6 | Properties 7 | ~~~~~~~~~~ 8 | 9 | - yoffset : number [optional] : Vertical grid offset of the origin 10 | - xoffset : number [optional] : Horizontal grid offset of the origin 11 | - widthoffset : number [optional] : Reduce the width by X grid 12 | 13 | Functions 14 | ~~~~~~~~~ 15 | 16 | fillCoordinatesFromString 17 | ^^^^^^^^^^^^^^^^^^^^^^^^^ 18 | 19 | The argument is an array of arrays that contain the ASCII 20 | 21 | .. code:: json 22 | 23 | [ 24 | [ "Layer Name", 25 | "rectangle definitions", 26 | ] 27 | ] 28 | 29 | for example 30 | 31 | .. code:: json 32 | 33 | [ 34 | [ "M1", 35 | "--xxxQxxxxx---", 36 | "----------x---", 37 | "--xxxxxkx-x---", 38 | "--------x-D---", 39 | "--xxxxxxx-x---", 40 | "--------x-x---", 41 | "--xxxxxkx-x---", 42 | "----------x---", 43 | "--xxxQxxxxx---" 44 | ] 45 | ] 46 | 47 | The possible rectangle definitions are 48 | 49 | * ‘-’ : Empty rectangle 50 | * ‘x’ : Fill rectangle completely 51 | * ‘X’ : 52 | * ‘m’ : Fill rectangle horizontally, but use “mingatelength” rule for height 53 | * ‘w’ : Fill rectangle horizontally, but use “width” rule for height 54 | * ‘D,G,S,B,A’ : Add Port 55 | * ‘c’ : Add cut in the center of the current grid 56 | * ‘C’ : Add cut aligned on the left edge of the current grid 57 | * ‘K’ : Add two cuts with the first cut aligend on the left edge of the current grid 58 | * ‘k’ : Add two cuts with the first cut aligend in the center of the current grid 59 | * ‘Q’ : Add two cuts centered in the center of the current grid 60 | * ‘r’ : Add metal resistor 61 | -------------------------------------------------------------------------------- /docs/source/cells/patterntransistor.rst: -------------------------------------------------------------------------------- 1 | PatternTransistor 2 | ================= 3 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # For the full list of built-in configuration values, see the documentation: 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 5 | 6 | # -- Project information ----------------------------------------------------- 7 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information 8 | 9 | 10 | project = 'Custom IC Creator' 11 | copyright = '2022, Carsten Wulff' 12 | author = 'Carsten Wulff' 13 | 14 | # -- General configuration --------------------------------------------------- 15 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration 16 | 17 | extensions = [ "breathe"] 18 | 19 | 20 | breathe_projects = {"ciccreator": "../../doxygen/xml/"} 21 | 22 | breathe_default_project = "ciccreator" 23 | 24 | breathe_implementation_filename_extensions = ['.c', '.cc', '.cpp'] 25 | 26 | templates_path = ['_templates'] 27 | exclude_patterns = [] 28 | 29 | html_sidebars = { 30 | '**': [ 31 | 'globaltoc.html', 32 | ] 33 | } 34 | 35 | # -- Options for HTML output ------------------------------------------------- 36 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output 37 | 38 | html_theme = 'nature' 39 | html_static_path = ['_static'] 40 | -------------------------------------------------------------------------------- /docs/source/graphics/Connectivity_AB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Connectivity_AB.png -------------------------------------------------------------------------------- /docs/source/graphics/Connectivity_B.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Connectivity_B.png -------------------------------------------------------------------------------- /docs/source/graphics/DirectedRoute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/DirectedRoute.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_3cuts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_3cuts.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_5cuts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_5cuts.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_offsethigh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_offsethigh.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_offsethighend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_offsethighend.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_offsetlow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_offsetlow.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_offsetlowend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_offsetlowend.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_onTopB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_onTopB.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_onTopL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_onTopL.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_onTopR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_onTopR.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_onTopT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_onTopT.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_track4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_track4.png -------------------------------------------------------------------------------- /docs/source/graphics/Options_track8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Options_track8.png -------------------------------------------------------------------------------- /docs/source/graphics/StartLeft_Left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/StartLeft_Left.png -------------------------------------------------------------------------------- /docs/source/graphics/StartLeft_Right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/StartLeft_Right.png -------------------------------------------------------------------------------- /docs/source/graphics/StartRight_Left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/StartRight_Left.png -------------------------------------------------------------------------------- /docs/source/graphics/StartRight_Right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/StartRight_Right.png -------------------------------------------------------------------------------- /docs/source/graphics/TEST.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/TEST.png -------------------------------------------------------------------------------- /docs/source/graphics/TESTVIA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/TESTVIA.png -------------------------------------------------------------------------------- /docs/source/graphics/U_Left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/U_Left.png -------------------------------------------------------------------------------- /docs/source/graphics/U_Right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/U_Right.png -------------------------------------------------------------------------------- /docs/source/graphics/Vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wulffern/ciccreator/b18ec44cc1c94b8af621be6341de9a69417dca39/docs/source/graphics/Vertical.png -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. Custom IC Creator documentation master file, created by 2 | sphinx-quickstart on Mon Dec 5 20:08:26 2022. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Custom IC Creator 7 | ============================================= 8 | 9 | cIcCreator is a compiler for integrated circuits. 10 | 11 | cIcCreator reads a JSON object definition file, technology rule file 12 | and a SPICE netlist (assumes same name as object definition file) 13 | and outputs a cic description file (.cic). 14 | 15 | Use cicpy (https://github.com/wulffern/cicpy) to transpile the .cic file to other formats. 16 | 17 | 18 | Getting started 19 | =============== 20 | 21 | First clone the repo 22 | 23 | .. code-block:: bash 24 | 25 | git clone https://github.com/wulffern/ciccreator 26 | cd ciccreator 27 | git clone https://github.com/wulffern/ciccreator-bin release 28 | 29 | In the release folder, you hopefully find the binary for your platform. 30 | 31 | There are three input files needed to run the compiler 32 | 33 | * `Technology file `_ 34 | * `Object definition file `_ 35 | * `Netlist `_ 36 | 37 | The description below is for MacOS. For other OS replace the .darwin with the 38 | binary that applies to your platform. 39 | 40 | .. code-block:: bash 41 | 42 | release/cic.darwin-latest examples/SAR_ESSCIRC16_28N.json examples/tech.json SAR_TEST 43 | 44 | The output of the compiler will be SAR_TEST.cic 45 | 46 | To view the output, do 47 | 48 | .. code-block:: bash 49 | 50 | release/cic-gui.darwin-latest SAR_TEST.cic examples/tech.json 51 | 52 | 53 | The examples/routes.json show some examples of the routings, and other options 54 | 55 | .. code-block:: bash 56 | 57 | release/cic.darwin-latest examples/routes.json examples/tech.json routes 58 | release/cic-gui.darwin-latest routes.cic examples/tech.json 59 | 60 | 61 | 62 | .. toctree:: 63 | :maxdepth: 2 64 | :caption: Contents: 65 | 66 | basics/basics 67 | cells/cells 68 | routing/route 69 | api 70 | -------------------------------------------------------------------------------- /docs/source/routing/con_route.rst: -------------------------------------------------------------------------------- 1 | Connectivity Route 2 | ================== 3 | 4 | ConnectivityRoute uses regular expressions to match the net names. For 5 | example, take the spice circuit below 6 | 7 | .. code:: spice 8 | 9 | .subckt TEST A B 10 | XA1 B DDD 11 | XA2 A DDD 12 | XB1 B DDD 13 | XB2 A DDD 14 | .ends 15 | 16 | Without any routes, we’ll get 17 | 18 | .. code:: json 19 | 20 | { "name" : "TEST", "class" : "cIcCore::LayoutCell"} 21 | 22 | .. image:: ../graphics/TEST.png 23 | 24 | We can add a route by matching for example ‘B’ with 25 | 26 | .. code:: json 27 | 28 | { "name" : "Connectivity_B_-|--", 29 | "inherit": "TEST", 30 | "beforeRoute": [ 31 | {"addConnectivityRoutes" : [["M1","B","-|--"]]} 32 | ] 33 | } 34 | 35 | 36 | .. image:: ../graphics/Connectivity_B.png 37 | 38 | Or even matching both A and B 39 | 40 | .. code:: json 41 | 42 | { "name" : "Connectivity_A|B_-", 43 | "inherit": "TEST", 44 | "beforeRoute": [ 45 | {"addConnectivityRoutes" : [["M1","A|B","-"]]} 46 | ] 47 | } 48 | 49 | 50 | .. image:: ../graphics/Connectivity_AB.png 51 | 52 | Even though we match both nets, the compiler knows it should not try and 53 | route A->B. But the Router is very dum, it does not know if it’s created a 54 | short. 55 | -------------------------------------------------------------------------------- /docs/source/routing/dir_route.rst: -------------------------------------------------------------------------------- 1 | Directed Route 2 | =============== 3 | 4 | DirectedRoute is for the cases were you want to access a port deep in 5 | the hierarchy, but it’s not available on top level via a port. The 6 | 7 | DirectedRoute should be avoided if at all possible, because it’s hard 8 | linked to the hierarchy, so if you change instance names, or the 9 | hierarchy, they will no longer work. But it’s perfect for those tricky 10 | situations where ConnectivityRoute falls short. 11 | 12 | The arguments for directed route are layer, net, and ‘route command’. 13 | 14 | Route Command 15 | ^^^^^^^^^^^^^ 16 | 17 | A route command looks like this 18 | 19 | .. code:: json 20 | 21 | "XA1:S-|--XB2:S" 22 | 23 | The route command contains three parts, start rectangles path regex, 24 | route type, and stop rectangles path regex. See addDirectedRoute in 25 | [[LayoutCell]] for details. 26 | 27 | A ‘path regex’ looks like this ‘XA1:XB2:D,XA2:XB2:D’, the colon denotes 28 | a hierarchy border, while the stuff between are the regular expressions 29 | used to match instance names. The last ‘D’ is the port name of an 30 | instance. Multiple paths can be specified in one routecommand, separated 31 | by a comma. 32 | 33 | The `-|--` is the [[Route Type]] of this particular route command. 34 | 35 | With the spice 36 | 37 | .. code:: spice 38 | 39 | .subckt TEST A B 40 | XA1 B DDD 41 | XA2 A DDD 42 | XB1 B DDD 43 | XB2 A DDD 44 | .ends 45 | 46 | .. code:: json 47 | 48 | { "name" : "Directed_StartLeft_Left(-|--)", 49 | "inherit": "TEST", 50 | "beforeRoute": [ 51 | {"addDirectedRoutes" : [["M1","S","XA1:S-|--XB2:S"]]} 52 | ] 53 | } 54 | 55 | Will produce 56 | 57 | .. image:: ../graphics/DirectedRoute.png 58 | -------------------------------------------------------------------------------- /docs/source/routing/options.rst: -------------------------------------------------------------------------------- 1 | Route Options 2 | ============= 3 | 4 | The router has some options to ease routing. Both connectivity routes 5 | and directed routes have options. Options are separated by a comma. 6 | 7 | Sort options 8 | ^^^^^^^^^^^^ 9 | 10 | These options specify which rectangle to route from. They are useful for 11 | connectivity route where the start rectangles are not specified. 12 | 13 | onTopB 14 | '''''' 15 | 16 | Put the bottom rectangle as start rectangle 17 | 18 | 19 | .. image:: ../graphics/Options_onTopB.png 20 | 21 | onTopT 22 | '''''' 23 | 24 | Put the top rectangle as 25 | start rectangle 26 | 27 | .. image:: ../graphics/Options_onTopT.png 28 | 29 | onTopR 30 | ''''''' 31 | 32 | Put the 33 | right rectangle as start rectangle 34 | 35 | 36 | .. image:: ../graphics/Options_onTopR.png 37 | 38 | onTopL 39 | '''''''' 40 | 41 | Put the left rectangle as start rectangle 42 | 43 | .. image:: ../graphics/Options_onTopL.png 44 | 45 | Offset 46 | ^^^^^^ 47 | 48 | These options can offset the routing rectangle to avoid nearby routings 49 | 50 | offsethigh 51 | '''''''''' 52 | 53 | .. image:: ../graphics/Options_offsethigh.png 54 | 55 | offsetlow 56 | '''''''''' 57 | 58 | .. image:: ../graphics/Options_offsetlow.png 59 | 60 | offsethighend 61 | '''''''''''''''''''' 62 | 63 | .. image:: ../graphics/Options_offsethighend.png 64 | 65 | offsetlowend 66 | '''''''''''''''''''' 67 | 68 | .. image:: ../graphics/Options_offsetlowend.png 69 | 70 | Track 71 | ^^^^^ 72 | 73 | ‘track’ can be used to specifiy how many grids the route is offset. It 74 | uses “ROUTE” and “horizontalgrid”. 75 | 76 | For example ‘track4’, gives 77 | 78 | .. image:: ../graphics/Options_track4.png 79 | 80 | For example ‘track8’, gives 81 | 82 | .. image:: ../graphics/Options_track8.png 83 | 84 | Cuts 85 | ^^^^ 86 | 87 | The number of cuts used by the route can be modified. Default is two 88 | cuts for the horizontal via. 89 | 90 | .. _cuts-1: 91 | 92 | \\d+cuts 93 | '''''''''''''''''''''' 94 | 95 | For example ‘3cuts’ 96 | 97 | .. image:: ../graphics/Options_3cuts.png 98 | 99 | And for example ‘5cuts’ 100 | 101 | .. image:: ../graphics/Options_5cuts.png 102 | -------------------------------------------------------------------------------- /docs/source/routing/route.rst: -------------------------------------------------------------------------------- 1 | Routing 2 | ======= 3 | 4 | Routing in ciccreator is done using functions in LayoutCell, 5 | addDirectedRoutes and addConnectivityRoutes. One should start with 6 | addConnectivityRoutes, because that is easiest to use, however, it can 7 | only access the ports on instances in a subcircuit. 8 | 9 | See 10 | https://github.com/wulffern/ciccreator/tree/master/examples/routes.spi 11 | and 12 | https://github.com/wulffern/ciccreator/tree/master/examples/routes.json 13 | for the example source code used in this wiki. 14 | 15 | .. toctree:: 16 | :maxdepth: 1 17 | 18 | con_route 19 | dir_route 20 | via 21 | type 22 | options 23 | -------------------------------------------------------------------------------- /docs/source/routing/type.rst: -------------------------------------------------------------------------------- 1 | Route Type 2 | =========== 3 | 4 | The following route types can be used, all of them have a short-hand 5 | notation. 6 | 7 | Left (-\|--) 8 | ^^^^^^^^^^^^^ 9 | 10 | The ‘Left’ route will go one metal space to the left, then up, and or 11 | down, and finish the route. The type of route will depend on whether the 12 | start rectangle is to the left, or the right of the finish. 13 | 14 | Starting from the left 15 | 16 | .. code:: json 17 | 18 | { "name" : "Directed_StartLeft_Left(-|--)", 19 | "inherit": "TEST", 20 | "beforeRoute": [ 21 | {"addDirectedRoutes" : [["M1","S","XA1:S-|--XB2:S"]]} 22 | ] 23 | } 24 | 25 | .. image:: ../graphics/StartLeft_Left.png 26 | 27 | Starting from the right 28 | 29 | .. code:: json 30 | 31 | { "name" : "Directed_StartRight_Left(-|--)", 32 | "inherit": "TEST", 33 | "beforeRoute": [ 34 | {"addDirectedRoutes" : [["M1","S","XB1:S-|--XA2:S"]]} 35 | ] 36 | } 37 | 38 | .. image:: ../graphics/StartRight_Left.png 39 | 40 | 41 | Right (--\|-) 42 | ^^^^^^^^^^^^^^ 43 | 44 | The ‘Right’ route will go one metal spacing to the right, then up, and 45 | or down, and finish the route. 46 | 47 | Starting from the left 48 | 49 | .. code:: json 50 | 51 | { "name" : "Directed_StartLeft_Right(--|-)", 52 | "inherit": "TEST", 53 | "beforeRoute": [ 54 | {"addDirectedRoutes" : [["M1","S","XB1:S--|-XB2:S"]]} 55 | ] 56 | } 57 | 58 | .. image:: ../graphics/StartLeft_Right.png 59 | 60 | .. code:: json 61 | 62 | { "name" : "Directed_StartRight_Right(--|-)", 63 | "inherit": "TEST", 64 | "beforeRoute": [ 65 | {"addDirectedRoutes" : [["M1","S","XB1:S--|-XA2:S"]]} 66 | ] 67 | } 68 | 69 | .. image:: ../graphics/StartRight_Right.png 70 | 71 | U left route (\|-) 72 | ^^^^^^^^^^^^^^^^^^ 73 | 74 | The U route will go one metal spacing left, up or down, and back again. 75 | 76 | .. code:: json 77 | 78 | { "name" : "Directed_U_Left(|-)", 79 | "inherit": "TEST", 80 | "beforeRoute": [ 81 | {"addDirectedRoutes" : [["M1","S","XB1:S|-XB2:S"]]} 82 | ] 83 | } 84 | 85 | .. image:: ../graphics/U_Left.png 86 | 87 | U right route (-\|) 88 | ^^^^^^^^^^^^^^^^^^^^ 89 | 90 | The U route will go one metal spacing right, up or down, and back again. 91 | 92 | .. code:: json 93 | 94 | { "name" : "Directed_U_Right(-|)", 95 | "inherit": "TEST", 96 | "beforeRoute": [ 97 | {"addDirectedRoutes" : [["M1","S","XB1:S-|XB2:S"]]} 98 | ] 99 | } 100 | 101 | .. image:: ../graphics/U_Right.png 102 | 103 | Vertical route (||) 104 | ^^^^^^^^^^^^^^^^^^^ 105 | 106 | The vertical route will find the center of the start rectangles and draw 107 | a straight vertical line up, or down to the stop rectangles. 108 | 109 | .. code:: json 110 | 111 | { "name" : "Directed_Vertical(||)", 112 | "inherit": "TEST", 113 | "beforeRoute": [ 114 | {"addDirectedRoutes" : [["M1","S","XB1:S||XB2:S"]]} 115 | ] 116 | } 117 | 118 | .. image:: ../graphics/Vertical.png 119 | -------------------------------------------------------------------------------- /docs/source/routing/via.rst: -------------------------------------------------------------------------------- 1 | Via/Cut 2 | ======= 3 | 4 | For most routes the vias will be automatically inserted. It will 5 | automatically find the layer for the start/stop rectangles, and add a 6 | via up to the routing layer specified. 7 | 8 | Automatic via 9 | ^^^^^^^^^^^^^ 10 | 11 | Routes will find the necessary transisitons for routes. 12 | 13 | :: 14 | 15 | .subckt TESTVIA S D B 16 | XA1 S D B DDMVIA 17 | XA2 S D B DDMVIA 18 | XB1 S D B DDMVIA 19 | XB2 S D B DDMVIA 20 | .ends 21 | 22 | .. code:: json 23 | 24 | { "name" : "TESTVIA", 25 | "class" : "cIcCore::LayoutCell", 26 | "beforeRoute": [ 27 | {"addConnectivityRoutes" : [ 28 | ["M4","S","-|--","track0"], 29 | ["M1","D","-|--","track4"], 30 | ["M2","B","-|--","track6"] 31 | ]} 32 | ] 33 | 34 | .. image:: ../graphics/TESTVIA.png 35 | -------------------------------------------------------------------------------- /docs/source/svg/Connectivity_A_-|--.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/Connectivity_A|B_-.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/Connectivity_B_-|--.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/DDD.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/Directed_StartLeft_Left(-|--).svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/Directed_StartLeft_Right(--|-).svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/Directed_StartRight_Left(-|--).svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/Directed_StartRight_Right(--|-).svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/Directed_U_Left(|-).svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/Directed_U_Right(-|).svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/Directed_Vertical(||).svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/source/svg/TEST.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /etc/console_config.pro: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | ## Copyright (c) 2015 Carsten Wulff Software, Norway 3 | ## ################################################################### 4 | ## Created : wulff at 2015-8-20 5 | ## ################################################################### 6 | ## This program is free software: you can redistribute it and/or modify 7 | ## it under the terms of the GNU General Public License as published by 8 | ## the Free Software Foundation, either version 3 of the License, or 9 | ## (at your option) any later version. 10 | ## 11 | ## This program is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public License 17 | ## along with this program. If not, see . 18 | ###################################################################### 19 | 20 | QT += core 21 | CONFIG += c++11 22 | 23 | 24 | osx:DESTDIR = ../bin/darwin 25 | linux:DESTDIR = ../bin/linux 26 | win32:DESTDIR = ../bin/windows 27 | 28 | #- Add coverage information 29 | QMAKE_CFLAGS += $$(CFLAGS) --coverage 30 | QMAKE_LFLAGS += $$(LDFLAGS) --coverage 31 | 32 | OBJECTS_DIR=build 33 | MOC_DIR=build 34 | 35 | DEPENDPATH +=. 36 | 37 | INCLUDEPATH += src/ ../cic-core/external/libgds_dist/ ../cic-core/src 38 | 39 | # Input 40 | SOURCES += src/main.cpp 41 | win32: LIBS += -L$$PWD/../lib/windows/ -lcic 42 | else:linux: LIBS += -L$$PWD/../lib/linux/ -lcic 43 | else:mac: LIBS += -L$$PWD/../lib/darwin/ -lcic 44 | 45 | 46 | mac:PRE_TARGETDEPS += ../lib/darwin/libcic$${LIBSUFFIX}.a 47 | mac:INCLUDEPATH += $$PWD/../lib/darwin 48 | mac:DEPENDPATH += $$PWD/../lib/darwin 49 | 50 | 51 | linux:PRE_TARGETDEPS += ../lib/linux/libcic$${LIBSUFFIX}.a 52 | linux:INCLUDEPATH += $$PWD/../lib/linux 53 | linux:DEPENDPATH += $$PWD/../lib/linux 54 | 55 | win32:PRE_TARGETDEPS += ../lib/windows/libcic$${LIBSUFFIX}.a 56 | win32:INCLUDEPATH += $$PWD/../lib/windows 57 | win32:DEPENDPATH += $$PWD/../lib/windows 58 | 59 | -------------------------------------------------------------------------------- /etc/mac_sdk.pro: -------------------------------------------------------------------------------- 1 | 2 | mac { 3 | #- This needs to point to the SDK usually in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ 4 | #CONFIG += sdk 5 | EXPORT_QMAKE_MAC_SDK = macosx15.2 6 | #QT_MAC_SDK_NO_VERSION_CHECK = 1 7 | 8 | } 9 | -------------------------------------------------------------------------------- /examples/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Carsten Wulff 2016 2 | 3 | carsten@wulff.no 4 | 5 | The examples in this directory are free for Academic and non-commercial use. If you want to use them for commercial products you 6 | should contact the author. This applies to: 7 | SAR_ESSCIRC16_28N.json 8 | SAR_ESSCIRC16_28N.spi 9 | -------------------------------------------------------------------------------- /examples/legend.json: -------------------------------------------------------------------------------- 1 | { 2 | "header" : { 3 | "comment" : "------------------------------------------------------------", 4 | "author" : "Carsten Wulff", 5 | "license" : [ 6 | "Copyright (c) 2015 Carsten Wulff", 7 | "This program is free software: you can redistribute it and/or modify", 8 | "it under the terms of the GNU General Public License as published by", 9 | "the Free Software Foundation, either version 3 of the License, or", 10 | "(at your option) any later version.", 11 | 12 | "This program is distributed in the hope that it will be useful,", 13 | "but WITHOUT ANY WARRANTY; without even the implied warranty of", 14 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", 15 | "GNU General Public License for more details.", 16 | "You should have received a copy of the GNU General Public License", 17 | "along with this program. If not, see ." 18 | ], 19 | "comment" : "------------------------------------------------------------" 20 | }, 21 | "cells": 22 | [ 23 | { "name" : "B_OD","class" : "cIcCore::PatternTile", "fillCoordinatesFromStrings" : [[ "OD","A---"]], "spice" : [ ".subckt B_OD A",".ends"] }, 24 | { "name" : "B_CO","class" : "cIcCore::PatternTile", "fillCoordinatesFromStrings" : [[ "CO","A---"]], "spice" : [ ".subckt B_CO A",".ends"] }, 25 | { "name" : "B_PO","class" : "cIcCore::PatternTile", "fillCoordinatesFromStrings" : [[ "POD","A---"]], "spice" : [ ".subckt B_PO A",".ends"] }, 26 | { "name" : "B_M1","class" : "cIcCore::PatternTile", "fillCoordinatesFromStrings" : [[ "M1","A---"]], "spice" : [ ".subckt B_M1 A",".ends"] }, 27 | { "name" : "B_M2","class" : "cIcCore::PatternTile", "fillCoordinatesFromStrings" : [[ "M2","A---"]], "spice" : [ ".subckt B_M2 A",".ends"] }, 28 | { "name" : "B_M3","class" : "cIcCore::PatternTile", "fillCoordinatesFromStrings" : [[ "M3","A---"]], "spice" : [ ".subckt B_M3 A",".ends"] }, 29 | { "name" : "B_M4","class" : "cIcCore::PatternTile", "fillCoordinatesFromStrings" : [[ "M4","A---"]] , "spice" : [ ".subckt B_M4 A",".ends"] }, 30 | { "name" : "LEGENDM4", 31 | "boundaryIgnoreRouting" : 0, 32 | "spice" : [ 33 | ".subckt LEGENDM4 CO OD PO M1 M2 M3 M4", 34 | "XA2 OD B_OD", 35 | "XB2 CO B_CO", 36 | "XC2 PO B_PO", 37 | "XD2 M1 B_M1", 38 | "XE2 M2 B_M2", 39 | "XF2 M3 B_M3", 40 | "XG2 M4 B_M4", 41 | ".ends" 42 | ], 43 | "rotateAngle" : "MY" 44 | }, 45 | { "name" : "LEGENDM1M4", 46 | "boundaryIgnoreRouting" : 0, 47 | "spice" : [ 48 | ".subckt LEGENDM1M4 CO OD PO M1 M2 M3 M4", 49 | "XD2 M1 B_M1", 50 | "XE2 M2 B_M2", 51 | "XF2 M3 B_M3", 52 | "XG2 M4 B_M4", 53 | ".ends" 54 | ], 55 | "rotateAngle" : "MY" 56 | }, 57 | 58 | { "name" : "LEGENDM1", 59 | "boundaryIgnoreRouting" : 0, 60 | "spice" : [ 61 | ".subckt LEGENDM1 CO OD PO M1 M2 M3 M4", 62 | "XA2 OD B_OD", 63 | "XB2 CO B_CO", 64 | "XC2 PO B_PO", 65 | "XD2 M1 B_M1", 66 | ".ends" 67 | ], 68 | "rotateAngle" : "MY" 69 | } 70 | 71 | 72 | ] 73 | } 74 | -------------------------------------------------------------------------------- /examples/routes.spi: -------------------------------------------------------------------------------- 1 | 2 | .subckt DDD S 3 | .ends 4 | 5 | .subckt DDA S 6 | .ends 7 | 8 | .subckt DDMVIA S D B 9 | .ends 10 | 11 | .subckt CAPCELL A B C 12 | 13 | .ends 14 | 15 | 16 | .subckt TEST A B 17 | XA1 B DDD 18 | XA2 A DDD 19 | XB1 B DDD 20 | XB2 A DDD 21 | .ends 22 | 23 | .subckt TEST_OPT A B 24 | XA1 A DDA 25 | XA2 S A B DDMVIA 26 | XB1 A S B DDMVIA 27 | XB2 A DDD 28 | .ends 29 | 30 | 31 | .subckt TESTVIA S D B 32 | XA1 S D B DDMVIA 33 | XA2 S D B DDMVIA 34 | XB1 S D B DDMVIA 35 | XB2 S D B DDMVIA 36 | .ends 37 | 38 | .subckt TESTDDMVIA S D B 39 | XA1 S D B DDMVIA 40 | XA2 S D B DDMVIA 41 | XB1 S D B DDMVIA 42 | XB2 S D B DDMVIA 43 | .ends 44 | 45 | -------------------------------------------------------------------------------- /lay/Makefile: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | ## Copyright (c) 2016 Carsten Wulff Software, Norway 3 | ## ################################################################### 4 | ## Created : wulff at 2016-1-29 5 | ## ################################################################### 6 | ## This program is free software: you can redistribute it and/or modify 7 | ## it under the terms of the GNU General Public License as published by 8 | ## the Free Software Foundation, either version 3 of the License, or 9 | ## (at your option) any later version. 10 | ## 11 | ## This program is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public License 17 | ## along with this program. If not, see . 18 | ###################################################################### 19 | 20 | OPT= 21 | cmd=time ../bin/cic 22 | 23 | CELL= 24 | GDS=${CELL}.gds 25 | SPI=${CELL}.spi 26 | LIBPATH=../../icarus_mpw2/lib/ 27 | 28 | tech=../examples/tech.json 29 | 30 | 31 | all:json 32 | 33 | 34 | FILE=devices 35 | 36 | json: 37 | ${cmd} ../examples/${FILE}.json ${tech} ${FILE} ${OPT} 38 | 39 | 40 | esscirc: 41 | ${cmd} ../examples/SAR_ESSCIRC16_28N.json ../../cnano/examples/soi_io.json SAR_ESSCIRC16_28N ${OPT} 42 | cat SAR_ESSCIRC16_28N.spi | perl -pe 'if(m/^\s*M\d+/ig){s/\n//ig;$$_ = $$_ . " p_la=0 \n";}' > SAR_ESSCIRC16_28N_tmp.spi; 43 | rm SAR_ESSCIRC16_28N.spi; 44 | mv SAR_ESSCIRC16_28N_tmp.spi SAR_ESSCIRC16_28N.spi 45 | 46 | 47 | esscirc_core: 48 | ${cmd} ~/pro/analogicus/ip/SAR_CORE_ESSCIRC16_28N/SAR_CORE_ESSCIRC16_28N.json ../../cnano/examples/soi_io.json SAR_CORE_ESSCIRC16_28N ${OPT} 49 | cat SAR_ESSCIRC16_28N.spi | perl -pe 'if(m/^\s*M\d+/ig){s/\n//ig;$$_ = $$_ . " p_la=0 \n";}' > SAR_ESSCIRC16_28N_tmp.spi; 50 | rm SAR_ESSCIRC16_28N.spi; 51 | mv SAR_ESSCIRC16_28N_tmp.spi SAR_ESSCIRC16_28N.spi 52 | 53 | 54 | #-------------------------------------------------------------------- 55 | # Sections below are used for testing of ADC compile, which is not public (yet) 56 | #-------------------------------------------------------------------- 57 | 58 | sar: 59 | ${cmd} ../../cnano/examples/SAR_LPWR_ST28N/SAR_LPWR_ST28N.json ../../cnano/examples/soi.json SAR_LPWR_ST28N ${OPT} 60 | cat SAR_LPWR_ST28N.spi | perl -pe 'if(m/^\s*M\d+/ig){s/\n//ig;$$_ = $$_ . " p_la=0 \n";}' > SAR_LPWR_ST28N_tmp.spi; 61 | rm SAR_LPWR_ST28N.spi; 62 | mv SAR_LPWR_ST28N_tmp.spi SAR_LPWR_ST28N.spi 63 | 64 | 65 | 66 | devices: 67 | ${cmd} ../examples/devices.json ../../cnano/examples/soi.json DEVICES ${OPT} 68 | cat DEVICES.spi | perl -pe 'if(m/^\s*M\d+/ig){s/\n//ig;$$_ = $$_ . " p_la=0 \n";}' > DEVICES_tmp.spi; 69 | rm DEVICES.spi; 70 | mv DEVICES_tmp.spi DEVICES.spi 71 | 72 | drc: 73 | -rm calibre/${CELL}_drc.svrf 74 | -rm calibre/${CELL}_drc.log 75 | cat ${LIBPATH}/calibre/calibre.cell.drc | perl -pe 's#gdsii/myCell.gds#${GDS}#ig' | perl -pe 's/myCell/${CELL}/ig' > calibre/${CELL}_drc.svrf 76 | calibre -drc -hier -nowait calibre/${CELL}_drc.svrf > calibre/${CELL}_drc.log 77 | -cat Cdrc/${CELL}.drc.summary | grep RULECHECK | grep -v "= 0" | grep -v "NOT EXECUTED" | grep -v "STATISTICS"| egrep -v '^\s+' 78 | 79 | 80 | lvsl: 81 | -mkdir calibre 82 | -rm -rf svdb_${CELL} 83 | -rm calibre/${CELL}_lvs.svrf 84 | -rm calibre/${CELL}_lvs.log 85 | cat ${PDKITROOT}/DATA/LVS/CALIBRE/calibrelvs.ctrl |perl -pe 's#myCell\.gds#${GDS}#ig;s#myCell\.cdl#${SPI}#ig;s/\"svdb\"/\"svdb\/${CELL}\"/ig;s/qrc\/compare.rep/${CELL}\.lvs\.report/ig;s/SOFTCHK YES/SOFTCHK NO/ig;s/SUPPLY ERROR YES/SUPPLY ERROR NO/ig;s/myCell\.lvs/Clvs\/${CELL}.lvs/ig;s/myCell\.erc/Cerc\/${CELL}.erc/ig;s/erc\.summary/Cerc\/${CELL}_erc.summary/ig;s/myCell/${CELL}/ig;s#^INCLUDE#INCLUDE "${PROJECT}/lib/calibre/calibre.lvs"\nINCLUDE#ig;' > calibre/${CELL}_lvs.svrf 86 | calibre -spice Clvs/${CELL}.sp -lvs -hier -automatch -nowait calibre/${CELL}_lvs.svrf > calibre/${CELL}_lvs.log 87 | 88 | lvs: lvsl 89 | less Clvs/${CELL}.lvs.report 90 | less Clvs/${CELL}.lvs.report.ext 91 | -------------------------------------------------------------------------------- /tests/routes/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | test: 4 | ../../bin/cic ../../examples/routes.json ../../examples/tech.json routes 5 | cicpy svg routes.cic ../../examples/tech_svg.json routes --x 100 --y 200 6 | 7 | clean: 8 | rm -f routes.cic 9 | rm -rf routes_svg 10 | rm -f routes_svg.html 11 | -------------------------------------------------------------------------------- /tests/sar/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | test: 4 | ../../bin/cic ../../examples/SAR_ESSCIRC16_28N.json ../../examples/tech.json SAR 5 | cicpy svg SAR.cic ../../examples/tech_svg.json SAR --x 300 --y 400 6 | 7 | clean: 8 | rm -f SAR.cic 9 | rm -rf SAR_svg 10 | rm -f SAR_svg.html 11 | -------------------------------------------------------------------------------- /tests/sun_sar9b/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | test: 4 | ../../bin/cic ip.json sky130.tech SAR 5 | cat SAR.cic | jq .cells > sar.json 6 | cat ref.cic | jq .cells > ref.json 7 | diff sar.json ref.json || exit 1; 8 | cicpy svg SAR.cic sky130.tech SAR --x 300 --y 400 --scale 10 9 | 10 | clean: 11 | rm -f SAR.cic 12 | rm -f sar.json 13 | rm -f ref.json 14 | --------------------------------------------------------------------------------