/pics/scams_wave_1200_80.png

Examples using the free development environment

Accellera examples (recommended starting point)

/pics/reading.pngOn the Accellera download page (external link) you can find the user's guide and the source code of many examples to download.
You should really start with this ones:
These examples can be used with the free modelling environment click  here to see how to set it up. Please also ensure you have gtkwave and unzip installed your the environment.
  • Copy the ZIP file to "C:\tools\msys64\home\<username>"
  • Start a Mingw64 command line of your modelling environment.
  • Enter following commands (this shows just one of the examples):
        unzip application_examples.zip
        cd application_examples/bask
           (you may select any other example directory there)
        SYSTEMC_PATH=/opt/scams
        SYSTEMC_AMS_PATH=/opt/scams
        TARGET_ARCH=mingw64
        export SYSTEMC_PATH
        export SYSTEMC_AMS_PATH
        export TARGET_ARCH
            (you may put these lines into a shell script for your convenience)
        make -j12
            (use the #CPUs you have)
        ./sc_main.exe
        /mingw32/bin/gtkwave tr.vcd

Using SystemC-AMS and Python for post processing

This is the RC-lowpass example again we used for our first test compile in the installation description. This time we use Python to compile the example, run it and view the results using a plot window. It is just an example showing the idea how this works.
  • This is the RC low pass example, you can download the sc_main.cpp here.
  • And this is the python script, just put it in the same directory as the sc_main.cpp file and start it:
#!/usr/bin/env python

#----------------------------------------------------------------------
#   Copyright 2020 Carinthia University of Applied Sciences
#   All Rights Reserved Worldwide
#
#   Licensed under the Apache License, Version 2.0 (the
#   "License"); you may not use this file except in
#   compliance with the License.  You may obtain a copy of
#   the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in
#   writing, software distributed under the License is
#   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
#   CONDITIONS OF ANY KIND, either express or implied.  See
#   the License for the specific language governing
#   permissions and limitations under the License.
#----------------------------------------------------------------------

import subprocess
import numpy as np
import matplotlib
import matplotlib.pyplot as plt

def compile_model():
    compile_cmd = ['bash','-c','g++ sc_main.cpp -o sc_main.exe -I /opt/scams/include -L /opt/scams/lib-mingw64 -l systemc-ams -l systemc -l m']
    print ('Running : ' + str(compile_cmd));
    subprocess.call(compile_cmd);


def run_sim():
    run_cmd = ['./sc_main.exe']
    print ('Running : ' + str(run_cmd));
    subprocess.call(run_cmd);


def tran_plot(t,sig1,sig2,tmin,tmax,ylabel,title):
    size = len(t)

    x = []
    y1 = []
    y2 = []
    for i in range(0, size):
        if (t[i]>=tmin) and (t[i]<=tmax):
            x.append(t[i])
            y1.append(sig1[i])
            y2.append(sig2[i])

    fig, ax = plt.subplots()
    ax.plot(x, y1, label='vin')
    ax.plot(x, y2, label='vout')
    ax.set(xlabel='time [s]', ylabel=ylabel, title=title)
    ax.grid()
    ax.legend()
    plt.show()


compile_model()
run_sim()
dat = []
dat = np.loadtxt('tr.tab', comments='%', unpack=True)
tran_plot(dat[0],dat[1],dat[2],-1,99,'nodes [V]','LP filter')
  •  The Python code should be quite self-explanatory, although it is not perfect. But you get the idea, right? The result of this code will look like this:
/pics/rc_lowpass_python.png
 
 

Playing with diode modulators:

/pics/spyder_ide_small.png

I set up an example using the free tools:
 
Spyder, Numpy, Pweave, lcapy
 
 
and
/pics/eclipse_ide_small.png
 
 
Eclipse/CDT
(here I tried the commercial waveform plugin "Impulse" I was not at all satisfied with - I explain here why...)

 

 

Further examples

(more to come soon)
 

SystemC-AMS Design Examples using Coside®

/pics/Logo_COSEDA.svgSee here (external link) how to obtain Coside®. Project sources following soon!

Some basic examples

Here I list some examples of using SystemC-AMS for some basic investigations.


Lecturing content

Here is the model we will implement in my "System Modelling and Verification - Analog" class, which is part of the Integrated Circuit and System Design program (external link) at the Carinthia University of Applied Sciences (external link). Please note, that the browse-able model shown there is incomplete, descriptions of many library cells were removed from the online version because of copyright reasons.
 

External sites

Here is a nice web page (external link) designing a PLL model in Coside®.