Skip to main content

Chaotic logic simulator in Python.

Project description

chaogate

Simulations of the 3-MOSFET system known as a choagate using pyspice.

This library corresponds to a selection of the code used in "Chaogate Parameter Optimization using Bayesian Optimization and Genetic Algorithm", “AI for Hardware Security", ISQED’21, 4/7/2020.

Install

pip install chaogate

How to use

import chaogate
from chaogate import *

Ensure you change the global_path to the folder containing the as described in the core page.

By default, they point to:

global_path
'C:\\Anaconda3\\Lib\\site-packages\\PySpice\\Examples\\libraries\\chaogate'

We can instantiate a chaogate with the chaogate function, though this is automatically called by all the other functions which need it in this library. Most functions, such as sweep, grid, and bifurcate, accept kwargs as an argument, which refers to all the possible keyword arguments of the choagate netlist. For exmaple,

s1,s2=sweep(Vbias=(0,1.2,0.01),TEMP=(-20,120,20))
plot_sweep(s1,ncurves=10)
plot_sweep(s2,ncurves=10)
sweep : Elapsed time: 0.3116 seconds

png

png

Once we sweep, we calculate the relevant chaotic properties using iterate.

This is packaged into an automatic process, along with calculating the lyapunov exponent, with the bifurcate function.

We can calculate these quantities over entire regions of parameter space with functions like grid, then estimate the computational stability with boolean_divergence:

g=bifurcate(Vbias=(0,1.2,0.01),Vdd=(1.15,1.25,0.001),as_grid=True)
grid : Elapsed time: 29.5447 seconds
iterate_map : Elapsed time: 5.9907 seconds
plot_bifurcate(itr=g.iterate.sel(Vdd=1.2),lya=g.lyapunov.sel(Vdd=1.2))

png

grad = boolean_gradient(g.iterate)
div = boolean_divergence(grad)
plt.matshow(div)
plt.colorbar()
<matplotlib.colorbar.Colorbar at 0x255f89bae88>

png

We can quickly compare the difference between the desired chaotic properties (positive $\lambda$), and the undesirable properties (the boolean divergence) by taking a linear combination such as:

normalized_lyapunov = (g.lyapunov.data>0)*g.lyapunov.data/np.max(g.lyapunov.data)
normalized_divergence = div/np.max(div) 
optimizer = normalized_lyapunov - normalized_divergence 
plt.matshow(optimizer)
plt.colorbar()
<matplotlib.colorbar.Colorbar at 0x255f4b6be48>

png

With an appropriate optimizatier we can then begin to assess the appropriate chaogate design

sidis.refresh()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chaogate-0.0.1.tar.gz (18.6 kB view hashes)

Uploaded Source

Built Distribution

chaogate-0.0.1-py3-none-any.whl (15.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page