All Projects → KenKundert → psf_utils

KenKundert / psf_utils

Licence: other
Read Spectre PSF files

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to psf utils

Noscript
The popular NoScript Security Suite browser extension.
Stars: ✭ 366 (+1730%)
Mutual labels:  spectre
Spectre Meltdown Poc
A semi-demi-working proof of concept for a mix of spectre and meltdown vulnerabilities
Stars: ✭ 127 (+535%)
Mutual labels:  spectre
spectre-attack-demo
Reproducing malicious memory reading on Intel i5 and Intel Xeon using a Spectre attack
Stars: ✭ 87 (+335%)
Mutual labels:  spectre
Specucheck
SpecuCheck is a Windows utility for checking the state of the software mitigations and hardware against CVE-2017-5754 (Meltdown), CVE-2017-5715 (Spectre v2), CVE-2018-3260 (Foreshadow), and CVE-2018-3639 (Spectre v4)
Stars: ✭ 542 (+2610%)
Mutual labels:  spectre
Hexo Theme Spectre
A modern, simple & elegant theme for Hexo
Stars: ✭ 109 (+445%)
Mutual labels:  spectre
Ex money
A [work-in-progress] self-hosted personal finance app
Stars: ✭ 154 (+670%)
Mutual labels:  spectre
deep spectre
Deep learning side channel privileged memory reader
Stars: ✭ 46 (+130%)
Mutual labels:  spectre
spectre-canjs
A data administration component library built on the Spectre.css framework enabled with CanJS
Stars: ✭ 25 (+25%)
Mutual labels:  spectre
Spectreexploit
SpectreExploit POC
Stars: ✭ 115 (+475%)
Mutual labels:  spectre
Spectrepoc
Proof of concept code for the Spectre CPU exploit.
Stars: ✭ 239 (+1095%)
Mutual labels:  spectre
Spectre Attack
Example of using revealed "Spectre" exploit (CVE-2017-5753 and CVE-2017-5715)
Stars: ✭ 690 (+3350%)
Mutual labels:  spectre
In Spectre Meltdown
This tool allows to check speculative execution side-channel attacks that affect many modern processors and operating systems designs. CVE-2017-5754 (Meltdown) and CVE-2017-5715 (Spectre) allows unprivileged processes to steal secrets from privileged processes. These attacks present 3 different ways of attacking data protection measures on CPUs enabling attackers to read data they shouldn't be able to. This tool is originally based on Microsoft: https://support.microsoft.com/en-us/help/4073119/protect-against-speculative-execution-side-channel-vulnerabilities-in
Stars: ✭ 86 (+330%)
Mutual labels:  spectre
Spectre
GPU-accelerated Factors analysis library and Backtester
Stars: ✭ 157 (+685%)
Mutual labels:  spectre
Hardware And Firmware Security Guidance
Guidance for the Spectre, Meltdown, Speculative Store Bypass, Rogue System Register Read, Lazy FP State Restore, Bounds Check Bypass Store, TLBleed, and L1TF/Foreshadow vulnerabilities as well as general hardware and firmware security guidance. #nsacyber
Stars: ✭ 408 (+1940%)
Mutual labels:  spectre
alias-wallet
Official Alias source code repository
Stars: ✭ 5 (-75%)
Mutual labels:  spectre
Spectre Meltdown Checker
Spectre, Meltdown, Foreshadow, Fallout, RIDL, ZombieLoad vulnerability/mitigation checker for Linux & BSD
Stars: ✭ 3,482 (+17310%)
Mutual labels:  spectre
Spectre
Spectre.css - A Lightweight, Responsive and Modern CSS Framework
Stars: ✭ 10,938 (+54590%)
Mutual labels:  spectre
gotify-push
Chrome Extension for Send Push Notification 🔔 to gotify/server ☁
Stars: ✭ 32 (+60%)
Mutual labels:  spectre
meltdown-spectre-bios-list
a list of BIOS/Firmware fixes adressing CVE-2017-5715, CVE-2017-5753, CVE-2017-5754
Stars: ✭ 16 (-20%)
Mutual labels:  spectre
Spectre Attack Sgx
Spectre attack against SGX enclave
Stars: ✭ 214 (+970%)
Mutual labels:  spectre

PSF Utilities - Read Spectre Data Files

https://pepy.tech/badge/psf_utils/month
Author:Ken Kundert
Version:1.5.0
Released:2021-11-11

What?

psf_utils is a library that allows you to read data from a Spectre PSF ASCII file. Spectre is a commercial circuit simulator produced by Cadence Design Systems. PSF files contain signals generated by Spectre. This package also contains two programs that are useful in their own right, but also act as demonstrators as to how to use the library. They are list-psf and show-psf. The first lists the available signals in a file, and the other displays them.

Accessing the Results

You can use the PSF class to read ASCII Parameter Storage Format files. When instantiating the class you pass in the path to the file and then the resulting PSF object contains the signals. For example, the following lists the signals present in a ASCII PSF file:

from psf_utils import PSF
from inform import Error, display

kinds = {
    'float double': 'real',
    'float complex': 'complex',
}

try:
    psf = PSF('adc.raw/tran.tran')

    for signal in psf.all_signals():
        kind = signal.type.kind
        kind = kinds.get(kind, kind)
        display(f'{signal.name:<15}  {signal.units:<12}  {kind}')
except Error as e:
    e.terminate()

This example plots the output signal:

from psf_utils import PSF
from inform import Error, display
import matplotlib.pyplot as plt

try:
    psf = PSF('adc.raw/tran.tran')
    sweep = psf.get_sweep()
    out = psf.get_signal('out')

    figure = plt.figure()
    axes = figure.add_subplot(1,1,1)
    axes.plot(sweep.abscissa, out.ordinate, linewidth=2, label=out.name)
    axes.set_title('ADC Output')
    axes.set_xlabel(f'{sweep.name} ({PSF.units_to_unicode(sweep.units)})')
    axes.set_ylabel(f'{out.name} ({PSF.units_to_unicode(out.units)})')
    plt.show()
except Error as e:
    e.terminate()

abscissa and ordinate are NumPy arrays. As such, you can perform computation with them:

out = out_p.ordinate - out_n.ordinate

from numpy import sin
sine = sin(sweep.abscissa)

Reading large ASCII data files is slow, so psf_utils reads the PSF file once, then pickles the data and writes it to disk. On subsequent runs the pickled data is used if the pickle file is newer that the corresponding PSF file.

Things are a bit different for DC operating point results. In this case, sweep is None and the results are scalar quantities:

from psf_utils import PSF, Quantity

psf = PSF('opamp.raw/op.dc')
with Quantity.prefs(map_sf=Quantity.map_sf_to_greek):
    for signal in sorted(psf.all_signals(), key=lambda s: s.name):
        name = f'{signal.access}({signal.name})'
        print(f'{name:>20} = {signal.ordinate}')

Utility Programs

Two utility programs are installed along with the psf_utils library: list-psf and show-psf. The first lists the signals available from a PSF file, and the second displays them. They both employ caching to speed up access to the data. They also cache the name of the PSF file so that it need not be given every time. show-psf also caches its arguments, so if you run it again with no arguments it will simply repeat what it did last time. For example, here is a typical session:

# list the signals in noise PSF file
> list-psf -f resistor.raw/pnoise.pnoise
Using resistor.raw/pnoise.pnoise.
    R1:flicker  R1:total    R2:fn       out
    R1:thermal  R2:rn       R2:total

# list them again, this time in long form
> list-psf -l
Using resistor.raw/pnoise.pnoise.
    R1:flicker  A²/Hz  real  (12042 points)
    R1:thermal  A²/Hz  real  (12042 points)
    R1:total    A²/Hz  real  (12042 points)
    R2:fn       A²/Hz  real  (12042 points)
    R2:rn       A²/Hz  real  (12042 points)
    R2:total    A²/Hz  real  (12042 points)
    out         A/√Hz  real  (12042 points)

# list only those that match R1:* (assumes nonomatch variable is set in shell)
> list-psf -l R1:*
Using resistor.raw/pnoise.pnoise.
    R1:flicker  A²/Hz  real  (12042 points)
    R1:thermal  A²/Hz  real  (12042 points)
    R1:total    A²/Hz  real  (12042 points)

# show a graph containing signals that start with R1:
> show-psf R1:*

# show the thermal noise of R1, and then the total noise minus the flicker noise
> show-psf R1:thermal R1:total-R1:flicker

> show-psf out        # show a graph containing only out

> show-psf            # show out again, exactly as in previous run

> show-psf -M out     # show out again, this time include point markers

> show-psf -P out     # show out again, this time only show point markers

> show-psf -s out.svg out     # send graph of out to svg file

# list signals in a PSF file from a DC operating point file:
> list-psf -f diffamp.raw/tran.dc
Using diffamp.raw/pnoise.pnoise.
    in_n    in_p    out_n   out_p   Vdd     Vdd:p

# show the DC voltages
> show-psf \*
     V(in_n) = 47.678 µV
     V(in_p) = 47.623 µV
    V(out_n) = 876.16 µV
    V(out_p) = 876.16 µV
      V(Vdd) = 2.5 V
    I(Vdd:p) = −10.05 µA

# list signals in transient PSF file
> list-psf -f diffamp.raw/tran.tran
Using diffamp.raw/pnoise.pnoise.
    in_n    in_p    out_n   out_p   Vdd     Vdd:p

# display differential output and differential input
> show-psf out_p-out_n in_p-in_n

Converting to PSF ASCII

psf_utils only supports PSF ASCII files. As an alternative, libpsf is a Python package that can read both ASCII and binary PSF files. Or, you can use the Cadence psf program to convert various types of simulation results files into PSF ASCII format. To use it, simply specify the input and output files:

> psf -i adc.raw/tran.tran -o adc.raw/tran.psfascii
> list-psf -f adc.raw/tran.psfascii

In this example there is nothing special about the 'psfascii' suffix, it is simply mnemonic. Rather, the output is in ASCII format because the -b (binary) option is not specified.

psf_utils does not support SST files, which are generated by AMS Designer, Cadence's mixed-signal simulator. You can recognize SST files in that they come in pairs, and the two files have .dsn and .trn suffixes. In this case, Cadence's PSF utility cannot help you either. However, you can use the simvisdbutil to convert the data to a CSV file, which would allow you to access the data, though not with psf_utils. For example, the following converts all waveforms contained in ldo.trn into CSV data:

simvisdbutil ldo.trn -csv -timeunits s -output ldo.csv

Examples

Flicker Noise is a simulation script that shows how to write simple Python scripts that run Spectre and use psf_utils to extract and display the desired results.

Releases

Latest development release:
Version: 1.5.0
Released: 2021-11-11
1.5 (2021-11-11):
  • Renamed plot-psf to show-psf.
  • Improved support of DC operating points.
  • Suppress access function names when printing members of PSF structures.
  • Correct invalid units produced by Spectre on oppoint files (I, R, C).
1.4 (2021-10-21):
  • Allow signal names to contain backslashes.
1.3 (2021-03-21):
  • Improve support for DC operating points.
1.2 (2021-01-07):
  • Support PSF files that contain DC operating points.
  • Support PSF files where values are given in a group.
1.1 (2021-01-30):
  • Allow, but ignore, properties on traces.
1.0 (2020-11-03):
  • Production release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].