Exemple #1
0
        out = Pin(C=ind.p, xoff=100, kind='out', name='out', w=2)
        out_wire = Wire([ind.p, out.C])

        fb = shift_y(R1.n, 100)

        Rt = Resistor(n=with_x(fb, out_wire.m), orient='v')
        Rb = Resistor(p=with_x(fb, out_wire.m), orient='v')
        Wire([Rt.p, with_y(Rt.p, out.C)])
        Ground(C=Rb.n)

        RG = Box(o=C1.n, yoff=175)
        rg2cmp = Wire([RG.o, cmp.ni], kind='-|-')
        Dot(C=with_y(rg2cmp.m, fb), color='white')
        Wire([
            shift_x(RG.C, -30),
            shift(RG.C, -25, 25),
            shift(RG.C, 25, -25),
            shift_x(RG.C, 30)
        ])
        Label(C=RG.S, loc='s', name='ramp_gen')
        Wire([R1.n, fb, Rt.n], kind='|-')

        en = Pin(C=lvl.C, yoff=250, kind='in', name='en', w=2)
        Wire([en.C, shift_x(en.C, 50)])
        avss = Pin(C=en.C, yoff=50, kind='in', name='avss', w=2)
        Wire([avss.C, shift_x(avss.C, 50)])

except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
        Wire([sh.o, sum.W])
        Wire([sum.E, amp.i])
        Wire([shift_x(i.t, 50), adc.i], kind='|-')
        Wire([adc.o, dac.i])
        Wire([dac.o, sum.S], kind='-|')

        # Stages 2, 3, 4
        s2 = Box(N=dac.S, off=(25, 75), name='Stage 2')
        s3 = Box(W=s2.E, xoff=50, name='Stage 3')
        s4 = Box(W=s3.E, xoff=50, name='4 bit', value='Flash')
        Wire([s2.o, s3.i])
        Wire([s3.o, s4.i])
        Wire([
            amp.o,
            shift_x(amp.o, 50),
            shift(s1.SE, 25, 25),
            shift(s2.NW, -25, -25),
            shift_x(s2.W, -25),
            s2.W,
        ])

        # Error correction
        ec = Box(NW=s2.SW,
                 off=(-75, 50),
                 name='Digital Error Correction',
                 w=9,
                 h=1)
        out = Pin(t=shift_x(ec.o, 50), kind='out', name='out', w=2)
        Wire([ec.o, out.t])
        Label(C=shift_x(ec.E, 25), kind='slash', loc='s', name='10')
Exemple #3
0
# Generates schematic as an .svg file.
# Requires svg_schematic:
#     git clone https://github.com/KenKundert/svg_schematic.git
#     cd svg-schematic
#     python3 setup.py --user --upgrade install

from svg_schematic import (Schematic, shift, shift_x, shift_y, midpoint, Box,
                           Ground, Label, Source, Wire)

with Schematic(filename="msnm.svg"):
    v = Source(kind='noise', value='S(f)', orient='v')
    Ground(C=v.n, orient='v')

    m = Source(C=shift_x(v.p, 200), kind='mult')
    Wire([v.p, m.W])
    wm = Wire([m.S, shift_y(m.S, 25)])
    Label(C=wm.e, loc='S', name='m(t)')
    Label(C=midpoint(v.p, m.W), loc='N', name='stationary noise')

    wo = Wire([m.E, shift_x(m.E, 210)])
    Label(C=wo.e, kind='arrow', loc='NW', name='cyclostationary noise')

    Box(C=shift(v.C, 100, -3),
        w=5.5,
        h=3.2,
        line_width=0.5,
        background='none',
        stroke_dasharray="4 2")
    Label,
    Source,
    Wire,
    midpoint,
    shift,
    shift_y,
)
from inform import Error, error, os_error

try:
    with Schematic(filename="oscillator.svg", background='none', line_width=2):

        # resonator
        vdd = Label(loc='n', nudge=10, name=r'$V_{\rm dd}$')
        Wire([vdd.C, shift_y(vdd.C, 25)])
        ll = Inductor(p=shift(vdd.C, -125, 25),
                      orient='v',
                      name=r'$\frac{1}{2} L$')
        lr = Inductor(p=shift(vdd.C, 125, 25),
                      orient='v|',
                      name=r'$\frac{1}{2} L$')
        c = Capacitor(C=midpoint(ll.n, lr.n), orient='h', name='$C$')
        Wire([ll.p, lr.p])
        Wire([ll.n, c.p])
        Wire([lr.n, c.n])

        # gain stage
        ml = MOS(d=ll.n, yoff=75, orient='|')
        mr = MOS(d=lr.n, yoff=75, orient='')
        Wire([ll.n, ml.d])
        Wire([lr.n, mr.d])