Coder Social home page Coder Social logo

xyce / xdm Goto Github PK

View Code? Open in Web Editor NEW
16.0 6.0 7.0 647 KB

This is the XDM netlist converter, used to convert PSPICE and HSPICE netists into Xyce format.

License: Other

CMake 1.85% Python 42.35% Batchfile 0.62% C++ 46.18% HTML 8.95% Shell 0.04%
snl-applications xyce spice

xdm's Introduction

Xyce(TM) XDM Netlist Translator

Xyce(TM) XDM Netlist Translator Copyright 2002-2020 National Technology & Engineering Solutions of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

XDM uses CMake, the Boost Spirit header files, the Boost Python libraries, and Python 3 to create a mixed language Python/C++ tool called xdm_bdl that can translate PSpice, HSpice, and Spectre netlist files into Xyce-compatible netlist files. XDM is available in binary form for Unix, Mac, and Windows systems as part the Xyce release here Xyce and XDM along with the XDM User's Guide. Source code for XDM and Xyce can be found here XDM and Xyce Source Code.

There are two ways to run xdm_bdl both are available with the released version of XDM: 1. As a python script xdm_bdl.py that loads the compiled XDM libraries SpiritCommon, SpiritExprCommon, and XdmRapidXmlReader. These are C++ libraries that can be imported as Python 3 modules. 2. As a standalone executable built from xdm_bdl.py and the aforementioned binaries using PyInstaller. Both are available in the release of XDM

Building XDM

Building XDM can be tricky since there are many versions of Boost, Python 3, and C++ compilers available not all of which are compatible with each other. In particular older versions of Boost (before Boost 1.70.0) don't have CMake support and XDM developers may have trouble building against later versions of Python 3 and recent C++ compilers. XDM is developed with Boost 1.70.0 and later, Python 3.8 and 3.9, Clang 12, and GCC 8.X.X. XDM's only C++11 restriction is having a C++11 compatible compiler. As such, older compilers may work as well but aren't supported. Experience has shown that more modern compilers can yield noticeable speed improvements, which may be a factor when converting large files.

CMake configure

The XDM build should be simple given a system where the Boost Python libraries are installed with CMake support and built against Python 3. Something like the CMake command below should work from an empty directory intended to be the build XDM.

Configure with Boost with CMake Support

```
cmake <path to XDM source> \
    -DBOOST_ROOT=<top level boost intallation location> \
    -DPyInstaller_PATH=${PyInstaller_PATH}
```

Configure with Boost without CMake Support

The following should also work in the above case but also if Boost doesn't have CMake support:

```
cmake <path to XDM source> \
    -DBoost_NO_BOOST_CMAKE=ON \
    -DBOOST_INCLUDEDIR=<top level boost installation locations>/include \
    -DBOOST_LIBARYDIR=<top level boost installation location>k/lib \
    -DPyInstaller_PATH=${PyInstaller_PATH}
```

The "top level boost installation location" should contain the typical "include" and "lib" directories and with a "lib/cmake" sub-directory that contains a number of CMake files if CMake support is available.

Notes:

1. CMake can be invoked from the command line on Unix-like systems with the
   command ```cmake``` or ```ccmake``` to use an interactive NCurses GUI.
   On Windows CMake is GUI based and works much like the Unix based NCurses
   interface.
2. PyInstaller is optional for building XDM. If is available to CMake it
   will be used to create a standalone executable xdm_bdl that can be
   relocated and shared with others on compatible systems. If PyInstaller
   is not available then xdm_bdl.py can be used in conjunction with
   SpiritCommon, SpiritExprCommon, and XdmRapidXmlReader libraries built by
   XDM and CMake.
3. It is generally a good idea to build CMake projects in a directory other
   than the directory that contains the source code. If 'xdm' is the XDM
   source directory in the snippet below, a good practice is to make the
   build directory a peer to the source directory:
    ```
    <path to working directory>/
        xdm/
        xdm-build/
    ```
4. BOOST_ROOT can be set as an environment variable instead of as a CMake
   argument. The latter takes precedence if both are used.
5. To specify which C++ compiler CMake should use see:
    - [CMake CXX](https://cmake.org/cmake/help/latest/envvar/CXX.html?highlight=cmake_cxx_compiler)
    - [CMAKE_CXX_COMPILER](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html#variable:CMAKE_%3CLANG%3E_COMPILER)
7. For available CMake build configurations see: [CMake Build Variants](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html)
8. XDM will not work with Python 2.

Common CMake XDM problems:

1. The most common XDM build problem is when Boost is built with a
   different version of Python from what CMake found in the configuration
   process. This will likely cause run-time errors and crashes with
   uninformative messages.
2. Another problem may be that PyInstaller is not compatible with the
   Python used to build Boost. Which is a variation of the first problem.

Dependencies

Primary XDM Depenencies

- [CMake](https://cmake.org/)
- [Python](https://www.python.org/)
- [Boost](https://www.boost.org/)

CMake and finding dependencies

- [CMake and Boost](https://cmake.org/cmake/help/latest/module/FindBoost.html#hints)
- [CMake and Python](https://cmake.org/cmake/help/latest/module/FindPython3.html#hints)
- Since PyInstaller is single file, there's no explicit CMake support and
   it is up to the user to specify the full path to PyInstaller as shown

Package managers

-  [SPACK](https://spack.io/) Linux, Mac
-  [Macports](https://www.macports.org/) Mac
-  [Homebrew](https://brew.sh/) Mac
-  [Fink](http://www.finkproject.org/) Mac

Installing dependencies

Boost and Python dependencies can be installed on most unix systems via the system package manager. There are several options for local installation. Package managers are helpful since they attempt to manage dependencies between things like Python 3 and the Boost Python libraries. The package managers below have been sucessfully used to build XDM dependencies. Linux package managers work as well.

-  [SPACK](https://spack.io/) Linux, Mac
-  [Macports](https://www.macports.org/) Mac
-  [Homebrew](https://brew.sh/) Mac
-  Linux packages managers

XDM can be built on Windows 10 using the MSVC Compiler suite. We typically install the Python binaries and build boost with MSVC. XDM has not been tested with Cygwin.

-  [Python](https://www.python.org/)
-  [Boost](https://www.boost.org/)
-  [MSVC](https://visualstudio.microsoft.com/)

PyInstaller

If PyInstaller isn't available with the systems's Python installation or is outdated a Python virtual environment can be used to install a local version of PyInstaller that is compatible with the system's Python 3 installation.

- To create a Python virtual environment and activate it
  ```
  python3 -m venv venv
  source ./venv/bin/activate
  ```
- Install pip and then PyInstaller. The proxy settings may not be necessary

  ```
  export HTTPS_PROXY=<proxy address>
  pip install PyInstaller
  ```
- Test PyInstaller before building XDM

  ```
  echo "print('Hello')" > hello.py
  PyInstaller hello.py
  ./dist/hello/hello
  ```
- PyInstaller may also be available via a system compatible package manager
- For more details see [Python Virtual Environemnts](https://docs.python.org/3/tutorial/venv.html)

xdm's People

Contributors

tbird2001 avatar tvrusso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xdm's Issues

XDM 2.7 Xyce diode parameters not up to date

Xyce 7.7 contains a number of updates to the diode model that included a new instance parameter and a number of new model parameters. The file XDM/src/python/xdm/inout/xml/schema/xyce.xml does not have those updated parameters, and therefore if I understand it correctly they will be ignored when converting from netlist formats of simulators that do have those parameters.

C.f. Xyce/Xyce#58

XDM/src/c_boost/expr/ast_common.hpp missing include of sstream

ast_common.hpp uses std::istringstream, but does not include <sstream>.

This caused an XDM build failure on my system for the first time in a long time. It used to build just fine this way, but something must have changed in a boost update that removed some upstream include of that header from boost headers. My last build used boost 1.83, but my system updated to boost 1.84 today and that caused xdm to have a missing dependent library. Trying to rebuild to fix that exposed the problem.

Inserting an include of this header into that file fixes the problem for me. Inserting it immediately after the include of <unordered_map> did the trick for me.

Tagging @Karlsefni2012, @gjtempl, and @TBird2001 directly to make sure they see this.

XDM 2.7.0 missing EKV 2.6 (level 260 MOSFET) data in xyce.xml

The XDM schema in XDM/src/python/xdm/inout/xml/schema/xyce.xml contains information for the EKV 3.01 model (level 301 MOSFET), present only in the nonfree version of Xyce, but does not contain the EKV 2.6 model (level 260 MOSFET).

Ideally, XDM data for Xyce should be cross checked against "Xyce -param" to assure that it is in sync with Xyce itself, both for available model levels and for parameters associated with those models. #9 and #8 are additional issues that have been reported about missing Xyce models or parameters in XDM definition files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.