Share on Facebook0Tweet about this on TwitterShare on Reddit0Share on Google+0Share on LinkedIn0Share on StumbleUpon0Buffer this pageEmail this to someonePrint this page

In a previous post titled Simulating the Knowm M-MSS Memristor Model Using Qucs-S with Xyce, I presented the transient simulation of the basic AC sinusoidal response of the Knowm M-MSS (Mean Metastable-Switch Memristor) model implemented in Sandia National Laboratories’ Xyce Parallel Electronic Simulator. Today I’ll be discussing a collaborative effort to extend the Knowm OSS EDA suite by adding support for Knowm’s own JSpice SPICE-inspired simulator in Qucs – Quite Universal Circuit Simulator an open source circuit simulator which has been steadily growing in popularity. Both applications are available now for download under the GNU General Public License (GPLv3). Since 2014 a branch of the Qucs project called Spice4qucs also known as Qucs-S has provided the user with a simple schematic layout tool, algebraic equation manipulation, EDD (Equation-Defined Device) modeling, Verilog-A model synthesis and a range of other behavioral device modeling and post simulation analysis tools. The Qucs-S user interface can be used with several popular SPICE compatible simulators including Ngspice, SpiceOpus and Xyce. Now the latest release candidate of the Knowm Open Source EDA Stack includes extensions to Qucs-S to support Xyce and JSpice allowing simulations using Knowm’s latest Xyce compatible M-MSS Mean Meta-stable Switch Memristor model as described in The Mean Metastable Switch Memristor Model in Xyce. The M-MSS memristor model was recently added to JSpice along with Knowm’s original generalized MSS Metastable Switch Memristor model as described in the white paper Knowm Memristors, MSS Model and BEOL Service. These additional memristor models provide a SPICE compatible model and a stochastic behavioral model that capture the memory-enabling hysteresis behavior which is responsible for the memristive effect or “pinched” I-V response of the memristor. In this post I will be comparing the results of simulations of the M-MSS memristor model in JSpice with those previously obtained with Xyce and will provide additional information on JSpice usage and future development.

Prerequisites

Binaries of a new release candidate rc5 of the Knowm OSS EDA Stack are available for macOS 10.12 Sierra and Ubuntu 16.04 LTS (Xenial Xerus). This post covers installation and use on macOS. The included versions of Qucs-S (0.0.19S) and Xyce 6.7 have been built for use on amd64 architectures. Support for other architectures and operating systems are under development and will be released when available. JSpice is being delivered as an executable Java Archive .jar file. You will need to have Java installed on your computer before you can use the JSpice simulator. Here are the steps to get all the software installed and configured:
Download and install the latest release candidate #3 from these links.

MacOS Sierra 10.12 QUCs
MacOS Sierra 10.12 Knowm Examples JSpice
MacOS Sierra 10.12 Xyce
MacOS Sierra 10.12 JSpice

Linux QUCs
Linux Knowm Examples JSpice
Linux Xyce
Linux JSpice

You can download and install Java from Oracle Java SE Development Kit 8 Downloads:. I suggest downloading the latest version of the JDK 8 and get it configured on your computer. Although technically you only need the Java Runtime Environment the JDK installer includes the JRE. If you follow our blog regularly at some point you will need the Javac compiler installed. I’m going to show you how to install it and get it configured so you’ll be ready for some of our more advanced tutorials. For MacOS Sierra we will want to download the Mac OS X bundle.

  1. Select the Accept License Agreement radio button.
  2. Click on the Mac OS X bundlejdk-8u144-macosx-x64.dmg link to begin the download.
  3. Once the download is complete, double-click on the .dmg file to start the installer.
  4. Double-click on the package icon and follow the instructions to get the JDK installed on your computer.
  5. Check the version of Java just installed by opening a terminal window and typing:

Note: Java should return something like the following:

For additional assistance in installing the JDK you can read through the documentation on the Oracle site JDK 8 Installation for OS X or better yet use Homebrew and type brew cask install java.

  1. Java applications use the default JDK when being launched. If your version of the JDK is not set correctly then you can do the following:
  • Set the JAVA_HOME environment variable in your .bash_profile so that Java applications (i.e. JSpice) knows where the JDK is located. Assuming you have nano editor installed you could enter the following:

Add…

Exit nano

Alternatively you can use the java_home utility to set the default JDK by typing:

Install the latest Suite-Sparse from Homebrew

Xyce requires AMD and UMFPACK, which are installed as part of SuiteSparse package. The fftw library is also required to support FFT (Fast Fourier Transforms) and should also be installed using Homebrew.

Open a terminal window and type the following:

NOTE: The version of suite-sparse should be updated to 4.5.5_1 along with is dependency metis v.5.1.0. These are the latest versions available from the homebrew-core and are required dependencies for running the Xyce 6.7 software.

Check that suite-sparse is updated by typing:

NOTE: You should observe something similar to the following:

Install Xyce-6.7 Open_Source bundle

  1. Double click on the bundle xyce_knowm_oss_eda-6.7-rc5.dmg to mount the bundle.
  2. Copy or drag-n-drop the xyce folder to /Applications folder.

Install JSpice-1.0 bundle

  1. Double click on the bundle jspice_knowm_oss_eda-1.0-rc5.dmg to mount the bundle.
  2. Copy or drag-n-drop the jspice folder to /Applications folder.

Install Qucs-0.0.19S bundle

  1. Double click on the bundle qucs_knowm_oss_eda-0.0.19s-rc5.dmg to mount the bundle.
  2. Copy or drag-n-drop the qucs folder to /Applications folder.
  3. Open the qucs folder that you just copied and the open the bin folder.
  4. Drag the Qucs.app to the Launcher Bar.

Install Knowm Qucs-0.0.19S Memristor JSpice compatible example projects

Double click on the bundle examples_j_knowm_oss_eda-0.0.19s-rc5.dmg to mount the bundle.
Open a terminal window and type the following:

Copy or drag-n-drop all of the _prj folders from examples-j to your /Users//.qucs folder.

NOTE: These new example projects have circuits with JSpice compatible configurations. You should be able to them in both Xyce and JSpice simulators. They will be used to compare the simulated results that we will cover later in this tutorial.

Linux

NOTE: The release candidate Debian packages are currently being installed in the /usr/local under their own package directories to allow for side-by-side comparison of release candidates. The final release versions will be provided under a package manager and will use standard directories in /usr.

Install Java 8 JDK – Java Development Kit

Using apt-get and PPA

Update your system:

Install the software-properties-common package if you don’t already have it. This provides an easier way to add new repositories:

Add the Java PPA:

This repository is not maintained by Oracle. It does not contain actual Java files, but does allow us to download installers for Oracle Java software. Before using the installers, you’ll be prompted to accept a license agreement, which can be found in its entirety here.

Update the local package cache:

Install the metapackage:

This package will run an installer for The Oracle JDK 8, which is the current stable release. You may also replace java8 in the package name with java7 or java9 to install different versions, although these releases are not recommended for development.

You will be asked to accept the License Agreement

  1. Click OK
  2. Click Yes to accept the license and begin the installation
  3. Verify that Java and the Java compiler have been properly installed:

As of this post, these commands should return the following:

java version “1.8.0_144”
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

javac 1.8.0_144

Since the PPA only provides an installer, and not updates for the JDK itself, you may want to delete it when you’re finished in order to keep your repositories organized:

Set JAVA_HOME environment variable

Many applications include code or configuration that references the JAVA_HOME environment variable. This variable points them to the Java binary file, allowing them to run Java code.

To set the variable for your system:

Reload your system’s environment variables:

Verify the variable was set correctly:

This should return the path to the Java binary.

JAVA_HOME=/usr/bin/java

Install Xyce-6.7-Open_Source bundle

  1. Download the package xyce-knowm-oss-eda-6.7-rc5.deb to the $HOME/Downloads directory.
  2. Install using dpkg the following command $ sudo dpkg -i xyce-knowm-oss-eda-6.7-rc5.deb
  3. Set the LD_LIBRARY_PATH variable export LD_LIBRARY_PATH=/usr/local/xyce/serial/lib
  4. Set the PATH variable export PATH=/usr/local/xyce/serial/bin:$PATH
  5. Test the install by typing runxyce -v.

Install JSpice-1.0 bundle

  1. Double click on the bundle jspice_knowm_oss_eda-1.0-rc5.deb to mount the bundle.
  2. Install using dpkg the following command $ sudo dpkg -i jspice-knowm-oss-eda-1.0-rc5.deb
  3. Set the PATH variable export PATH=/usr/local/jspice/bin:$PATH

Install Qucs-0.0.19S .deb package

  1. Download the package qucs-knowm-oss-eda-0.0.19s-rc5.deb to the $HOME/Downloads directory.
  2. Install using dpkg the following command $ sudo dpkg -i qucs-knowm-oss-eda-0.0.19s-rc5.deb
  3. Set the PATH variable export PATH=/usr/local/qucs/bin:$PATH
  4. Test the install by typing qucs --version.

Execution should return Qucs 0.0.19 (f277f5c).

Install Knowm Qucs-0.0.19S Memristor JSpice compatible example projects

  1. Download the package examples-j-knowm-oss-eda-0.0.19s-rc5.deb to the $HOME/Downloads directory.
  2. Install using dpkg the following command $ sudo dpkg -i examples-j-knowm-oss-eda-0.0.19s-rc5.deb
  3. Copy or drag-n-drop all of the _prj folders from examples-j to your $HOME/.qucs folder.

NOTE: These new example projects have circuits with JSpice compatible configurations. You should be able to them in both Xyce and JSpice simulators. They will be used to compare the simulated results that we will cover later in this tutorial.

Launch Qucs-S

  1. Click on the Qucs app icon on the Launcher Bar. NOTE: the first time Qucs is started is will inform you that no default simulator has been selected.
  2. Click Ok and then select Xyce (serial) as the default.

Qucs Application Settings

  1. Select File / Application Settings... from the menu.
  2. Click the Locations tab.

The Qucs Home will be set by default to a folder named .qucs in your home directory. This is where all projects will be stored for your installation. Each project will be stored in a separate sub-directory with the _prj suffix appended to the name you specify. Other directories such as the spice4qucs directory will also be created which will store the data and netlist information for your simulations.

Open the Ymemristor_J_prj Project File

  1. Select the Projects tab on the left of the Main Dock.

  2. Double click the Ymemristor_J_prj to automatically open the Content tab.

  3. Click on the schematics list and then double-click on knowm_mr_test.sch to open the schematic diagram.

    NOTE: The schematic should look like the following:

  4. Double click on the transient simulation symbol to open the setup parameters dialog.

  5. Verify that 1001 is set in the number value field which will give a 100 us step size.

  6. Click Apply to save the changes.

  7. Click OK to exit the properties dialog.

The Model and .Model Directive for the MR Memristor Component

The MR Memristor component is accompanied by several model directives that can be independently applied to each memristor symbol instance in the schematic diagram. These are selected from the Libraries tab. The MR Memristor component is used for multiple model definitions in Xyce or JSpice. These are selected by the level parameter of the model. The M-MSS (Meta Multi-stable Switch) Memristor model is defined as a level 5 model in Xyce and JSpice. The current KnowmMemristor model has been included in a separate library called the Knowm_Memristor_Technology library. To access this model do the following:

  1. Select the Libraries tab from the Main Dock.

  2. Left click on the Knowm_Memristor_Technology to expand the list.

    Notice: there is only one item, MRM5 listed in the library.

  3. This is the model that is currently assisgned to MR1 in the schematic.

NOTE: The Rinit parameter that models the memristor’s initial resistance was previous defined for the circuit by specifying a .PARAM statement. The Rinit has now been added to the .MODEL parameters list. In practice this model parameter should be set equal to the Roff parameter value for most circuits. In future circuit simulations the Rinit parameter may be set to a random value for initialization of AHaH synapse nodes which will incorporate two memristors in series to model an AHaH kT-Synapse.

Set AC Voltage Source properties

  1. Double click on the ac Voltage Source symbol to open the parameters for the source.

  2. Select the f row in the properties table.

  3. Change the frequency from 10 Hz to 100 Hz.

  4. Verify the display in schematic checkbox is selected.

  5. Click Apply to set the frequency value.

  6. Click OK to exit the properties dialog.

Save the Schematic Diagram File

  1. Click the Save button on the toolbar to save the changes to the schematic.
    qucs_toolbar_save

    Save Toolbar Button

Select Xyce (Serial) as the Default Simulator

  1. Select Simulate / Select default simulator

  2. Verify the Xyce executable location is set to /Applications/xyce/serial/bin/runxyce

    NOTE: After changing the default simulator you will receive a warning to restart Qucs. This is not always necessary unless you want to make the selected simulator the new default for the project. For now just proceed and we will discuss this in more detail below in the General Notes on Usage.

  3. Click Apply Changes

Run a Xyce Simulation

  1. Select Simulation / Simulate on the main menu or select Simulate button on the toolbar.

    qucs_toolbar_run

    Run Simulation Toolbar Button

    NOTE: The simulation results are returned from Xyce and the plots are updated automatically.

  2. Check simulation for errors or warnings. See the status bar at the bottom of the Qucs window lower right corner.

  3. If you want to save the current netlist, use the Save netlist button on the external simulator window to open the file save dialog. Specify the name of the netlist to save, typically the schematic’s filename with the extension .cir instead of .sch. The resulting file will be saved in the project folder and you can open the .cir file under the Others list in the project tree.

    NOTE: The F6 key or Show Last Netlist from the Simulations menu currently only displays the last netlist for the latest Qucsator simulation.

  4. Click the Exit button to close the Simulation window.

  5. You can view any messages written by the simulator by clicking the F5 key or selecting Show Last Messages from the Simulations menu.

  6. The Qucs data file knowm_mr_test.dat.xyce produced by the transient simulation will be automatically created in the $HOME/.qucs/Ymemristor_J_prj/ directory.

Select JSpice as the Default Simulator

  1. Select Simulate / Select default simulator

  2. Verify the JSpice executable location is set to /Applications/jspice/runjspice

    NOTE: After changing the default simulator you will receive a warning to restart Qucs. This is not always necessary unless you want to make the selected simulator the new default for the project. For now just proceed and we will discuss this in more detail below in the General Notes on Usage.

  3. Click Apply Changes

Run a JSpice Simulation

  1. Select Simulation / Simulate on the main menu or select Simulate button on the toolbar.

    qucs_toolbar_run

    Run Simulation Toolbar Button

    NOTE: The simulation results are returned from JSpice and the plots are updated automatically. The results are very close to those obtained from the previous Xyce simulation.

  2. Check simulation for errors or warnings. See the status bar at the bottom of the Qucs window lower right corner.

  3. Again, if you want to save the current netlist, use the Save netlist button on the external simulator window to open the file save dialog. Specify the name of the netlist to save, typically the schematic’s filename with the extension .cir instead of .sch. The resulting file will be saved in the project folder and you can open the .cir file under the Others list in the project tree.

  4. Click the Exit button to close the Simulation window.

  5. You can view any messages written by the simulator by clicking the F5 key or selecting Show Last Messages from the Simulations menu.

  6. The Qucs data file knowm_mr_test.dat.jspice produced by the transient simulation will be automatically created in the $HOME/.qucs/Ymemristor_J_prj/ directory.

Check JSpice Tabular Results

  1. You can scroll through the data values for all data vectors returned from JSpice using the tabular diagram slider control.

General Notes on Usage

Default simulator selection

When selecting a new default simulator, if you want the change to be persistent after closing Qucs-S then you need to do the following steps.

  1. Select Simulation / Select default simulator

  2. Select the simulator in the Default simulator drop-down list.

  3. Click Apply changes

  4. Select File / Application Settings

  5. Click Apply to save the settings.

  6. Click OK to exit the dialog.

  7. Select Qucs / Quit Qucs

NOTE: Several of the features of the Qucs-S user interface are displayed based on the Default simulator which is saved in the QucsSettings file updated when you save the Application Settings for the program. If you don’t perform the steps outlined above before closing Qucs-S then the Default simulator selection will not be saved and the will not be set when reopening Qucs-S. This issue should be corrected in a future version of the software.

Conclusion

That completes this comparison of Xyce vs. JSpice simulation of the M-MSS memristor model using Qucs-S to define a simple transient simulation for the sinusoidal response of a discrete memristor. I will be presenting the additional capabilities and comparisons with Xyce in follow-on posts including the M-MSS model’s pulse response for discrete memristors and Knowm AHaH synapse circuits.

JSpice is still under development and we will be adding features that are most useful to our mission to provide OSS EDA tools to those of you who are interested in developing neuromorphic circuits using memristor-based synapses. We will be accepting feedback and will be building a wish list for additional requested features for JSpice that may be found in other SPICE compatible simulators. Please leave a comment or send us e-mail through the knowm.org site’s contact page.

You should also checkout the documentation and other examples listed in the Qucs 0.0.19 and Qucs-S 0.0.19 documentation available on the web at the following URLs.

Other References

Share on Facebook0Tweet about this on TwitterShare on Reddit0Share on Google+0Share on LinkedIn0Share on StumbleUpon0Buffer this pageEmail this to someonePrint this page
Michael Arendall

Michael Arendall

Michael Arendall is an experienced software developer, entrepreneur and innovator with more than 25 years experience working with leading semiconductor manufacturers, academia and government laboratories; directly supporting research and development labs by building tools and apparatus for characterizing, analyzing and performing reliability studies on advanced semiconductor process nodes.

Related Posts

Subscribe To Our Newsletter

Join our low volume mailing list to receive the latest news and updates from our team.

Leave a Comment

Newsletter

Subscribe to our low-volume mailing list to receive important updates and announcements directly in your inbox.