Skip to content

Commit e9285fc

Browse files
committed
Add vendor drop for XDM 2.6.0
1 parent 0c5b79b commit e9285fc

File tree

6 files changed

+55
-44
lines changed

6 files changed

+55
-44
lines changed

CMakeLists.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
2020
# Process the Version Numbers
2121
#------------------------------------
2222
set(XDM_MAJOR_VERSION "2")
23-
set(XDM_MINOR_VERSION "5")
23+
set(XDM_MINOR_VERSION "6")
2424
set(XDM_PATCH_VERSION "0")
2525
if( NOT XDM_MAJOR_VERSION MATCHES "[0-9]+" )
2626
set( XDM_MAJOR_VERSION "X" CACHE STRING "The major version number for this build." )
@@ -366,16 +366,6 @@ if(PYINSTALLER_PATH)
366366
)
367367
endif()
368368

369-
#------------------------------------
370-
# Build Test Cases
371-
#------------------------------------
372-
option( BUILD_TESTS "GTests for expression parser." OFF )
373-
if( BUILD_TESTS )
374-
enable_testing()
375-
find_package(GTest REQUIRED)
376-
add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
377-
endif()
378-
379369
#------------------------------------
380370
# Installation Details
381371
#------------------------------------

RELEASE_NOTES.md

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,37 @@
11
# Xyce(TM) XDM Netlist Translator
2+
Xyce(TM) XDM Netlist Translator
23
Copyright 2002-2020 National Technology & Engineering Solutions of
34
Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
45
NTESS, the U.S. Government retains certain rights in this software.
5-
66
This program is free software: you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
88
the Free Software Foundation, either version 3 of the License, or
99
(at your option) any later version.
10-
1110
This program is distributed in the hope that it will be useful,
1211
but WITHOUT ANY WARRANTY; without even the implied warranty of
1312
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1413
GNU General Public License for more details.
15-
1614
You should have received a copy of the GNU General Public License
17-
along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
along with this program. If not, see http://www.gnu.org/licenses/.
1816

19-
20-
# XDM 2.5.0 Release Notes
17+
# XDM 2.6.0 Release Notes
2118

2219
## General
2320

24-
- Translations of netlists using binned models will no longer have the
25-
\texttt{.OPTION PARSER MODEL\_BINNING=TRUE} statement. This option is
26-
turned on by default in \Xyce{} now and therefore no longer needs to be
27-
explicitly declared.
28-
29-
- Duplicate output variables will now be removed from the \texttt{.PRINT}
30-
line.
31-
32-
- The expression and function pre-processing capabilities have been
33-
removed from XDM.
34-
35-
## spectre
36-
37-
- The \texttt{else} conditional block in \texttt{if-else} statments will
38-
now be commented out by XDM, since conditional statement support is not
39-
fully mature yet in \Xyce{}.
40-
41-
## PSpice
42-
43-
- Fixed bug where instance parameters for temperature coefficients for
44-
resistors were not translated.
21+
\item XDM now allows models to be redefined within the same scope
22+
without raising an exception. Previously, the code would exit out
23+
if a model was redefined. Now, it will just emit a warning.
24+
25+
## HSpice
26+
27+
\item HSPICE expressions can be delimited by double quotes. XDM would
28+
either let this pass through without making any changes (which
29+
would cause problems with the resultant Xyce netlist), or comment
30+
it out in some cases (mostly, in expressions in sources). This was
31+
fixed by adding a HSPICE grammar rule that defines expressions
32+
delimited by double quotes, and then adding code in the parser
33+
interface to change the expression delimiters to curly braces.
34+
35+
## SPECTRE
36+
37+
\item XDM now tranlates the SPECTRE model parameter "VERSION" to "version".

src/c_boost/xyce/HSPICEGrammar.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ struct hspice_parser : qi::grammar<Iterator, std::vector<netlist_statement_objec
6666
measure_param_name, measure_param_value, variable_expr_or_value, vol_type, cur_type, standalone_param, data_table_name, data_param_name, data_param_value, if_dir_type, else_dir_type, elseif_dir_type, endif_dir_type,
6767
IF_COND;
6868

69-
qi::rule<Iterator, std::string()> identifier, math_expression, math_expression_single_quote_delimiter, math_expression_no_delimiter, composite_math_expression, output_variable_expression,
70-
simple_v_output_expression, inline_comment_str, comment_str, filename_str, param_with_comma, raw_identifier, no_curly_brace_expression, any, node_identifier, raw_node_identifier,
71-
parenthetical_expression, numeric, number;
69+
qi::rule<Iterator, std::string()> identifier, math_expression, math_expression_single_quote_delimiter, math_expression_double_quote_delimiter, math_expression_no_delimiter, composite_math_expression,
70+
output_variable_expression, simple_v_output_expression, inline_comment_str, comment_str, filename_str, param_with_comma, raw_identifier, no_curly_brace_expression, any, node_identifier,
71+
raw_node_identifier, parenthetical_expression, numeric, number;
7272

7373
qi::rule<Iterator> white_space, par_name;
7474

@@ -131,12 +131,16 @@ struct hspice_parser : qi::grammar<Iterator, std::vector<netlist_statement_objec
131131
char_("'") >> +(parenthetical_expression | +char_("a-zA-Z0-9.+/*^,_=<> \t!|$&?:~-")) >> char_("'")
132132
;
133133

134+
math_expression_double_quote_delimiter =
135+
char_("\"") >> +(parenthetical_expression | +char_("a-zA-Z0-9.+/*^,_=<> \t!|$&?:~-")) >> char_("\"")
136+
;
137+
134138
math_expression_no_delimiter =
135139
parenthetical_expression | char_("a-zA-Z0-9.+,_=<>!|&:~-") >> *(parenthetical_expression | +char_("a-zA-Z0-9.+/*^,_=<>'!|$&?:~-"))
136140
;
137141

138142
math_expression =
139-
math_expression_single_quote_delimiter | math_expression_no_delimiter
143+
math_expression_single_quote_delimiter | math_expression_double_quote_delimiter | math_expression_no_delimiter
140144
;
141145

142146
simple_v_output_expression =

src/python/xdm/index/NAME_SCOPE_INDEX.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,25 +208,38 @@ def add_model(self, m, case_insensitive=False):
208208

209209
# If MASTER_MODEL already exists
210210
model_name = m.name
211+
212+
211213
if case_insensitive:
212214
model_name = m.name.upper()
213215

216+
214217
if ("__MODELDEF__" + model_name) in self._statements and isinstance(
215218
self._statements[("__MODELDEF__" + model_name)], MASTER_MODEL):
216219
master = self._statements[("__MODELDEF__" + model_name)]
220+
217221
else:
218222
d = self.get_object("__LAZYSTATEMENT__" + model_name)
219223
master = MASTER_MODEL(m.name)
224+
220225
if isinstance(d, LAZY_STATEMENT):
221226
d.bind(master, case_insensitive)
222227
self.remove_statement(d)
223-
if self._lib_command is None:
228+
229+
230+
if self._subckt_command is not None:
231+
if self.scope_contains("__MODELDEF__" + model_name):
232+
logging.warning(model_name + " has already been used in this scope")
233+
234+
elif self._lib_command is None:
224235
if self.scope_contains("__MODELDEF__" + model_name):
225236
raise NameConflictException(model_name + " has already been used in this scope")
237+
226238
else:
227239
if self.local_scope_contains("__MODELDEF__" + model_name):
228240
raise NameConflictException(model_name + " has already been used in this scope")
229241

242+
230243
self._statements["__MODELDEF__" + model_name] = master
231244
# Put MASTER_MODEL in indexes (if any care to see it)
232245
self._add_to_indexes(master)

src/python/xdm/inout/readers/HSPICENetlistBoostParserInterface.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,12 @@ def convert_next_token(self, parsed_object, parsed_object_iter, pnl, synthesized
547547
self._np = -1
548548

549549

550+
elif parsed_object.types[0] == SpiritCommon.data_model_type.EXPRESSION:
551+
processed_value = self.curly_braces_for_expressions(parsed_object.value)
552+
pnl.add_known_object(processed_value, BoostParserInterface.boost_xdm_map_dict[parsed_object.types[0]])
553+
554+
555+
550556
else:
551557
XyceNetlistBoostParserInterface.convert_next_token(parsed_object, parsed_object_iter, pnl, synthesized_pnls)
552558

@@ -624,6 +630,10 @@ def curly_braces_for_expressions(in_expression):
624630
if in_expression.startswith("'") and in_expression.endswith("'"):
625631
return in_expression
626632

633+
# check if expression is enclosed in double quotes
634+
if in_expression.startswith('"') and in_expression.endswith('"'):
635+
in_expression = in_expression[1:-1]
636+
627637
# remove single quotes that may be around function arguments
628638
expression_fields = in_expression.split("'")
629639
out_expression = "".join(expression_fields)

src/python/xdm/inout/readers/XDMFactory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,8 @@ def build_model(parsed_netlist_line, reader_state, language_definition):
923923

924924
if parsed_netlist_line.params_dict.get("VERSION"):
925925
version = parsed_netlist_line.params_dict["VERSION"]
926-
del parsed_netlist_line.params_dict["VERSION"]
926+
if language_definition.language != "hspice":
927+
del parsed_netlist_line.params_dict["VERSION"]
927928

928929
language_device_types = language_definition.get_devices_by_local_name(model_device_type)
929930
language_device_type = None

0 commit comments

Comments
 (0)