Coder Social home page Coder Social logo

sar-adc's Introduction

What is this repo?

  • Simulate ADC quantizations in python

  • Fast Simulations using Numpy

  • Can add noise for your design optimization!

Very simple SAR Simulation

# ADCBIT
BIT = 12

# ADC noise
noise = 2/2**BIT # noise is 2LSB

# create ADC
adc = SAR(BIT, noise, 0, 0, 2)

# ADC conversion
adcout = adc.forward_fft(input, plot=True)
Simulating a 12 bit SAR ADC
Capacitor mismatch not included
plotting conversion results


SNDR: [64.12131504]
ENOB: [10.35902243]

Further usage

# example.py

from sar import SAR, normalize_input
import numpy as np
import matplotlib.pyplot as plt

#bit = number of bits in ADC
#ncomp = noise of the comparator
#ndac = noise of the c-dac
#nsamp = sampling kT/C noise
#radix = radix of the C-DAC

# make a ideal sin signal
adcin = np.sin(np.arange(0, 10, 0.001))

# This simulates a standard 6-bit ADC
bit = 6
ncomp = 0.001
ndac = 0
radix = 2
nsamp = 0

# Define ADC
myadc = SAR(bit, ncomp, ndac, nsamp, radix)

# Normalize your input
norm_input, center, maxbin = normalize_input(adcin)

# Run ADC
adcout=myadc.forward(norm_input)

# Rescale ADC output to original
adcout, _ , _ = normalize_input(adcout)
adcout = adcout * maxbin + center

#print it.
print(adcout)
plt.plot(adcin)
plt.show()
plt.plot(adcout)
plt.show()

PLot results

raw

qunat

sar-adc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sar-adc's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.