pyibis-ami 7.2.2__tar.gz → 7.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. {pyibis_ami-7.2.2/src/pyibis_ami.egg-info → pyibis_ami-7.2.4}/PKG-INFO +1 -2
  2. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/pyproject.toml +2 -2
  3. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4/src/pyibis_ami.egg-info}/PKG-INFO +1 -2
  4. pyibis_ami-7.2.4/src/pyibisami/ami/generic.ibs.em +176 -0
  5. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ami/model.py +4 -3
  6. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ami/parameter.py +11 -2
  7. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ami/parser.py +24 -18
  8. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ami/reserved_parameter_names.py +2 -2
  9. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/tools/run_notebook.py +4 -4
  10. pyibis_ami-7.2.2/src/pyibisami/ami/generic.ibs.em +0 -139
  11. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/LICENSE +0 -0
  12. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/MANIFEST.in +0 -0
  13. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/README.md +0 -0
  14. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/docs/source/ami.rst +0 -0
  15. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/docs/source/conf.py +0 -0
  16. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/docs/source/ibis.rst +0 -0
  17. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/docs/source/index.rst +0 -0
  18. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/docs/source/install.rst +0 -0
  19. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/docs/source/modules.rst +0 -0
  20. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/docs/source/tools.rst +0 -0
  21. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/all_taps.run +0 -0
  22. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/bandwidth.run +0 -0
  23. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/dummy.em +0 -0
  24. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/examples.md +0 -0
  25. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/freq_resp.em +0 -0
  26. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/impulse.em +0 -0
  27. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/impulse_response_8ma.txt +0 -0
  28. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/mode.run +0 -0
  29. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/stratix4_ami_tx_runs/all_taps.run +0 -0
  30. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/stratix4_ami_tx_runs/test_results.xml +0 -0
  31. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/examples/test_results/test_results.xsl +0 -0
  32. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/setup.cfg +0 -0
  33. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibis_ami.egg-info/SOURCES.txt +0 -0
  34. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibis_ami.egg-info/dependency_links.txt +0 -0
  35. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibis_ami.egg-info/entry_points.txt +0 -0
  36. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibis_ami.egg-info/requires.txt +0 -0
  37. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibis_ami.egg-info/top_level.txt +0 -0
  38. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/IBIS_AMI_Checker.ipynb +0 -0
  39. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/IBIS_AMI_Tester.ipynb +0 -0
  40. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/__init__.py +0 -0
  41. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/__main__.py +0 -0
  42. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ami/__init__.py +0 -0
  43. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ami/config.py +0 -0
  44. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ami/generic.ami.em +0 -0
  45. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/common.py +0 -0
  46. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ibis/__init__.py +0 -0
  47. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ibis/file.py +0 -0
  48. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ibis/model.py +0 -0
  49. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/ibis/parser.py +0 -0
  50. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/tools/__init__.py +0 -0
  51. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/tools/run_tests.py +0 -0
  52. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/src/pyibisami/tools/test_results.xsl +0 -0
  53. {pyibis_ami-7.2.2 → pyibis_ami-7.2.4}/tests/test_run_tests.py +0 -0
@@ -1,9 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyibis-ami
3
- Version: 7.2.2
3
+ Version: 7.2.4
4
4
  Summary: Facilitates working directly with IBIS-AMI DLLs from the Python command prompt.
5
5
  Author-email: David Banas <capn.freako@gmail.com>
6
- License-Expression: BSD-3-Clause
7
6
  Project-URL: Documentation, https://pyibis-ami.readthedocs.io/en/latest/
8
7
  Project-URL: Wiki, https://github.com/capn-freako/PyAMI/wiki
9
8
  Project-URL: GitHub, https://github.com/capn-freako/PyAMI
@@ -5,12 +5,12 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "pyibis-ami"
7
7
  description = "Facilitates working directly with IBIS-AMI DLLs from the Python command prompt."
8
- version = "7.2.2"
8
+ version = "7.2.4"
9
9
  authors = [ {name = "David Banas", email = "capn.freako@gmail.com"}
10
10
  ]
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.10,<3.13"
13
- license = "BSD-3-Clause"
13
+ # license = "BSD-3-Clause"
14
14
  dependencies = [
15
15
  "chaco>=6.0.0",
16
16
  "click>=8.1.3",
@@ -1,9 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyibis-ami
3
- Version: 7.2.2
3
+ Version: 7.2.4
4
4
  Summary: Facilitates working directly with IBIS-AMI DLLs from the Python command prompt.
5
5
  Author-email: David Banas <capn.freako@gmail.com>
6
- License-Expression: BSD-3-Clause
7
6
  Project-URL: Documentation, https://pyibis-ami.readthedocs.io/en/latest/
8
7
  Project-URL: Wiki, https://github.com/capn-freako/PyAMI/wiki
9
8
  Project-URL: GitHub, https://github.com/capn-freako/PyAMI
@@ -0,0 +1,176 @@
1
+ @{
2
+ from numpy import array
3
+
4
+ version = ibis_params['version']
5
+ file_name = ibis_params['file_name']
6
+ file_rev = ibis_params['file_rev']
7
+ copyright = ibis_params['copyright']
8
+ source = ibis_params['source']
9
+ component = ibis_params['component']
10
+ manufacturer = ibis_params['manufacturer']
11
+ r_pkg = ibis_params['r_pkg']
12
+ l_pkg = ibis_params['l_pkg']
13
+ c_pkg = ibis_params['c_pkg']
14
+ model_name = ibis_params['model_name']
15
+ model_type = ibis_params['model_type']
16
+ c_comp = ibis_params['c_comp']
17
+ c_ref = ibis_params['c_ref']
18
+ v_ref = ibis_params['v_ref']
19
+ v_meas = ibis_params['v_meas']
20
+ r_ref = ibis_params['r_ref']
21
+ temperature_range = ibis_params['temperature_range']
22
+ voltage_range = ibis_params['voltage_range']
23
+ impedance = ibis_params['impedance']
24
+ slew_rate = ibis_params['slew_rate']
25
+ }
26
+
27
+ [IBIS Ver] @(version)
28
+ [File Name] @(file_name)
29
+ [File Rev] @(file_rev)
30
+
31
+ [Date] @(date)
32
+
33
+ [Source] @(source)
34
+
35
+ [Disclaimer]
36
+ THIS MODEL IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
40
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
42
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
43
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45
+ OF THIS MODEL, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
+
47
+ [Notes]
48
+ This IBIS file was generated using the template file: "generic.ibs.em".
49
+
50
+ [Copyright] @(copyright)
51
+
52
+ [Component] @(component)
53
+ [Manufacturer] @(manufacturer)
54
+
55
+ [Package]
56
+
57
+ @{
58
+ print("R_pkg %5.2f %5.2f %5.2f" % (r_pkg[0], r_pkg[1], r_pkg[2]))
59
+ print("L_pkg %5.2fn %5.2fn %5.2fn" % (l_pkg[0] * 1.e9, l_pkg[1] * 1.e9, l_pkg[2] * 1.e9))
60
+ print("C_pkg %5.2fp %5.2fp %5.2fp" % (c_pkg[0] * 1.e12, c_pkg[1] * 1.e12, c_pkg[2] * 1.e12))
61
+ }
62
+
63
+ [Pin] signal_name model_name R_pin L_pin C_pin
64
+ @{
65
+ if model_type.startswith("Output") or model_type == "Repeater":
66
+ for n in range(3):
67
+ print(f"{n + 1}p Tx_{n + 1}_P {model_name}_Tx")
68
+ print(f"{n + 1}n Tx_{n + 1}_N {model_name}_Tx")
69
+ if model_type.startswith("Input") or model_type == "Repeater":
70
+ for n in range(3):
71
+ print(f"{n + 4}p Rx_{n + 4}_P {model_name}_Rx")
72
+ print(f"{n + 4}n Rx_{n + 4}_N {model_name}_Rx")
73
+ }
74
+
75
+ [Diff_Pin] inv_pin vdiff tdelay_typ tdelay_min tdelay_max
76
+ @{
77
+ if model_type.startswith("Output") or model_type == "Repeater":
78
+ for n in range(3):
79
+ print(f"{n + 1}p {n + 1}n 0.1V NA NA NA")
80
+ if model_type.startswith("Input") or model_type == "Repeater":
81
+ for n in range(3):
82
+ print(f"{n + 4}p {n + 4}n 0.1V NA NA NA")
83
+ }
84
+
85
+ @{
86
+ if model_type == "Repeater":
87
+ print("[Repeater Pin] tx_non_inv_pin")
88
+ for n in range(3):
89
+ print(f" {n + 4}p {n + 1}p")
90
+ }
91
+
92
+ @{
93
+ if model_type.startswith("Output") or model_type == "Repeater":
94
+ print(f"[Model] {model_name}_Tx")
95
+ print("Model_type Output")
96
+ print(f"C_comp {c_comp[0]*1.e12:5.2f}p {c_comp[1]*1.e12:5.2f}p {c_comp[2]*1.e12:5.2f}p")
97
+ print(f"Cref = {c_ref}")
98
+ print(f"Vref = {v_ref}")
99
+ print(f"Vmeas = {v_meas}")
100
+ print(f"Rref = {r_ref}")
101
+ print("")
102
+ print("[Algorithmic Model]")
103
+ print(f"Executable linux_gcc4.1.2_32 {model_name}_tx_x86.so {model_name}_tx.ami")
104
+ print(f"Executable linux_gcc4.1.2_64 {model_name}_tx_x86_amd64.so {model_name}_tx.ami")
105
+ print(f"Executable Windows_VisualStudio_32 {model_name}_tx_x86.dll {model_name}_tx.ami")
106
+ print(f"Executable Windows_VisualStudio_64 {model_name}_tx_x86_amd64.dll {model_name}_tx.ami")
107
+ print("[End Algorithmic Model]")
108
+ print("")
109
+ print("[Pulldown]")
110
+ print(f"{-1.*voltage_range[0]:-5.2f} -10.0 -10.0 -10.0")
111
+ for v in [k * voltage_range[0] for k in range(2)]:
112
+ i = v / array(impedance)
113
+ print(f"{v:-5.2f} {i[0]:-10.3e} {i[1]:-10.3e} {i[2]:-10.3e}")
114
+ print(f"{2.*voltage_range[0]:-5.2f} 10.0 10.0 10.0")
115
+
116
+ print("[Pullup]")
117
+ print(f"{-1.*voltage_range[0]:-5.2f} 10.0 10.0 10.0")
118
+ for v in [k * voltage_range[0] for k in range(2)]:
119
+ i = -1. * v / array(impedance)
120
+ print(f"{v:-5.2f} {i[0]:-10.3e} {i[1]:-10.3e} {i[2]:-10.3e}")
121
+ print(f"{2.*voltage_range[0]:-5.2f} -10.0 -10.0 -10.0")
122
+
123
+ print("[Ramp]")
124
+ dv = 0.6 * array([v * 50. / (50. + z) for (v, z) in zip(voltage_range, impedance)])
125
+ dt = 1.e12 * dv / array(slew_rate)
126
+ print(f"dV/dt_r {dv[0]:5.3f}/{dt[0]:05.2f}p {dv[1]:5.3f}/{dt[1]:05.2f}p {dv[2]:5.3f}/{dt[2]:05.2f}p")
127
+ print(f"dV/dt_f {dv[0]:5.3f}/{dt[0]:05.2f}p {dv[1]:5.3f}/{dt[1]:05.2f}p {dv[2]:5.3f}/{dt[2]:05.2f}p")
128
+ print("")
129
+ print("[GND Clamp]")
130
+ print(f"{-1.*voltage_range[0]:-5.2f} 0.0 0.0 0.0")
131
+ for v in [k * voltage_range[0] for k in range(3)]:
132
+ i = v / array(impedance) / 2
133
+ print(f"{v:-5.2f} 0.0 0.0 0.0")
134
+ print("")
135
+ print("[Power Clamp]")
136
+ print(f"{-1.*voltage_range[0]:-5.2f} 0.0 0.0 0.0")
137
+ for v in [k * voltage_range[0] for k in range(3)]:
138
+ i = v / array(impedance) / 2
139
+ print(f"{v:-5.2f} 0.0 0.0 0.0")
140
+ print("")
141
+ print(f"[Temperature_Range] {temperature_range[0]:5.1f} {temperature_range[1]:5.1f} {temperature_range[2]:5.1f}")
142
+ print(f"[Voltage_Range] {voltage_range[0]:5.2f} {voltage_range[1]:5.2f} {voltage_range[2]:5.2f}")
143
+ }
144
+
145
+ @{
146
+ if model_type.startswith("Input") or model_type == "Repeater":
147
+ print(f"[Model] {model_name}_Rx")
148
+ print("Model_type Input")
149
+ print(f"C_comp {c_comp[0]*1.e12:5.2f}p {c_comp[1]*1.e12:5.2f}p {c_comp[2]*1.e12:5.2f}p")
150
+ print(f"Vinl = {voltage_range[0]/2.-0.025}")
151
+ print(f"Vinh = {voltage_range[0]/2.+0.025}")
152
+ print("")
153
+ print("[Algorithmic Model]")
154
+ print(f"Executable linux_gcc4.1.2_32 {model_name}_rx_x86.so {model_name}_rx.ami")
155
+ print(f"Executable linux_gcc4.1.2_64 {model_name}_rx_x86_amd64.so {model_name}_rx.ami")
156
+ print(f"Executable Windows_VisualStudio_32 {model_name}_rx_x86.dll {model_name}_rx.ami")
157
+ print(f"Executable Windows_VisualStudio_64 {model_name}_rx_x86_amd64.dll {model_name}_rx.ami")
158
+ print("[End Algorithmic Model]")
159
+ print("")
160
+ print("[GND Clamp]")
161
+ print(f"{-1.*voltage_range[0]:-5.2f} -10.0 -10.0 -10.0")
162
+ for v in [k * voltage_range[0] for k in range(3)]:
163
+ i = v / array(impedance) / 2
164
+ print(f"{v:-5.2f} {i[0]:-10.3e} {i[1]:-10.3e} {i[2]:-10.3e}")
165
+ print("")
166
+ print("[Power Clamp]")
167
+ print(f"{-1.*voltage_range[0]:-5.2f} 10.0 10.0 10.0")
168
+ for v in [k * voltage_range[0] for k in range(3)]:
169
+ i = v / array(impedance) / 2
170
+ print(f"{v:-5.2f} {-i[0]:-10.3e} {-i[1]:-10.3e} {-i[2]:-10.3e}")
171
+ print("")
172
+ print(f"[Temperature_Range] {temperature_range[0]:5.1f} {temperature_range[1]:5.1f} {temperature_range[2]:5.1f}")
173
+ print(f"[Voltage_Range] {voltage_range[0]:5.2f} {voltage_range[1]:5.2f} {voltage_range[2]:5.2f}")
174
+ }
175
+
176
+ [END]
@@ -161,10 +161,9 @@ class AMIModelInitializer:
161
161
 
162
162
  def __str__(self):
163
163
  return "\n\t".join([
164
- f"AMIModelInitializer instance:",
164
+ "AMIModelInitializer instance:",
165
165
  f"`ami_params`: {self.ami_params}",
166
- f"`info_params`: {self.ami_params}",
167
- ])
166
+ f"`info_params`: {self.ami_params}"])
168
167
 
169
168
  def _getChannelResponse(self):
170
169
  return list(map(float, self._init_data["channel_response"]))
@@ -336,6 +335,8 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
336
335
  def sexpr(pname, pval):
337
336
  """Create an S-expression from a parameter name/value pair, calling
338
337
  recursively as needed to elaborate sub-parameter dictionaries."""
338
+ if isinstance(pval, str):
339
+ return f'({pname} "{pval}")'
339
340
  if isinstance(pval, dict):
340
341
  subs = []
341
342
  for sname in pval:
@@ -248,9 +248,18 @@ class AMIParameter: # pylint: disable=too-many-instance-attributes,too-few-publ
248
248
  # Check for mutual exclusivity of 'Format Value' and 'Default'.
249
249
  elif (param_format == "Value") and (param_default is not None):
250
250
  self._msg += "'Format Value' and 'Default' both found! (They are mutually exclusive.)\n"
251
+ # Canonicalize Boolean if necessary.
252
+ elif (param_format == "List") and (param_type == "Boolean"):
253
+ if param_default:
254
+ self._value = param_default
255
+ else:
256
+ self._value = "False"
257
+ param_format = "Value"
258
+ self._format_rem = [self._value]
259
+ self._format = param_format
251
260
 
252
261
  # Check for 'Default' used with parameter type 'Out'.
253
- if (param_type == "Out") and (param_default is not None):
262
+ if (param_usage == "Out") and (param_default is not None):
254
263
  raise AMIParamError("'Default' may not be used with parameter type 'Out'!\n")
255
264
 
256
265
  # Complete the instance.
@@ -274,7 +283,7 @@ class AMIParameter: # pylint: disable=too-many-instance-attributes,too-few-publ
274
283
  self._value = False
275
284
  else:
276
285
  raise AMIParamError(f"Couldn't read Boolean from '{value_str}'.\n")
277
- else:
286
+ else: # `String`
278
287
  self._value = value_str.strip('"')
279
288
  elif param_format == "Range":
280
289
  if param_type not in ("Float", "Integer", "UI", "Tap"):
@@ -28,12 +28,12 @@ from .reserved_parameter_names import AmiReservedParameterName, RESERVED_PARAM_
28
28
  # See: https://stackoverflow.com/questions/70894567/using-mypy-newtype-with-type-aliases-or-protocols
29
29
  ParamName = NewType("ParamName", str)
30
30
  ParamValue: TypeAlias = int | float | str | list["ParamValue"]
31
- Parameters: TypeAlias = dict[ParamName, "AMIParameter | 'Parameters'"]
32
- ParamValues: TypeAlias = dict[ParamName, "ParamValue | 'ParamValues'"]
31
+ Parameters: TypeAlias = dict[ParamName, "'AMIParameter' | 'Parameters'"]
32
+ ParamValues: TypeAlias = dict[ParamName, "'ParamValue' | 'ParamValues'"]
33
33
 
34
34
  AmiName = NewType("AmiName", str)
35
35
  AmiAtom: TypeAlias = bool | int | float | str
36
- AmiExpr: TypeAlias = "AmiAtom | 'AmiNode'"
36
+ AmiExpr: TypeAlias = "'AmiAtom' | 'AmiNode'"
37
37
  AmiNode: TypeAlias = tuple[AmiName, list[AmiExpr]]
38
38
  AmiNodeParser: TypeAlias = Callable[[str], AmiNode]
39
39
  AmiParser: TypeAlias = Callable[[str], tuple[AmiName, list[AmiNode]]] # Atoms may not exist at the root level.
@@ -41,7 +41,7 @@ AmiParser: TypeAlias = Callable[[str], tuple[AmiName, list[AmiNode]]] # Ato
41
41
  ParseErrMsg = NewType("ParseErrMsg", str)
42
42
  AmiRootName = NewType("AmiRootName", str)
43
43
  ReservedParamDict: TypeAlias = dict[AmiReservedParameterName, AMIParameter]
44
- ModelSpecificDict: TypeAlias = dict[ParamName, "AMIParameter | 'ModelSpecificDict'"]
44
+ ModelSpecificDict: TypeAlias = dict[ParamName, "'AMIParameter' | 'ModelSpecificDict'"]
45
45
 
46
46
  __all__ = [
47
47
  "ParamName", "ParamValue", "Parameters", "ParamValues",
@@ -97,17 +97,23 @@ class AMIParamConfigurator(HasTraits):
97
97
  super().__init__()
98
98
 
99
99
  # Parse the AMI file contents, storing any errors or warnings, and customize the view accordingly.
100
- err_str, root_name, description, reserved_param_dict, model_specific_dict = parse_ami_file_contents(ami_file_contents_str)
101
- assert reserved_param_dict, ValueError(
102
- "\n".join([
103
- "No 'Reserved_Parameters' section found!",
104
- err_str
105
- ]))
106
- assert model_specific_dict, ValueError(
107
- "\n".join([
108
- "No 'Model_Specific' section found!",
109
- err_str
110
- ]))
100
+ (err_str,
101
+ root_name,
102
+ description,
103
+ reserved_param_dict,
104
+ model_specific_dict) = parse_ami_file_contents(ami_file_contents_str)
105
+ if not reserved_param_dict:
106
+ raise ValueError(
107
+ "\n".join([
108
+ "No 'Reserved_Parameters' section found!",
109
+ err_str
110
+ ]))
111
+ if not model_specific_dict:
112
+ raise ValueError(
113
+ "\n".join([
114
+ "No 'Model_Specific' section found!",
115
+ err_str
116
+ ]))
111
117
  gui_items, new_traits = make_gui(model_specific_dict)
112
118
  trait_names = []
113
119
  for trait in new_traits:
@@ -501,8 +507,8 @@ def parse_ami_file_contents( # pylint: disable=too-many-locals,too-many-branche
501
507
  err_str, param_dict = proc_branch(res)
502
508
  if err_str:
503
509
  return (err_str, AmiRootName(""), "", {}, {})
504
- assert len(param_dict.keys()) == 1, ValueError(
505
- f"Malformed AMI parameter S-exp has top-level keys: {param_dict.keys()}!")
510
+ if len(param_dict.keys()) != 1:
511
+ raise ValueError(f"Malformed AMI parameter S-exp has top-level keys: {param_dict.keys()}!")
506
512
 
507
513
  reserved_found = False
508
514
  init_returns_impulse_found = False
@@ -645,7 +651,7 @@ def make_gui_items( # pylint: disable=too-many-locals,too-many-branches
645
651
  val = default if default else param.pvalue[0]
646
652
  the_trait = Enum([val] + param.pvalue)
647
653
  case _:
648
- raise ValueError(f"Unrecognized AMI parameter format: {pformat}!")
654
+ raise ValueError(f"Unrecognized AMI parameter format: {pformat}, for parameter `{pname}` of type `{param.ptype}` and usage `{param.pusage}`!")
649
655
  if the_trait.metadata:
650
656
  the_trait.metadata.update({"transient": False}) # Required to support modal dialogs.
651
657
  else:
@@ -20,8 +20,8 @@ class AmiReservedParameterName():
20
20
  def __post_init__(self):
21
21
  "Validate parameter name."
22
22
 
23
- assert self.pname in RESERVED_PARAM_NAMES, ValueError(
24
- f"Parameter name: {self.pname}, is not an IBIS-AMI reserved parameter name!")
23
+ if self.pname not in RESERVED_PARAM_NAMES:
24
+ raise ValueError(f"Parameter name: {self.pname}, is not an IBIS-AMI reserved parameter name!")
25
25
 
26
26
 
27
27
  RESERVED_PARAM_NAMES = [
@@ -45,10 +45,10 @@ def run_notebook(
45
45
  start_time = time()
46
46
 
47
47
  # Validate input.
48
- assert ibis_file.exists(), RuntimeError(
49
- f"Can't find IBIS-AMI model file, {ibis_file}!")
50
- assert notebook.exists(), RuntimeError(
51
- f"Can't find notebook file, {notebook}!")
48
+ if not ibis_file.exists():
49
+ raise RuntimeError(f"Can't find IBIS-AMI model file, {ibis_file}!")
50
+ if not notebook.exists():
51
+ raise RuntimeError(f"Can't find notebook file, {notebook}!")
52
52
 
53
53
  # Define temp. (i.e. - parameterized) notebook and output file locations.
54
54
  tmp_dir = (
@@ -1,139 +0,0 @@
1
- @{
2
- from numpy import array
3
-
4
- version = ibis_params['version']
5
- file_name = ibis_params['file_name']
6
- file_rev = ibis_params['file_rev']
7
- copyright = ibis_params['copyright']
8
- source = ibis_params['source']
9
- component = ibis_params['component']
10
- manufacturer = ibis_params['manufacturer']
11
- r_pkg = ibis_params['r_pkg']
12
- l_pkg = ibis_params['l_pkg']
13
- c_pkg = ibis_params['c_pkg']
14
- model_name = ibis_params['model_name']
15
- model_type = ibis_params['model_type']
16
- c_comp = ibis_params['c_comp']
17
- c_ref = ibis_params['c_ref']
18
- v_ref = ibis_params['v_ref']
19
- v_meas = ibis_params['v_meas']
20
- r_ref = ibis_params['r_ref']
21
- temperature_range = ibis_params['temperature_range']
22
- voltage_range = ibis_params['voltage_range']
23
- impedance = ibis_params['impedance']
24
- slew_rate = ibis_params['slew_rate']
25
- }
26
-
27
- [IBIS Ver] @(version)
28
- [File Name] @(file_name)
29
- [File Rev] @(file_rev)
30
-
31
- [Date] @(date)
32
-
33
- [Source] @(source)
34
-
35
- [Disclaimer]
36
- THIS MODEL IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
40
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
42
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
43
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45
- OF THIS MODEL, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
-
47
- [Notes]
48
- This IBIS file was generated using the template file: "generic.ibs.em".
49
-
50
- [Copyright] @(copyright)
51
- [Component] @(component)
52
- [Manufacturer] @(manufacturer)
53
-
54
- [Package]
55
-
56
- @{
57
- print("R_pkg %5.2f %5.2f %5.2f" % (r_pkg[0], r_pkg[1], r_pkg[2]))
58
- print("L_pkg %5.2fn %5.2fn %5.2fn" % (l_pkg[0] * 1.e9, l_pkg[1] * 1.e9, l_pkg[2] * 1.e9))
59
- print("C_pkg %5.2fp %5.2fp %5.2fp" % (c_pkg[0] * 1.e12, c_pkg[1] * 1.e12, c_pkg[2] * 1.e12))
60
- }
61
-
62
- [Pin] signal_name model_name R_pin L_pin C_pin
63
- 1p Tx_1_P @(model_name)
64
- 1n Tx_1_N @(model_name)
65
- 2p Tx_2_P @(model_name)
66
- 2n Tx_2_N @(model_name)
67
- 3p Tx_3_P @(model_name)
68
- 3n Tx_3_N @(model_name)
69
-
70
- [Diff_Pin] inv_pin vdiff tdelay_typ tdelay_min tdelay_max
71
- 1p 1n 0.1V NA NA NA
72
- 2p 2n 0.1V NA NA NA
73
- 3p 3n 0.1V NA NA NA
74
-
75
- [Model] @(model_name)
76
- Model_type @(model_type)
77
-
78
- @{
79
- print("C_comp %5.2fp %5.2fp %5.2fp" % (c_comp[0] * 1.e12, c_comp[1] * 1.e12, c_comp[2] * 1.e12))
80
- if(model_type == 'Output'):
81
- print("Cref = {}".format(c_ref))
82
- print("Vref = {}".format(v_ref))
83
- print("Vmeas = {}".format(v_meas))
84
- print("Rref = {}".format(r_ref))
85
- else:
86
- print("Vinl = {}".format(voltage_range[0] / 2. - 0.025))
87
- print("Vinh = {}".format(voltage_range[0] / 2. + 0.025))
88
- }
89
-
90
- [Algorithmic Model]
91
- Executable linux_gcc4.1.2_32 @(model_name)_x86.so @(model_name).ami
92
- Executable linux_gcc4.1.2_64 @(model_name)_x86_amd64.so @(model_name).ami
93
- Executable Windows_VisualStudio_32 @(model_name)_x86.dll @(model_name).ami
94
- Executable Windows_VisualStudio_64 @(model_name)_x86_amd64.dll @(model_name).ami
95
- [End Algorithmic Model]
96
-
97
- @{
98
- print("[Temperature_Range] %5.1f %5.1f %5.1f" % (temperature_range[0], temperature_range[1], temperature_range[2]))
99
- print("[Voltage_Range] %5.2f %5.2f %5.2f" % (voltage_range[0], voltage_range[1], voltage_range[2]))
100
- }
101
-
102
- @{
103
- if(model_type == 'Output'):
104
- print("[Pulldown]")
105
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (-1. * voltage_range[0], -10., -10., -10.))
106
- for v in [k * voltage_range[0] for k in range(2)]:
107
- i = v / array(impedance)
108
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (v, i[0], i[1], i[2]))
109
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (2. * voltage_range[0], 10., 10., 10.))
110
-
111
- print("[Pullup]")
112
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (-1. * voltage_range[0], 10., 10., 10.))
113
- for v in [k * voltage_range[0] for k in range(2)]:
114
- i = -1. * v / array(impedance)
115
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (v, i[0], i[1], i[2]))
116
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (2. * voltage_range[0], -10., -10., -10.))
117
-
118
- print("[Ramp]")
119
- dv = 0.6 * array([v * 50. / (50. + z) for (v, z) in zip(voltage_range, impedance)])
120
- dt = 1.e12 * dv / array(slew_rate)
121
- print("dV/dt_r %5.3f/%5.2fp %5.3f/%5.2fp %5.3f/%5.2fp" % (dv[0], dt[0], dv[1], dt[1], dv[2], dt[2]))
122
- print("dV/dt_f %5.3f/%5.2fp %5.3f/%5.2fp %5.3f/%5.2fp" % (dv[0], dt[0], dv[1], dt[1], dv[2], dt[2]))
123
- print("")
124
- else:
125
- print("[GND Clamp]")
126
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (-1. * voltage_range[0], -10., -10., -10.))
127
- for v in [k * voltage_range[0] for k in range(3)]:
128
- i = v / array(impedance) / 2
129
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (v, i[0], i[1], i[2]))
130
- print("")
131
- print("[Power Clamp]")
132
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (-1. * voltage_range[0], 10., 10., 10.))
133
- for v in [k * voltage_range[0] for k in range(3)]:
134
- i = v / array(impedance) / 2
135
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (v, -i[0], -i[1], -i[2]))
136
- print("")
137
- }
138
-
139
- [END]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes