The SOURCE file format, also called a SOU file, comes from the 1970s and was widely used in the Eastern Bloc. It is the topology format of the Kulon-1 workstation. A design is a set of binary files, one file for each cell. A cell name has at most six characters, and the file carries that name. Coordinates are integers in steps of 0.1 micrometre. The origin is the lower left corner. X increases to the right and Y increases upwards. The file itself does not store the unit.
A record is a run of 16-bit words. The first word holds the record code in its high byte and the length in its low byte. The length is the number of words that follow. The top bit of the code is the direction of a path, an inclined rectangle or a polygon. Clear means counter-clockwise, set means clockwise. The TextEditor writes this as dir=ccw or dir=cw.
Records are packed in blocks of 256 words, which is 512 bytes. When the next record would cross a block boundary, an EMPTY record fills the rest of the block. The last block of a file is the auxiliary BLOCK. It always occupies 256 words. In files from the original tools the first byte of that block is 74, so the first word is 002112 octal.
| Record | Code | Contents |
|---|---|---|
| RECTANGLE | 3 | An axis-aligned rectangle. y1, x1 and y2, x2 are opposite corners. |
| PATH | 7 | A closed outline of constant width. The first segment is the width. |
| INCLINED | 9 | A rectangle with slanted sides, given by four corners. |
| EXPOSITION | 15 | A rectangle used where a circle or a ring was approximated. angle 0 gives two corners. Any other angle is degrees times 10 and uses the side projections d1, d4, d3 and d2. |
| POLYGON | 23 | A polygon. Corners are pt. aminy, aminx, amaxy and amaxx are byte offsets to the extreme coordinates. |
| LINE | 23 | The same record with aminy 1085. The outline may stay open. |
| CELL | 2 | A reference to another cell. The name has six characters. orient, y and x place it. |
| ARRAY | 10 | A repeated reference. kx and ky are the counts, lx and ly the steps. |
| TEXT | 1 | A text of at most 80 characters, with orient, height and type. |
| EMPTY | 0 | Padding to the end of a 256-word block. |
| BLOCK | 4 | The auxiliary block at the end of the file. |
RECTANGLE, PATH, INCLINED, CELL, ARRAY and TEXT store coordinates as the integer steps. POLYGON, LINE and EXPOSITION store each coordinate shifted left by three bits. On a polygon vertex the same three bits say which axis changed: 0 means both X and Y follow, 1 means only Y, 2 means only X. A circle, a ring or a ring sector has no record of its own. Files store that shape as a series of INCLINED or EXPOSITION records.
The spec uses the last word of a text as the text type: 1 for a vector font and 2 for an outline. height is the text height in micrometres times 10. The LayoutEditor writes the text width, in database units, into height and writes type 0.
orient on a CELL, an ARRAY and a TEXT uses these codes.
| Code | Placement |
|---|---|
| 0 | No rotation. |
| 1 | 90° to the left. |
| 2 | 180°. |
| 3 | 90° to the right. |
| 8 | Mirrored on the X axis. |
| 9 | Mirrored, then 90° to the right. |
| 10 | Mirrored, then 180°. |
| 11 | Mirrored, then 90° to the left. |
The LayoutEditor reads the records above. An unknown code is reported and skipped. Referenced cells are loaded from the same folder: the file name is the cell name with the same extension.
A design can be stored as SOURCE. On saving, the layout is scaled to the SOURCE database unit. The default is 100 nm, the standard 0.1 micrometre step, and the unit can be changed in the Setup dialog. Each cell is written to its own file, named after the cell. A name longer than six characters is shortened. If that would give two cells the same name, a digit is added so the names stay unique.
A rectangle is stored as RECTANGLE, a polygon as POLYGON, and a path that has a width as a polygon too. A path without width is stored as LINE. A cell reference is a CELL, a repeated reference an ARRAY, and a text a TEXT. lx and ly are signed steps along the axes. A step that also moves on the other axis is reported and is not stored. Rotation is stored in steps of 90°, with the mirror codes above. Any other angle is reported, and the reference is written without that rotation. A magnification is reported and is not stored.
Open a file ending in sou or source in the TextEditor. The binary file is shown as one line per record. The number in brackets is the byte offset. The record names are the names in the table above. Coordinates are the integer steps, with the three-bit shift of POLYGON, LINE and EXPOSITION already removed. An EMPTY line gives the number of padding words and lists every word that is not zero, because the gap up to the next block is not always cleared. A BLOCK line shows mark, the low byte of its first word, and the same kind of list.
Saving from the TextEditor writes this text next to the SOURCE file, with .txt added to the file name. The binary file stays as it is. Exec opens the binary file as a layout.
These lines are each the first record of a file.
[0] RECTANGLE layer=1 y1=2000 x1=6000 y2=14000 x2=25000
[0] CELL name="REC" orient=0 y=6000 x=4500
[0] ARRAY name="REC" orient=0 y=4000 x=4000 ky=3 ly=14000 kx=2 lx=21000
[0] TEXT layer=1 y=3000 x=3000 orient=0 "1234567890 ABC abc" height=25600 type=256