In the post titled Simulating the Knowm M-MSS Memristor Model Pulse Response with Qucs-S and Xyce, I presented the dynamic behavior of the M-MSS model’s response to a square wave pulse with various pulse configurations while introducing some more advanced features of Qucs-S and Xyce integration. In this post I will discuss extensions to Qucs-S that have been added to support the Knowm JSpice SPICE-inspired simulator to run transient simulations of a memristor using the M-MSS (Mean Meta-Stable Switch Memristor Model). I will be comparing the simulation results of the M-MSS model’s response to a rectangular square wave pulse using while varying the pulse pulse width and duty cycle. The I will adding an Octave script to perform post analysis of the simulated data to extract resistance and conductance values and plot these values vs. the incremental pulse values to evaluate the incremental pulse response of the model.

An example Qucs-S project has been created to perform various experiments that we will later set up on actual memristor devices using the Knowm Memristor Discovery board and associated extender modules. The example Qucs-S/Xyce/JSpice compatible project knowm_mr_pulse_j experiment will be covered in this tutorial.

Prerequisites

Update to the latest release candidate rc5 of the Knowm OSS EDA Stack. It is available for macOS 10.12 Sierra and Ubuntu 16.04 LTS (Xenial Xerus). This post covers installation and use on macOS and support for Xyce (Serial) simulations only. 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. The provided versions of Qucs-S (0.0.19S) and Xyce 6.7 include libraries for amd64 architectures. Support for other architectures and operating systems are under development and will be released when available.

Please follow the detailed tutorial Comparing Simulation Results for the Knowm M-MSS Model in Xyce and JSpice Using Qucs-S to download the latest version of the Qucs-S, Xyce and JSpice binaries and get them configured properly. Running the example project circuits there will verify that everything is working properly.

Additional Software Installation

The following assumes you have downloaded the pre-built bundles for the Qucs-S, Xyce and JSpice.

Install GNU Octave – Scientific Programming Language

Octave provides powerful mathematics-oriented syntax with built-in plotting and visualization tools.
The Octave syntax is largely compatible with Matlab. The Octave interpreter can be run in GUI mode, as a console, or invoked as part of a shell script. It is accessed in Qucs by selecting View->Octave Window.

NOTE: Octave is not currently provided with the Knowm Opensource EDA Stack MacOS release so you will need to install it from the Octave site. We have tested with an older stable Octave version 4.0.3 for use with Qucs-S so it is recommended that you install this version for now. We will soon be updating to version 4.2.1 in the future which is available for MacOS from Homebrew and aptitude from Ubuntu Linux.

MacOS 10.12 Sierra Install

  1. To download the MacOS installer package from Source Forge go to the Octave 4.0.3 project wiki https://wiki.octave.org/Octave_for_macOS_X

  2. On the Octave wiki site, under Installing a Mac OS X Bundle click on the link download Octave 4.0.3 with graphical user interface (OS X 10.9+)

  3. Double-click on the downloaded .dmg package and follow the steps in the Octave 4.0.3 installer to complete the installation of Octave.

  4. Verify Octave is found in the /Applications/Octave.app folder.

  5. You can test the install from the terminal console by typing:

Debian Linux Install – Ubuntu LTS (Xenial Xerus)

  1. To install Octave 4.0.0 using aptitude you will need to open a terminal window.

  2. Type the following command at the shell prompt:

  1. Answer Y to the prompt to begin the Octave installation.

  2. Verify Octave is installed correctly by typing at shell prompt:

  1. You should get the response

  1. You can test the install from the terminal console by typing:

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 if prompted.

Qucs-S Application Settings

  1. Select File->Application Settings... from the menu.

  2. Click the Locations tab.

    NOTE: The Qucs Home will be a folder named .qucs in your user $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 Xyce and JSpice simulations.

Save the Application Settings

  1. Click Apply to save the settings.

  2. Click OK to exit the settings dialog.

Open the KnowmMemristor_J_prj Examples Project File

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

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

Select the Schematic diagram

  1. Double click on the knowm_mr_pulse_j.sch from the Schematics list in the Main Dock.

    NOTE: We will be referring to the multiple components of this schematic in the following sections to familiarize you with the basic settings required to perform the transient simulation using Xyce and JSpice. You may want to consult the Qucs-S documentation and Xyce Reference Manual or the JSpice documentation on the Knowm JSpice Github page for more information on available settings.

  2. Notice the MR Memristor has been placed on the schematic and the MRM5 model has been assigned to the MR1 component instance.

  3. The .Model directive for the MRM5 model has been selected from a newly added Knowm Memristor Technology library found under the Libraries tab of the Main Dock.

    NOTE: This library will be the repository in Qucs-S for any new models developed and provided by Knowm.org and the Knowm Developer Community. The models and updates will also be featured on the memristor-models-4-all Github repository.

  4. The Rectangle Voltage source has been selected from the sources drop-down list and the parameters set for a 10us Pulse Width and 20us Period. (TH + TL = Period).

    NOTE: The voltage is set to 1 V which will produce a pulse starting at 0 V for the TL time then it will transition to 1 V for the specified TH time.

Save the Schematic Diagram File

  1. The filename knowm_mr_pulse_j.sch has been used for this example schematic and will be used in future tutorials.

  2. Click the Save button on the toolbar to save the schematic file.

    qucs_toolbar_save

    Save Toolbar Button

Select Xyce (Serial) as the Default Simulator

  1. Select Simulation->Select default simulator.

  2. Verify the Xyce (Serial) executable location is set to /Applications/xyce/bin/runxyce.

  3. Select Xyce (Serial) from the Default simulator drop-down-list.

  4. Click Apply changes.

    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.

Run a Xyce Simulation

  1. Press Simulation->Simulate on the main menu or select Simulate button on the toolbar.

    qucs_toolbar_run

    Run Simulation Toolbar Button

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

  3. You can save the current netlist by clicking the Save Netlist button on the simulation window.

    NOTE: The F6 key or Show Last Netlist from the Simulations menu currently only displays the last netlist for the latest
    Qucsator simulation. If you save the netlist using the button on the simulation window then you can open the .cir file under Others list in the project tree.

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

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

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

Modifying the Experiment

Set Rectangle Pulse Voltage Source properties

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

  2. Leave the 1 V amplitude for the U parameter unchanged for the pulse.

  3. Select the TL row in the properties table.

  4. Change the duration of low pulses from 10 us to 20 us.

  5. Verify the display in schematic checkbox is selected.

  6. Click Apply to set the TL value.

  7. Click OK to exit the properties dialog.

Save the Schematic Diagram File

  1. Click the Save button on the toolbar to save changes to the knowm_mr_pulse_j.sch schematic file.

    qucs_toolbar_save

    Save Toolbar Button

Run the Modified Xyce Simulation

  1. Press Simulation->Simulate on the main menu or select Simulate button on the toolbar.

    qucs_toolbar_run

    Run Simulation Toolbar Button

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

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

  4. The Qucs data file knowm_mr_pulse_j.dat.xyce produced by the transient simulation will be automatically created in the $HOME/.qucs/KnowmMemristor_J_prj/ directory.

View the Tabular Results

  1. Check the Tabular results.

Cartesian Plot of Memristor I,V vs. Time Results

  1. You should also observe the results in the specified Xyce I,V vs. Time plot defined in the schematic.

    NOTE: The results contain 0 V to 1 V with the pulse width 10 us at 1 V and 20 us pulse width at 0 V with a combined period of 30 us and duty cycle 33.3%.

Select JSpice as the Default Simulator

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

  2. Select Simulation->Select default simulator.

  3. Select JSpice from the Default simulator drop-down-list.

  4. Click Apply Changes.

    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.

  5. Click OK.

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

  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.

    NOTE: The F6 key or Show Last Netlist from the Simulations menu currently only displays the last netlist for the lastest 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_pulse_j.dat.jspice produced by the transient simulation will be automatically created in the $HOME/.qucs/KnowmMemristor_J_prj/ directory.

Cartesian Plot of Memristor I,V vs. Time Results

  1. You should also observe the results in the specified JSpice I,V vs. Time plot defined in the schematic.

    NOTE: The results again contain 0 V to 1 V with the pulse width 10 us at 1 V and 20 us pulse width at 0 V with a combined period of 30 us and duty cycle 33.3%. These results closely agree with the Xyce simulation results above.

Calculate R(MR) and G(MR) vs. Pulse Number using Octave

For a detailed description of Octave script stuctures in Qucs-S and how to write and execute an Octave script to extract data from the simulation results read the post Using GNU Octave Scripts for Post-Analysis of Xyce Simulation Results within Qucs-S Graphical User Interface.

Set Document Settings

Only one of the two Qucs-S/Octave simulation data post-processing methods can be active at any one time. To select which check the correct boxes in the Edit File Properties window located under File->Document Settings. For example when box open data display after simulation is ticked and box run script after simulation is NOT ticked then the Manual method is selected. Reversing which box is ticked results in selection of the Automatic method of Octave post-simulation data processing.

  1. Right click on the schematic and select Document Settings...

  2. Select Simulation tab.

  3. Uncheck open data display after simulation checkbox in the dialog.

  4. Check the run script after simulation checkbox in the dialog.

  5. Click Apply to save the changes.

  6. Click OK to exit the properties dialog.

Save the Schematic Diagram File

  1. Click the Save button on the toolbar to save changes to the knowm_mr_pulse_j.sch schematic file.

    qucs_toolbar_save

    Save Toolbar Button

Open Octave Window

The Octave interpreter can be run in Qucs-S GUI mode, as a console, or invoked as part of a shell script.

  1. Select View->Octave Window from the Main Menu.

    NOTE: This should open the Octave console window at the bottom of the screen and start the Octave command interpreter.

Run a Xyce Simulation

  1. Press Simulation->Simulate on the main menu or select Simulate button on the toolbar.

    qucs_toolbar_run

    Run Simulation Toolbar Button

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

  3. You can save the current netlist by clicking the Save Netlist button on the simulation window.

    NOTE: The F6 key or Show Last Netlist from the Simulations menu currently only displays the last netlist for the latest
    Qucsator simulation. If you save the netlist using the button on the simulation window then you can open the .cir file under Others list in the project tree.

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

View Octave Window Output

The Octave interpreter should now be configured to automatically execute the knowm_mr_pulse_j.m script, and write debug output to the Octave console output window.

  1. The Octave console window should display the output of the script. You should observe the text parsing data . .. ...

  2. Once the data is parsed the debug output will be displayed in the Octave console.

  3. Next (2) plot windows should be created by the Qt plot subsystem.

    NOTE: These plot windows may not be visible due to the fact that the Qucs-S interface may regain focus. You can switch the window focus to the octave-gui process by using the key sequence Command ⌘-Tab.

  4. The first plot is the Memristor Resistance vs. the Pulse number.

  5. The second plot is the Memristor Conductance vs. the Pulse number.

NOTE: The Octave script will require modification to support the JSpice simulation data. The Octave script included in this project works with Xyce simulation data only. Additional features will be added to JSpice in the future that will allow a single Octave script to work with both simulators. More information will be available soon in another blog post. Check back with us for further developments regarding JSpice features.

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.

References

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.

Other References

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

Knowm 32X32 Crossbar

Knowm Newsletter

Are you ready for memristor AI processors? With our newsletter, you will be.