Coordinate scale: dbuPerMicron and dbuPerEditorUnit

How integer DBU in Block geometry map to layout microns and schematic editor units

Two scale fields on CellContent

FieldUsed forTypical value
dbuPerMicron Layout views (GDS, OAS). Physical size: how many integer DBU equal one micron. 1000 (GDS UNITS record)
dbuPerEditorUnit Schematic / symbol views. How many integer DBU equal 1.0 native editor coordinate in the source tool file. 1 (Qucs), 1000 (Xschem)

All coordinates in Point, Instance::transform(), wire paths, and pin positions are stored as signed integer DBU in ROOM. Exporters divide by the appropriate scale; importers multiply. Grid snap (Grid=10,10 in Qucs, SNAP in Xschem) stays in editor metadata — it is not the same as DBU scale.

Conversion (schematic / symbol)

// utils/coord_scale.h
DBU       = round(editor_coord × dbuPerEditorUnit)
editor_coord = DBU / dbuPerEditorUnit

effectiveDbuPerEditorUnit(content)  // uses stored value, or infers from SourceInfo::format()

Per-tool defaults

ImporterdbuPerEditorUnitSourceInfo::format()Example
QucsImporter1qucs.sch coord 270 → DBU 270
XschemImporter1000xschem.sch coord 270.5 → DBU 270500
GdsImportern/alayoutUses dbuPerMicron from GDS UNITS

On disk (schema/database.capnp)

struct CellContent {
  viewType         @0 :ViewType;
  dbuPerMicron     @1 :Float64;
  properties       @2 :List(Property);
  payload          @3 :ViewPayload;
  dbuPerEditorUnit @4 :Float64;  // 0 = infer on read (legacy files)
}

Migration

Older .room files may have dbuPerEditorUnit = 0 (unset). Readers call effectiveDbuPerEditorUnit(): qucs → 1, xschem → 1000. Re-import from the native tool to persist the field explicitly. TextDumper prints both scales per view.

Orientation helpers

coord_scale.h also provides Qucs/Xschem placement mapping used during cross-tool export:

FunctionPurpose
orientToQucsPlacement / orientFromQucsPlacementMap Orient ↔ Qucs mirror/rotate fields
orientFromQucsLibToNativePdkQucs LibComp E–W ports → native PDK N–S symbols
qucsLibNeedsEwToNsCompensateDetect IHP LibComp vs native symbol orientation mismatch

Wire endpoint alignment uses pin_retarget on top of these scales.

Qucs ↔ ROOM ↔ Xschem

A Qucs schematic opened in Xschem goes through ROOM export (XschemExporter / xschem_bridge). Qucs component types are mapped to Xschem symbols (e.g. GND → gnd.sym; PDK cells resolve via PrimitiveResolver). Coordinates use the view's dbuPerEditorUnit, so Qucs DBU and Xschem editor units stay consistent without ad-hoc divisors.

See also: Qucs example · Xschem example · Schema evolution