Class Reference component

A component (=device) which can be placed in the schematic window. More...

Member

void createSymbol(netList *nl)
string description
string extractionMethod
string extractionParameter
string extractionDeviceParameter
string label
string prefix
string layout
void setName(string name)
void setLibrary(string library)
string getLibrary()
string getName()
symbol * getSymbol(int pos=0)
void setModel(string type,string value)
void setNameLibrary(string name,string library)
void setNetlist(string type,string value)
void setSymbol(sheet *symbol)

Detailed Description

graph LR ce(sheet)--getSheetComponent-->co(component) e(sElement)--getComponent-->co co--getSymbol-->sy(symbol) click ce "/layoutscript/api/sheet" click e "/layoutscript/api/selement" click co "/layoutscript/api/component" click sy "/layoutscript/api/symbol" classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; class co thisClas class ce,e,sy clas

A component is a library device: the symbol you place, the parameters, the netlist and model text for simulation, and the layout or macro used for schematic-driven layout. You do not construct one with new; components findComponent or newComponent returns the pointer. A placement on a sheet points back through sElement getComponent. getSymbol returns the drawing of the device as a symbol; if several symbols exist, pos selects which one. setNetlist and setModel store the text used when a netlist of that type is generated. Extraction fields (extractionMethod, extractionParameter, extractionDeviceParameter) describe how the same device is recognised in a layout; they match the Edit Component dialog and device extraction.

Example:

component *c = components::findComponent("nmos", "analog");
if (c == NULL)
 c = components::newComponent("nmos", "analog");
c->prefix = "M";
c->setNetlist("ngspice", "M%d %d %d %d %d nmos w=%d l=%d");
symbol *sy = c->getSymbol();
if (sy != NULL && sy->firstElement != NULL) {
 sElement *e = sy->firstElement->thisElement;
}

Member Function Documentation


void component::createSymbol(netList *nl)

Builds a simple black-box symbol from the ports of nl. (introduced with release 20210103)


string component::description

Text description of the component.


string component::extractionMethod

Method used to extract this component from a layout. See Edit Component and device extraction.


string component::extractionParameter

Parameters of the extraction method. See Edit Component and device extraction.


string component::extractionDeviceParameter

Component parameters filled on devices extracted from layout. See Edit Component and device extraction.


string component::label

Text used for the component label.


string component::prefix

Prefix used when a new device name is generated, for example R or M.


string component::layout

Layout cell or macro used for this component in schematic-driven layout.


void component::setName(string name)

Sets the name of the component in its library.


void component::setLibrary(string library)

Sets the library this component belongs to.


string component::getLibrary()

Returns: the library name.


string component::getName()

Returns: the component name.


symbol * component::getSymbol(int pos=0)

Returns: a pointer to a symbol of this component. If several symbols exist, pos selects which one. The pointer can be used to edit the symbol.


void component::setModel(string type,string value)

Stores model text value for netlist format type. (introduced with release 20210103)

Parameter:
type mode selector
value value

void component::setNameLibrary(string name,string library)

Sets both the name and the library of the component.

Parameter:
name name
library library

void component::setNetlist(string type,string value)

Stores netlist text value for netlist format type. (introduced with release 20210103)

Parameter:
type mode selector
value value

void component::setSymbol(sheet *symbol)

Takes the drawing of symbol (a sheet) and stores it as the symbol of this component.