SIM(5)

πŸ’… sim(5) β€” the .sim file format, no gatekeeping πŸ’…

okay bestie, pull up a chair, we're doing file formats today 🫢


✨ NAME ✨

sim β€” the format of .sim files that esim, crystal, etc. read.


πŸ¦‹ DESCRIPTION πŸ¦‹

So the simulation girlies β€” crystal(1) and esim(1) β€” accept a circuit description in .sim format. And here's the iconic part: there is a single .sim file for the entire circuit. One file. That's it. Which is NOT how Magic's ext(5) format works, because over there you get a .ext file for every single cell in a hierarchical design and honestly? exhausting. .sim said "one file, main character energy" and we respect it πŸ’….

A .sim file is just a series of lines, and every line starts with a key letter. That key letter is the vibe check for the whole line β€” it decides how the rest of the line gets interpreted. Here's the complete list of key letters that are understood, and no, we are not skipping any:

  • | β€” the units / tech / format header
| units: s  tech: tech format: MIT|LBL|SU

If this line is present, it must be the first line in the .sim file, periodt. It identifies the technology of this circuit as tech, and it gives a scale factor for units of linear dimension as s. Every linear dimension that shows up in the .sim file gets multiplied by s to give centimicrons. The format field signifies the sim variant: MIT and SU are compatible and understood by all tools, while LBL is understood only by gemini(1) (she's exclusive, she's niche, we love her πŸ™ˆ).

  • type β€” the transistor line
type  g  s  d  l  w  x  y  g=gattrs  s=sattrs  d=dattrs

Defines a transistor of type type. Currently, type may be e or d for NMOS, or p or n for CMOS. The names of the nodes that the gate, source, and drain of the transistor are connected to are given by g, s, and d respectively. The length and width of the transistor are l and w. The next two tokens, x and y, are optional β€” if they're present, they give the location of a point inside the gate region of the transistor. The last three tokens are the attribute lists for the transistor gate, source, and drain. If no attributes are present for a particular terminal, the corresponding attribute list may be absent (i.e., there may be no g= field at all β€” she ghosted πŸ‘»). The attribute lists gattrs, etc. are comma-separated lists of labels. The label names should not include any spaces, although some tools can accept label names with spaces if they are enclosed in double quotes.

Now the tea β˜•: in version 6.4.5 and later, the default format produced by ext2sim is SU. In this format, the attribute of the gate starting with S_ is the substrate node of the fet. The attributes of the gate, and source and substrate starting with A_, P_ are the area and perimeter (summed for that node only once) of the source and drain respectively. This addition to the format is backwards compatible, so nobody gets left behind 🫢.

  • C β€” capacitor
C n1 n2 cap

Defines a capacitor between nodes n1 and n2. The value of the capacitor is cap femtofarads.

⚠️ NOTE bestie: since many analysis tools compute transistor gate capacitance themselves from the transistor's area and perimeter, the capacitance between a node and substrate (GND!) normally does not include the capacitance from transistor gates connected to that node. If the .sim file was produced by ext2sim(1), check the technology file that was used to produce the original .ext files to see whether transistor gate capacitance is included or excluded; see Magic Maintainer's Manual #2: The Technology File for details. iykyk.
  • R β€” lumped resistance
R node res

Defines the lumped resistance of node node to be res ohms. Heads up though: this construct is only interpreted by a few programs.

  • r β€” explicit resistor
r node1 node2 res

Defines an explicit resistor between nodes node1 and node2 of resistance res ohms. And again: this construct is only interpreted by a few programs.

  • N β€” node area/perimeter report
N node darea dperim parea pperim marea mperim

As an alternative to computed capacitances, some tools expect the total perimeter and area of the polysilicon, diffusion, and metal in each node to be reported in the .sim file. The N construct associates diffusion area darea (in square centimicrons) and diffusion perimeter dperim (in centimicrons) with node node, polysilicon area parea and perimeter pperim, and metal area marea and perimeter mperim. Fair warning: this construct is technology dependent and obsolete πŸ’€.

  • A β€” node attribute
A node attr

Associates attribute attr for node node. The string attr should contain no blanks.

  • = β€” aliases
= node1 node2

Every node in a .sim file is named implicitly, just by showing up in a transistor definition. All node names appearing in a .sim file are assumed to be distinct. Some tools, such as esim(1), recognize aliases for node names. The = construct lets the name node2 be defined as an alias for the name node1. But listen: aliases defined by means of this construct may not appear anywhere else in the .sim file. Nowhere. Not once. We do not play with that πŸ™….


🌈 SEE ALSO 🌈

crystal(1), esim(1), ext2sim(1), sim2spice(1), ext(5)


And that's the whole page, bestie ✨. This one's brought to you by the 4th Berkeley Distribution, and the footer just says SIM(5) with honestly no date anywhere in sight β€” mysterious, vintage, we love that for her πŸŽ€. go forth and parse πŸ’–

πŸ“¦ where this page comes from