Parsing of a subcircuit call (an X element) in the netlist in the active circuit object. The name of the active circuit object is the last name in the global CIRCUITNAMES: CIRCUITNAMES[-1]. The circuit object itself is stored in the dictionary CIRCUITS under this name: circuitDi
(line, name, cirType)
| 479 | _addElement(newElement, name, cirType) |
| 480 | |
| 481 | def _parseSubcircuitElement(line, name, cirType): |
| 482 | """ |
| 483 | Parsing of a subcircuit call (an X element) in the netlist in the active |
| 484 | circuit object. |
| 485 | The name of the active circuit object is the last name in the global |
| 486 | CIRCUITNAMES: CIRCUITNAMES[-1]. The circuit object itself is stored in the |
| 487 | dictionary CIRCUITS under this name: circuitDict[CIRCUITNAMES[-1]]. |
| 488 | |
| 489 | :param line: list with tokens from a netlist line |
| 490 | :type line: list with tokens |
| 491 | |
| 492 | :param circuitDict: Dictionary to which the definition will be written, |
| 493 | defaults to CIRCUITS. |
| 494 | :type circuitDict: dictionary |
| 495 | |
| 496 | :return: Errors: number of errors found in this line. |
| 497 | |
| 498 | :rtype: Integer |
| 499 | """ |
| 500 | global _CIRCUITNAMES |
| 501 | errors = 0 |
| 502 | # Check if there are parameter definitions |
| 503 | for modelPos in range(len(line)): |
| 504 | if line[modelPos].type == "PARDEF": |
| 505 | modelPos -= 1 |
| 506 | break |
| 507 | newElement = element() |
| 508 | newElement.refDes = line[0].value |
| 509 | newElement.type = 'X' |
| 510 | newElement.model = line[modelPos].value |
| 511 | for i in range(1, modelPos): |
| 512 | if line[i].type in _NODES: |
| 513 | newElement.nodes.append(line[i].value) |
| 514 | else: |
| 515 | errors += 1 |
| 516 | _printError("Error: Expected a node ID.", line[i]) |
| 517 | if len(line) > modelPos + 1: |
| 518 | for i in range(modelPos + 1, len(line)): |
| 519 | if line[i].type == "PARDEF": |
| 520 | key, value = line[i].value |
| 521 | newElement.params[key] = value |
| 522 | else: |
| 523 | errors += 1 |
| 524 | _printError("Error: Expected a parameter definition.", line[i]) |
| 525 | if errors == 0: |
| 526 | _addElement(newElement, name, cirType) |
| 527 | |
| 528 | def _parseCommand(line, name, cirType): |
| 529 | """ |
no test coverage detected