.DSN File Format

Specctra design file

Introduction

A Specctra design file describes a printed circuit board for an autorouter: its layers and outline, the design rules, the placed components with their footprints and pads, the nets to be connected and any wiring that already exists. Board editors such as KiCad export it, and routers such as Freerouting read it. The result of routing normally comes back in a session file (.ses). The design language belongs to the Specctra router, now a Cadence product. This page describes the format as the open source code of KiCad and Freerouting reads and writes it, so it covers what those programs handle rather than the whole language.

The extension .dsn is also used by unrelated files, among them ODBC file data source names and OrCAD Capture schematic designs.

Text rules

  • The file is text made of nested lists. Each list is written (keyword item …), and an item is a word, a number, a string or another list. White space and line breaks separate items.
  • Numbers are integers or decimal fractions, optionally signed and with an exponent.
  • A name that contains spaces or brackets is quoted. The parser section can name the quote character with (string_quote "); KiCad accepts ", ' or $ there and treats no character as an escape inside a quoted name. (space_in_quoted_tokens on) allows a space inside the quotes.
  • Comments differ between readers. KiCad skips a line whose first visible character is #. Freerouting also takes a # that starts a word later in a line as a comment to the end of that line, and skips /* … */.
  • A pin is referred to as the component name and pin name joined by a hyphen, such as U1-14. KiCad splits an unquoted reference at the first hyphen; either half may be quoted, as in "U-1"-"14".

File and parser

(pcb "board.dsn"
  (parser
    (string_quote ")
    (space_in_quoted_tokens on)
    (host_cad "KiCad's Pcbnew")
    (host_version "5.1.5")
  )
  (resolution um 10)
  (unit um)
  (structure …)
  (placement …)
  (library …)
  (network …)
  (wiring …)
)

The whole file is one pcb list whose first item names the design. KiCad accepts each of parser, unit, resolution, structure, placement, library, network and wiring once.

Item in parserMeaning
string_quote cquote character
space_in_quoted_tokens on|offwhether quoted names may contain spaces
host_cad name, host_version textprogram that wrote the file
constant name valuea named constant
write_resolution letter na letter and a positive integer
routes_include testpoint|guide|image_conductorkinds of object that routes include
wires_include testpointkinds of object that wires include
case_sensitive on|offwhether names are case-sensitive
via_rotate_first on|offorder of via transformation
generated_by_freeroute, generated_by_freeroutingmark left by Freerouting (older and current spelling)

Units and coordinates

(unit u) sets the unit in which lengths are written, and (resolution u n) gives a unit and the number of steps into which it is divided. The units are inch, mil, cm, mm and um. KiCad writes (resolution um 10) and (unit um): coordinates in the design are then micrometres, with decimals where needed, and the finest step is 0.1 µm. structure, placement, library, a single padstack or image and wiring can carry their own unit or resolution.

The y axis points up. KiCad, whose own y axis points down, negates every y value. Angles are in degrees.

Shapes

Outlines, pads, keepouts and wires use the same shape lists. The first item names a layer; in KiCad output the board boundary uses the layer name pcb and footprint outlines use signal.

ShapeContents
(rect layer x1 y1 x2 y2)rectangle between two corners
(circle layer diameter [x y])circle, by diameter, with an optional centre
(path layer width x y x y …)line through the points, drawn with the width; may end with (aperture_type round|square)
(polygon layer width x y x y …)polygon, written like a path
(polyline_path …), (polygon_path …)further path forms; KiCad reads polyline_path as a path, and Freerouting knows both in wires
(qarc layer width x1 y1 x2 y2 x3 y3)quarter arc: start point, end point and centre

A (window shape) list inside a keepout, plane, padstack shape or wire cuts a hole.

Structure

(structure
  (layer F.Cu (type signal) (property (index 0)))
  (layer B.Cu (type signal) (property (index 1)))
  (boundary (path pcb 0  153035 -98425  106045 -98425  106045 -73025
                         153035 -73025  153035 -98425))
  (via "Via[0-1]_800:400_um")
  (rule
    (width 250)
    (clearance 200.1)
    (clearance 200.1 (type default_smd))
    (clearance 50 (type smd_smd))
  )
)
ItemContents
layer name …one routing layer, listed in stack order; its parts are below
boundaryboard outline, as one rect or one or more path lists
place_boundaryarea for placement; KiCad also reads a second boundary as this
planea copper area, written like a keepout with the net as its name
keepout, via_keepout, wire_keepout, place_keepout, bend_keepout, elongate_keepoutforbidden area: optional name, sequence_number, rule or place_rule, one shape and any windows
regionoptional name, a rect or polygon, one of region_net, region_class or region_class_class, and a rule
via name … [(spare name …)]padstacks that may be used as vias, with spare ones
grid via|wire|via_keepout|snap|place sizegrid spacing; optionally (direction x|y), (offset n) (not for place) or (image_type smd|pin) (place only)
controlrouter switches, such as (via_at_smd on); KiCad also accepts off_grid, route_to_fanout_only, force_to_terminal_point, same_net_checking, checking_trim_by_pin, noise_calculation, noise_accumulation, include_pins_in_crosstalk, bbv_ctr2ctr, average_pair_length, crosstalk_model, roundoff_rotation, microvia and reroute_order_viols, each with one value
snap_angleallowed wire angles; Freerouting knows ninety_degree, fortyfive_degree and none
rule, place_ruleboard-wide rules
layer_noise_weight(layer_pair layer layer weight) entries
flip_style, autoroute_settingsread here by Freerouting; autoroute_settings holds its own router options

Layers

PartValues
typesignal, power, mixed or jumper; KiCad writes its mixed layers as signal because Freerouting does not take mixed
directionhorizontal, vertical, orthogonal, positive_diagonal, negative_diagonal, diagonal or off; hori and vert also occur
costforbidden, high, medium, low, free or an integer, optionally followed by (type length|way)
use_netnets assigned to the layer
rule, propertylayer rules, and name and value pairs such as (index 0)

Rules

A rule list holds entries such as (width 250) and (clearance 200.1). A clearance may be limited to a pairing of object kinds with (type …): KiCad writes default_smd and smd_smd, the latter for the spacing between surface-mount pads, and Freerouting writes smd_to_turn_gap. Freerouting also reads length and meander settings. A layer_rule list names layers and gives a rule for them.

Placement

(placement
  (component "TE_1-84953-5:TE_1-84953-5"
    (place U1 111410 -85550 front 90 (PN "1-84953-5"))
  )
)

Each component names an image from the library and holds a place list for every instance: reference name, then position, side (front or back) and rotation. When it imports a placement, KiCad takes the rotation of a front-side part as written and adds 180 degrees to that of a back-side part to get its own orientation.

Option of placeValues
mirrorx, y, xy or off
statusadded, deleted or substituted
lock_typeposition, gate, subgate or pin
PNpart number
logical_partname of a logical part
rule, region, place_rule, propertyrules and properties of this instance

The placement section may also carry unit or resolution, and a place_control list whose flip_style is mirror_first or rotate_first.

Library

(library
  (image "Footprint"
    (outline (path signal 127  -9050 8600  9050 8600))
    (pin Round[A]Pad_1358_um S1 -8900 -5720)
    (pin Rect[T]Pad_350x1800_um A1 -6600 5180)
  )
  (padstack Round[A]Pad_1358_um
    (shape (circle F.Cu 1358))
    (shape (circle B.Cu 1358))
    (attach off)
  )
  (padstack Rect[T]Pad_350x1800_um
    (shape (rect F.Cu -175 -900 175 900))
    (attach off)
  )
)

Images

An image is a footprint, with coordinates relative to its origin. It may give side (front, back or both) and unit, and holds outline shapes, pins, keepouts and rules. A pin is (pin padstack [(rotate degrees)] name x y).

Padstacks

ItemContents
shapeone shape on one layer, optionally with (connect on|off) and windows
attach on|off [(use_via name)]whether a via may be attached at the pad, and with which via
rotate on|off, absolute on|offhow the padstack's orientation is treated
unit, ruleits own unit and rules

Padstack names are free text. Those that KiCad generates encode the shape and size, and a via name such as Via[0-1]_800:400_um gives the first and last copper layer index, the diameter and the drill size; KiCad reads the drill size back from that name when importing a session.

Network

(network
  (net /MIPI_CSI_D0_N
    (pins J2-A2 U1-2)
  )
  (class kicad_default +3V3 /I2C_SCL /I2C_SDA
    (circuit (use_via Via[0-1]_800:400_um))
    (rule (width 250) (clearance 200.1))
  )
)
Item of netContents
pins, orderthe pins on the net, unordered or in order
unassigned, net_number nflag and number
type fix|normalwhether the net is fixed
fromto from toone required connection, with (type fix|normal|soft), net and rules
comp_orderorder of components along the net
expose, noexpose, source, load, terminatorpins given these roles
rule, layer_rulerules for the net

A class list gives a name, the member nets and their shared rule, layer_rule, circuit and topology lists. circuit constrains routing, for instance with use_via, use_layer or length. Freerouting additionally reads via and via_rule lists in the network, via_rule, clearance_class, shove_fixed and pull_tight in a class, and class_class lists, which name two or more classes and give rules between them.

Wiring

(wiring
  (wire (path F.Cu 250  1000 -2000  3000 -2000) (net GND) (type protect))
  (via "Via[0-1]_800:400_um" 3000 -2000 (net GND) (type protect))
)
ItemContents
wire shape …a path, qarc or other shape of copper, followed by options
via padstack x y …a padstack placed at one or more points
net namenet of the wire or via
typefix, route, normal or protect; Freerouting also reads shove_fixed
attrfor a wire test, fanout, bus or jumper; for a via test, fanout, jumper or virtual_pin name
turret n, shield net, connect, windowfurther wire options
via_number n, contact layer …further via options
supplymarks a power or ground connection
clearance_classread by Freerouting

Recognising the file

After any white space and comments the file starts with (pcb followed by a name, and normally contains a structure list. KiCad board files start (kicad_pcb and are a different format.

Not described

The explorer has no Specctra viewer, so a dropped file shows as text.

Known, not yet covered

  • Reference: the full design language of the Specctra router, whose manual is proprietary and was not used here. Constructs that neither program handles completely include the other resolution and unit kinds (such as capacitance, resistance and time), file descriptors other than a whole design, floor plan, part library and colour sections, image conductors and vias, jumper, via array template and image directory entries of the library, circuit, supply, group, pair and bundle entries of the network, virtual pins, test points and supply pins of the wiring, and composite names.
  • Reference: the parts of place_rule, circuit, topology, autoroute_settings and many rule entries, and the exact meaning of most control switches.
  • Reference: required order of items, default values and differences between router versions.
  • Viewer: no board view.

Links

Software

  • Freerouting – open source autorouter that reads design files and writes session files (Windows, macOS, Linux)
  • KiCad – open source circuit board editor that exports design files and imports session files (Windows, macOS, Linux)

Developers

Reference