Beispiel #1
0
        Label(C=lvl2ref.m, kind='slash', name='6', loc='se')

        amp = Amp(pi=reference.o, xoff=50, kind='oa', name='amp')
        Wire([reference.o, amp.pi])
        C1 = Capacitor(p=amp.C, off=(-12.5, 75), orient='h')
        R1 = Resistor(p=C1.p, xoff=12.5, orient='h')
        C2 = Capacitor(C=midpoint(R1.C, C1.C), yoff=50, orient='h')
        Wire([C1.n, with_y(C1.n, amp.o)], kind='-|')
        Wire([R1.n, amp.ni], kind='|-')
        Wire([C2.p, R1.n], kind='-|')
        Wire([C2.n, C1.n], kind='-|')

        cmp = Amp(pi=amp.o, xoff=125, kind='comp', name='cmp')
        Wire([amp.o, cmp.pi])

        gd = Box(i=cmp.o, xoff=50, name='gate', value='drivers')
        Wire([cmp.o, gd.i])

        pfet = MOS(g=gd.N, yoff=-50, kind='p', orient='h')
        Wire([pfet.g, gd.N])
        Wire([pfet.s, pvdd.C])

        nfet = MOS(g=gd.o, xoff=25, kind='n', orient='v')
        Wire([nfet.g, gd.o])
        Wire([nfet.d, pfet.d], kind='|-')
        Ground(C=nfet.s)

        ind = Inductor(n=with_x(pfet.d, nfet.E), orient='h')
        Wire([pfet.d, ind.n])
        cap = Capacitor(p=ind.p, orient='v')
        Ground(C=cap.n)
Beispiel #2
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")
Beispiel #3
0
from svg_schematic import Schematic, Box, Wire, Label, shift_x, shift_y

with Schematic(filename='network-map.svg', line_width=2):
    # work network
    work = Box(w=6.5, h=4.5, stroke_dasharray="4 2")
    Label(C=work.SW, loc='ne', name='work')
    bastion = Box(S=work.S, yoff=-25, w=5.5, h=2, color='lightgray')
    Wire([bastion.E, shift_x(bastion.E, 75)])
    Label(C=bastion.SW, loc='ne', name='bastion')
    www = Box(NE=bastion.N,
              off=(-12.5, 25),
              w=2,
              h=1,
              color='white',
              name='www')
    mail = Box(NW=bastion.N,
               off=(12.5, 25),
               w=2,
               h=1,
               color='white',
               name='mail')
    dump = Box(SW=bastion.NW, yoff=-25, w=2.5, h=1, name='dump')
    laptop = Box(SE=bastion.NE,
                 yoff=-25,
                 w=2.5,
                 h=1,
                 name='my laptop',
                 stroke_dasharray="2 2")

    # home network
    home = Box(N=work.S, yoff=50, w=6.5, h=2, stroke_dasharray="4 2")
Beispiel #4
0
    rf_in = Pin(kind='in', name='L-band Horn', w=3)
    Label(C=rf_in.C, yoff=15, loc='w', name='fc=1420MHz', w=3.5, nudge=14)
    Label(C=rf_in.C, yoff=30, loc='w', name='BW=15MHz', w=3.5, nudge=14)

    # First preamp
    rf_preamp1 = Amp(i=rf_in.t, xoff=25, kind='se', name='RF Preamp1')
    Label(C=rf_preamp1.S, loc='s', name='A>=26dB')
    Wire([rf_in.t, rf_preamp1.i])

    # Second preamp
    rf_preamp2 = Amp(i=rf_preamp1.o, xoff=25, kind='se', name='RF Preamp2')
    Label(C=rf_preamp2.S, loc='s', name='A>=26dB')
    Wire([rf_preamp1.o, rf_preamp2.i])

    # RF band-pass filter
    rf_bpf = Box(i=rf_preamp2.o, xoff=25, name='RF BPF')
    l = Label(C=rf_bpf.S, loc='s', name='fc=1380MHz')
    Label(C=l.S, name='BW=320MHz')
    Wire([rf_preamp2.o, rf_bpf.i])

    # First RF amplifier
    rf_amp1 = Amp(i=rf_bpf.o, xoff=25, kind='se', name='RF Amp1')
    Label(C=rf_amp1.S, loc='s', name='A<=20dB')
    Wire([rf_bpf.o, rf_amp1.i])

    # Second RF amplifier
    rf_amp2 = Amp(i=rf_amp1.o, xoff=25, kind='se', name='RF Amp2')
    Label(C=rf_amp2.S, loc='s', name='A<=20dB')
    Wire([rf_amp1.o, rf_amp2.i])

    # RF mixer
    midpoint,
    shift_x,
    shift,
    with_x,
    with_y,
)
from inform import Error, error, os_error

try:
    with Schematic(filename='pipeline-adc.svg', line_width=2):

        # Stage 1
        i = Pin(kind='in', name='in')
        s1 = Box(NW=i.t,
                 off=(25, -62.5),
                 w=10.5,
                 h=4.5,
                 background='lightgray')
        Label(C=s1.SE, loc='nw', name='Stage 1')
        adc = Box(W=i.t, off=(75, 100), name='2 bit', value='Flash')
        dac = Box(i=adc.o, xoff=50, name='2 bit', value='DAC')
        sh = Box(C=with_x(i.t, midpoint(adc.C, dac.C)), name='SAH')
        sum = Source(W=with_x(i.t, dac.E), xoff=25, kind='sum', orient='h|')
        Label(C=sum.W, loc='nw', name='+')
        Label(C=sum.S, loc='se', name='−')
        amp = Amp(i=sum.E, xoff=25, kind='se', name='4×')
        Wire([i.t, sh.i])
        Wire([sh.o, sum.W])
        Wire([sum.E, amp.i])
        Wire([shift_x(i.t, 50), adc.i], kind='|-')
        Wire([adc.o, dac.i])
Beispiel #6
0
from svg_schematic import Schematic, Resistor, Box, Label
from inform import Error, error, os_error

try:
    with Schematic(
            filename='tile1.svg',
            background='none',
    ):
        b = Box(w=2, h=2, background='lightgray')
        r = Resistor(C=b.C)
        Label(C=r.C, name='C', loc='s', kind='dot', color='blue', w=2)
        Label(C=r.N, name='N', loc='n', kind='dot', color='blue', w=2)
        Label(C=r.NE, name='NE', loc='ne', kind='dot', color='blue', w=2)
        Label(C=r.E, name='E', loc='e', kind='dot', color='blue', w=2)
        Label(C=r.SE, name='SE', loc='se', kind='dot', color='blue', w=2)
        Label(C=r.S, name='S', loc='s', kind='dot', color='blue', w=2)
        Label(C=r.SW, name='SW', loc='sw', kind='dot', color='blue', w=2)
        Label(C=r.W, name='W', loc='w', kind='dot', color='blue', w=2)
        Label(C=r.NW, name='NW', loc='nw', kind='dot', color='blue', w=2)

        b = Box(C=b.C, xoff=200, w=2, h=2, background='lightgray')
        r = Resistor(C=b.C, orient='v')
        Label(C=r.C, name='C', loc='e', kind='dot', color='blue', w=2)
        Label(C=r.N, name='N', loc='n', kind='dot', color='blue', w=2)
        Label(C=r.NE, name='NE', loc='ne', kind='dot', color='blue', w=2)
        Label(C=r.E, name='E', loc='e', kind='dot', color='blue', w=2)
        Label(C=r.SE, name='SE', loc='se', kind='dot', color='blue', w=2)
        Label(C=r.S, name='S', loc='s', kind='dot', color='blue', w=2)
        Label(C=r.SW, name='SW', loc='sw', kind='dot', color='blue', w=2)
        Label(C=r.W, name='W', loc='w', kind='dot', color='blue', w=2)
        Label(C=r.NW, name='NW', loc='nw', kind='dot', color='blue', w=2)
Beispiel #7
0
from svg_schematic import Schematic, Box, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='box.svg'):
        b = Box(name='4 bit', value='Flash')
        Label(C=b.i, name='i', loc='w', kind='dot', color='blue')
        Label(C=b.o, name='o', loc='e', kind='dot', color='blue')

        b = Box(name='𝘻⁻¹', w=1, h=1, C=b.C, xoff=150)
        Label(C=b.i, name='i', loc='w', kind='dot', color='blue')
        Label(C=b.o, name='o', loc='e', kind='dot', color='blue')
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Beispiel #8
0
#!/usr/bin/env python3

from svg_schematic import Schematic, Amp, Box, Label, Pin, Source, Wire, shift_x
from inform import Error, error, os_error

try:
    with Schematic(
        filename = "feedback.svg",
        font_size=16,
        font_family='serif'
    ):

        summer = Source(kind='sum')
        amp = Amp(W=summer.E, xoff=25, name='$a$', kind='se')
        fb = Box(C=amp.C, yoff=100, name='$f$', h=1, orient='|')
        Label(C=summer.W, name='$+$', loc='nw')
        Label(C=summer.S, name='$-$', loc='sw')
        i = Pin(C=summer.W, xoff=-50, name='in', kind='in')
        o = Pin(C=amp.E, xoff=50, name='out', kind='out')

        Wire([i.C, summer.W])
        Wire([summer.E, amp.i])
        Wire([amp.E, o.C])
        Wire([shift_x(amp.E, 25), fb.i], kind='|-')
        Wire([summer.S, fb.W], kind='|-')

except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))