In a previous post titled Simulating the Knowm M-MSS Memristor Model Using Qucs-S with Xyce, I presented the use of the open-source project Qucs-S – Quite Universal Circuit Simulator featuring the Spice4qucs branch and the Xyce Electronic Simulator as part of the Knowm Open-Source EDA Stack. Several extensions to Qucs-S are being added to fully support circuit designs using the Knowm M-MSS ( Mean Meta-Stable Switch Memristor Model ). In this post I will continue to explore the dynamic behavior of the M-MSS model by creating circuits that will simulate the model’s response to a square wave pulse with various pulse configurations while introducing some more advanced features of Qucs-S and Xyce integration.

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 following experiments are included in the example Qucs-S project but only the knowm_mr_pulse experiment will be covered in this tutorial.

Memristor Experiments Included in This Tutorial

  • knowm_mr_pulse – Rectangular Pulse with positive incremental pulse amplitude from 250mV to 1V with 250mV steps
  • knowm_mr_pulse_neg – Rectangular Pulse with negative incremental pulse amplitude from -250mV to -1V with -250mV steps
  • knowm_mr_pulse_bipolar – Series of positive pulses followed by a series of negative pulses with peak amplitude constant at 800mV and -650mV repectively
  • knowm_mr_pulse_bipolar_incr – Multiple series of alternating bipolar pulses with incremental stepped amplitude from -100mV to -1V and 100mV to 1V

Each of these experiments was created with the inclusion of a series limiting resistor to effectively limit the current through the M-MSS memristor which is generally necessary in actual circuit designs in order to avoid overcurrent conditions that could damage the device. An accompanying no_load version of each of the circuits is also included in the KnowmMemristor_prj examples to allow for inspection of the ideal memristor behavior.

Prerequisites

Please follow the detailed tutorial Simulating the Knowm M-MSS Memristor Model Using Qucs-S with Xyce to learn the basics of creating a Qucs-S schematic file for use with Xyce to perform a transient simulation of the M-MSS model using an AC sinusoidal waveform.

Update to the latest release candidate #2 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. The included versions of Qucs-S (0.0.19S) and Xyce 6.6 include libraries for amd64 architectures. Support for other architectures and operating systems are under development and will be released when available.

Software Installation

NOTE: The current release candidate for the Knowm OSS EDA Stack is available for macOS Sierra 10.12 and Ubuntu 16.04 LTS (Xenial Xerus). This post covers installation on MacOS and Linux but usage only on the macOS platform. The installation process is different, but the use of the software is more or less the same. There is currently support for Xyce (Serial) simulations. The included versions of Qucs-S (0.0.19S) and Xyce 6.6 include libraries for amd64 (intel) 64-bit architectures. Support for other architectures and operating systems are under development and will be released when available.

First, download the pre-built bundles for the Qucs-S and Xyce for your operating system. These packages are available from the Knowm.org.

MacOS Sierra

To Uninstall a Previous Version of the OSS EDA Applications

  1. Go to the /Applications/ folder

  2. Drag the qucs folder and its contents to the trash.

  3. Drag the xyce folder and its contents to the trash.

    NOTE: All user files and application settings are stored in the .qucs sub-directory of your $HOME/ directory so all previous work will be preserved after installing the new version of the software.

Install Qucs-0.0.19S Release Candidate #2 Bundle

  1. Double click on the bundle qucs_knowm_oss_eda-0.0.19s-rc2.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 open the ./bin folder.

  4. Drag the Qucs.app to the Launcher Bar.

  5. Right click on the Qucs-S bundle and select Eject Qucs-S from the context menu.

Install Xyce-6.6-Open_Source Release Candidate #2 Bundle

  1. Double click on the bundle xyce_knowm_oss_eda-6.6-rc2.dmg to mount the bundle.

  2. Copy or drag-n-drop the xyce folder to /Applications folder.

  3. Right click on the Xyce-6.6 bundle and select Eject Xyce-6.6 from the context menu.

Install Qucs-S Example Projects bundle

  1. Double click on the bundle qucs_knowm_oss_eda-examples.dmg to mount the bundle.

  2. Copy or drag-n-drop the KnowmMemristor_prj folder to your user $HOME/.qucs folder. By default this should be /Users/username/.qucs on MacOS or /home/username on Linux OS.

  3. Open the .qucs folder that you just copied the bundles contents to. You should have two project folders, the Ymemristor_prj from the previously completed tutorials and the new KnowmMemristor_prj just installed in the previous steps. These project folders contain the files necessary to follow along with future tutorials and will provide examples of how to extend the concepts presented here to build projects for your own circuit designs.

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.

To Uninstall a Previous Version of the OSS EDA Applications

  1. Start a Terminal application session and type dpkg -l | grep qucs.

  2. Type sudo dpkg -r qucs-knowm-oss-eda or substitute the app name returned from the previous step.

  3. Start a Terminal application session and type dpkg -l | grep xyce.

  4. Type sudo dpkg -r xyce-knowm-oss-eda or substitute the app name returned from the previous step.

    NOTE: All user files and application settings are stored in the .qucs sub-directory of your $HOME/ directory so all previous work will be preserved after installing the new version of the software.

Install Qucs-0.0.19S .deb package

  1. Download the package qucs-knowm-oss-eda-0.0.19s-rc2.deb to the $HOME/Downloads directory.

  2. Install using the following command $ sudo dpkg -i qucs-knowm-oss-eda-0.0.19s-rc2.deb

  3. From Terminal set the PATH variable $ export PATH=/usr/local/qucs/bin:$PATH

  4. Test the install by typing qucs --version.

  5. Execution should return Qucs 0.0.19 (7526999).

Install Xyce-6.6-Open_Source bundle

  1. Download the package xyce-knowm-oss-eda-6.6-rc2.deb to the $HOME/Downloads directory.

  2. Install using dpkg the following command $ sudo dpkg -i xyce-knowm-oss-eda-6.6-rc2.deb

  3. Set the LD_LIBRARY_PATH variable export LD_LIBRARY_PATH=/usr/local/xyce-6.6/serial/lib

  4. Set the PATH variable export PATH=/usr/local/xyce-6.6/serial/bin:$PATH

  5. Test the install by typing runxyce -v.

Install Octave 4.0.3 – Scientific Programming Language bundle for MacOS Sierra

NOTE: A Knowm provided Octave bundle is not currently provided with this release so you will need to install Octave 4.0.3 from the Sourceforge.

  1. Download the Octave 4.0.3 version from the sourceforge.net site here. Click on Octave MacOSX Binary then select 2016-7-11-binary-octave-403. Select octave_gui_403_appleblas.dmg to start the download.

  2. Double click on the octave_gui_403_appleblas.dmg to mount the bundle and launch the installer.

  3. Follow the package install instructions – for MacOs Sierra the installer will use /Applications/Octave.app/ as the default application directory. You don’t need to install Octave on Ubuntu/Debian as it is included in the /usr/local/qucs/octave folder to allow for easy updates or uninstallation of Octave in the future.

  4. You need to create or edit the .octaverc file in your $HOME/ directory in your favorite text editor to set Qt as the graphics package to use with Octave. Enter the following single line:

    graphics_toolkit(“qt”)

  5. Save .octaverc

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

The Qucs Settings file qucs.conf is stored in your $HOME directory in the .config directory. If you experience any issues with persistence of your settings in this section you can manually edit this file with a compatible editor.

  1. Select File/Application Settings... from the menu.

  2. Click the Locations tab.

    qucs_app_settings

    Application Settings

    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 simulations.

ADMS – An Automatic Device Model Synthesizer

ADMS is a code generator that converts electrical compact device models specified in high-level description language into ready-to-compile C code for the API of SPICE simulators. Based on transformations specified in XML language, ADMS transforms Verilog-AMS code into other target languages.

  1. Verify AdmsXml Path: is to /Applications/qucs/adms/bin. If not set it.

ASCO – A SPICE Circuit Optimizer

ASCO project aims to bring circuit optimization capabilities to existing SPICE simulators using a high-performance parallel differential evolution (DE) optimization algorithm. Currently out-of-the-box support for Eldo (TM), HSPICE (R), LTspice (TM),Spectre (R), Qucs and ngspice exist.

  1. Verify ASCO Path: to /Applications/qucs/asco/bin. If not set it.

GNU Octave – Scientific Programming Language

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 from the main menu.

  1. Set Octave Path: to /Applications/Octave.app/Contents/Resource/usr/bin. If not, set it.
    qucs_app_loc_set

    Application Locations

  2. Click Apply to save the settings.

  3. Click OK to exit the settings dialog.

Open the KnowmMemristor_prj Examples Project File

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

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

    qucs_kmr_proj_list

    Project List

Select the Schematic diagram

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

    qucs_kmr_proj_content

    KnowmMemristor_prj Content

    qucs_kmr_1u_rect_pulse_sch

    Pulse Schematic

    NOTE: We will be referring to the multiple components of this schematic in the following sections to familarize you with the basic settings required to perform the transient simulation using Xyce. You may want to consult the Qucs-S documentation and Xyce Reference Manual for more information on other 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.

    qucs_kmr_1u_rect_pulse_mrm5_hlt

    Knowm Memristor Technology Model MRM5

  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.

    qucs_kmr_tech_lib

    Knowm Memristor Technology Library

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

    qucs_kmr_1u_rect_v1_0v_pulse_hlt

    Xyce Script Square-wave Pulse Setting

    NOTE: The voltage is set to 0 V but we will be specifying the pulse applitude from the Xyce script component which will be covered in the following steps.

  5. The XYCE script component is available from the simulations drop-down list under the Components tab of the Main Dock. This component allows for addtional Xyce netlist statements to be specified that will be integrated into the Qucs-S Xyce compatible netlist. We will cover a few of these functions in the next couple of steps.

    qucs_kmr_1u_rect_pulse_xyce_scr_hlt

    Xyce Script Square-wave Pulse Setting

  6. Notice the .STEP function. This function will instruct Xyce to perform multiple simulation runs modifying the V1 pulse amplitude by the parameter :V2 according to the voltages listed. Other allowable syntax include LIN, OCT, DEC with initial, final, step for the selected parameter. We are using the LIST feature to specify a discrete list of pulse amplitudes. (see the .STEP statement in the Xyce 6.6 Reference Guide for detailed information).

    qucs_kmr_1u_rect_pulse_xyce_scr_v1_list_hlt

    Xyce Script Square-wave Pulse Amplitude List

  7. Next the familiar .TRAN statement from SPICE is specified in the XYCE script component. This replaces the .TRAN component available from the simulations drop-down list found in the Components tab of the Main Dock. Xyce will use this .tran statement to perform the transient analysis.

    qucs_kmr_1u_rect_pulse_xyce_scr_tran_hlt

    Xyce Script Tranisent Simulation Setting

  8. The .PRINT statement of the XYCE script provides the format, filename and data vectors from the simulation results to allow post-analysis and plotting. In order to use view diagrams of tabular and cartesian plots in Qucs-S you should specify raw format. The data names should match the name nodes specified in the schematic (i.e. I(Pr1), v(Vin), v(Vmr), v(Vout)) as listed in the example.

    qucs_kmr_1u_rect_pulse_xyce_scr_print_hlt

    Xyce Script .PRINT Statement

Save the Schematic Diagram File

  1. The filename knowm_mr_pulse.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

Run a Simulation

  1. Press F2 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.

    qucs_sim_extern_sim

    External Simulation Window

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

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

    qucs_kmr_sim_trans_msg

    Xyce Simulator Message

  5. 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 lastest
    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.

    qucs_kmr_pulse_netlist

    Qucs Generated Netlist

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

Set Keyboard Preferences (Optional)

  1. Open System Preferences and select Keyboard.

  2. Then check thebox F1, F2,
    etc as standard function keys.

    keyboard_preferences

    Change Keyboard Preferences for F1, F2 Selection

NOTE: You can change the keyboard mapping for other the keys in macOS by selecting the Shortcuts tab then define the new key mappings in the Keyboard group.

View the Tabular Results

  1. Check the Tabular results.
    qucs_kmr_1u_rect_pulse_iv_t_tab

    Tabular Results

  2. Notice that Number is the label of the first column. If you scroll down the list you should observe 4 datatsets corresponding to the stepped amplitude values that we specified in the .STEP statement of the XYCE script. The table now holds the results of the 4 transient simulations that were performed.

    NOTE: When using the XYCE Script only data specified in the .PRINT statement will be available in Qucs-S diagrams.

Cartesian Plot of Memristor I,V vs. Time Results

  1. You should also observe the results in the specified Cartesian plot defined in the schematic.

    qucs_kmr_1u_rect_pulse_iv_t_cart_plot

    I-V vs. Time Cartesian Plot

    NOTE: The results contain multiple pulses of the varying amplitudes we defined in the .STEP function of the XYCE script. 250mV, 500mV, 750mV and 1V.

Modifying the Experiment

Set Rectangle Pulse Voltage Source properties

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

    qucs_kmr_pulse_rect_sel

    Select Rectangular Pulse Source Settings

  2. Leave the O V amplitude for the U parameter unchanged for the pulse as we will again be using the settings in the .STEP statement of the XYCE script to specify the pulse amplitudes for our transient simulation runs.

    qucs_kmr_pulse_rect_set

    Rectangular Pulse Settings

  3. Select the TH row in the properties table.

  4. Change the duration of high pulses from 1 us to 5 us.

  5. Select the display in schematic checkbox.

    qucs_kmr_pulse_plth_set

    Duration for High Pulse

  6. Select the TL row in the properties table.

  7. Change the duration of low pulses from 1 us to 5 us.

    qucs_kmr_pulse_pltl_set

    Duration of Low Pulse

  8. Select the Tr row in the properties table.

  9. Verify the rise time of the leading edge is set to 1 ns.

    qucs_kmr_pulse_pltl_set

    Duration of Low Pulse

qucs_kmr_pulse_pltr_set

Rise Time of Pulse Leading Edge

  1. Select the Tf row in the properties table.

  2. Verify the fall time of trailing edge is set to 1 ns.

    qucs_kmr_pulse_pltf_set

    Fall Time of Pulse Trailing Edge

  3. Click Apply to set the frequency value.

  4. Click OK to exit the properties dialog.

Reconfigure the Transient Simulation in the XYCE Script

  1. Double click on the XYCE script component symbol in the schematic to open the settings.

    qucs_kmr_pulse_xyce_scr_set

    Specify Xyce Script Transient Simulation Parmeters

  2. Change the .tran start and end time to 1u and 50us repectively.

  3. Click Apply to save the changes.

  4. Click OK to exit the properties dialog.

    qucs_kmr_pulse_xyce_scr_sch

    Schematic with Updated Xyce Script

Save the Schematic Diagram File

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

    Save Toolbar Button

Run a Simulation

  1. Press F2 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.

    qucs_sim_extern_sim

    External Simulation Window

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

View the Tabular Results

  1. Observe the Tabular results.

    qucs_kmr_5u_rect_pulse_iv_t_tab

    Tabular Results for 5us Pulse

  2. Notice again that Number is the label of the first column. If you scroll down the list you should observe 4 datatsets corresponding to the stepped amplitude values that we specified in the .STEP statement of the XYCE script. The table now holds the results of the latest 4 transisent simulations that were performed.

    NOTE: When using the XYCE script only data specified in the .PRINT statement will be available in Qucs-S diagrams.

  3. You should also observe the results in the specified Cartesian plot defined in the schematic.

    qucs_kmr_5u_rect_pulse_iv_t_cart_plot

    I-V vs. Time Cartesian Plot for 5 us Pulse

    NOTE: The results contain multiple pulses of the varing amplitudes we defined in the .STEP function of the XYCE script. 250mV, 500mV, 750mV and 1V.

Conclusion

That completes this tutorial. Try some of the other example schematic files available in the KnowmMemristor_prj project. All of these experiments use common features presented here. In our next tutorial we will explore adding Qctave scripts to perform post-analysis on the transient simulation results.

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

Further Resources

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.