wilkinson_tree module#
A fenced 1:4 Wilkinson divider tree, built in code from one 1:2 cell.
WilkinsonCell is one 1:2 divider. WilkinsonTree puts three of them in
a tree, one cell feeding two, so the circuit hierarchy follows the RF tree.
WilkinsonFeed adds an input connector, four output connectors and the
code routes between them, and a timing constraint asks the router to match
the four paths from the input to each output. Everything is placed with
.at(); the placer moves nothing.
The numbers are the example’s inputs, chosen for illustration, not validated
RF performance: 5.8 GHz, effective permittivity 4.4, 0.3 mm lines, 0.18 mm
arms (0.6 times the line width), a 2.0 mm input stub, a 100 ohm 0201
isolation resistor, 20 mm output pitch, 20 mm between stages, 2.0 mm
straight exits, 0.2 mm tangency squares 1.0 mm off the trace, and a 0.5 ps
timing tolerance against output 0. The line is declared 50 ohm
(rf_structure) and the arm 70.7 ohm (arm_structure), but both
impedances are labels on those widths. The board uses the sample substrate,
0.75 mm from top copper to bottom copper, with no dielectric constant set,
which does not realize either one; nothing here solves a width for an
impedance.
The example ports an earlier experiment. It drops that experiment’s soldermask openings over the dividers and along the lines, and its stackup with its reference and keepout layers. It keeps the experiment’s arc guards.
The cell#
Body. Each arm is a guided quarter wavelength, c / f / sqrt(er) / 4 = 6.160 mm, bent into an arc whose ends land on the isolation resistor’s pads.
pad_pitchreads the pad spacing from the resistor’s landpattern (0.672 mm for the 0201 used here), andarc_anglesolves the sweep: 170.65 degrees on a 2.068 mm radius per arm.CellGeometryraisesValueErrorfor a sweep outside 30 to 175 degrees or a radius under twice the arm width. Each output stub leaves its arm’s end along -y for 0.6 mm, then turns outward for 2.0 mm to its output pad. An arm and its stub share copper only inside the resistor pad they both end on, so the arm runs its full quarter wave before its output. The two stubs’ first legs are 0.372 mm apart, edge to edge, inside the body; the outward legs put the two output pads 4.672 mm apart, centre to centre, which holds the cell’s straight exits to the floor under “The joins”. The stubs and arms are buffered with flat ends, mitred at the turns, and unioned into one polygon, drawn asOverlappableCopper, which is on no net and which the router and the overlap checks ignore.PolylineandArcPolylinetake no end-cap argument on jitx 4.6.0, and in the Python conversion they get round caps (a 1 mm, 0.3 mm widePolylineconverts to 0.3706 mm squared, not 0.3; what the runtime draws was not checked). One flat-ended polygon has no round caps to stick out where an arm meets a stub.Port pads.
CellPorts, an embedded part that is not soldered and not in the BOM, puts a pad the width of the line at the input and at each output, where the body ends, with no soldermask opening. Routes end on those pads. ABridgingPinModelfrom the input to each output carries the delay and loss of the drawn centreline (10.760 mm of line, 75.29 ps), so the timing constraint resolves through the cell. AVirtualConnectionfrom each output pad to its resistor pad says the body joins them, so they report no ratsnest;jitx.virtualis marked experimental.Isolation resistor.
jitxlib.parts.Resistor(resistance=100 ohm, case="0201"). In this repository it resolves offline, through the parts chain inpyproject.toml, fromsrc/jitxexamples/parts/example-passives.csv.Keepouts.
body_keepoutcovers the body grown by the 0.15 mm clearance, on the RF layer, for pours, routes and vias, so pours and routes stay off the body. The pour does not avoid the body by itself: withpour=Falseon this keepout, the top pour covers part of each body.resistor_keepoutcovers the rectangle over the resistor’s two pads and the gap between them, grown the same way, for pours and vias. There is no via keepout over the ring the arms make: one there removes every fence via inside the ring, the first row of the region fence included, and leaves the inside of the loop unfenced.Region fence.
fence_pouris a groundPourwhose outline is the body copper itself, on the ground layer, where the fence via stops. It carriesBodyFenceTag, and the substrate’sfence_viarule on that tag puts two rows of vias around it, as infenced_pour_outline, so the body is fenced like a trace: the first row stands 0.6 mm off the body copper all the way round, inside the loop as well as outside it. On the ground layer the pour realizes as the body’s copper. Drawn on the RF layer instead, inside the body keepout, it realizes empty, but its fence still stands, so either layer gives the same fence. A fence pour grown past the body copper moves the rows off the body by the growth. The pour gets its ground from the cell’sGNDport, which joins nothing else inside the cell, so the runtime log of each build warns “The following circuit port(s) have no internal connections” for each cell’sGND.
The joins#
Every line leaves a cell port or a connector straight along the pad’s axis
to a route point: at a cell, TANGENT_LENGTH past the pad’s outer edge,
and at a connector, the same distance past the inner end of the connector’s
centre pad. Their positions follow from the pads; no designer places them.
Where the line turns past that route point, a square of ground copper on the
inside of the turn sets the bend (tangency_square): TANGENCY_SQUARE
(0.2 mm) on a side, from the route point to 0.2 mm past it along the axis,
its near side TANGENCY_CLEARANCE (1.0 mm) off the trace’s copper edge.
The squares carry TangencyTag, and
design_constraint(TangencyTag(), RFLineTag()).clearance(1.0) holds the
lines’ copper that far from them. A plain route then holds the axis past the
square’s far edge and bends around its corner on a centre-line radius of
half the trace plus the clearance, 1.15 mm, so the clearance to the square
sets the bend. A square nearer the trace than the clearance leaves the route
unrealized, and a rule clearance under the structure’s own loses to it. The
square is copper, not a keepout: a route keepout gets no clearance, so the
line runs along its edge and bends at half the trace whatever the clearance.
The input line runs straight on. Each of its two squares, one past each
end’s route point, sits to the left of its own exit’s axis, and the two axes
point opposite ways, so the squares sit on opposite sides of the line, each
the clearance off its copper edge. The line is straight, so neither sets a
bend; they are there so that every port and connector exit has its square.
Each join and each output feed is a Section of five routes: the straight
exit; a plain route around the exit’s square to a bend route point
BEND_REACH (3.0 mm) on, 45 degrees off the axis toward the turn; a middle
route with Route.Config(envelope_overhead=ENVELOPE), a region 3.0 mm
wider than the trace in which the router may meander it to meet the timing
constraint; the same bend at the far end; and the straight entry. The middle
route runs only between the bend points because a route with an envelope
does not keep the clearance to tagged copper: its copper can reach a square
and no issue is reported. The translator also warns that length-matched
routes should end at route points, which can resize to fit the meander
envelope.
The routes run on rf_structure, whose RoutingStructure.Layer.fence
adds two rows of ground vias along each route. A routing_structure rule
on RFLineTag applies it to every RF net, with the board ground as
reference net. The first cell sits FEED_OFFSET below the tree’s axis, so
the two joins differ in length and the router has something to match.
A cell’s straight exits, each from its port pad along the pad’s axis to
its square’s far edge, stand at least the floor apart at their closest,
whichever way they point. The floor is set by two lines leaving side by
side, so that neither line’s fence rows crowd the other’s: each line’s
outer fence row, 1.35 mm off its centre line, twice, plus the space
between two fence via centres, 0.554 mm for this via’s 0.3 mm drill and
the sample fabrication
constraints’ 0.254 mm min_hole_to_hole, 3.254 mm in all. Here the two
output exits are collinear and leave in opposite directions, so they are
closest at the output pads, 4.672 mm apart.
The connectors are Würth Elektronik 60312202114514 WR-SMA end launch jacks
(components/connectors/wurth_elektronik_60312202114514). Each sits with
its body face on a board edge and its centre pad running into the board: the
input on the left edge and the four outputs on the right, which sets the
board’s width. The part has ground pads on the top and on the bottom, so the
ground plane on the bottom layer has a ground object on its layer and fills
with no via placed to anchor it. The connector’s 1.73 mm slot is for a
1.6 mm board, so it would not clamp this one; the example uses the part for
its land pattern. The component module keeps the URL of the vendor’s HFSS
model for later use. The pads start at the board edge, closer to it than
the sample fabrication constraints’ 0.5 mm min_copper_edge_space
allows. Land-pattern pads are placed as drawn, and pads closer to the edge
than min_copper_edge_space raise no design issue, so confirm the edge
distance with your fabricator and check realized copper with your
fabricator’s design rule check.
ConstrainReferenceDifference bounds each output against output 0, so two
other outputs can differ by up to twice the tolerance. At 0.5 ps against
output 0, any two outputs fall within 1 ps, 2.09 degrees at 5.8 GHz.
The design builds with every route routed and the timing constraint met. The router meanders until each output stands just inside the 0.5 ps tolerance of output 0, so the worst pair, an output on each side of output 0, differs by just under 1 ps. The top pour stops the body keepout’s 0.15 mm from every body and covers none of it.
The region fence’s first row stands all the way round inside the loop.
Its second row comes back with few vias; why is not known. Five of the
six output exits keep both route fence rows on both sides. Along the exit
of the first output section (feeds[0]), the outer row on the inside of
the turn comes back with no vias; why is not known. Count the rows in your own build if your design
depends on them.
- SPEED_OF_LIGHT = 299792458000.0#
Speed of light in vacuum, in mm/s.
- FREQUENCY = 5800000000.0#
Design frequency, in Hz.
- EFFECTIVE_ER = 4.4#
Effective relative permittivity of the microstrip.
- Z0 = 50.0#
System impedance, in ohms. The isolation resistor is twice this.
- TRACE_WIDTH = 0.3#
Width of the lines and stubs, in mm, labelled 50 ohm in
rf_structure.
- ARM_WIDTH = 0.18#
0.6 times the line width.
arm_structuredeclares it as the 70.7 ohm arm line, and the body reads it from there.- Type:
Width of the arms, in mm
- INPUT_STUB_LENGTH = 2.0#
Length of the stub from the input pad to the arms, in mm.
- OUTPUT_DROP = 0.6#
Length of each output stub’s first leg, along -y from its arm’s end, in mm.
- OUTPUT_STUB_LENGTH = 2.0#
Length of each output stub’s second leg, outward from the turn to the output pad, in mm. The exit floor under “The joins” needs 1.29 mm here. With legs from 1.3 to 1.9 mm, the region fence’s first row inside the loop came back with a via missing beside a route fence via, for a reason not known; at 2.0 mm the row stands full.
- MIN_ARC_DEGREES = 30.0#
Smallest arm sweep the cell accepts, in degrees.
- MAX_ARC_DEGREES = 175.0#
Largest arm sweep the cell accepts, in degrees.
- RESISTOR_CASE = '0201'#
Package of the isolation resistor.
- CLEARANCE = 0.15#
Gap from RF copper to other copper on the RF layer, in mm.
- INSERTION_LOSS = 0.05#
Line loss, in dB/mm.
- RF_LAYER = 0#
Layer of the lines and the divider bodies.
- GROUND_LAYER = 1#
Reference plane layer, and the layer the fence via stops on.
- FENCE_VIA#
Via used by both fences: 0.45 mm pad, 0.3 mm drill.
- FENCE_PATTERN = ViaFencePattern(pitch=1.0, offset=0.6, num_rows=2, min_pitch=None, max_pitch=None, initial_offset=0.6, input_shape_only=None)#
Two rows at 1.0 mm pitch, the first 0.6 mm out from the copper edge and the second 0.6 mm beyond it.
- OUTPUT_PITCH = 20.0#
Distance between neighbouring output connectors, in mm. The second-stage cells sit at plus and minus this, so they are twice it apart, each centred between its two connectors.
- STAGE_SPACING = 20.0#
Distance from the first cell to the second-stage cells, in mm.
- FEED_OFFSET = 4.0#
How far the first cell sits below the tree’s axis, in mm. It makes the two joins differ in length.
- ENVELOPE = 3.0#
Width, beyond the trace, of the region each matched section may meander in, in mm.
- INPUT_RUN = 15.0#
Distance along x from the input connector to the first cell, in mm. The output connectors sit
STAGE_SPACINGbeyond the second-stage cells.
- BOARD_MARGIN = 10.0#
Board edge distance beyond the outermost output connectors along y, in mm.
- BOARD_WIDTH = 55.0#
the input-to-output connector span. The connectors are end launches, so their body faces sit on the left and right board edges.
- Type:
Board width along x, in mm
- BOARD_HEIGHT = 80.0#
the span of the four output connectors plus the margin on each side.
- Type:
Board height along y, in mm
- TIMING_TOLERANCE = 5e-13#
Allowed delay difference from output 0 to each other output, in s. Any two outputs then differ by at most twice this, 1 ps.
- TANGENT_LENGTH = 2.0#
How far each port’s straight exit runs past the pad’s outer edge, in mm, to its route point.
- TANGENCY_SQUARE = 0.2#
Side of the ground copper square past each exit’s route point, in mm.
- TANGENCY_CLEARANCE = 1.0#
Clearance from a line’s copper to each tangency square, in mm. The square’s near side stands this far off the trace’s copper edge, and the line bends around the square’s corner on a centre-line radius of half the trace plus this.
- BEND_REACH = 3.0#
How far each section’s bend route point stands from its exit’s route point, in mm, at 45 degrees off the exit’s axis toward the turn: clear of the square, so the matched route starts and ends clear of it.
- IN_DIRECTION = (0.0, 1.0)#
Direction a line leaves the input pad by, in the cell’s frame.
- OUT_A_DIRECTION = (-1.0, 0.0)#
Direction a line leaves output A by, in the cell’s frame.
- OUT_B_DIRECTION = (1.0, 0.0)#
Direction a line leaves output B by, in the cell’s frame.
- arc_angle(length, chord)[source]#
Half the sweep, in radians, of an arc of
lengthwhose ends arechordapart: the root oflength * sin(t) / t = chordon (0, pi). With the radiuslength / (2 * t), each half of the arc turns throught.
- pad_pitch(part)[source]#
Centre-to-centre distance of a two-terminal part’s pads, read from its landpattern.
- class CellGeometry(quarter_wave, arm_width, angle, radius, input_pad, out_a, out_b, arm_end_a, arm_end_b)[source]#
Bases:
objectOne cell’s copper in its own frame: the input pad above the origin, the two arms leaving the origin left and right and curling down to end on the resistor’s pads, and the output stubs leaving the arm ends straight down, then turning outward to the output pads.
- Parameters:
- classmethod from_inputs(resistor_pitch, arm_width)[source]#
Solve the arms so their ends are
resistor_pitchapart.Raises
ValueErrorwhen an arm would sweep less than 30 or more than 175 degrees, or when the arc radius is under twice the arm width: the guards of the experiment this example comes from.- Return type:
- Parameters:
- class PortPad[source]#
Bases:
PadA square pad the width of the line, where a route meets the body. It sits mid-line and nothing is soldered to it, so it has no soldermask opening.
- class CellPortPads(g)[source]#
Bases:
Landpattern- Parameters:
g (CellGeometry)
- class CellPorts(g)[source]#
Bases:
ComponentThe cell’s three port pads, the ends routes attach to.
- Parameters:
g (CellGeometry)
- reference_designator_prefix: str | None = 'X'#
Reference designator prefix for this component. This will be used to generate a unique reference designator for each component of the same type.
Note
This field is a required data point for matching components between builds. If this value changes (including changing from unset to set), it will be treated as a new component, even if nothing else changes.
- in_bom: bool | None = False#
Whether this component is in the bill of materials. If unset, defers to the parent
Circuit’sin_bomattribute. If a component is not in the bill of materials, then it can be considered to be non-populated.
- soldered: bool | None = False#
Whether this component is soldered on the board. If unset, defers to the parent
Circuit’ssolderedattribute. If a component is not soldered on the board but in the bill of materials, then it can be considered to a component that is orderable such as a jumper, screw or other mechanical components but not attached via a standard soldering process.
- sig_in = Port()#
- sig_out_a = Port()#
- sig_out_b = Port()#
- class BodyFenceTag[source]#
Bases:
TagPours drawn in a cell body’s outline: fence vias go around them.
- class WilkinsonSubstrate(*args, **kwargs)[source]#
Bases:
SampleSubstrateThe two-layer sample substrate with the body fence rule attached.
- body_fence = UnaryDesignConstraint(BodyFenceTag, name=None, priority=0).fence_via(FenceVia(definition=<class 'jitx.sample.SampleSubstrate.THVia'>, pattern=ViaFencePattern(pitch=1.0, offset=0.6, num_rows=2, min_pitch=None, max_pitch=None, initial_offset=0.6, input_shape_only=None)))#
- tangent_end(placement, pad, direction)[source]#
End of a port’s straight exit,
TANGENT_LENGTHpast the pad’s outer edge, mapped byplacementfrom the cell’s frame into the caller’s.
- mapped_direction(placement, direction)[source]#
directionin the cell’s frame, turned byplacementinto the caller’s frame.
- turn_side(point, direction, toward)[source]#
The side of a line leaving
pointalongdirectionthattowardlies on: 1 for its left, -1 for its right. The line turns that way, so that is the inside of the turn.
- tangency_square(point, direction, side)[source]#
The square past an exit’s route point
point, onside(1 for the left ofdirection, -1 for its right): from the point toTANGENCY_SQUAREfurther alongdirection, its near sideTANGENCY_CLEARANCEoff the trace’s copper edge.
- bend_point(point, direction, side)[source]#
BEND_REACHfrompoint, 45 degrees offdirectiontowardside(1 for its left).
- class TangencyTag[source]#
Bases:
TagCopper the lines keep
TANGENCY_CLEARANCEfrom: the squares that set their bends.
- class WilkinsonCell[source]#
Bases:
CircuitOne 1:2 Wilkinson divider, fenced, with tangent ports.
Connect
GNDto the board ground; the region fence is on that net.- sig_in = Port()#
- sig_out_a = Port()#
- sig_out_b = Port()#
- GND = Port()#
- arm_structure()[source]#
The arm line, declared 70.7 ohm (Z0 times the square root of 2, what a Wilkinson arm needs) at
ARM_WIDTH. The impedance is a label: nothing here solves the width for it. Build it inside a circuit’s__init__, likerf_structure.- Return type:
- rf_structure()[source]#
The fenced microstrip the routes use, declared 50 ohm. Build it inside a circuit’s
__init__: aRoutingStructurebuilt at module level fails to translate.- Return type:
- class Section(net, gnd, src, src_point, src_direction, dst, dst_point, dst_direction, envelope)[source]#
Bases:
ContainerA join between two pads, in five routes: a straight exit to a route point on the source pad’s axis, a bend around that exit’s tangency square to a second route point, a middle the router may meander within
envelope, the same bend at the far end, and a straight entry.src_pointanddst_pointare the exits’ route points andsrc_directionanddst_directiontheir axes, pointing away from the pads. Each square goes on the inside of its exit’s turn, the side the other end lies on, and joinsgnd. The route points follow from the pads and the stated lengths; nothing here is a designer’s choice.
- class WilkinsonTree(envelope=3.0)[source]#
Bases:
CircuitThree cells as a 1:4 tree: one cell feeding two.
rf_outruns from the bottom output to the top one.- Parameters:
envelope (float)
- rf_in = Port()#
- rf_out = [Port(), Port(), Port(), Port()]#
- GND = Port()#
- class WilkinsonFeed(envelope=3.0)[source]#
Bases:
CircuitThe tree between one input connector and four output connectors.
- Parameters:
envelope (float)