Index: trunk/doc/design/07_devmap.html =================================================================== --- trunk/doc/design/07_devmap.html (revision 277) +++ trunk/doc/design/07_devmap.html (revision 278) @@ -13,7 +13,7 @@ footprint or simulation model (problem known as "slotting") -

{des7:0} +

{des7:1} These goals are achieved by using symbolic terminal names (instead of "pin numbers") in the schematic symbols and auxiliary data to translate the terminal names into port numbers. The following diagram demonstrates @@ -21,7 +21,7 @@

-

{des7:0} +

{des7:2} The device mapper has three major features: slotting name translation (red), device mapping (green) and pin mapping (blue). The slotting translation makes sure the resulting abstract component has the right amount of ports; @@ -29,7 +29,7 @@ attributes from a database; the pin mapper applies a pin numbers from a table (the table typically set up by the device mapper). -

{des7:0} +

{des7:3} The device mapper is an optional mechanism implemented in a plugin. The user may choose to use it or to:

-

{des7:0} +

{des7:4} It is possible to use features of this plugin selectively and/or replace some or all features using another plugin.

7.1. Slot prefixing

-

{des7:0} +

{des7:5} Devmap registers for the terminal-name-to-port-name translation. -

{des7:0} +

{des7:6} If the slot attribute presents in a symbol, and the terminal does not have the "noslot" attribute, the translation is activated. The slot name is taken directly from the concrete symbol's slot attribute. @@ -61,11 +61,11 @@ attribute is then removed from the abstract component to avoid collisions. -

{des7:0} +

{des7:7} Typical example: common opamp symbol: -

{des7:0} +

{des7:8}

-
{des7:0} example opamp terminal attributes +
{des7:9} example opamp terminal attributes
name noslot terminal description
in_plus (not present) positive input pin
in_minus (not present) negative input pin @@ -74,7 +74,7 @@
v_minus "yes" negative power rail
-

{des7:0} +

{des7:10} In the above example v_plus and v_minus are never prefixed with "slot/" because of their noslot attribute. In case the symbol is used with the slot attribute set, this means: @@ -85,7 +85,7 @@ exist in the abstract component -

{des7:0} +

{des7:11} Note: when the same symbol is used in a non-slotted use case, the symbol will not have the "slot" attribute; in this case no terminal name translation applied and the resulting abstract component will have the same port names @@ -94,7 +94,7 @@

7.2. Pin mapping

-

{des7:0} +

{des7:12} Pin mapping takes a map between the symbolic description and emits the physical description (port numbers for a footprint or sim model). There shall be one such mapping per abstract component. If multiple symbols @@ -102,7 +102,7 @@ keep only one of the arrays. -

{des7:0} +

{des7:13} The input is a array is an unordered list of (terminal name + slot name) -> (attribute_name + value) pairs, each specified in the following syntax:

@@ -109,17 +109,17 @@
 slot/termname -> attribkey=value
 
-

{des7:0} E.g. "A/out -> pcb/pin=1" means "terminal with +

{des7:14} E.g. "A/out -> pcb/pin=1" means "terminal with name=out in symbol tagged as slot=A shall get attribute pcb/pin set to 1". -

{des7:0} +

{des7:15} If a slot/terminal pair is not found in the map, an error message is emitted. This happens when the schematics symbol uses a terminal that has no physical pin with the given device. -

{des7:0} +

{des7:16} If a slot/terminal pair of the map is not used in the mapping, no error is generated. A typical example when this happens is when a logic circuit has 4 identical slots but the schematics uses only 3. If this is considered @@ -126,9 +126,9 @@ an error, a DRC plugin shall check for it. -

{des7:0} +

{des7:17}

-
{des7:0} pin mapping related symbol attributes +
{des7:18} pin mapping related symbol attributes
attribute value description
pinmap array of map entries the actual map, as described in TODO
slot slot name textual name of the slot the symbol provides @@ -136,24 +136,24 @@

7.3. Device mapping

-

{des7:0} +

{des7:19} The device mapper takes the devmap attribute of a symbol and looks it up in a database for finding a device map file. If the devmap attribute is an array, each devmap file is looked up and applied, in order of appearance. -

{des7:0} +

{des7:20} A device map file is a simple list of cschem attributes. The device mapper takes each attribute from the device map file and apply it on the symbol that had the devmap attribute. -

{des7:0} +

{des7:21} A common device map file will usually have a pinmap attribute that will set at least one attributes on each terminal. -

{des7:0} +

{des7:22}

-
{des7:0} device mapping related symbol attributes +
{des7:23} device mapping related symbol attributes
attribute value description
devmap name name of the devmap file to use
Index: trunk/doc/design/07_devmap_imp.html =================================================================== --- trunk/doc/design/07_devmap_imp.html (revision 277) +++ trunk/doc/design/07_devmap_imp.html (revision 278) @@ -12,13 +12,13 @@ is especially annoying when the same symbol is to be used with signal (sot23) and power (to220) transistors. -

{imp7:0} +

{imp7:1} Classic solution 'A' is simply having different, heavy symbols for each footprint. This approach has the obvious problem that replacing the footprint means replacing the symbol as well and that symbol needs to be copied for each footprint variant. -

{imp7:0} +

{imp7:2} A less obvious problem is that the symbol-<pcb-footprint mapping is only one aspect, for one workflow (f1). If there's another flow (f2) that may also have different mappings for the same symbol, multiple @@ -25,7 +25,7 @@ combinations of f1+f2 mappings. This easily leads to an explosion of heavy symbols even for the very same device. -

{imp7:0} +

{imp7:3} Classic solution 'B' is to craft the footprint to match the symbol. This means there's no sot23 footprint, but a sot23-2n7002 footprint. In other words, the same sot23 footprint is copied over and over with only pin numbering @@ -35,7 +35,7 @@ the different requirements, this method requires 3 or 4 time clones of many footprint specific sot23 footprints. -

{imp7:0} +

{imp7:4} While both of the above solutions would work with cschem, it is recommended to use the devmap mechanism instead. For the 2n7002-in-sot23 example, the devmap would mean: @@ -58,7 +58,7 @@

7.1.2 SPICE example

-

{imp7:0} +

{imp7:5} The same example for SPICE simulation works the same way, except the devmap file would set spice/model=M and a different pinmap array:

@@ -66,7 +66,7 @@
 
 

7.3. Combining the two

-

{imp7:0} +

{imp7:6} A schematics can be the source of multiple workflows, e.g. both simulation and PCB layout. An easy way to specify the device mapping for multiple flows is to include them all in the same devmap file. The resulting file would set all @@ -80,7 +80,7 @@ D->spice/pin=1

-

{imp7:0} +

{imp7:7} However, this again creates bad coupling: for PCB, the devmap file name includes the footprint, because that makes the actual binding between the generic symbol and generic footprint. This mean there would be a different @@ -87,7 +87,7 @@ devmap file for the same MOSFET part coming in a to92 package. Yet, the spice model attribute and pin mapping would be copied into both. -

{imp7:0} +

{imp7:8} A better way is to have a pcb-only devmap file called "2n7002_sot23" and a SPICE specific devmap file called "2n7002_spice". The devmap attribute of the generic MOSFET symbol placed for the device can be an array, listing both @@ -96,7 +96,7 @@

7.2. Slotting

-

{imp7:0} +

{imp7:9} Slotting works by the slot slot attribute. Each entry of the pinmap attribute may contain a slot reference on the left side. When present, it limits the use of the entry to symbols with matching slot name. This allows @@ -103,7 +103,7 @@ assignment of the same terminal names multiple times, to different physical pin numbers, depending on the slot attribute. -

{imp7:0} +

{imp7:10} For example the PCB devmap for common (TODO: link) dual opamp in a 8 pin package, using slots 'A' and 'B':

@@ -117,7 +117,7 @@
 v_minus -> pcb/pin=4
 
-

{imp7:0} +

{imp7:11} When both slots are present, using this pinmap will produce the following port names in the resulting abstract model component: A/out, A/in_mius, A/in_plus, B/out, B/in_minus, B/in_plus, v_plus, v_minus. If slot A is @@ -124,7 +124,7 @@ missing from the schematics, only B/out, B/in_minus, B/in_plus, v_plus, v_minus are added in the abstract model. -

{imp7:0} +

{imp7:12} Note how v_plus and v_minus are specified to match universally, regardless of the slot. This allows a symbol where both instances have v_plus and v_minus terminals, but also allows a separate "opamp power" symbol with an arbitrary @@ -132,7 +132,7 @@ not prefixed with A/ or B/ because they had the noslot attribute (in the terminal). -

{imp7:0} +

{imp7:13} The resulting devmap file could be called "lm358_dip8", "lm358_so8" (and can set attribute device=lm358 on the resulting component). But this pinout is a de-facto standard for dual ompamps in 8 pin packages, so @@ -140,7 +140,7 @@ "opamp2_any8" - but in this case the device=lm358 can not be part of the devmap file. -

{imp7:0} +

{imp7:14} Note that this leads to the same heavy vs. light symbol consideration, applied to devmap files now. Cschem supports both approaches, it is up to the user to decide whether heavy or light devmap files should be used @@ -150,13 +150,13 @@

7.3.1. Device map

-

{imp7:0} +

{imp7:15} Option A: do the same as in gschem: manually set "pin numbers" and all attributes specific to footprints and simulation. This obviously reproduces the transistor problem, easily resulting in mismatched footprints. It also reproduces the heavy vs. light symbol problem. -

{imp7:0} +

{imp7:16} Option B: instead of filling in the footprint attribute, fill in the devmap attribute. Instead of saying it is a "footprint=sot23" (and maybe adding a device=2n7002 or value=2n7002), say it is a "devmap=2n7002_sot23". @@ -166,24 +166,24 @@

7.3.2. Slotting

-

{imp7:0} +

{imp7:17} Instead of the slotdef attribute, use the devmap attribute that is pointing to a slotted devmap file. Using the slot attribute is the same, except the value of the slot attribute doesn't have to be an integer but can be text, e.g. "power", "gpio", "i2c". -

{imp7:0} +

{imp7:18} Instead of the somewhat cryptic slotdef attribute, the devmap file contains a more readable table of pin assignment.

7.4. How it is displayed on the UI?

-

{imp7:0} +

{imp7:19} After devmap or pinmap runs, the resulting attributes are available in the abstract model. Cschem can trace the connection between the concrete model's schematics symbol/terminal and the abstract model's component/port. -

{imp7:0} +

{imp7:20} Using this connection, a plugin in turn can take the resulting pcb/pin or spice/pin attribute from the abstract model and display it at any terminal on the schematics that contributed to it. Whether pcb/pin or spice/pin is @@ -190,7 +190,7 @@ displayed that way, depends on the plugin (or plugin parameters), which is configured in the view. -

{imp7:0} +

{imp7:21} In short: a view can be set up to display PCB pin numbers and another view can be set up to display SPICE pin numbers and the user can switch between views any time.