pyibisami.ibis
IBIS related submodules in the PyIBIS-AMI package.
file
A class for encapsulating IBIS model files.
Original Author: David Banas <capn.freako@gmail.com>
Original Date: November 1, 2019
For information regarding the IBIS modeling standard, visit: https://ibis.org/
Note: The IBISModel
class, defined here, needs to be kept separate from the
other IBIS-related classes, defined in the model
module, in order to
avoid circular imports.
Copyright (c) 2019 by David Banas; All rights reserved World wide.
- class pyibisami.ibis.file.IBISModel(*args: Any, **kwargs: Any)[source]
Bases:
HasTraits
HasTraits subclass for wrapping and interacting with an IBIS model.
This class can be configured to present a customized GUI to the user for interacting with a particular IBIS model (i.e. - selecting components, pins, and models).
The intended use model is as follows:
Instantiate this class only once per IBIS model file. When instantiating, provide the unprocessed contents of the IBIS file, as a single string. This class will take care of getting that string parsed properly, and report any errors or warnings it encounters, in its
ibis_parsing_errors
property.When you want to let the user select a particular component/pin/model, call the newly created instance, as if it were a function, passing no arguments. The instance will then present a GUI to the user, allowing him to select a particular component/pin/model, which may then be retrieved, via the
model
property. The latest user selections will be remembered, as long as the instance remains in scope.
Any errors or warnings encountered while parsing are available, in the
ibis_parsing_errors
property.The complete dictionary containing all parsed models may be retrieved, via the
model_dict
property.- Parameters:
ibis_file_name (str) – The name of the IBIS file.
is_tx (bool) – True if this is a Tx model.
- Keyword Arguments:
debug (bool) – Output debugging info to console when true. Default = False
gui (bool) – Set to False for command line and/or script usage. Default = True.
- property ami_file
- property dll_file
- property ibis_parsing_errors
Any errors or warnings encountered, while parsing the IBIS file contents.
- log(msg, alert=False)[source]
Log a message to the console and, optionally, to terminal and/or pop-up dialog.
- property log_txt
The complete log since instantiation.
- property model_dict
Dictionary of all model keywords.
model
Classes for encapsulating IBIS model constituents.
Original Author: David Banas <capn.freako@gmail.com>
Original Date: November 1, 2019
For information regarding the IBIS modeling standard, visit: https://ibis.org/
Copyright (c) 2019 by David Banas; All rights reserved World wide.
- class pyibisami.ibis.model.Component(*args: Any, **kwargs: Any)[source]
Bases:
HasTraits
Encapsulation of a particular component from an IBIS model file.
- Parameters:
subDict (dict) – Dictionary of [Component] sub-keywords/params.
- property pin
The pin selected most recently by the user.
Returns the first pin in the list, if the user hasn’t made a selection yet.
- property pins
The list of component pins.
- class pyibisami.ibis.model.Model(*args: Any, **kwargs: Any)[source]
Bases:
HasTraits
Encapsulation of a particular I/O model from an IBIS model file.
- Parameters:
subDict (dict) – Dictionary of sub-keywords/params.
- property ccomp
The parasitic capacitance.
- property mtype
Model type.
- property slew
The driver slew rate.
- property zin
The input impedance.
- property zout
The driver impedance.
parser
Parse an IBIS model file.
Original Author: David Banas <capn.freako@gmail.com>
Original Date: November 1, 2019
For information regarding the IBIS modeling standard, visit: https://ibis.org/
Copyright (c) 2019 by David Banas; All rights reserved World wide.
- pyibisami.ibis.parser.keyword(kywrd='')[source]
Parse an IBIS keyword.
- Keyword Arguments:
kywrd (str) – The particular keyword to match; null for any keyword. If provided, must be in canonicalized form (i.e. - underscores, no spaces)!
- Returns:
A keyword parser.
- Return type:
Parser
- pyibisami.ibis.parser.lexeme(p)[source]
Lexer for words.
Skips all ignored characters after word, including newlines.
- pyibisami.ibis.parser.logf(p, preStr='')[source]
Logs failure at point of occurence.
- Parameters:
p (Parser) – The original parser.
- Keyword Arguments:
preStr (str) – A prefix string to use in failure message. (Default = <empty string>)
- pyibisami.ibis.parser.node(valid_keywords, stop_keywords, debug=False)[source]
Build a node-specific parser.
- Parameters:
valid_keywords (dict) – A dictionary with keys matching those keywords we want parsed. The values are the parsers for those keywords.
stop_keywords – Any iterable with primary values (i.e. - those tested by the
in
function) matching those keywords we want to stop the parsing of this node and pop us back up the parsing stack.
- Returns:
A parser for this node.
- Return type:
Parser
Notes
- 1: Any keywords encountered that are _not_ found (via
in
) in either
valid_keywords
orstop_keywords
are ignored.
- pyibisami.ibis.parser.parse_ibis_file(ibis_file_contents_str, debug=False)[source]
Parse the contents of an IBIS file.
- Parameters:
ibis_file_contents_str (str) – The contents of the IBIS file, as a single string.
- Keyword Arguments:
debug (bool) – Output debugging info to console when true. Default = False
Example
with open(<ibis_file_name>) as ibis_file: ibis_file_contents_str = ibis_file.read() (err_str, model_dict) = parse_ibis_file(ibis_file_contents_str)
- Returns:
A pair containing:
- err_str:
A message describing the nature of any parse failure that occured.
- model_dict:
Dictionary containing keyword definitions (empty upon failure).
- Return type:
(str, dict)