pax_global_header 0000666 0000000 0000000 00000000064 13165012111 0014501 g ustar 00root root 0000000 0000000 52 comment=519303bf34ef0b2d42b8d8299f6f3048400bafb5
AUTHORS 0000664 0000000 0000000 00000001005 13165012111 0012111 0 ustar 00root root 0000000 0000000 Gnucap is primarily the work of Albert Davis.
Here is a list of some of the contributors who have contributed more
than a bug report:
Dan McMahill - "autoconf" interface, NetBSD package
Stuart Brorson - configuration mods
Hamish Moffatt - Debian package
Telford Tendys - documentation and convergence
Dmitry Nadezhin - "electric" interface
Simon Hoffe - Command line editing and history
Gennady Serdyuk - lots of new work in progress
Felix Salfelder - lots of new work in progress
COPYING 0000664 0000000 0000000 00000104513 13165012111 0012104 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
ChangeLog 0000664 0000000 0000000 00000112250 13165012111 0012620 0 ustar 00root root 0000000 0000000 Gnucap revision history
------------------------------------------------------------------
------------------------------------------------------------------
Gnucap 0.34 release notes (02/01/2004)
This is a bug fix and compatibility release.
1. Fix bug causing incorrect interpolation of backwards tables.
2. Fix tanh overflow bug.
3. Fix some parsing bugs.
4. Fix occasional "double load" bug.
5. Fix AC sweep with one point.
6. Transient start time really works.
7. Fix occasional assert fail after option short is changed.
8. Fix memory leak resulting from failure to delete unused common.
9. Fix a Z probe bug that sometimes gave wrong answers.
10. Fix a limiting bug that sometimes caused non-convergence.
11. Configure handles isnan.
12. Improvements to logic initialization. It is still not correct.
------------------------------------------------------------------
Gnucap 0.33 release notes (01/12/2003)
This is a bug fix and compatibility release.
0.32 was not widely distributed due to password problems and a heavy
work load, so the release notes are repeated after the current ones.
New features:
1. Add inductance probes, like capacitor.
Bug fixes:
1. Fix xprobe duplicate default arg bug - shows in g++3.2.
2. Fix bug that sometimes caused a crash when changing a model after
analysis.
3. Fix bug that caused an assert to fail (debug build) after removing
a probe from an element.
4. Fix a dumb typo hack bug ddHAS_READLINE. Now history and command
line editing really works. It was working, but somehow the hack
slipped into the release code.
------------------------------------------------------------------
Gnucap 0.32 release notes (09/30/2002)
New features:
1. Series resistance in the diode. It took 5 minutes to do,
so it is embarrasing that it wasn't done before.
2. History and command line editing, using Gnu Readline. Thanks to
Simon Hoffe for sending me the patch.
3. More parameters in the BJT model. This gives it better
compatibility with commercial simulators. These parameters are beyond
Spice 3f5.
4. "M" parameter in diode, BJT and MOS devices. M is the number of
parallel devices. Some commercial simulators have this.
Changes that may or may not be improvements.
1. The definition of the transient option "UIC" has changed. It is
now Spice compatible, which means to not attempt to do any solution or
consistency check. Just apply the values, assuming anything that
isn't specified is 0. The old behavior was to attempt a solution
while holding the IC values.
Bug fixes:
1. voltage sync bug. It still doesn't fix the MOS 2 convergence
problem.
2. Fix memory leak in POLY components.
3. Fix bug in Fourier that sometimes causes overrun (crash) and time
sync errors.
4. Modelgen: fix bug in list parsing.
5. Some changes to eliminate warnings when compiling with g++ 3.1.
6. Use Euler differentiation on first step, because trap used a value
that cannot be known then. Usually, this doesn't make much
difference, but there are a few cases where the error can get
magnified and trigger trapezoidal ringing, leading to a totally bogus
result. It most cases, you could hide it with small enough steps.
These cases should work with default settings now.
7. Fix bug that sometimes caused incorrect handling of initial
conditions (UIC),
8. Fix bug that caused continuing a transient analysis to give
incorrect results.
Significant internal changes:
1. The inductor uses all of the same support functions as the
capacitor, including "integrate", which is now correctly called
"differentiate".
2. Most of the code is in place for named nodes. It mostly works and
can be turned on with the option "namednodes". It is off by default
because it is not complete. Most likely, it will be finished in the
next release.
Some things that are still partially implemented:
1. BSIM models, charge effects, "alpha0" parameter. (computed then
ignored)
2. Configure still doesn't handle everything.
3. The model compiler still requires too much raw coding.
4. Named nodes. If you set the option "namednodes", it will support
named nodes, but some things don't work, so it is off by default.
5. The preliminary IBIS code is now included. For now, it is a
standalone executable, that reads an IBIS file and generates a
netlist. The netlist requires some editing to use, and is not fully
compatible anyway. It is included in hopes of recruiting help in
finishing the project.
Bugs (nothing new, but needs repeating):
1. The transmission line initial conditions are not propagated until
the transient analysis runs.
2. An occasional bogus calculation in MOSFETS occurs when a device is
reversed. This sometimes causes nonconvergence.
3. The "modify" command with multiple arguments seems to take only the
first one. It used to work, but is broken in this release. I am not
sure when it broke.
------------------------------------------------------------------
Gnucap 0.31 release notes (03/25/2002)
The most significant changes are the BJT model and "binning".
New features:
1. BJT model.
2. "Binning" for all MOS models.
3. Internal element: non-quasi-static poly-capacitor. (needed by BJT).
4. Enhancements to the data structures and model compiler to support
binning in general.
5. A line prefixed by "*>" is not ignored, in spite of the fact that
"*" usually begins a comment. This is a deliberate incompatibility
with Spice. If you prefix a line by "*>" it will be interpreted as a
non-comment in Gnucap, but a comment in Spice.
6. Circuit line prefixes of ">" and command prefixes of "-->" are
ignored. This is so you can copy and paste whole lines, without
having to manually remove the prompt string.
Changes that may or may not be improvements.
1. It is not the default to include stray resistance in device models.
The option "norstray" will revert to the old behavior. This is only a
change to the default value of "rstray".
Significant internal changes:
1. The internal element non-quasi-static poly-capacitor actually
works. It is used by the BJT model, and will eventually be used by
MOSFET models.
2. There are now two poly_g devices: "CPOLY_G" and "FPOLY_G". There
are interface differences that impact modeling. Previously, there was
only one, which is equivalent to the "FPOLY_G".
Some things that are still partially implemented:
1. BSIM models, charge effects, "alpha0" parameter. (computed then
ignored)
2. Configure still doesn't handle everything.
3. The model compiler still requires too much raw coding.
General comments:
The new BJT model seems to pass the CircuitSim90 test cases as well as
anything else, except where a missing feature prevented it from
working. A few files would not run because of named nodes. One file
(ring11) failed completely. This file also has MOSFETs, with level 2
models. The MOS level 2 model is not as robust as the BJT. I believe
the problem is due to the voltage sync bug that still impacts the MOS
model.
Most of the models have has a reasonable amount of testing in DC, but
inadequate testing in AC and transient. The BJT model has had more
testing than the others in AC and transient. All differences
(relative to other simulators) that were observed can be attributed to
differences in transient step size control or tolerance checking.
Bugs (nothing new, but needs repeating):
1. The transmission line initial conditions are not propagated until
the transient analysis runs.
------------------------------------------------------------------
GNUCAP 0.30 release notes (10/29/2001)
The primary effort has been to finish the model compiler, to the point
where it can handle most modeling issues. The second change is to
re-release as "gnucap", and add some configuration features to be more
consistent with other GNU software.
New features:
1. More complete model compiler.
2. "./configure" makes compiling more like other GNU software.
Some things that are still partially implemented:
1. Internal element: non-quasi-static poly-capacitor.
2. BSIM models, charge effects, "alpha0" parameter. (computed then ignored)
3. Configure still doesn't handle everything.
4. The model compiler still requires too much raw coding.
Bugs (nothing new, but needs repeating):
1. The transmission line initial conditions are not propagated until
the transient analysis runs.
------------------------------------------------------------------
ACS 0.29 release notes (06/30/2001)
The primary effort has been to implement IBIS, which is still not
done. The changes here are mostly infrastructure changes needed to
support IBIS.
New features:
1. "Fit" function has choice of fit order and extrapolation. You can
have order 0, 1, 2, or 3.
2. "Posy" has even and odd options, to determine what happens in the
negative region.
3. Modelgen improvements. It now is useful for the whole device,
sometimes. It now handles probes and the device side of the model.
The diode uses it completely. There are still a few missing features
needed for the MOSFET and BJT.
4. Spice-3 compatible semiconductor resistor and capacitor.
5. "Table" model statement.
Improvements, bug fixes, etc.
1. Option "numdgt" really works.
2. Better error messages from modelgen.
3. Code changes for optimization of commons. This should reduce
memory use, sometimes, by sharing commons. Common sharing is still
not fully implemented.
4. Fix two bugs that sometimes caused problems after a "modify" or on
a "fault".
5. Better handling of "vmin" and "vmax". It should be much less
likely that limiting causes convergence to a nonsense result.
Some things that are still partially implemented:
1. Internal element: non-quasi-static poly-capacitor.
2. BSIM models, charge effects, "alpha0" parameter. (computed then ignored)
Bugs (nothing new, but needs repeating):
1. The transmission line initial conditions are not propagated until
the transient analysis runs.
2. The makefile does not set up the proper link for the model
compiler. You need to do it manually.
3. On some systems, you will get a warning from the linker that "the
use of 'tmpnam' is dangerous". You can ignore this warning.
------------------------------------------------------------------
ACS 0.28 release notes (09/05/2000)
New features:
1. New probes: diode G, mos IBD, IBS, GBD, GBS.
2. New options: "floor" and "vfloor". (Floor was in the manual, but
not in the simulator.)
Improvements, bug fixes, etc.
1. There is a change to the way behavioral modeling conditionals are
handled. It should now be 100% compatible with SPICE, considering the
subset that duplicates SPICE. There are still significant extensions
beyond SPICE, particularly that you can have behavioral resistors,
capacitors, inductors, etc.
2. Parameter default calculations are now done in a manner consistent
with Spice 3f5. Previously, it was supposedly consistent with Spice
2g6.
3. A bug in calculation of threshold voltage of the level 6 model, for
P channel devices, has been fixed.
4. A bug in calculation of Meyer capacitances when the device is
reversed has been fixed. This bug sometimes caused a discontinuity at
vds=0.
5. I have added some smoothing to the Meyer mos capacitor models.
This improves convergence. The down side is that sometimes the
answers are different. It is probably a little better, when
considering closeness to reality, but it is still Meyer's model.
6. MOSFET parasitic diodes are now the same as those used in Spice.
7. There are subtle changes in the diode model. I think this usually
improves convergence.
8. Charge calculation in Meyer capacitors and diode capacitiors is now
supposedly Spice 3 compatible.
9. An error in BSIM3 scaling has been fixed.
Some things that are still partially implemented:
1. Internal element: non-quasi-static poly-capacitor.
2. BSIM models, charge effects.
Bugs (nothing new, but needs repeating):
1. The transmission line initial conditions are not propagated until
the transient analysis runs.
2. The makefile does not set up the proper link for the model
compiler. You need to do it manually.
3. A bad setting of "vmax" and "vmin" can lead to convergence to a
nonsense result. It is not as bad now as it used to be.
------------------------------------------------------------------
ACS 0.27 release notes (06/03/2000)
New features:
1. BSIM3 model, DC.
They work for AC and transient analysis, but only the DC effects
actually work. The next release should have the charge effects. For
now, it fakes it with Meyer's model.
2. A first cut at a model compiler, to aid in development of new
models. Models are described in a ".model" file, which is processed
to automatically generate the ".h" and ".cc" files. This version
fully handles the ".model" statement part of it, but leaves the device
and common sections the old way. Eventually, the entire process will
be automated. The old way still works.
3. "Fit" behavioral modeling function, which fits a curve to a set of
data. You can specify the order of the fit, which is piecewise
polynomials. For now, the order may be 1 (linear, like PWL) or 3
(cubic splines). You may also specify the boundary consitions.
4. More probes.
Some things that are partially implemented:
1. Internal element: non-quasi-static poly-capacitor. It is needed by
the BSIM3 and EKV models. Eventually, it will be available as a
netlist item, but not yet.
Bug fixes:
1. PWL could fail if there were duplicate points at the beginning. It
still does, but gives a reasonable error message.
2. Some "dot commands" were ignored if there were spaces before the
dot. This was particularly annoying if the line was supposed to be
".end" which should make it exit. It didn't, leaving it in
interactive mode, a major annoyance in a script.
Other improvements:
1. There is a change to the way integration in capacitors is done. It
is now strictly based on charge (i = dq/dt). The old version was
based on capacitance (i = C * dv/dt) which is strictly incorrect. The
dC/dt term was missing (i = C * dv/dt + v * dC/dt). This is a
non-issue when C is constant.
2. More documentation on internals.
Changes that I think are improvements, but some may disagree:
1. The command line is a little different. In the old version,
"acs file" would run it, and whether it exited or not depended on
whether there was an ".end" line. Now, by default, it just loads the
file in preparation for interactive use. If you want batch mode, say
"acs -b file".
2. The regression suite is included in the standard distribution.
Changes that are not really improvements:
1. Due to the model compiler, the build process is a little more
complicated. To do a complete build, you must build the model
compiler first, then the simulator. If you are not making any new
models, you can probably get away with just building the simulator.
This will change in a future release.
Bugs:
1. The transmission line initial conditions are not propagated until
the transient analysis runs.
2. The makefile does not set up the proper link for the model
compiler. You need to do it manually.
------------------------------------------------------------------
ACS 0.26 release notes (02/02/2000)
New features:
1. BSIM1, BSIM2 models -- DC only.
They work for AC and transient analysis, but only the
DC effects actually work. The next release should
have the charge effects.
2. New elements:
trans-capacitor
voltage controlled capacitor
voltage controlled conductance
voltage controlled resistor
This is a side effect of the BSIM work.
3. Optional new syntax, with type first so component labels can start
with any letter, and the choice of components is no longer limited by
the 26 letters. This was necessary for a clean syntax
for #2.
4. Some new parameters on existing devices, also a side
effect of the BSIM work.
5. The manual in HTML form. The manual source is still in LaTeX,
which can be used to generate HTML, PDF, Postscript, or many other
formats.
Bug fixes:
1. An error causing truncation error to be underestimated has been fixed.
Other improvements:
1. MOSFET model evaluation is a little faster, due to use of one of
the new elements to replace several old ones. I have seen 40%, but
20% is more likely. The improvement is most evident on busy circuits,
where the ACS speed enhancements based on latency exploitation
contribute more overhead than their value, that is .. the type of
circuit that has run faster in Spice than ACS.
2. More documentation on internals.
Changes that I think are improvements, but some may disagree:
1. Truncation error based step control is disabled when Euler's method
is selected. The justification for this is that the reason for
selecting Euler's method is to avoid the artifacts of high order
methods on "stiff" poles. Without this change, a "stiff" pole would
cause an unreasonably small step size. This did not appear to be much
of a problem in the old release because the use of an incorrect
formula for estimating truncation error. A "stiff" pole is one that
has a response so fast it can be thought of as instantaneous.
2. The "help" command, with its 4 year old help file, has been
removed. The concept is really obsolete. With the HTML form of the
manual, a full online manual is a better replacement.
------------------------------------------------------------------
ACS 0.25 release notes (11/04/99)
New features:
None!
Bug fixes:
1. A name conflict that caused compile to fail with gcc 2.95 has been
fixed.
2. A problem that caused switches to lose state when a simulation is
stopped and restarted when a switch is in transition has been fixed.
3. Two unrelated problems with transmission lines have been fixed.
(Short lines and lines in subcircuits.)
Changes that may or may not be improvements:
1. Several queues have been added, to manage model evaluation
scheduling. This is part of work on multi-rate and mixed-mode
simulation, and it replaces the traditional bypass scheme. In this
release, probably the only noticeable difference will be that it runs
a little faster.
Known bugs:
1. The help file has not been updated for 4 years.
------------------------------------------------------------------
ACS 0.24 release notes (08/21/99)
New features:
1. Enhanced (now documented) behavioral modeling.
2. Transmission line in transient analysis.
3. More documentation of internals.
4. Better batch mode error handling.
Bug fixes:
1. Control-C trap works.
2. A bug that could cause a crash when a device had an improper number
of nodes has been fixed. It now issues a warning, and grounds the
unspecified nodes.
3. A bug that could cause a crash when a model or subcircuit is
deleted then accessed has been fixed.
4. A scoping bug that sometimes put subckt parts in the root circuit
has been fixed.
5. A bug in "fanout" that listed internal subckt nodes incorrectly has
been fixed.
Changes that may or may not be improvements:
1. "Make2" files for some systems have been removed. These have not
been tested in years, and ACS and the compilers have both evolved
significantly, so any portability patches that old are probably
completely wrong now.
Known bugs:
1. The help file has not been updated for 4 years.
------------------------------------------------------------------
ACS 0.23 release notes (06/15/99)
New features:
1. Level 6 mos model.
2. HSpice style PWL and POLY(1).
3. "Table" behavioral modeling function.
4. Mixed-mode digital initialization.
The bug fixes:
1. The alarm range worked backwards, now fixed.
2. Keep track of commons better.
3. Improved mixed-mode simulation. It still has not been tested as
well as I would like, but is better. Digital initialization works
now.
4. Another case of "zero time step" has been fixed. This one was
relatively benign, in that it only caused a single extra full
evaluation, with immediate recovery to a normal step size.
5. "Z" probe gave wrong results when probing a voltage source.
Other improvements: (?)
1. Some subtractions now de-noise the result, eliminating the tiny
numbers that result from subtracting two nearly equal numbers. The
threshold can be set by the option "roundofftol". It is best left set
at 1e-13. This improves speed slightly because 0 will prevent a
matrix reload, but any non-zero number will not. It improves
convergence slightly because the tiny numbers (which result from
numerical problems) tend to cause further numerical problems. These
tiny numbers are an artifact of the machine math, and vary depending
on optimization and machine implementation details.
2. MOS temperature effects are computed at run time, instead of at
load time, so you can change the temperature after loading and get
correct results.
3. The options for integration method have changed, and are more
flexible. The default is still trapezoidal, but that may change in a
future release. You can specify the mode individually for capacitors
and inductors. The information is in the data structure for all
components, but it isn't always parsed. A future release will let you
specify it by component or by model. The names are Spectre
compatible, not Spice compatible, because it is more flexible. The
Spice names are accepted, but may not act the same as they do in
Spice. Choices are: unknown, euler, euleronly, trap, traponly.
Options accepted and coerced into something else are: gear2,
gear2only, trapgear, trapeuler. In general, gear is treated as euler,
and each element will use either euler or trap. The device choice
wins over the option command choice, but "only" wins over non-only.
4. Logic device syntax is changed. There are two more nodes, so
power, ground, and enable are passed in. Power and enable are not
used (except possibly in subckt models) but are required for
consistency.
5. In many (not all) cases, arbitrary limits, due to fixed size
arrays, have been removed.
6. More rigorous testing. I actually have a regression suite now. It
is still not rigorous enough.
7. More rigorous convergence criteria. This should solve some of the
false convergence problems. ACS convergence criteria has always been
more rigorous than Spice.
The cosmetic changes:
1. Convert most containers to STL.
2. Complete migration to the "common" tree, and eliminating reference
to the old C "x" structure extensions.
3. Rearrangement of MOS model hierarchy, to make it easier to install
other models. (BSIM family is coming.)
------------------------------------------------------------------
ACS 0.22 release notes (10/16/98)
This release contains a few bug fixes, and a few cosmetic changes to the
code.
The bug fixes:
1. Fixes convergence failures in circuits with linear inductors,
linear mutual inductors, and linear current controlled sources.
2. Fixes a bypass problem, which shows as transient analysis failure
with the message "very backward time step".
3. Failed assertion on switch.
The cosmetic changes:
1. The "OMSTREAM" class, as a step in migrating the i/o to C++ style.
2. A cleaner event queue, using a generic heap class.
That's really all. I have not been actively working on ACS, mostly
due to employment at a semiconductor company in their "corporate CAD"
department. This will change soon, because my new employer (a CAD
tool vendor) says it is ok to work on ACS.
------------------------------------------------------------------
ACS 0.21 release notes (03/30/96)
There are several changes, most of which are only visible in subtle
ways from the outside.
1. The code is more conformant with the upcoming standard, particularly
in the use of complex, templates, lifetime of temporaries, and for
scope. This should fix problems compiling with g++ 2.7.
2. Element commons are freed properly.
3. The manner in which elements are loaded into the matrix is
different, and should be faster for large circuits with latency.
Model bypass is more complete, because it is no longer necessary
to do anything with a latent model. It makes little difference
for small circuits, and circuits that are mostly active. Speed
gains on small circuits are offset by #4.
4. The bypass criteria are more strict. It was possible to get
incorrect results through interaction between model evaluation
bypass and iteration damping. This release will not bypass anything
when damping is in effect. There is a slight speed penalty.
5. Logic devices work even when there is no analog model. The bug
causing a failure in this case has been fixed. The "bug" (that
could in a twisted sense be called a feature) that leads to random
mapping on start-up is still there. The logic model still needs
work.
6. The code is somewhat more object-oriented. Some classes have
been changed to be more general.
------------------------------------------------------------------
ACS 0.20 release notes (11/22/95)
This release adds the level-3 MOSFET model. It is Spice compatible.
Actually, it was there a long time ago but was removed because it
didn't work correctly. This one has been tested and seems to match
Spice results, and have convergence characteristics a little better
than Spice 2g6. Like the level 1 and 2 models, only Meyer's
capacitance model is implemented. (like Spice 3).
------------------------------------------------------------------
ACS 0.19 release notes (10/31/95)
This release offers "improved" convergence.
Several new options have been added to control iteration damping.
In some cases, the program will take a partial step in an attempt
to tame the wild fluctuations that can occur during iteration with
Newton's method. This version appears to be considerably more
robust than Spice 2g6. Several test circuits that fail to converge
on Spice do converge on ACS. The cost of this is sometimes slower
convergence. It generally takes about 2 more iterations per step
than the previous version. This can be turned off, using the
"dampstrategy" option at a slight cost in robustness. See the
manual on the options command for more information.
------------------------------------------------------------------
ACS 0.18 release notes (05/12/95)
This release offers improved memory management and exception
handling, primarily aimed at MSDOS systems.
Bug fixes:
1. For all ... Out of memory exceptions are properly trapped.
Version 0.17 would crash if it ran out of memory. Now you get a
reasonable message. It was only a real problem on MSDOS systems.
2. MSDOS floating point exceptions are trapped. In 0.17, underflow
exceptions and null floating point exceptions could sometimes cause
an abort. I don't know why, but the 80287 can generate a null
exception when apparently nothing is wrong.
3. MSDOS only: Evade underflow in exp(). A large negative argument
to exp can give bogus results. This was a known (to me) in Microsoft
C 5.1. Apparently Borland has the same behavior. It may be a
hardware problem. The fix is to not call exp with an argument
beyond -200, and return 0 instead.
4. Don't use "-fast-math" with g++. (Makefile change). It doesn't
make any difference in speed, and it sometimes causes problems,
particularly the one in #3 above.
Performance improvements:
1. Most elements no longer store values from the past. Only
inductors and capacitors do. This means that some probes are no
longer available. Some other data has been moved to improve memory
usage. This change increases the capacity of the MSDOS version by
about 10 transistors. Unix systems will swap less.
Other visible changes:
1. The method of attaching models to devices has been changed, to
improve maintainability. There are a few noticeable side effects.
a. The default models -d-, -n- are no longer available. These were
not documented.
b. Model names must now be unique. If you have a diode model named
"foo", you may not also have a mosfet model named "foo".
c. A diode can reference a mosfet model. The diode will be equivalent
to the source-bulk diode in the mosfet. This is a byproduct of
using C++ derived classes. The mosfet model is derived from the
diode model.
2. Exception handling in batch mode is different. It is still not
right.
------------------------------------------------------------------
ACS 0.17 release notes (04/21/95)
The primary difference in this release is reorganization and C++.
A side benefit is that it is slightly faster, and uses slightly
less memory. (The program is bigger, but it stores data more
efficiently, for a net improvement.) It is a transitional release,
with some of the code still in C. I hope to have a full C++ version
this summer.
Bug fixes:
1. Voltage source (vs, vcvs, ccvs) probes (current, power, etc.)
now really work.
2. Fixed bug that caused strange results with mutual inductance
after other parts of the circuit are changed.
3. Fixed memory leak in subcircuits and complex devices.
4. Fixed bug that caused a crash when probed elements were deleted.
------------------------------------------------------------------
ACS 0.16 release notes (12/10/94)
New features:
1. New components: current controlled switch, current controlled
current source, current controlled voltage source. Any simple two
terminal element (not a diode) can be used as a probe, not just
a voltage source.
2. Diode transit time parameter works.
3. Mutual inductance. The coupled coils must be linear. Only
pairs of coupled inductors are supported in this release. A future
release will probably support multiply coupled inductors.
Bug fixes:
1. Continuing a transient analysis now works as documented.
------------------------------------------------------------------
ACS 0.15 release notes (07/31/94)
Version 0.15 is supposed to be a minimal bug fix release to 0.14,
but does have one new component.
1. Some additional ports are supported, including VMS. An HP port
is supplied as a user contribution, but I have not tested it.
2. New component: voltage controlled switch. Spice-3 compatible.
3. Fixed bug that caused unpredictable behavior (usually loss of
a probe, sometimes a crash) after replacing a component.
4. Fixed bug that caused incorrect evaluation and initialization
of logic devices when there is no analog model.
5. Fixed a bug in truncation error control that sometimes caused
it to become a no-op. It still seems to usually work the same as
Spice, except that ACS will actually use at least the time steps
you ask for. Spice will pick all the steps and interpolate for
the points you ask for. This will usually cause ACS to use more
time steps than Spice, hence often slower simulations.
6. Fixed another bug in truncation error that sometimes caused a
divide by zero.
------------------------------------------------------------------
ACS 0.14 release notes (07/05/94)
Version 0.14 was supposed to be a minimal bug fix release to 0.13.
The same bugs are still there and there are a few small additions
mostly aimed at coping with convergence problems.
1. The truncation error formula was changed to use the third
derivative of charge instead of the second derivative of current.
These two numbers are theoretically equal, but in practice they
are not. The second derivative of current uses 3 terms to compute
by divided differences. The third derivative of charge uses 4
terms. Using the odd number of terms catches the error due to the
oscillatory nature of the trapezoid rule. An even number of terms
tends to lose this error. Also, using charge tends to mask it.
So, I have changed it to a less accurate, more optimistic method,
the same as Spice. It now seems to work about the same as Spice,
in the sense that it usually chooses about the same step sizes.
Strictly, the old method is "better" but it tends to run away on
stiff poles, trying for excess accuracy that doesn't matter. Your
comments on this matter are welcome. If you know of any good papers
on this, please let me know.
2. The "stiff" option has been removed from the transient command.
Instead, use the .options "trapezoid" or "gear". For now, "gear"
implies first order and is equivalent to the old "stiff". (A
cop-out.) Actually, for stiff poles you want a first order method
because the error is lower.
3. You can specify the integration method individually on any
capacitor or inductor.
4. A bug causing the MSDOS version (2 byte integers) to mess up
probes of other than nodes was fixed.
5. A bug that sometimes caused it to perpetually repeat the same
time step was fixed. (SPICE would have reported "time step too
small" and stopped.)
6. A bug that messed up step control when a dormant model wakes up
and finds out it has been sleeping too long has been fixed.
7. "Mosflags" and "diodeflags" are different and there are more of
them. There are lots of them and they may be useful in taming
convergence problems. They control the heuristics that are applied
when there appears to be a convergence problem. I have yet to find
a circuit that could not be made to converge by judicious application
of the flags and options, but any one setting is no better than
Spice, and many are worse. One combination of flags gives Spice
style limiting, which more often than not makes convergence worse.
8. "vmax" and "vmin" options as part of convergence heuristics.
The default value of "limit" now large enough to essentially remove
it. These limits sometimes help convergence, but more often hurt.
9. The "damp" option actually works.
10. The diode "off" flag works correctly.
11. There is a new command "alarm" that prints a message when a
value exceeds a range. The syntax is the same as the "plot" command.
------------------------------------------------------------------
ACS 0.13 release notes (03/11/94)
Version 0.13 adds several new features and has several bug fixes
and performance improvements.
1. Fourier analysis really works.
The "Fourier" command does a transient analysis but prints the
results in the frequency domain. It is similar to the Spice command
of the same name but not exactly the same. It is significantly
more accurate than Spice because the transient time steps are chosen
for the best match to the Fast Fourier Transform. Considerably
more flexibility is available than in Spice.
2. Transient time step control by truncation error (finally).
3. Several options have been added to display diagnostics.
4. Fixed the default value for idsat, issat, ad, and as in the
mos-diode. In 0.12, the default area was 1 square meter, which
gave mosfet capacitors in the 500 uf range. This sometimes caused
strange results.
5. Added some node probes, mostly for diagnostic use.
6. Fixed the "F" probe on linear elements. (Capacitor charge,
inductor flux, admittance current, resistor voltage) It used to
give an obviously bogus answer.
Other changes:
1. Some general changes in the interest of improving code quality
in general.
2. Function headers are in ANSI style, rather than K&R style. This
version will compile as either C or C++. Future versions will
require a C++ compiler.
------------------------------------------------------------------
ACS 0.12 release notes (10/09/93)
Version 0.12 is a maintenance release. It adds no features (except Ultrix
support) but fixes several bugs and changes some porting details. It
should be easier to port this version than previous versions.
The bug fixes are significant enough that you should upgrade to 0.12 even
if you are not having any problems.
------------------------------------------------------------------
ACS 0.11 release notes (07/26/93)
Version 0.11 fixes a few bugs in 0.10. 0.10 was supposed to be
posted on alt.sources but due to a problem with the feed it never
happened.
New features:
1. New MOSFET and diode probes. All information available from
the Spice 2 "op" analysis is now available as probes. For MOSFET
these include cbd, cbs, cgsovl, cgdovl, cgbovl, cgs, cgd, cgb,
vdsat, vth. Other (non-spice) new probes include cgst, cgdt, cgbt.
(cgst = Cgs total = cgsovl + cgs.) These were available before by
probing the value of the internal element but it was less convenient.
Now it is simple and has the same name as in Spice. These probes
are also available in transient analysis, so you can see (for
example) the dynamic variations in capacitance.
Bugs fixed:
1. Pass arguments to tr_volts and family by pointer instead of the
whole structure. This is less likely to tickle a bug in Microsoft
C. The MSDOS version of ACS 0.10 crashed frequently due to this
bug. (Strictly, this is a Microsoft-C bug, not an ACS bug but the
effect is the same.)
2. The AC "Z" probes work again. They were broken in 0.10.
3. The size of the buffer for text plots is increased allowing
support for wider screens. The old version would crash if you did
plots with outwidth set to wider than 128. The fix is to make it
bigger, with a new constant MAXWIDTH, and trap the width setting
bigger than MAXWIDTH. The current max is 256 for MSDOS and 512
for unix. The plotting code should probably be redone.
4. Width is narrower by 1 so setting width to 80 won't leave blank
lines on an 80 column screen.
5. MOSFET capacitance now matches Spice (Meyer model)
6. Level 1 model linear region gds calculation was wrong, but close
enough to often go unnoticed. It is correct and matches Spice now.
7. The value of an AC source now is compatible with Spice. That
is, plain value is the DC-tran value. In old versions of ACS a
plain value applied to all analyses including AC. You needed to
prefix the value with "DC" to make it not apply to AC. Actually,
it worked as documented. Now it works like Spice, which makes more
sense. This was a major source of strange results in AC analysis.
------------------------------------------------------------------
------------------------------------------------------------------
INSTALL 0000664 0000000 0000000 00000002177 13165012111 0012105 0 ustar 00root root 0000000 0000000 Installation Instructions
*************************
This program does not use "autoconf" but rather uses a simple script
that provides a subset with a similar interface.
In most cases, you can do:
=======
./configure
make
sudo make install
=======
The scripts are recursive, so you can cd to any of the subdirectories
and do the same.
By default, it installs in /usr/local . To change it, you can specify a prefix:
./configure --prefix=/usr/share
If you have already compiled it, you do not need to recompile to
change the install directory. Just ./configure and make install.
Other targets:
"make clean" removes object files.
"make debug" builds a development version with additional debugging
code enabled. It runs about 2x slower than the standard build.
"make depend" builds the files "Make.depend" which are used to decide
what to rebuild. You need to do this only if you modify the code in a
way that changes what files are included by #include.
"make tags" builds cross reference files that can be used by some
editors, such as emacs, to navigate the code.
"make manifest" builds a list of the files included in a distribution.
Make3 0000664 0000000 0000000 00000006716 13165012111 0011742 0 ustar 00root root 0000000 0000000 #$Id: Make3 2016/04/19 al $ -*- Makefile -*-
# Copyright (C) 2001 Albert Davis
# Author: Albert Davis
#
# This file is part of "Gnucap", the Gnu Circuit Analysis Package
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#------------------------------------------------------------------------
# Part 3 of a Makefile
#------------------------------------------------------------------------
tags: $(HDRS) $(SRCS)
etags --c++ $(HDRS) $(SRCS)
#------------------------------------------------------------------------
checkout:
co $(RAW)
#------------------------------------------------------------------------
install-debug : install
install : $(INSTALL_FILES) $(DATA_FILES)
echo ==================
mkdir -p $(DESTDIR)$(INSTALL_DIR)
cp $(INSTALL_FILES) $(DESTDIR)$(INSTALL_DIR)
[ -z "$(INSTALL_DATA_DIR)" ] || \
mkdir -p $(DESTDIR)$(INSTALL_DATA_DIR)
[ -z "$(INSTALL_DATA_FILES)" ] || \
cp $(INSTALL_DATA_FILES) $(DESTDIR)$(INSTALL_DATA_DIR)
[ -z "$(INSTALL_SYSCONF_DIR)" ] || \
mkdir -p $(DESTDIR)$(INSTALL_SYSCONF_DIR)
[ -z "$(INSTALL_SYSCONF_FILES)" ] || \
cp $(INSTALL_SYSCONF_FILES) $(DESTDIR)$(INSTALL_SYSCONF_DIR)
#------------------------------------------------------------------------
uninstall :
(cd $(DESTDIR)$(INSTALL_DIR) ; rm $(INSTALL_FILES))
#------------------------------------------------------------------------
#unclean:
# rm $(ALL)
#------------------------------------------------------------------------
backup:
-mkdir BACKUP
cp $(RAW) BACKUP
#------------------------------------------------------------------------
depend: Make.depend
Make.depend: $(SRCS) $(HDRS)
$(CCC) -MM $(CCFLAGS) $(SRCS) > Make.depend
#-----------------------------------------------------------------------------
date:
date "+#define PATCHLEVEL \"`git branch | awk '/\*/ { print $$2; }'` %Y.%m.%d\"" \
>patchlev.h
#-----------------------------------------------------------------------------
header-check:
-$(CCC) -I../include -o /dev/null $(RAW_HDRS)
#-----------------------------------------------------------------------------
manifest: MANIFEST
MANIFEST: $(DISTFILES)
echo $(DISTFILES) | sed 's/ /\n/g' >MANIFEST
#-----------------------------------------------------------------------------
md5sums: MD5SUMS
MD5SUMS: $(DISTFILES)
md5sum $(DISTFILES) | grep -v MD5SUMS >MD5SUMS
#-----------------------------------------------------------------------------
mostlyclean:
rm -rf $(MOSTLYCLEANFILES)
rm -f */*.o */*.obj */*.h */*.cc
clean:
rm -rf $(CLEANFILES)
rm -f */*.o */*.obj */*.h */*.cc
distclean:
rm -rf $(DISTCLEANFILES)
rm -f */*.o */*.obj */*.h */*.cc
rm -f *~ \#*\#
maintainer-clean:
rm -rf $(MAINTAINERCLEANFILES)
rm -f */*.o */*.obj */*.h */*.cc
rm -f *~ \#*\#
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
Makefile 0000664 0000000 0000000 00000004151 13165012111 0012506 0 ustar 00root root 0000000 0000000
gnucap: nothing
#(cd include; ${MAKE} gnucap)
(cd lib; ${MAKE} -k)
(cd modelgen; ${MAKE} -k)
(cd main; ${MAKE} -k)
(cd apps; ${MAKE} -k)
debug:
#(cd include; ${MAKE} debug)
(cd lib; ${MAKE} debug)
(cd modelgen; ${MAKE} debug)
(cd main; ${MAKE} debug)
(cd apps; ${MAKE} debug)
g++:
#(cd include; ${MAKE} g++)
(cd lib; ${MAKE} g++)
(cd modelgen; ${MAKE} g++)
(cd main; ${MAKE} g++)
(cd apps; ${MAKE} g++)
mingw:
#(cd include; ${MAKE} mingw)
(cd lib; ${MAKE} mingw)
(cd modelgen; ${MAKE} mingw)
(cd main; ${MAKE} mingw)
(cd apps; ${MAKE} mingw)
clean:
#(cd include; ${MAKE} clean)
(cd lib; ${MAKE} clean)
(cd modelgen; ${MAKE} clean)
(cd main; ${MAKE} clean)
(cd apps; ${MAKE} clean)
-rm *~ \#*\#
depend:
#(cd include; ${MAKE} depend)
(cd lib; ${MAKE} depend)
(cd modelgen; ${MAKE} depend)
(cd main; ${MAKE} depend)
(cd apps; ${MAKE} depend)
tags:
#(cd include; ${MAKE} tags)
(cd lib; ${MAKE} tags)
(cd modelgen; ${MAKE} tags)
(cd main; ${MAKE} tags)
(cd apps; ${MAKE} tags)
unconfig:
#(cd include; ${MAKE} unconfig)
(cd lib; ${MAKE} unconfig)
(cd modelgen; ${MAKE} unconfig)
(cd main; ${MAKE} unconfig)
(cd apps; ${MAKE} unconfig)
install: nothing
(cd include; ${MAKE} install)
(cd lib; ${MAKE} install)
(cd modelgen; ${MAKE} install)
(cd main; ${MAKE} install)
(cd apps; ${MAKE} install)
install-debug: nothing
(cd include; ${MAKE} install-debug)
(cd lib; ${MAKE} install-debug)
(cd modelgen; ${MAKE} install-debug)
(cd main; ${MAKE} install-debug)
(cd apps; ${MAKE} install-debug)
uninstall: nothing
(cd include; ${MAKE} uninstall)
(cd lib; ${MAKE} uninstall)
(cd modelgen; ${MAKE} uninstall)
(cd main; ${MAKE} uninstall)
(cd apps; ${MAKE} uninstall)
manifest:
(cd include; ${MAKE} manifest)
(cd lib; ${MAKE} manifest)
(cd modelgen; ${MAKE} manifest)
(cd main; ${MAKE} manifest)
(cd apps; ${MAKE} manifest)
header-check:
(cd include; ${MAKE} header-check)
(cd lib; ${MAKE} header-check)
(cd modelgen; ${MAKE} header-check)
(cd main; ${MAKE} header-check)
(cd apps; ${MAKE} header-check)
date:
(cd include; ${MAKE} date)
checkin:
$(MAKE) date
-git commit -a
nothing:
Makefile.template 0000664 0000000 0000000 00000012574 13165012111 0014330 0 ustar 00root root 0000000 0000000 #$Id: Makefile.template $ -*- Makefile -*-
# Copyright (C) 2001 Albert Davis
# Author: Albert Davis
#
# This file is part of "Gnucap", the Gnu Circuit Analysis Package
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#------------------------------------------------------------------------
# In most cases you can just type "make" to build it.
# Generally, you will want "make your-system".
# Look in this file for the choices.
# If yours is not here, look for a similar one and copy.
# The special configurations listed here allow you to do multiple builds
# from the same source directory, and patch some problems.
#-----------------------------------------------------------------------------
# The default is to use the makefile built by "configure"
default: nothing
-mkdir O
cat Make1 Make2 ../Make3 Make.depend >O/Makefile
(cd O; ${MAKE} -k)
#-----------------------------------------------------------------------------
# The most common configuration is g++
# This should work if it is properly installed
# and has the proper libraries and headers.
# It is optimized for speed. Debugging is off.
g++: nothing
-mkdir O
cat Make1 Make2.g++ ../Make3 Make.depend >O/Makefile
(cd O; ${MAKE} -k)
#-----------------------------------------------------------------------------
# This one makes a "debug" build ...
# Asserts and some tracing is turned on.
# It prints a trace when "untested" code is exercised.
# "Untested" means the regressions don't test it.
# It doesn't mean TOTALLY untested.
debug: nothing
-mkdir O-DEBUG
cat Make1 Make2.Debug ../Make3 Make.depend >O-DEBUG/Makefile
(cd O-DEBUG; ${MAKE} -k)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# MS Windows using mingw32
mingw: nothing
-mkdir MSW
cat Make1 Make2.mingw32 ../Make3 Make.depend >MSW/Makefile
(cd MSW; ${MAKE} -k)
#-----------------------------------------------------------------------------
tags: nothing
cat Make1 Make2 ../Make3 >Make.aux
(${MAKE} tags -f Make.aux)
#-----------------------------------------------------------------------------
depend: nothing
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux depend
#-----------------------------------------------------------------------------
checkin: nothing
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux checkin
#-----------------------------------------------------------------------------
checkout: nothing
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux checkout
#-----------------------------------------------------------------------------
install: nothing
${MAKE} default
(cd O; ${MAKE} install)
#-----------------------------------------------------------------------------
install-debug: nothing
${MAKE} debug
(cd O-DEBUG; ${MAKE} install)
#-----------------------------------------------------------------------------
uninstall: nothing
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux uninstall
#-----------------------------------------------------------------------------
# Note that the /usr/local directory is overwritten by configure.
not_install: nothing
if test -d /usr/local/bin; then \
cp O/gnucap /usr/local/bin/gnucap; \
else \
mkdir -p /usr/local/bin && \
cp O/gnucap /usr/local/bin/gnucap; \
fi
#-----------------------------------------------------------------------------
not_uninstall: clean
-rm /usr/local/bin/gnucap
#-----------------------------------------------------------------------------
unconfig:
rm -f Makefile
#-----------------------------------------------------------------------------
date: nothing
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux date
#-----------------------------------------------------------------------------
header-check:
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux header-check
#-----------------------------------------------------------------------------
manifest:
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux manifest
#-----------------------------------------------------------------------------
md5sums:
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux md5sums
#-----------------------------------------------------------------------------
mostlyclean:
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux mostlyclean
clean:
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux clean
distclean:
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux distclean
maintainer-clean:
cat Make1 Make2 ../Make3 >Make.aux
${MAKE} -f Make.aux maintainer-clean
#-----------------------------------------------------------------------------
nothing:
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
NEWS 0000664 0000000 0000000 00000000000 13165012111 0011532 0 ustar 00root root 0000000 0000000 README 0000664 0000000 0000000 00000002375 13165012111 0011734 0 ustar 00root root 0000000 0000000 Readme for development snapshot 2013-04-23
This is a development snapshot. As such, there may be problems due to
new work.
This snapshot splits the code into sections "lib", "apps", "main".
"main" is a simple main program "gnucap" that dynamically links to
libgnucap.
"lib" is the core library "libgnucap.so", required for all programs in
the gnucap collection. This library can also be used with different
front-ends, possibly in other languages.
"apps" is a set of plugins that are loaded by default. It builds
"libgnucap-default-plugins.so". The ".cc" files here are mostly
independent of each other. To add or remove one of them from the
build, just edit "Make1" and recompile. Alternatively, any of them
can be extracted and built separately.
"modelgen" is the old model compiler, which now links to libgnucap.so.
Installation (still "make install") installs the parts as expected.
It also installs the header files in $PREFIX/include/gnucap, to build
plugins.
Although it does not use autoconf, the configure/make procedure is the
same as it would be with autoconf.
Model plugin tarballs have not been updated yet, but have been
repackaged for date consistency.
This snapshot lifts the biggest block that has been getting in the way
of a stable release.
apps/ 0000775 0000000 0000000 00000000000 13165012111 0012010 5 ustar 00root root 0000000 0000000 apps/Make.depend 0000664 0000000 0000000 00000136210 13165012111 0014051 0 ustar 00root root 0000000 0000000 d_mos1.o: d_mos1.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h d_mos1.h d_mos123.h d_mos_base.h d_mos.h d_diode.h \
../include/u_sdp.h ../include/e_node.h ../include/e_subckt.h \
../include/e_model.h
d_mos2.o: d_mos2.cc ../include/l_compar.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_denoise.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/globals.h ../include/l_dispatcher.h ../include/e_base.h \
../include/l_stlextra.h ../include/ap.h ../include/e_elemnt.h \
../include/e_node.h ../include/u_sim_data.h ../include/constant.h \
../include/l_compar.h ../include/m_matrix.h ../include/m_cpoly.h \
../include/l_denoise.h ../include/e_compon.h ../include/u_time_pair.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/e_cardlist.h ../include/e_card.h d_mos2.h d_mos123.h \
d_mos_base.h d_mos.h d_diode.h ../include/u_sdp.h ../include/e_node.h \
../include/e_subckt.h ../include/e_model.h
d_mos3.o: d_mos3.cc ../include/l_denoise.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/l_stlextra.h \
../include/ap.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h d_mos3.h d_mos123.h d_mos_base.h d_mos.h d_diode.h \
../include/u_sdp.h ../include/e_node.h ../include/e_subckt.h \
../include/e_model.h
d_mos4.o: d_mos4.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h d_mos4.h d_mos_base.h d_mos.h d_diode.h \
../include/u_sdp.h ../include/e_node.h ../include/e_subckt.h \
../include/e_model.h
d_mos5.o: d_mos5.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h d_mos5.h d_mos_base.h d_mos.h d_diode.h \
../include/u_sdp.h ../include/e_node.h ../include/e_subckt.h \
../include/e_model.h
d_mos6.o: d_mos6.cc ../include/l_denoise.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/l_stlextra.h \
../include/ap.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h d_mos6.h d_mos123.h d_mos_base.h d_mos.h d_diode.h \
../include/u_sdp.h ../include/e_node.h ../include/e_subckt.h \
../include/e_model.h
d_mos7.o: d_mos7.cc ../include/l_compar.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_denoise.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/globals.h ../include/l_dispatcher.h ../include/e_base.h \
../include/l_stlextra.h ../include/ap.h ../include/e_elemnt.h \
../include/e_node.h ../include/u_sim_data.h ../include/constant.h \
../include/l_compar.h ../include/m_matrix.h ../include/m_cpoly.h \
../include/l_denoise.h ../include/e_compon.h ../include/u_time_pair.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/e_cardlist.h ../include/e_card.h d_mos7.h d_mos_base.h \
d_mos.h d_diode.h ../include/u_sdp.h ../include/e_node.h \
../include/e_subckt.h ../include/e_model.h
d_mos8.o: d_mos8.cc ../include/l_compar.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_denoise.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/globals.h ../include/l_dispatcher.h ../include/e_base.h \
../include/l_stlextra.h ../include/ap.h ../include/e_elemnt.h \
../include/e_node.h ../include/u_sim_data.h ../include/constant.h \
../include/l_compar.h ../include/m_matrix.h ../include/m_cpoly.h \
../include/l_denoise.h ../include/e_compon.h ../include/u_time_pair.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/e_cardlist.h ../include/e_card.h d_mos8.h d_mos_base.h \
d_mos.h d_diode.h ../include/u_sdp.h ../include/e_node.h \
../include/e_subckt.h ../include/e_model.h
d_mos123.o: d_mos123.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h d_mos123.h d_mos_base.h d_mos.h d_diode.h \
../include/u_sdp.h ../include/e_node.h ../include/e_subckt.h \
../include/e_model.h
d_mos_base.o: d_mos_base.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h d_mos_base.h d_mos.h d_diode.h ../include/u_sdp.h \
../include/e_node.h ../include/e_subckt.h ../include/e_model.h
d_mos.o: d_mos.cc ../include/u_limit.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/e_storag.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/m_matrix.h ../include/l_stlextra.h ../include/e_base.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/ap.h \
../include/e_cardlist.h ../include/e_card.h d_mos_base.h d_mos.h \
d_diode.h ../include/u_sdp.h ../include/e_node.h ../include/e_subckt.h \
../include/e_model.h ../include/globals.h ../include/l_dispatcher.h \
../include/e_elemnt.h
d_bjt.o: d_bjt.cc ../include/u_limit.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h d_bjt.h d_diode.h ../include/u_sdp.h \
../include/e_node.h ../include/e_subckt.h ../include/e_model.h
d_diode.o: d_diode.cc ../include/e_aux.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_compar.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/m_matrix.h ../include/l_stlextra.h ../include/e_base.h \
../include/e_storag.h ../include/e_elemnt.h ../include/m_cpoly.h \
../include/l_denoise.h ../include/e_compon.h ../include/u_time_pair.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/ap.h ../include/e_cardlist.h ../include/e_card.h \
../include/globals.h ../include/l_dispatcher.h ../include/e_elemnt.h \
d_diode.h ../include/u_sdp.h ../include/e_node.h ../include/e_subckt.h \
../include/e_model.h
d_admit.o: d_admit.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_cap.o: d_cap.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_storag.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_cccs.o: d_cccs.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_ccsrc.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_ccvs.o: d_ccvs.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_ccsrc.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_coil.o: d_coil.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_subckt.h ../include/e_compon.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/e_ccsrc.h ../include/e_elemnt.h \
../include/e_node.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_storag.h
d_cs.o: d_cs.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_poly_g.o: d_poly_g.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_poly_cap.o: d_poly_cap.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/e_storag.h ../include/e_elemnt.h \
../include/e_node.h ../include/u_sim_data.h ../include/constant.h \
../include/l_compar.h ../include/m_matrix.h ../include/m_cpoly.h \
../include/l_denoise.h ../include/e_compon.h ../include/u_time_pair.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/e_cardlist.h ../include/e_card.h
d_res.o: d_res.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_switch.o: d_switch.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_model.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/constant.h ../include/e_cardlist.h \
../include/e_card.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h
d_trln.o: d_trln.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/m_wave.h ../include/l_denoise.h ../include/m_interp.h \
../include/m_cpoly.h ../include/constant.h ../include/e_elemnt.h \
../include/e_node.h ../include/u_sim_data.h ../include/l_compar.h \
../include/m_matrix.h ../include/e_compon.h ../include/u_time_pair.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/e_cardlist.h ../include/e_card.h
d_vcg.o: d_vcg.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_vcr.o: d_vcr.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_vcvs.o: d_vcvs.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_vs.o: d_vs.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h
d_meter.o: d_meter.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/u_xprobe.h
bm_complex.o: bm_complex.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/bm.h
bm_exp.o: bm_exp.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/u_lang.h ../include/bm.h
bm_fit.o: bm_fit.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_lang.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/m_spline.h ../include/bm.h
bm_generator.o: bm_generator.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/bm.h
bm_model.o: bm_model.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_model.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/constant.h ../include/e_cardlist.h \
../include/e_card.h ../include/bm.h ../include/e_compon.h \
../include/u_sim_data.h ../include/l_compar.h ../include/m_matrix.h \
../include/u_time_pair.h
bm_poly.o: bm_poly.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_lang.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/bm.h
bm_posy.o: bm_posy.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_lang.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/bm.h
bm_pulse.o: bm_pulse.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/u_lang.h ../include/bm.h
bm_pwl.o: bm_pwl.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_lang.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/m_interp.h ../include/bm.h
bm_sffm.o: bm_sffm.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/l_denoise.h ../include/u_lang.h \
../include/bm.h
bm_sin.o: bm_sin.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/u_lang.h ../include/l_denoise.h \
../include/bm.h
bm_tanh.o: bm_tanh.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_lang.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/bm.h
bmm_table.o: bmm_table.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_lang.h ../include/e_elemnt.h ../include/e_node.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/m_cpoly.h ../include/l_denoise.h \
../include/e_compon.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/m_spline.h ../include/e_model.h \
../include/bm.h
bmm_semi.o: bmm_semi.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_lang.h ../include/e_model.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/constant.h \
../include/e_cardlist.h ../include/e_card.h ../include/bm.h \
../include/e_compon.h ../include/u_sim_data.h ../include/l_compar.h \
../include/m_matrix.h ../include/u_time_pair.h
c_clear.o: c_clear.cc ../include/c_comand.h ../include/e_card.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/globals.h ../include/l_dispatcher.h \
../include/l_stlextra.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/ap.h
c_comand.o: c_comand.cc ../include/constant.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/c_comand.h \
../include/e_card.h ../include/e_base.h ../include/globals.h \
../include/l_dispatcher.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h
c_delete.o: c_delete.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_cardlist.h ../include/c_comand.h ../include/e_card.h
c_exp.o: c_exp.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/m_expression.h ../include/m_base.h ../include/constant.h \
../include/c_comand.h ../include/e_card.h
c_genrat.o: c_genrat.cc ../include/u_sim_data.h ../include/constant.h \
../include/md.h ../include/io_trace.h ../include/io_error.h \
../include/l_compar.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/m_matrix.h \
../include/l_stlextra.h ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/ap.h ../include/c_comand.h \
../include/e_card.h
c_help.o: c_help.cc ../include/l_dispatcher.h ../include/e_base.h \
../include/md.h ../include/io_trace.h ../include/io_error.h \
../include/l_stlextra.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/c_comand.h ../include/e_card.h ../include/globals.h \
../include/l_dispatcher.h
c_list.o: c_list.cc ../include/e_cardlist.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/u_lang.h \
../include/e_base.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/c_comand.h \
../include/e_card.h ../include/globals.h ../include/l_dispatcher.h \
../include/l_stlextra.h ../include/ap.h
c_measure.o: c_measure.cc ../include/u_parameter.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/m_expression.h \
../include/m_base.h ../include/ap.h ../include/constant.h \
../include/e_cardlist.h ../include/u_function.h ../include/e_base.h \
../include/c_comand.h ../include/e_card.h ../include/globals.h \
../include/l_dispatcher.h ../include/l_stlextra.h
c_modify.o: c_modify.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/e_elemnt.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/m_matrix.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/e_compon.h \
../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/u_cardst.h ../include/c_comand.h
c_param.o: c_param.cc ../include/c_comand.h ../include/e_card.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/u_parameter.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/m_expression.h ../include/m_base.h ../include/ap.h \
../include/constant.h ../include/e_cardlist.h ../include/globals.h \
../include/l_dispatcher.h ../include/l_stlextra.h
c_prbcmd.o: c_prbcmd.cc ../include/u_sim_data.h ../include/constant.h \
../include/md.h ../include/io_trace.h ../include/io_error.h \
../include/l_compar.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/m_matrix.h \
../include/l_stlextra.h ../include/c_comand.h ../include/e_card.h \
../include/e_base.h ../include/u_prblst.h ../include/u_probe.h \
../include/globals.h ../include/l_dispatcher.h ../include/ap.h
c_status.o: c_status.cc ../include/u_sim_data.h ../include/constant.h \
../include/md.h ../include/io_trace.h ../include/io_error.h \
../include/l_compar.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/m_matrix.h \
../include/l_stlextra.h ../include/u_status.h ../include/l_timer.h \
../include/c_comand.h ../include/e_card.h ../include/e_base.h \
../include/globals.h ../include/l_dispatcher.h ../include/ap.h
c_sweep.o: c_sweep.cc ../include/c_comand.h ../include/e_card.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/globals.h ../include/l_dispatcher.h \
../include/l_stlextra.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/ap.h
c_sim.o: c_sim.cc ../include/u_sim_data.h ../include/constant.h \
../include/md.h ../include/io_trace.h ../include/io_error.h \
../include/l_compar.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/m_matrix.h \
../include/l_stlextra.h ../include/c_comand.h ../include/e_card.h \
../include/e_base.h ../include/globals.h ../include/l_dispatcher.h \
../include/ap.h
c_system.o: c_system.cc ../include/c_comand.h ../include/e_card.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/globals.h ../include/l_dispatcher.h \
../include/l_stlextra.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/ap.h
s__init.o: s__init.cc ../include/e_cardlist.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/u_status.h \
../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/l_timer.h ../include/u_sim_data.h ../include/constant.h \
../include/l_compar.h ../include/u_opt.h ../include/m_matrix.h \
../include/l_stlextra.h ../include/s__.h ../include/c_comand.h \
../include/e_card.h ../include/e_base.h
s__out.o: s__out.cc ../include/u_sim_data.h ../include/constant.h \
../include/md.h ../include/io_trace.h ../include/io_error.h \
../include/l_compar.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/m_matrix.h \
../include/l_stlextra.h ../include/u_status.h ../include/l_timer.h \
../include/m_wave.h ../include/l_denoise.h ../include/m_interp.h \
../include/m_cpoly.h ../include/u_prblst.h ../include/u_probe.h \
../include/e_base.h ../include/declare.h ../include/s__.h \
../include/c_comand.h ../include/e_card.h
s__solve.o: s__solve.cc ../include/e_cardlist.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/u_status.h \
../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/l_timer.h ../include/e_node.h ../include/u_sim_data.h \
../include/constant.h ../include/l_compar.h ../include/u_opt.h \
../include/m_matrix.h ../include/l_stlextra.h ../include/e_base.h \
../include/s__.h ../include/c_comand.h ../include/e_card.h
s_ac.o: s_ac.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/u_status.h ../include/l_timer.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/e_cardlist.h ../include/u_prblst.h ../include/u_probe.h \
../include/s__.h ../include/c_comand.h ../include/e_card.h
s_dc.o: s_dc.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_status.h ../include/l_timer.h ../include/u_prblst.h \
../include/u_probe.h ../include/l_compar.h ../include/u_cardst.h \
../include/e_compon.h ../include/u_sim_data.h ../include/constant.h \
../include/m_matrix.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/e_card.h ../include/e_elemnt.h ../include/e_node.h \
../include/m_cpoly.h ../include/l_denoise.h ../include/s__.h \
../include/c_comand.h
s_fo.o: s_fo.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/u_status.h ../include/l_timer.h \
../include/m_phase.h ../include/declare.h ../include/u_prblst.h \
../include/u_probe.h ../include/s_tr.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/s__.h ../include/c_comand.h ../include/e_card.h
s_tr.o: s_tr.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/u_status.h ../include/l_timer.h \
../include/s_tr.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/e_cardlist.h ../include/s__.h \
../include/c_comand.h ../include/e_card.h
s_tr_set.o: s_tr_set.cc ../include/u_sim_data.h ../include/constant.h \
../include/md.h ../include/io_trace.h ../include/io_error.h \
../include/l_compar.h ../include/u_opt.h ../include/mode.h \
../include/io_.h ../include/l_lib.h ../include/m_matrix.h \
../include/l_stlextra.h ../include/u_prblst.h ../include/u_probe.h \
../include/e_base.h ../include/ap.h ../include/s_tr.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/ap.h ../include/e_cardlist.h ../include/s__.h \
../include/c_comand.h ../include/e_card.h
s_tr_swp.o: s_tr_swp.cc ../include/u_time_pair.h ../include/constant.h \
../include/md.h ../include/io_trace.h ../include/io_error.h \
../include/u_sim_data.h ../include/l_compar.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/m_matrix.h ../include/l_stlextra.h ../include/u_status.h \
../include/l_timer.h ../include/declare.h ../include/s_tr.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/ap.h ../include/e_cardlist.h ../include/s__.h \
../include/c_comand.h ../include/e_card.h ../include/e_base.h
lang_spice.o: lang_spice.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/u_status.h ../include/l_timer.h \
../include/c_comand.h ../include/e_card.h ../include/d_dot.h \
../include/d_coment.h ../include/e_subckt.h ../include/e_compon.h \
../include/u_sim_data.h ../include/constant.h ../include/l_compar.h \
../include/m_matrix.h ../include/u_time_pair.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/e_cardlist.h \
../include/u_lang.h ../include/d_logic.h ../include/e_model.h \
../include/e_elemnt.h ../include/e_node.h ../include/m_cpoly.h \
../include/l_denoise.h ../include/bm.h
lang_spectre.o: lang_spectre.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/c_comand.h ../include/e_card.h \
../include/d_dot.h ../include/d_coment.h ../include/e_subckt.h \
../include/e_compon.h ../include/u_sim_data.h ../include/constant.h \
../include/l_compar.h ../include/m_matrix.h ../include/u_time_pair.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/e_cardlist.h ../include/e_model.h ../include/u_lang.h
lang_verilog.o: lang_verilog.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/c_comand.h ../include/e_card.h \
../include/d_dot.h ../include/d_coment.h ../include/e_subckt.h \
../include/e_compon.h ../include/u_sim_data.h ../include/constant.h \
../include/l_compar.h ../include/m_matrix.h ../include/u_time_pair.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/e_cardlist.h ../include/e_model.h ../include/u_lang.h
func_core.o: func_core.cc ../include/globals.h ../include/l_dispatcher.h \
../include/e_base.h ../include/md.h ../include/io_trace.h \
../include/io_error.h ../include/l_stlextra.h ../include/u_opt.h \
../include/mode.h ../include/io_.h ../include/l_lib.h ../include/ap.h \
../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
../include/constant.h ../include/e_cardlist.h ../include/u_function.h
measure_eval.o: measure_eval.cc ../include/u_parameter.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/md.h ../include/io_trace.h ../include/io_error.h \
../include/m_expression.h ../include/m_base.h ../include/ap.h \
../include/constant.h ../include/e_cardlist.h ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/l_stlextra.h \
../include/u_function.h
measure_max.o: measure_max.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/constant.h ../include/e_cardlist.h \
../include/m_wave.h ../include/l_denoise.h ../include/m_interp.h \
../include/m_cpoly.h ../include/u_function.h
measure_min.o: measure_min.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/constant.h ../include/e_cardlist.h \
../include/m_wave.h ../include/l_denoise.h ../include/m_interp.h \
../include/m_cpoly.h ../include/u_function.h
measure_slewrate.o: measure_slewrate.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/l_compar.h ../include/u_parameter.h \
../include/m_expression.h ../include/m_base.h ../include/constant.h \
../include/e_cardlist.h ../include/m_wave.h ../include/l_denoise.h \
../include/m_interp.h ../include/m_cpoly.h ../include/u_function.h
measure_cross.o: measure_cross.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/constant.h ../include/e_cardlist.h \
../include/m_wave.h ../include/l_denoise.h ../include/m_interp.h \
../include/m_cpoly.h ../include/u_function.h
measure_integral.o: measure_integral.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/constant.h ../include/e_cardlist.h \
../include/m_wave.h ../include/l_denoise.h ../include/m_interp.h \
../include/m_cpoly.h ../include/u_function.h
measure_average.o: measure_average.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/constant.h ../include/e_cardlist.h \
../include/m_wave.h ../include/l_denoise.h ../include/m_interp.h \
../include/m_cpoly.h ../include/u_function.h
measure_rms.o: measure_rms.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/constant.h ../include/e_cardlist.h \
../include/m_wave.h ../include/l_denoise.h ../include/m_interp.h \
../include/m_cpoly.h ../include/u_function.h
measure_at.o: measure_at.cc ../include/globals.h \
../include/l_dispatcher.h ../include/e_base.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/l_stlextra.h \
../include/u_opt.h ../include/mode.h ../include/io_.h ../include/l_lib.h \
../include/ap.h ../include/u_parameter.h ../include/m_expression.h \
../include/m_base.h ../include/constant.h ../include/e_cardlist.h \
../include/m_wave.h ../include/l_denoise.h ../include/m_interp.h \
../include/m_cpoly.h ../include/u_function.h
signon.o: signon.cc ../include/io_.h ../include/l_lib.h ../include/md.h \
../include/io_trace.h ../include/io_error.h ../include/patchlev.h
apps/Make1 0000664 0000000 0000000 00000012533 13165012111 0012675 0 ustar 00root root 0000000 0000000 #$Id: Make1 2016/09/17 $ -*- Makefile -*-
# Copyright (C) 2001 Albert Davis
# Author: Albert Davis
#
# This file is part of "Gnucap", the Gnu Circuit Analysis Package
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#------------------------------------------------------------------------
TARGET = gnucap-default-plugins
#------------------------------------------------------------------------
INSTALL_FILES = $(TARGET)$(TARGET_EXT)
#------------------------------------------------------------------------
INSTALL_DIR = $(PREFIX)/lib/gnucap
#------------------------------------------------------------------------
DELETED =
#------------------------------------------------------------------------
# These source files can be omitted, and supplied as plugins.
# device models defined in high level .model files
MODELS = \
d_mos1.model d_mos2.model d_mos3.model \
d_mos4.model d_mos5.model d_mos6.model d_mos7.model d_mos8.model \
d_mos123.model d_mos_base.model d_mos.model \
d_bjt.model d_diode.model
# device models hand coded in C++
D_SRCS = \
d_admit.cc d_cap.cc d_cccs.cc d_ccvs.cc d_coil.cc \
d_cs.cc d_poly_g.cc d_poly_cap.cc d_res.cc d_switch.cc \
d_trln.cc d_vcg.cc d_vcr.cc d_vcvs.cc d_vs.cc \
d_meter.cc
# behavioral modeling functions
BM_SRCS = \
bm_complex.cc bm_exp.cc bm_fit.cc bm_generator.cc \
bm_model.cc bm_poly.cc bm_posy.cc bm_pulse.cc bm_pwl.cc bm_sffm.cc \
bm_sin.cc bm_tanh.cc bmm_table.cc bmm_semi.cc
# utility commands, usually one file per command
# some have multiple commands in a file
C_SRCS = \
c_clear.cc c_comand.cc c_delete.cc c_exp.cc c_genrat.cc \
c_help.cc \
c_list.cc c_measure.cc c_modify.cc c_param.cc c_prbcmd.cc \
c_status.cc c_sweep.cc c_sim.cc c_system.cc
# simulation commands, usually multiple files for one command
S_SRCS = \
s__init.cc s__out.cc s__solve.cc \
s_ac.cc s_dc.cc s_fo.cc \
s_tr.cc s_tr_set.cc s_tr_swp.cc
# netlist languages
LANG_SRCS = \
lang_spice.cc lang_spectre.cc lang_verilog.cc
# parameter functions
FUNC_SRCS = \
func_core.cc measure_eval.cc \
measure_max.cc measure_min.cc measure_slewrate.cc measure_cross.cc \
measure_integral.cc measure_average.cc measure_rms.cc measure_at.cc
# other stuff
OTHER_SRCS = \
signon.cc
#------------------------------------------------------------------------
RAW_SRCS = \
$(D_SRCS) \
$(BM_SRCS) \
$(C_SRCS) \
$(S_SRCS) \
$(LANG_SRCS) \
$(FUNC_SRCS) \
$(OTHER_SRCS)
#------------------------------------------------------------------------
RAW_OTHER = Make1 Make2.g++ Make2.Debug Make2.mingw32 configure test_readline.cc
#------------------------------------------------------------------------
RAW = $(RAW_HDRS) $(RAW_SRCS) $(RAW_OTHER) $(MODELS)
#------------------------------------------------------------------------
#------------------------------------------------------------------------
IMPORTED_SRCS =
IMPORTED_HDRS =
IMPORTED_OTHER =
IMPORTED = $(IMPORTED_SRCS) $(IMPORTED_HDRS) $(IMPORTED_OTHER)
#------------------------------------------------------------------------
#------------------------------------------------------------------------
GENERATED_SRCS = ${MODELS:.model=.cc}
GENERATED_HDRS = ${MODELS:.model=.h}
GENERATED_OTHER = Make.aux
GENERATED = $(GENERATED_HDRS) $(GENERATED_SRCS) $(GENERATED_OTHER)
#------------------------------------------------------------------------
#------------------------------------------------------------------------
GENERATED_DIST = Make.depend
IMPORTED_DIST = $(IMPORTED)
DISTFILES = $(RAW) $(GENERATED_DIST) $(IMPORTED_DIST)
#------------------------------------------------------------------------
#------------------------------------------------------------------------
SRCS = $(IMPORTED_SRCS) $(GENERATED_SRCS) $(RAW_SRCS)
HDRS = $(RAW_HDRS) $(GENERATED_HDRS) $(IMPORTED_HDRS)
OBJS = ${SRCS:.cc=.o}
TARGET_DEPENDS = $(OBJS) $(RAW) $(MODELS)
#------------------------------------------------------------------------
#------------------------------------------------------------------------
MOSTLYCLEANFILES = $(OBJS) $(GENERATED)
CLEANFILES = $(MOSTLYCLEANFILES)
DISTCLEANFILES = $(CLEANFILES)
MAINTAINERCLEANFILES = $(DISTCLEANFILES)
#------------------------------------------------------------------------
#------------------------------------------------------------------------
LIBPATH = `pwd | sed 's/apps/lib/g'`
MODELGEN = `pwd | sed 's/apps/modelgen/g'`/gnucap-modelgen
#------------------------------------------------------------------------
%.h : %.model
(export LD_LIBRARY_PATH=$(LIBPATH); $(MODELGEN) -h $<)
#------------------------------------------------------------------------
%.cc : %.model
(export LD_LIBRARY_PATH=$(LIBPATH); $(MODELGEN) -cc $<)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
apps/Make2.Debug 0000664 0000000 0000000 00000007225 13165012111 0013725 0 ustar 00root root 0000000 0000000 #$Id: Make2.Debug 2014/07/03 al $ -*- Makefile -*-
# Copyright (C) 2001 Albert Davis
# Author: Albert Davis
#
# This file is part of "Gnucap", the Gnu Circuit Analysis Package
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#------------------------------------------------------------------------
VPATH = .:..
# Standard base for g++, debugging, a little optimization
# Running the program will give a spew of line markers for debugging.
CCC = g++
TARGET_EXT = .so
CCFLAGS = \
-fPIC \
-DHAVE_LIBREADLINE \
-DUNIX -g -O0 -I. -I../../include -DTRACE_UNTESTED \
-Wall -Wextra \
-Wswitch-enum -Wundef -Wpointer-arith -Woverloaded-virtual \
-Wcast-qual -Wcast-align -Wpacked -Wshadow -Wconversion \
-Winit-self -Wmissing-include-dirs -Winvalid-pch \
-Wvolatile-register-var -Wstack-protector \
-Wlogical-op -Wvla -Woverlength-strings -Wsign-conversion
#last line not in 4.1
LIBS = \
LDFLAGS = -shared
%.SUFFIXES:
.SUFFIXES: .o .cc
.cc.o:; $(CCC) $(CCFLAGS) -c $<
#------------------------------------------------------------------------
$(TARGET)$(TARGET_EXT): $(TARGET_DEPENDS)
rm -f $@
$(CCC) $(CCFLAGS) $(OBJS) $(LIBS) $(LDFLAGS) -o $@
#------------------------------------------------------------
# warnings turned off, because they warn of nothing wrong
# 4.3
#-Wswitch-default -- lack of default is correct with enum
#-Wfloat-equal -- warns on NA, div by zero trap
#-Wpadded -- a bool in a class is enough
#-Wredundant-decls -- in both header and func is an error check
#-Wmissing-declarations -- pascal style
#-Wmissing-noreturn -- warns when always throws exception
#-Wunreachable-code -- warns even if reachable .. compiler bug??
#-Waggregate-return -- warns even if passed by reference
#-Wunsafe-loop-optimizations -- if can't unroll a loop
#-Winline
#-Wdisabled-optimization -- -O0 disables optimization, so it warns
# 4.2
#-Wpadded -- a bool in a class is enough
#-Winline
#-Waggregate-return -- warns even if passed by reference
#-Wfloat-equal -- warns on NA, div by zero trap
#-Wredundant-decls -- in both header and func is an error check
#-Wunsafe-loop-optimizations -- warns on any loop with variable count
# warnings turned off, because of the public headers
#-Wunreachable-code -- didn't use nonportable syntax to hide
#-Wmissing-noreturn -- didn't use nonportable syntax to hide
# warnings that should be on, but ...
#-Wshadow -- lambda functions
#------------------------------------------------------------
# If you are porting and using g++, you should use this file as a start,
# for a "debug" version, with extra warnings and run-time tracing.
# If you get errors or warnings, make a copy of it and modify that.
# After it works, use the file "Make2.g++" as a start for
# executable to use.
# If the port is non-trivial, check with me first because someone else
# may have already done it.
# If it works without changes, send me a note so I can put it in the docs.
# Please send the changes to aldavis@gnu.org
#------------------------------------------------------------
#------------------------------------------------------------
apps/Make2.g++ 0000664 0000000 0000000 00000004217 13165012111 0013251 0 ustar 00root root 0000000 0000000 #$Id: Make2.g++ 2014/07/03 al $ -*- Makefile -*-
# Copyright (C) 2001 Albert Davis
# Author: Albert Davis
#
# This file is part of "Gnucap", the Gnu Circuit Analysis Package
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#------------------------------------------------------------------------
VPATH = .:..
# Standard base for g++.
CCC = g++
TARGET_EXT = .so
CCFLAGS = \
-fPIC \
-DUNIX -O3 -DNDEBUG -I. -I../include -I../../include -W
LIBS = \
LDFLAGS = -shared
.SUFFIXES:
.SUFFIXES: .o .cc
.cc.o:; $(CCC) $(CCFLAGS) -c $<
#------------------------------------------------------------------------
$(TARGET)$(TARGET_EXT): $(TARGET_DEPENDS)
rm -f $@
$(CCC) $(CCFLAGS) $(OBJS) $(LIBS) $(LDFLAGS) -o $@
#------------------------------------------------------------
# If you are porting and using g++, you should use this file as a start,
# for a "release" version, optimized with run-time tracing removed.
# If you get errors or warnings, make a copy of it and modify that.
# For the first cut, use "Make2.Debug" as the start for more tracing,
# or "Make2.Trace" for an extreme amount of tracing.
# After it works, use the file "Make2.g++" as a start for
# executable to use.
# If the port is non-trivial, check with me first because someone else
# may have already done it.
# If it works without changes, send me a note so I can put it in the docs.
# Please send the changes to aldavis@gnu.org
#------------------------------------------------------------
#------------------------------------------------------------
apps/Make2.mingw32 0000664 0000000 0000000 00000003136 13165012111 0014162 0 ustar 00root root 0000000 0000000 #$Id: Make2.mingw32 2016/05/15 al $ -*- Makefile -*-
# Copyright (C) 2001 Albert Davis
# Author: Albert Davis
#
# This file is part of "Gnucap", the Gnu Circuit Analysis Package
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#------------------------------------------------------------------------
VPATH = .:..
CCC = i586-mingw32msvc-g++
DLLTOOL = i586-mingw32msvc-dlltool
TARGET_EXT = .dll
CCFLAGS = \
-O2 -DNDEBUG -I. -I../../include
LIBS = -lgnucap
LDFLAGS = -shared -L../../lib/MSW
.SUFFIXES:
.SUFFIXES: .o .cc
.cc.o:; $(CCC) $(CCFLAGS) -c $<
#------------------------------------------------------------------------
$(TARGET): $(TARGET)$(TARGET_EXT)
#------------------------------------------------------------------------
$(TARGET)$(TARGET_EXT): $(TARGET_DEPENDS)
rm -f $@
$(CCC) $(CCFLAGS) $(OBJS) $(LIBS) $(LDFLAGS) -o $@
#------------------------------------------------------------
#------------------------------------------------------------
apps/bm_complex.cc 0000664 0000000 0000000 00000010164 13165012111 0014446 0 ustar 00root root 0000000 0000000 /*$Id: bm_complex.cc,v 26.137 2010/04/10 02:37:05 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* behavioral modeling complex value
* used with tc, etc, and conditionals
*/
//testing=script 2006.07.13
#include "globals.h"
#include "e_elemnt.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class EVAL_BM_COMPLEX : public EVAL_BM_ACTION_BASE {
private:
COMPLEX _value;
explicit EVAL_BM_COMPLEX(const EVAL_BM_COMPLEX& p);
public:
explicit EVAL_BM_COMPLEX(int c=0);
~EVAL_BM_COMPLEX() {}
private: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_COMPLEX(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void tr_eval(ELEMENT*)const;
void ac_eval(ELEMENT*)const;
std::string name()const {return "complex";}
bool ac_too()const {untested();return true;}
bool parse_numlist(CS&);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_COMPLEX::EVAL_BM_COMPLEX(int c)
:EVAL_BM_ACTION_BASE(c),
_value(NOT_INPUT)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_COMPLEX::EVAL_BM_COMPLEX(const EVAL_BM_COMPLEX& p)
:EVAL_BM_ACTION_BASE(p),
_value(p._value)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_COMPLEX::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_COMPLEX* p = dynamic_cast(&x);
bool rv = p
&& _value == p->_value
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_COMPLEX::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name() << '('
<< _value.real() << ',' << _value.imag() << ')';
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_COMPLEX::tr_eval(ELEMENT* d)const
{
tr_finish_tdv(d, _value.real());
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_COMPLEX::ac_eval(ELEMENT* d)const
{
d->_ev = _value;
ac_final_adjust_with_temp(&(d->_ev));
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_COMPLEX::parse_numlist(CS& cmd)
{
unsigned here = cmd.cursor();
double real = NOT_VALID;
double imag = 0.;
cmd >> real >> imag;
if (cmd.gotit(here)) {
_value = COMPLEX(real,imag);
return true;
}else{
untested();
return false;
}
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_COMPLEX p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "complex", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_exp.cc 0000664 0000000 0000000 00000016562 13165012111 0013603 0 ustar 00root root 0000000 0000000 /*$Id: bm_exp.cc 2016/03/23 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* SPICE compatible EXP
*/
//testing=script 2005.10.06
#include "globals.h"
#include "e_elemnt.h"
#include "u_lang.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
const double _default_iv (NOT_INPUT);
const double _default_pv (NOT_INPUT);
const double _default_td1 (0);
const double _default_tau1 (0);
const double _default_td2 (0);
const double _default_tau2 (0);
const double _default_period(BIGBIG);
/*--------------------------------------------------------------------------*/
class EVAL_BM_EXP : public EVAL_BM_ACTION_BASE {
private:
PARAMETER _iv; // initial value
PARAMETER _pv; // pulsed value
PARAMETER _td1; // rise delay
PARAMETER _tau1; // rise time constant
PARAMETER _td2; // fall delay
PARAMETER _tau2; // fall time constant
PARAMETER _period; // repeat period
PARAMETER _end; // marks the end of the list
explicit EVAL_BM_EXP(const EVAL_BM_EXP& p);
public:
explicit EVAL_BM_EXP(int c=0);
~EVAL_BM_EXP() {}
private: // override vitrual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_EXP(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void tr_eval(ELEMENT*)const;
TIME_PAIR tr_review(COMPONENT*)const;
std::string name()const {return "exp";}
bool ac_too()const {return false;}
bool parse_numlist(CS&);
bool parse_params_obsolete_callback(CS&);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_EXP::EVAL_BM_EXP(int c)
:EVAL_BM_ACTION_BASE(c),
_iv(_default_iv),
_pv(_default_pv),
_td1(_default_td1),
_tau1(_default_tau1),
_td2(_default_td2),
_tau2(_default_tau2),
_period(_default_period),
_end(NOT_VALID)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_EXP::EVAL_BM_EXP(const EVAL_BM_EXP& p)
:EVAL_BM_ACTION_BASE(p),
_iv(p._iv),
_pv(p._pv),
_td1(p._td1),
_tau1(p._tau1),
_td2(p._td2),
_tau2(p._tau2),
_period(p._period),
_end(NOT_VALID)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_EXP::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_EXP* p = dynamic_cast(&x);
bool rv = p
&& _iv== p->_iv
&& _pv== p->_pv
&& _td1== p->_td1
&& _tau1== p->_tau1
&& _td2== p->_td2
&& _tau2== p->_tau2
&& _period== p->_period
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_EXP::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name();
print_pair(o, lang, "iv", _iv);
print_pair(o, lang, "pv", _pv);
print_pair(o, lang, "td1", _td1);
print_pair(o, lang, "tau1", _tau1);
print_pair(o, lang, "td2", _td2);
print_pair(o, lang, "tau2", _tau2);
print_pair(o, lang, "period",_period, _period.has_hard_value());
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_EXP::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
_iv.e_val(_default_iv, Scope);
_pv.e_val(_default_pv, Scope);
_td1.e_val(_default_td1, Scope);
_tau1.e_val(_default_tau1, Scope);
_td2.e_val(_default_td2, Scope);
_tau2.e_val(_default_tau2, Scope);
_period.e_val(_default_period, Scope);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_EXP::tr_eval(ELEMENT* d)const
{
double ev = _iv;
for (double time = d->_sim->_time0; time >= 0; time -= _period) {
if (time > _td1) {
ev += (_pv - _iv) * (1. - exp(-(time-_td1)/_tau1));
}else{
}
if (time > _td2) {
ev += (_iv - _pv) * (1. - exp(-(time-_td2)/_tau2));
}else{
}
}
tr_finish_tdv(d, ev);
}
/*--------------------------------------------------------------------------*/
TIME_PAIR EVAL_BM_EXP::tr_review(COMPONENT* d)const
{
double time = d->_sim->_time0;
time += d->_sim->_dtmin * .01; // hack to avoid duplicate events from numerical noise
double raw_time = time;
if (0 < _period && _period < BIGBIG) {
time = fmod(time,_period);
}else{
}
double time_offset = raw_time - time;
double dt = NEVER;
if (time > _td2) {
d->_time_by.min_event(_period + time_offset);
dt = (_tau2 > 0) ? _tau2 : NEVER;
}else if (time > _td1) {
d->_time_by.min_event(_td2 + time_offset);
dt = (_tau1 > 0) ? _tau1 : NEVER;
}else if (d->_sim->_time0 < _period) {
d->_time_by.min_event(_td1 + time_offset);
dt = NEVER;
}else{
d->_time_by.min_event(_td1 + time_offset);
dt = (_tau2 > 0) ? _tau2 : NEVER;
}
d->_time_by.min_error_estimate(d->_sim->_time0 + dt);
return d->_time_by;
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_EXP::parse_numlist(CS& cmd)
{
unsigned start = cmd.cursor();
unsigned here = cmd.cursor();
for (PARAMETER* i = &_iv; i < &_end; ++i) {
PARAMETER val(NOT_VALID);
cmd >> val;
if (cmd.stuck(&here)) {
break;
}else{
*i = val;
untested();
}
}
if (cmd.gotit(start)) {
untested();
}
return cmd.gotit(start);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_EXP::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "iv", &_iv)
|| Get(cmd, "pv", &_pv)
|| Get(cmd, "td1", &_td1)
|| Get(cmd, "tau1", &_tau1)
|| Get(cmd, "td2", &_td2)
|| Get(cmd, "tau2", &_tau2)
|| Get(cmd, "period", &_period)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_EXP p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "exp", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_fit.cc 0000664 0000000 0000000 00000016436 13165012111 0013571 0 ustar 00root root 0000000 0000000 /*$Id: bm_fit.cc 2016/03/23 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* cubic spline bm function
*/
//testing=script 2006.04.18
#include "globals.h"
#include "u_lang.h"
#include "e_elemnt.h"
#include "m_spline.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
const int _default_order (3);
const double _default_below (NOT_INPUT);
const double _default_above (NOT_INPUT);
const double _default_delta (NOT_INPUT);
const int _default_smooth(0);
/*--------------------------------------------------------------------------*/
class EVAL_BM_FIT : public EVAL_BM_ACTION_BASE {
private:
PARAMETER _order;
PARAMETER _below;
PARAMETER _above;
PARAMETER _delta;
PARAMETER _smooth;
std::vector,PARAMETER > > _table;
SPLINE* _spline;
explicit EVAL_BM_FIT(const EVAL_BM_FIT& p);
public:
explicit EVAL_BM_FIT(int c=0);
~EVAL_BM_FIT();
private: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_FIT(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void tr_eval(ELEMENT*)const;
std::string name()const {return "fit";}
bool ac_too()const {return false;}
bool parse_numlist(CS&);
bool parse_params_obsolete_callback(CS&);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_FIT::EVAL_BM_FIT(int c)
:EVAL_BM_ACTION_BASE(c),
_order(_default_order),
_below(_default_below),
_above(_default_above),
_delta(_default_delta),
_smooth(_default_smooth),
_table(),
_spline(0)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_FIT::EVAL_BM_FIT(const EVAL_BM_FIT& p)
:EVAL_BM_ACTION_BASE(p),
_order(p._order),
_below(p._below),
_above(p._above),
_delta(p._delta),
_smooth(p._smooth),
_table(p._table),
_spline(0)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_FIT::~EVAL_BM_FIT()
{
delete _spline;
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_FIT::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_FIT* p = dynamic_cast(&x);
bool rv = p
&& _order == p->_order
&& _below == p->_below
&& _above == p->_above
&& _delta == p->_delta
&& _smooth == p->_smooth
&& _table == p->_table
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_FIT::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name() << '(';
for (std::vector,PARAMETER > >::
const_iterator p = _table.begin(); p != _table.end(); ++p) {
o << p->first << ',' << p->second << ' ';
}
o << ')';
print_pair(o, lang, "order", _order);
print_pair(o, lang, "below", _below, _below.has_hard_value());
print_pair(o, lang, "above", _above, _above.has_hard_value());
print_pair(o, lang, "delta", _delta, _delta.has_hard_value());
print_pair(o, lang, "smooth",_smooth,_smooth.has_hard_value());
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_FIT::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
_order.e_val(_default_order, Scope);
_below.e_val(_default_below, Scope);
_above.e_val(_default_above, Scope);
_delta.e_val(_default_delta, Scope);
_smooth.e_val(_default_smooth, Scope);
for (std::vector,PARAMETER > >::
iterator p = _table.begin(); p != _table.end(); ++p) {
p->first.e_val(0, Scope);
p->second.e_val(0, Scope);
}
double last = -BIGBIG;
for (std::vector,PARAMETER > >::
iterator p = _table.begin(); p != _table.end(); ++p) {
if (last > p->first) {untested();
throw Exception_Precalc("FIT table is out of order: (" + to_string(last)
+ ", " + to_string(p->first) + ")\n");
}else{
}
last = p->first;
}
delete _spline;
double below = _below.has_hard_value() ? _below : NOT_INPUT;
double above = _above.has_hard_value() ? _above : NOT_INPUT;
_spline = new SPLINE(_table, below, above, _order);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_FIT::tr_eval(ELEMENT* d)const
{
d->_y[0] = _spline->at(d->_y[0].x);
tr_final_adjust(&(d->_y[0]), d->f_is_value());
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_FIT::parse_numlist(CS& cmd)
{
unsigned start = cmd.cursor();
unsigned here = cmd.cursor();
for (;;) {
unsigned start_of_pair = here;
std::pair, PARAMETER > p;
//cmd >> key >> value;
cmd >> p.first; // key
if (cmd.stuck(&here)) {
// no more, graceful finish
break;
}else{
cmd >> p.second; // value
if (cmd.stuck(&here)) {
// ran out, but already have half of the pair
// back up one, hoping somebody else knows what to do with it
cmd.reset(start_of_pair);
break;
}else{
_table.push_back(p);
}
}
}
if (cmd.gotit(start)) {
}else{
untested();
}
return cmd.gotit(start);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_FIT::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "order", &_order)
|| Get(cmd, "below", &_below)
|| Get(cmd, "above", &_above)
|| Get(cmd, "delta", &_delta)
|| Get(cmd, "smooth",&_smooth)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_FIT p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "fit", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_generator.cc 0000664 0000000 0000000 00000010065 13165012111 0014765 0 ustar 00root root 0000000 0000000 /*$Id: bm_generator.cc 2015.01.08 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* behavioral modeling simple value
* used with tc, etc, and conditionals
*/
//testing=script 2015.01.08
//BUG// no step control
//BUG// encapsulation violation: _sim->_genout
#include "globals.h"
#include "e_elemnt.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class EVAL_BM_GENERATOR : public EVAL_BM_ACTION_BASE {
private:
explicit EVAL_BM_GENERATOR(const EVAL_BM_GENERATOR& p);
public:
explicit EVAL_BM_GENERATOR(int c=0);
~EVAL_BM_GENERATOR() {}
private: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_GENERATOR(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void tr_eval(ELEMENT*)const;
void ac_eval(ELEMENT*)const;
std::string name()const {return "generator";}
bool ac_too()const {return true;}
bool parse_numlist(CS&);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_GENERATOR::EVAL_BM_GENERATOR(int c)
:EVAL_BM_ACTION_BASE(c)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_GENERATOR::EVAL_BM_GENERATOR(const EVAL_BM_GENERATOR& p)
:EVAL_BM_ACTION_BASE(p)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_GENERATOR::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_GENERATOR* p = dynamic_cast(&x);
if (p) {
}else{untested();
}
bool rv = p && EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {untested();
}else{
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_GENERATOR::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name();
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_GENERATOR::tr_eval(ELEMENT* d)const
{
tr_finish_tdv(d, d->_sim->_genout);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_GENERATOR::ac_eval(ELEMENT* d)const
{
d->_ev = 1;
ac_final_adjust_with_temp(&(d->_ev));
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_GENERATOR::parse_numlist(CS& cmd)
{
unsigned here = cmd.cursor();
PARAMETER new_value(NOT_VALID);
cmd >> new_value;
if (cmd.gotit(here)) {
_scale = new_value;
return true;
}else{
return false;
}
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_GENERATOR p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "gen|generator", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_model.cc 0000664 0000000 0000000 00000011707 13165012111 0014103 0 ustar 00root root 0000000 0000000 /*$Id: bm_model.cc,v 26.137 2010/04/10 02:37:05 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* behavioral modeling ".model" stub
* accepts an unknown name for later linking to a .model
*/
//testing=script 2006.07.13
#include "globals.h"
#include "e_model.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class EVAL_BM_MODEL : public EVAL_BM_ACTION_BASE {
private:
std::string _arglist;
COMMON_COMPONENT* _func;
explicit EVAL_BM_MODEL(const EVAL_BM_MODEL& p);
public:
explicit EVAL_BM_MODEL(int c=0);
~EVAL_BM_MODEL() {detach_common(&_func);}
private: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_MODEL(*this);}
void parse_common_obsolete_callback(CS&);
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void expand(const COMPONENT*);
COMMON_COMPONENT* deflate() {return (_func) ? _func->deflate() : this;}
void tr_eval(ELEMENT*d)const {assert(_func); _func->tr_eval(d);}
void ac_eval(ELEMENT*d)const {assert(_func); _func->ac_eval(d);}
std::string name()const {itested();return modelname();}
bool ac_too()const {return true;}
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_MODEL::EVAL_BM_MODEL(int c)
:EVAL_BM_ACTION_BASE(c),
_arglist(),
_func(0)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_MODEL::EVAL_BM_MODEL(const EVAL_BM_MODEL& p)
:EVAL_BM_ACTION_BASE(p),
_arglist(p._arglist),
_func(0)
{
attach_common(p._func, &_func);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_MODEL::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_MODEL* p = dynamic_cast(&x);
bool rv = p
&& _arglist == p->_arglist
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
incomplete();
untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_MODEL::parse_common_obsolete_callback(CS& cmd) //used
{
assert(!_func);
assert(!has_model());
parse_modelname(cmd);
_arglist = cmd.ctos("", "(", ")");
assert(!_func);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_MODEL::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
if (_func) {
_func->print_common_obsolete_callback(o, lang);
}else{
o << modelname();
if (_arglist != "") {
o << "(" << _arglist << ")";
}else{
}
}
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_MODEL::expand(const COMPONENT* d)
{
EVAL_BM_ACTION_BASE::expand(d);
// not sure what kind of model it is yet.
// see what we find.
COMMON_COMPONENT* c = NULL;
try {
attach_model(d);
assert(has_model());
c = dynamic_cast(model()->new_common());
}catch (Exception& e) {
error(bTRACE, e.message() + "++++\n");
assert(!has_model());
c = bm_dispatcher.clone("eval_bm_value");
}
if (!c) {
throw Exception(d->long_label() + ": model type mismatch");
//BUG// memory leak
}else{
}
// now we have one
// link to the real one
// later, a "deflate" will push it down to proper place.
c->set_modelname(modelname());
CS args(CS::_STRING, _arglist);
c->parse_common_obsolete_callback(args);
c->expand(d);
attach_common(c, &_func);
assert(_func);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_MODEL p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "eval_bm_model", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_poly.cc 0000664 0000000 0000000 00000013774 13165012111 0013774 0 ustar 00root root 0000000 0000000 /*$Id: bm_poly.cc 2016/03/23 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* HSPICE compatible POLY
*/
//testing=script,complete 2005.10.06
#include "globals.h"
#include "u_lang.h"
#include "e_elemnt.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
const double _default_max(BIGBIG);
const double _default_min(-BIGBIG);
const bool _default_abs(false);
/*--------------------------------------------------------------------------*/
class EVAL_BM_POLY : public EVAL_BM_ACTION_BASE {
private:
PARAMETER _min;
PARAMETER _max;
PARAMETER _abs;
std::vector > _c;
explicit EVAL_BM_POLY(const EVAL_BM_POLY& p);
public:
explicit EVAL_BM_POLY(int c=0);
~EVAL_BM_POLY() {}
private: // override vitrual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_POLY(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void tr_eval(ELEMENT*)const;
std::string name()const {return "poly";}
bool ac_too()const {untested();return false;}
bool parse_numlist(CS&);
bool parse_params_obsolete_callback(CS&);
void skip_type_tail(CS& cmd)const {cmd.umatch("(1)");}
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_POLY::EVAL_BM_POLY(int c)
:EVAL_BM_ACTION_BASE(c),
_min(_default_min),
_max(_default_max),
_abs(_default_abs)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_POLY::EVAL_BM_POLY(const EVAL_BM_POLY& p)
:EVAL_BM_ACTION_BASE(p),
_min(p._min),
_max(p._max),
_abs(p._abs),
_c(p._c)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_POLY::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_POLY* p = dynamic_cast(&x);
bool rv = p
&& _min == p->_min
&& _max == p->_max
&& _abs == p->_abs
&& _c == p->_c
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
incomplete();
untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_POLY::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name() << '(';
for (std::vector >::const_iterator
p = _c.begin(); p != _c.end(); ++p) {
o << *p << ' ';
}
o << ')';
print_pair(o, lang, "min", _min, _min.has_hard_value());
print_pair(o, lang, "max", _max, _max.has_hard_value());
print_pair(o, lang, "abs", _abs, _abs.has_hard_value());
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_POLY::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
for (std::vector >::const_iterator
p = _c.begin(); p != _c.end(); ++p) {
(*p).e_val(0, Scope);
}
_min.e_val(_default_min, Scope);
_max.e_val(_default_max, Scope);
_abs.e_val(_default_abs, Scope);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_POLY::tr_eval(ELEMENT* d)const
{
double x = ioffset(d->_y[0].x);
double f0 = 0.;
double f1 = 0.;
for (size_t i=_c.size()-1; i>0; --i) {
f0 += _c[i];
f0 *= x;
f1 *= x;
f1 += _c[i]*int(i);
}
f0 += _c[0];
if (_abs && f0 < 0) {
f0 = -f0;
f1 = -f1;
}
if (f0 > _max) {
f0 = _max;
f1 = 0;
}else if (f0 < _min) {
f0 = _min;
f1 = 0;
}
d->_y[0] = FPOLY1(x, f0, f1);
tr_final_adjust(&(d->_y[0]), d->f_is_value());
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_POLY::parse_numlist(CS& cmd)
{
unsigned start = cmd.cursor();
unsigned here = cmd.cursor();
for (;;) {
unsigned old_here = here;
PARAMETER val;
cmd >> val;
if (cmd.stuck(&here)) {
// no more, graceful finish
break;
}else{
if (cmd.match1('=')) {
// got one that doesn't belong, back up
cmd.reset(old_here);
break;
}else{
_c.push_back(val);
}
}
}
if (cmd.gotit(start)) {
}else{
untested();
}
return cmd.gotit(start);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_POLY::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "min", &_min)
|| Get(cmd, "max", &_max)
|| Get(cmd, "abs", &_abs)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_POLY p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "poly", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_posy.cc 0000664 0000000 0000000 00000017147 13165012111 0014001 0 ustar 00root root 0000000 0000000 /*$Id: bm_posy.cc 2016/03/23 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* behavioral modeling - posynomial (non-integer powers)
* pair ... first is key, second is value
*/
//testing=script 2005.10.06
#include "globals.h"
#include "u_lang.h"
#include "e_elemnt.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
const double _default_max(BIGBIG);
const double _default_min(-BIGBIG);
const bool _default_abs(false);
const bool _default_odd(false);
const bool _default_even(false);
/*--------------------------------------------------------------------------*/
class EVAL_BM_POSY : public EVAL_BM_ACTION_BASE {
private:
PARAMETER _min;
PARAMETER _max;
PARAMETER _abs;
PARAMETER _odd;
PARAMETER _even;
std::vector,PARAMETER > > _table;
explicit EVAL_BM_POSY(const EVAL_BM_POSY& p);
public:
explicit EVAL_BM_POSY(int c=0);
~EVAL_BM_POSY() {}
private: // override vitrual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_POSY(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void tr_eval(ELEMENT*)const;
std::string name()const {return "posy";}
bool ac_too()const {untested();return false;}
bool parse_numlist(CS&);
bool parse_params_obsolete_callback(CS&);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_POSY::EVAL_BM_POSY(int c)
:EVAL_BM_ACTION_BASE(c),
_min(_default_min),
_max(_default_max),
_abs(_default_abs),
_odd(_default_odd),
_even(_default_even),
_table()
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_POSY::EVAL_BM_POSY(const EVAL_BM_POSY& p)
:EVAL_BM_ACTION_BASE(p),
_min(p._min),
_max(p._max),
_abs(p._abs),
_odd(p._odd),
_even(p._even),
_table(p._table)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_POSY::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_POSY* p = dynamic_cast(&x);
bool rv = p
&& _min == p->_min
&& _max == p->_max
&& _abs == p->_abs
&& _odd == p->_odd
&& _even == p->_even
&& _table == p->_table
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_POSY::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name() << '(';
for (std::vector,PARAMETER > >::
const_iterator p = _table.begin(); p != _table.end(); ++p) {
o << p->second << ',' << p->first << ' ';
}
o << ')';
print_pair(o, lang, "min", _min, _min.has_hard_value());
print_pair(o, lang, "max", _max, _max.has_hard_value());
print_pair(o, lang, "abs", _abs, _abs.has_hard_value());
print_pair(o, lang, "odd", _odd, _odd.has_hard_value());
print_pair(o, lang, "even",_even,_even.has_hard_value());
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_POSY::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
_min.e_val(_default_min, Scope);
_max.e_val(_default_max, Scope);
_abs.e_val(_default_abs, Scope);
_odd.e_val(_default_odd, Scope);
_even.e_val(_default_even, Scope);
for (std::vector,PARAMETER > >::
iterator p = _table.begin(); p != _table.end(); ++p) {
p->first.e_val(0, Scope);
p->second.e_val(0, Scope);
}
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_POSY::tr_eval(ELEMENT* d)const
{
double x_raw = ioffset(d->_y[0].x);
trace1("before", x_raw);
double x = (x_raw < 0)
? ((_odd || _even) ? -x_raw : 0.)
: x_raw;
assert(x >= 0);
trace1("rev", x);
double f0 = 0.;
double f1 = 0.;
if (x > 0) {
for (std::vector,PARAMETER > >::
const_iterator p = _table.begin(); p != _table.end(); ++p) {
double coeff = p->second * pow(x, p->first-1);
f1 += coeff * p->first;
f0 += coeff * x;
}
}else{
assert(x == 0);
for (std::vector,PARAMETER > >::
const_iterator p = _table.begin(); p != _table.end(); ++p) {
if (p->first == 0.) {
f0 += 1;
untested();
}
}
}
trace3("", x, f0, f1);
if (_odd && x_raw < 0) {
f0 = -f0;
}
if (_even && x_raw < 0) {
f1 = -f1;
untested();
}
trace3("after", x, f0, f1);
if (_abs && f0 < 0) {
f0 = -f0;
f1 = -f1;
untested();
}
if (f0 > _max) {
f0 = _max;
f1 = 0;
untested();
}else if (f0 < _min) {
f0 = _min;
f1 = 0;
untested();
}
d->_y[0] = FPOLY1(x_raw, f0, f1);
tr_final_adjust(&(d->_y[0]), d->f_is_value());
trace3("fa", d->_y[0].x, d->_y[0].f0, d->_y[0].f1);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_POSY::parse_numlist(CS& cmd)
{
unsigned start = cmd.cursor();
unsigned here = cmd.cursor();
for (;;) {
unsigned start_of_pair = here;
std::pair, PARAMETER > p;
cmd >> p.second; // value
if (cmd.stuck(&here)) {
// no more, graceful finish
break;
}else{
cmd >> p.first; // key
if (cmd.stuck(&here)) {
// ran out, but already have half of the pair
// back up one, hoping somebody else knows what to do with it
cmd.reset(start_of_pair);
break;
}else{
_table.push_back(p);
}
}
}
if (cmd.gotit(start)) {
}else{
untested();
}
return cmd.gotit(start);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_POSY::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "min", &_min)
|| Get(cmd, "max", &_max)
|| Get(cmd, "abs", &_abs)
|| Get(cmd, "odd", &_odd)
|| Get(cmd, "even", &_even)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_POSY p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "posy", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_pulse.cc 0000664 0000000 0000000 00000017613 13165012111 0014135 0 ustar 00root root 0000000 0000000 /*$Id: bm_pulse.cc 2016/09/15 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* SPICE compatible PULSE
*/
//testing=script 2016.09.15
#include "globals.h"
#include "e_elemnt.h"
#include "u_lang.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
const double _default_iv (NOT_INPUT);
const double _default_pv (NOT_INPUT);
const double _default_delay (0);
const double _default_rise (0);
const double _default_fall (0);
const double _default_width (BIGBIG);
const double _default_period(BIGBIG);
/*--------------------------------------------------------------------------*/
class EVAL_BM_PULSE : public EVAL_BM_ACTION_BASE {
private:
PARAMETER _iv;
PARAMETER _pv;
PARAMETER _delay;
PARAMETER _rise;
PARAMETER _fall;
PARAMETER _width;
PARAMETER _period;
PARAMETER _end;
explicit EVAL_BM_PULSE(const EVAL_BM_PULSE& p);
public:
explicit EVAL_BM_PULSE(int c=0);
~EVAL_BM_PULSE() {}
private: // override vitrual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_PULSE(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void tr_eval(ELEMENT*)const;
TIME_PAIR tr_review(COMPONENT*)const;
std::string name()const {return "pulse";}
bool ac_too()const {return false;}
bool parse_numlist(CS&);
bool parse_params_obsolete_callback(CS&);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_PULSE::EVAL_BM_PULSE(int c)
:EVAL_BM_ACTION_BASE(c),
_iv(_default_iv),
_pv(_default_pv),
_delay(_default_delay),
_rise(_default_rise),
_fall(_default_fall),
_width(_default_width),
_period(_default_period),
_end(NOT_VALID)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_PULSE::EVAL_BM_PULSE(const EVAL_BM_PULSE& p)
:EVAL_BM_ACTION_BASE(p),
_iv(p._iv),
_pv(p._pv),
_delay(p._delay),
_rise(p._rise),
_fall(p._fall),
_width(p._width),
_period(p._period),
_end(NOT_VALID)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_PULSE::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_PULSE* p = dynamic_cast(&x);
bool rv = p
&& _iv == p->_iv
&& _pv == p->_pv
&& _delay == p->_delay
&& _rise == p->_rise
&& _fall == p->_fall
&& _width == p->_width
&& _period == p->_period
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {untested();
}else{
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_PULSE::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name();
print_pair(o, lang, "iv", _iv);
print_pair(o, lang, "pv", _pv);
print_pair(o, lang, "delay", _delay);
print_pair(o, lang, "rise", _rise);
print_pair(o, lang, "fall", _fall);
print_pair(o, lang, "width", _width);
print_pair(o, lang, "period", _period);
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_PULSE::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
_iv.e_val(_default_iv, Scope);
_pv.e_val(_default_pv, Scope);
_delay.e_val(_default_delay, Scope);
_rise.e_val(_default_rise, Scope);
_fall.e_val(_default_fall, Scope);
_width.e_val(_default_width, Scope);
_period.e_val(_default_period, Scope);
if (_width == 0.) {
_width = _default_width;
}else{
}
if (_period == 0.) {
_period = _default_period;
}else{
}
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_PULSE::tr_eval(ELEMENT* d)const
{
double ev = 0; // effective value
double raw_time = d->_sim->_time0;
if (raw_time <= _delay) { /* init val */
ev = _iv;
}else{
double reltime;
if (0 < _period && _period < BIGBIG) {
reltime = fmod(raw_time - _delay, _period);
}else{
reltime = raw_time - _delay;
}
if (reltime < _rise) { /* rising */
double interp = reltime / _rise;
ev = _iv + interp * (_pv - _iv);
}else if (reltime <= _rise + _width) { /* pulse val */
ev = _pv;
}else if (reltime < _rise + _width + _fall) { /* falling */
double interp = (reltime - (_rise+_width)) / _fall;
ev = _pv + interp * (_iv - _pv);
}else{ /* past pulse */
ev = _iv;
}
}
//d->q_accept();
tr_finish_tdv(d, ev);
}
/*--------------------------------------------------------------------------*/
TIME_PAIR EVAL_BM_PULSE::tr_review(COMPONENT* d)const
{
double raw_time = d->_sim->_time0 + d->_sim->_dtmin * .01;
// hack to avoid duplicate events from numerical noise
if (raw_time <= _delay) {
d->_time_by.min_event(_delay);
}else{
double reltime;
if (0 < _period && _period < BIGBIG) {
reltime = fmod(raw_time - _delay, _period);
}else{
reltime = raw_time - _delay;
}
double time_offset = raw_time - reltime;
if (reltime < _rise) { /* rising */
d->_time_by.min_event(_rise + time_offset);
}else if (reltime < _rise + _width) { /* pulse val */
d->_time_by.min_event(_rise + _width + time_offset);
}else if (reltime < _rise + _width + _fall) { /* falling */
d->_time_by.min_event(_rise + _width + _fall + time_offset);
}else{ /* past pulse */
d->_time_by.min_event(_period + time_offset);
}
}
return d->_time_by;
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_PULSE::parse_numlist(CS& cmd)
{
unsigned start = cmd.cursor();
unsigned here = cmd.cursor();
for (PARAMETER* i = &_iv; i < &_end; ++i) {
PARAMETER val(NOT_VALID);
cmd >> val;
if (cmd.stuck(&here)) {
break;
}else{
*i = val;
}
}
return cmd.gotit(start);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_PULSE::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "iv", &_iv)
|| Get(cmd, "pv", &_pv)
|| Get(cmd, "delay", &_delay)
|| Get(cmd, "rise", &_rise)
|| Get(cmd, "fall", &_fall)
|| Get(cmd, "width", &_width)
|| Get(cmd, "period", &_period)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_PULSE p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "pulse", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_pwl.cc 0000664 0000000 0000000 00000016517 13165012111 0013611 0 ustar 00root root 0000000 0000000 /*$Id: bm_pwl.cc 2016/03/23 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* HSPICE compatible PWL
*/
//testing=script 2005.10.06
#include "globals.h"
#include "u_lang.h"
#include "e_elemnt.h"
#include "m_interp.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
const double _default_delta (NOT_INPUT);
const int _default_smooth(0);
/*--------------------------------------------------------------------------*/
class EVAL_BM_PWL : public EVAL_BM_ACTION_BASE {
private:
PARAMETER _delta;
PARAMETER _smooth;
std::vector,PARAMETER > > _raw_table;
std::vector _num_table;
explicit EVAL_BM_PWL(const EVAL_BM_PWL& p);
public:
explicit EVAL_BM_PWL(int c=0);
~EVAL_BM_PWL() {}
private: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_PWL(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void tr_eval(ELEMENT*)const;
TIME_PAIR tr_review(COMPONENT*)const;
std::string name()const {return "pwl";}
bool ac_too()const {return false;}
bool parse_numlist(CS&);
bool parse_params_obsolete_callback(CS&);
void skip_type_tail(CS& cmd)const {cmd.umatch("(1)");}
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_PWL::EVAL_BM_PWL(int c)
:EVAL_BM_ACTION_BASE(c),
_delta(_default_delta),
_smooth(_default_smooth),
_raw_table(),
_num_table()
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_PWL::EVAL_BM_PWL(const EVAL_BM_PWL& p)
:EVAL_BM_ACTION_BASE(p),
_delta(p._delta),
_smooth(p._smooth),
_raw_table(p._raw_table),
_num_table(p._num_table)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_PWL::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_PWL* p = dynamic_cast(&x);
bool rv = p
&& _delta == p->_delta
&& _smooth == p->_smooth
&& _raw_table == p->_raw_table
&& _num_table == p->_num_table
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_PWL::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name() << '(';
for (std::vector,PARAMETER > >::
const_iterator p = _raw_table.begin(); p != _raw_table.end(); ++p) {
o << p->first << ',' << p->second << ' ';
}
o << ')';
print_pair(o, lang, "delta", _delta, _delta.has_hard_value());
print_pair(o, lang, "smooth",_smooth,_smooth.has_hard_value());
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_PWL::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
_delta.e_val(_default_delta, Scope);
_smooth.e_val(_default_smooth, Scope);
for (std::vector,PARAMETER > >::iterator
p = _raw_table.begin(); p != _raw_table.end(); ++p) {
p->first.e_val(0, Scope);
p->second.e_val(0, Scope);
}
double last = -BIGBIG;
for (std::vector,PARAMETER > >::iterator
p = _raw_table.begin(); p != _raw_table.end(); ++p) {
if (last > p->first) {
throw Exception_Precalc("PWL is out of order: (" + to_string(last)
+ ", " + to_string(p->first) + ")\n");
}else{
DPAIR x(p->first, p->second);
_num_table.push_back(x);
}
last = p->first;
}
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_PWL::tr_eval(ELEMENT* d)const
{
double ext = (d->is_source()) ? 0. : NOT_INPUT;
d->_y[0] = interpolate(_num_table.begin(), _num_table.end(),
ioffset(d->_y[0].x), ext, ext);
tr_final_adjust(&(d->_y[0]), d->f_is_value());
}
/*--------------------------------------------------------------------------*/
TIME_PAIR EVAL_BM_PWL::tr_review(COMPONENT* d)const
{
if (d->is_source()) {
// index (x) is time
ELEMENT* dd = prechecked_cast(d);
assert(dd);
double x = dd->_y[0].x + d->_sim->_dtmin * .01;
DPAIR here(x, BIGBIG);
std::vector::const_iterator begin = _num_table.begin();
std::vector::const_iterator end = _num_table.end();
std::vector::const_iterator upper = upper_bound(begin, end, here);
std::vector::const_iterator lower = upper - 1;
assert(x > lower->first);
d->_time_by.min_event((x < upper->first) ? upper->first : NEVER);
}else{itested();
// index (x) is input
// It's really needed here too, more work needed
}
return d->_time_by;
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_PWL::parse_numlist(CS& cmd)
{
unsigned start = cmd.cursor();
unsigned here = cmd.cursor();
for (;;) {
unsigned start_of_pair = here;
std::pair, PARAMETER > p;
//cmd >> key >> value;
cmd >> p.first; // key
if (cmd.stuck(&here)) {
// no more, graceful finish
break;
}else{
cmd >> p.second; // value
if (cmd.stuck(&here)) {
// ran out, but already have half of the pair
// back up one, hoping somebody else knows what to do with it
cmd.reset(start_of_pair);
break;
}else{
_raw_table.push_back(p);
}
}
}
if (cmd.gotit(start)) {
}else{
untested();
}
return cmd.gotit(start);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_PWL::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "delta", &_delta)
|| Get(cmd, "smooth", &_smooth)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_PWL p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "pwl", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_sffm.cc 0000664 0000000 0000000 00000020040 13165012111 0013724 0 ustar 00root root 0000000 0000000 /*$Id: bm_sffm.cc 2016/03/23 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* SPICE compatible SFFM
*/
//testing=script 2005.10.07
#include "globals.h"
#include "e_elemnt.h"
#include "l_denoise.h"
#include "u_lang.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
const double _default_offset (0);
const double _default_amplitude (1);
const double _default_carrier (NOT_INPUT);
const double _default_modindex (NOT_INPUT);
const double _default_signal (NOT_INPUT);
const double _default_samples (4);
const bool _default_zero (true);
const bool _default_peak (true);
/*--------------------------------------------------------------------------*/
class EVAL_BM_SFFM : public EVAL_BM_ACTION_BASE {
private:
PARAMETER _offset;
PARAMETER _amplitude;
PARAMETER _carrier;
PARAMETER _modindex;
PARAMETER _signal;
PARAMETER _end;
PARAMETER _samples;
PARAMETER _zero;
PARAMETER _peak;
explicit EVAL_BM_SFFM(const EVAL_BM_SFFM& p);
public:
explicit EVAL_BM_SFFM(int c=0);
~EVAL_BM_SFFM() {}
private: // override vitrual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_SFFM(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void tr_eval(ELEMENT*)const;
TIME_PAIR tr_review(COMPONENT*)const;
std::string name()const {return "sffm";}
bool ac_too()const {return false;}
bool parse_numlist(CS&);
bool parse_params_obsolete_callback(CS&);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_SFFM::EVAL_BM_SFFM(int c)
:EVAL_BM_ACTION_BASE(c),
_offset(_default_offset),
_amplitude(_default_amplitude),
_carrier(_default_carrier),
_modindex(_default_modindex),
_signal(_default_signal),
_end(NOT_VALID),
_samples(_default_samples),
_zero(_default_zero),
_peak(_default_peak)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_SFFM::EVAL_BM_SFFM(const EVAL_BM_SFFM& p)
:EVAL_BM_ACTION_BASE(p),
_offset(p._offset),
_amplitude(p._amplitude),
_carrier(p._carrier),
_modindex(p._modindex),
_signal(p._signal),
_end(NOT_VALID),
_samples(p._samples),
_zero(p._zero),
_peak(p._peak)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SFFM::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_SFFM* p = dynamic_cast(&x);
bool rv = p
&& _offset == p->_offset
&& _amplitude == p->_amplitude
&& _carrier == p->_carrier
&& _modindex == p->_modindex
&& _signal == p->_signal
&& _samples == p->_samples
&& _zero == p->_zero
&& _peak == p->_peak
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SFFM::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name();
print_pair(o, lang, "offset", _offset);
print_pair(o, lang, "amplitude", _amplitude);
print_pair(o, lang, "carrier", _carrier);
print_pair(o, lang, "modindex", _modindex);
print_pair(o, lang, "signal", _signal);
print_pair(o, lang, "samples", _samples, _samples.has_hard_value());
print_pair(o, lang, "zero", _zero, _zero.has_hard_value());
print_pair(o, lang, "peak", _peak, _peak.has_hard_value());
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SFFM::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
_offset.e_val(_default_offset, Scope);
_amplitude.e_val(_default_amplitude, Scope);
_carrier.e_val(_default_carrier, Scope);
_modindex.e_val(_default_modindex, Scope);
_signal.e_val(_default_signal, Scope);
_samples.e_val(_default_samples, Scope);
_zero.e_val(_default_zero, Scope);
_peak.e_val(_default_peak, Scope);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SFFM::tr_eval(ELEMENT* d)const
{
double time = d->_sim->_time0;
double mod = (_modindex * sin(M_TWO_PI * _signal * time));
double ev = _offset + _amplitude * sin(M_TWO_PI * _carrier * time + mod);
tr_finish_tdv(d, ev);
}
/*--------------------------------------------------------------------------*/
TIME_PAIR EVAL_BM_SFFM::tr_review(COMPONENT* d)const
{
double time = d->_sim->_time0 + d->_sim->_dtmin * .01;
double old_time;
double N = 0;
trace2("", time, N);
do {
// simple fixed point iteration to find peaks and zero crossings
old_time = time;
double mod = (_modindex * sin(M_TWO_PI * _signal * time));
double inst_freq = _carrier * (1 + mod / (M_TWO_PI * _carrier * time));
if (N == 0) {
if (_peak && _zero) {
N = floor(time * 4 * inst_freq + 1);
}else if (_peak) {untested();
N = floor(time * 2 * inst_freq + .5) + .5;
}else if (_zero) {untested();
N = floor(time * 2 * inst_freq + 1);
}else{
N = 0;
}
}else{
}
if (_peak && _zero) {
time = N / (4 * inst_freq);
}else if (_peak) {untested();
time = N / (2 * inst_freq);
}else if (_zero) {untested();
time = N / (2 * inst_freq);
}else{
time = NEVER;
}
trace2("", time, N);
} while (std::abs(dn_diff(time, old_time)) > 0);
d->_time_by.min_error_estimate(d->_sim->_time0 + 1. / (_samples * _carrier));
d->_time_by.min_event(old_time);
return d->_time_by;
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SFFM::parse_numlist(CS& cmd)
{
unsigned start = cmd.cursor();
unsigned here = cmd.cursor();
for (PARAMETER* i = &_offset; i < &_end; ++i) {
PARAMETER val(NOT_VALID);
cmd >> val;
if (cmd.stuck(&here)) {
break;
}else{
untested();
*i = val;
}
}
if (cmd.gotit(start)) {
untested();
}
return cmd.gotit(start);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SFFM::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "offset", &_offset)
|| Get(cmd, "amplitude", &_amplitude)
|| Get(cmd, "carrier", &_carrier)
|| Get(cmd, "modindex", &_modindex)
|| Get(cmd, "signal", &_signal)
|| Get(cmd, "samples", &_samples)
|| Get(cmd, "zero", &_zero)
|| Get(cmd, "peak", &_peak)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_SFFM p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "sffm", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_sin.cc 0000664 0000000 0000000 00000017605 13165012111 0013577 0 ustar 00root root 0000000 0000000 /*$Id: bm_sin.cc 2016/03/23 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* SPICE compatible SIN
*/
//testing=script,complete 2005.10.07
#include "globals.h"
#include "e_elemnt.h"
#include "u_lang.h"
#include "l_denoise.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
const double _default_offset (0);
const double _default_amplitude (1);
const double _default_frequency (NOT_INPUT);
const double _default_delay (0);
const double _default_damping (0);
const double _default_samples (4);
const bool _default_zero (false);
const bool _default_peak (false);
/*--------------------------------------------------------------------------*/
class EVAL_BM_SIN : public EVAL_BM_ACTION_BASE {
private:
PARAMETER _offset;
PARAMETER _amplitude;
PARAMETER _frequency;
PARAMETER _delay;
PARAMETER _damping;
PARAMETER _end;
PARAMETER _samples;
PARAMETER _zero;
PARAMETER _peak;
mutable double _actual_frequency;
explicit EVAL_BM_SIN(const EVAL_BM_SIN& p);
public:
explicit EVAL_BM_SIN(int c=0);
~EVAL_BM_SIN() {}
private: // override vitrual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_SIN(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void tr_eval(ELEMENT*)const;
TIME_PAIR tr_review(COMPONENT*)const;
std::string name()const {return "sin";}
bool ac_too()const {return false;}
bool parse_numlist(CS&);
bool parse_params_obsolete_callback(CS&);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_SIN::EVAL_BM_SIN(int c)
:EVAL_BM_ACTION_BASE(c),
_offset(_default_offset),
_amplitude(_default_amplitude),
_frequency(_default_frequency),
_delay(_default_delay),
_damping(_default_damping),
_end(NOT_VALID),
_samples(_default_samples),
_zero(_default_zero),
_peak(_default_peak),
_actual_frequency(0)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_SIN::EVAL_BM_SIN(const EVAL_BM_SIN& p)
:EVAL_BM_ACTION_BASE(p),
_offset(p._offset),
_amplitude(p._amplitude),
_frequency(p._frequency),
_delay(p._delay),
_damping(p._damping),
_end(NOT_VALID),
_samples(p._samples),
_zero(p._zero),
_peak(p._peak),
_actual_frequency(p._actual_frequency)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SIN::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_SIN* p = dynamic_cast(&x);
bool rv = p
&& _offset == p->_offset
&& _amplitude == p->_amplitude
&& _frequency == p->_frequency
&& _delay == p->_delay
&& _damping == p->_damping
&& _samples == p->_samples
&& _zero == p->_zero
&& _peak == p->_peak
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {untested();
}else{
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SIN::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name();
print_pair(o, lang, "offset", _offset);
print_pair(o, lang, "amplitude", _amplitude);
print_pair(o, lang, "frequency", _frequency);
print_pair(o, lang, "delay", _delay);
print_pair(o, lang, "damping", _damping);
print_pair(o, lang, "samples", _samples, _samples.has_hard_value());
print_pair(o, lang, "zero", _zero, _zero.has_hard_value());
print_pair(o, lang, "peak", _peak, _peak.has_hard_value());
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SIN::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
_offset.e_val(_default_offset, Scope);
_amplitude.e_val(_default_amplitude, Scope);
_frequency.e_val(_default_frequency, Scope);
_delay.e_val(_default_delay, Scope);
_damping.e_val(_default_damping, Scope);
_samples.e_val(_default_samples, Scope);
_zero.e_val(_default_zero, Scope);
_peak.e_val(_default_peak, Scope);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SIN::tr_eval(ELEMENT* d)const
{
if (!_frequency.has_hard_value()) {
_actual_frequency = d->_sim->_freq;
}else{
_actual_frequency = _frequency;
}
double reltime = ioffset(d->_sim->_time0);
double ev = _offset;
if (reltime > _delay) {
double x=_amplitude*fixzero(sin(M_TWO_PI*_actual_frequency*(reltime-_delay)),1.);
if (_damping != 0.) {
x *= exp(-(reltime-_delay)*_damping);
}else{
}
ev += x;
}else{
}
tr_finish_tdv(d, ev);
}
/*--------------------------------------------------------------------------*/
TIME_PAIR EVAL_BM_SIN::tr_review(COMPONENT* d)const
{
double reltime = ioffset(d->_sim->_time0) + d->_sim->_dtmin * .01;
if (reltime > _delay) {
if (_peak && _zero) {
d->_time_by.min_event(floor(reltime * 4 * _actual_frequency + 1) / (4 * _actual_frequency));
}else if (_peak) {
d->_time_by.min_event((floor(reltime*2*_actual_frequency+.5) + .5) / (2*_actual_frequency));
}else if (_zero) {
d->_time_by.min_event(floor(reltime * 2 * _actual_frequency + 1) / (2 * _actual_frequency));
}else{
}
d->_time_by.min_error_estimate(d->_sim->_time0 + 1. / (_samples * _actual_frequency));
}else{
d->_time_by.min_event(_delay);
}
return d->_time_by;
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SIN::parse_numlist(CS& cmd)
{
unsigned start = cmd.cursor();
unsigned here = cmd.cursor();
for (PARAMETER* i = &_offset; i < &_end; ++i) {
PARAMETER val(NOT_VALID);
cmd >> val;
if (cmd.stuck(&here)) {
break;
}else{
*i = val;
}
}
return cmd.gotit(start);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SIN::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "o{ffset}", &_offset)
|| Get(cmd, "a{mplitude}", &_amplitude)
|| Get(cmd, "f{requency}", &_frequency)
|| Get(cmd, "de{lay}", &_delay)
|| Get(cmd, "da{mping}", &_damping)
|| Get(cmd, "sa{mples}", &_samples)
|| Get(cmd, "ze{ro}", &_zero)
|| Get(cmd, "pe{ak}", &_peak)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_SIN p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "sin|sine", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bm_tanh.cc 0000664 0000000 0000000 00000012117 13165012111 0013731 0 ustar 00root root 0000000 0000000 /*$Id: bm_tanh.cc 2016/03/23 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* behavioral modeling hyperbolic tangent
*/
//testing=script 2005.10.07
#include "globals.h"
#include "u_lang.h"
#include "e_elemnt.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
const double _default_gain (NOT_INPUT);
const double _default_limit (NOT_INPUT);
/*--------------------------------------------------------------------------*/
class EVAL_BM_TANH : public EVAL_BM_ACTION_BASE {
private:
PARAMETER _gain;
PARAMETER _limit;
explicit EVAL_BM_TANH(const EVAL_BM_TANH& p);
public:
explicit EVAL_BM_TANH(int c=0);
~EVAL_BM_TANH() {}
private: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_TANH(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void tr_eval(ELEMENT*)const;
std::string name()const {return "tanh";}
bool ac_too()const {untested();return false;}
bool parse_numlist(CS&);
bool parse_params_obsolete_callback(CS&);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_TANH::EVAL_BM_TANH(int c)
:EVAL_BM_ACTION_BASE(c),
_gain(NOT_INPUT),
_limit(NOT_INPUT)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_TANH::EVAL_BM_TANH(const EVAL_BM_TANH& p)
:EVAL_BM_ACTION_BASE(p),
_gain(p._gain),
_limit(p._limit)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_TANH::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_TANH* p = dynamic_cast(&x);
bool rv = p
&& _gain == p->_gain
&& _limit == p->_limit
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_TANH::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << name();
print_pair(o, lang, "gain", _gain);
print_pair(o, lang, "limit", _limit);
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_TANH::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
_gain.e_val(_default_gain, Scope);
_limit.e_val(_default_limit, Scope);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_TANH::tr_eval(ELEMENT* d)const
{
double x = ioffset(d->_y[0].x);
double aa = x * _gain/_limit;
double f1, f0;
if (aa > LOGBIGBIG) {
f1 = 0;
f0 = _limit;
}else if (aa < -LOGBIGBIG) {
f1 = 0;
f0 = -_limit;
}else{
double cosine = cosh(aa);
f1 = _gain / (cosine*cosine);
f0 = _limit * tanh(aa);
}
d->_y[0] = FPOLY1(x, f0, f1);
tr_final_adjust(&(d->_y[0]), d->f_is_value());
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_TANH::parse_numlist(CS& cmd)
{
unsigned here = cmd.cursor();
PARAMETER gain(NOT_VALID);
PARAMETER limit(NOT_VALID);
cmd >> gain >> limit;
if (cmd.gotit(here)) {
_gain = gain;
_limit = limit;
return true;
}else{
return false;
}
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_TANH::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "gain", &_gain)
|| Get(cmd, "limit", &_limit)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
EVAL_BM_TANH p1(CC_STATIC);
DISPATCHER::INSTALL d1(&bm_dispatcher, "tanh", &p1);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bmm_semi.cc 0000664 0000000 0000000 00000050766 13165012111 0014125 0 ustar 00root root 0000000 0000000 /*$Id: bmm_semi.cc 2016/03/25 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* behavioral modeling
* Spice3 compatible "semiconductor resistor and capacitor"
*/
//testing=script 2016.03.25
#include "globals.h"
#include "u_lang.h"
#include "e_model.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
class EVAL_BM_SEMI_BASE : public EVAL_BM_ACTION_BASE {
protected:
PARAMETER _length;
PARAMETER _width;
double _va_lue;
private:
static double const _default_length;
static double const _default_width;
static double const _default_value;
protected:
explicit EVAL_BM_SEMI_BASE(const EVAL_BM_SEMI_BASE& p);
explicit EVAL_BM_SEMI_BASE(int c=0);
~EVAL_BM_SEMI_BASE() {untested();}
protected: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const = 0;
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void precalc_last(const CARD_LIST*);
void expand(const COMPONENT*);
void tr_eval(ELEMENT*)const;
std::string name()const {untested();return modelname().c_str();}
bool ac_too()const {untested();return false;}
bool parse_params_obsolete_callback(CS&);
bool parse_numlist(CS& cmd);
};
/*--------------------------------------------------------------------------*/
class EVAL_BM_SEMI_CAPACITOR : public EVAL_BM_SEMI_BASE {
private:
explicit EVAL_BM_SEMI_CAPACITOR(const EVAL_BM_SEMI_CAPACITOR& p)
:EVAL_BM_SEMI_BASE(p) {untested();}
public:
explicit EVAL_BM_SEMI_CAPACITOR(int c=0)
:EVAL_BM_SEMI_BASE(c) {}
~EVAL_BM_SEMI_CAPACITOR() {untested();}
private: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {untested();return new EVAL_BM_SEMI_CAPACITOR(*this);}
void expand(const COMPONENT*);
void precalc_last(const CARD_LIST*);
};
/*--------------------------------------------------------------------------*/
class EVAL_BM_SEMI_RESISTOR : public EVAL_BM_SEMI_BASE {
private:
explicit EVAL_BM_SEMI_RESISTOR(const EVAL_BM_SEMI_RESISTOR& p)
:EVAL_BM_SEMI_BASE(p) {untested();}
public:
explicit EVAL_BM_SEMI_RESISTOR(int c=0)
:EVAL_BM_SEMI_BASE(c) {}
~EVAL_BM_SEMI_RESISTOR() {untested();}
private: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {untested();return new EVAL_BM_SEMI_RESISTOR(*this);}
void expand(const COMPONENT*);
void precalc_last(const CARD_LIST*);
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
class MODEL_SEMI_BASE : public MODEL_CARD {
public:
PARAMETER _narrow;
PARAMETER _defw;
PARAMETER _tc1;
PARAMETER _tc2;
private:
static double const _default_narrow;
static double const _default_defw;
static double const _default_tc1;
static double const _default_tc2;
protected:
explicit MODEL_SEMI_BASE();
explicit MODEL_SEMI_BASE(const MODEL_SEMI_BASE& p);
protected: // override virtual
void precalc_first();
//void precalc_last();
//CARD* clone()const //MODEL_CARD/pure
void set_param_by_index(int, std::string&, int);
bool param_is_printable(int)const;
std::string param_name(int)const;
std::string param_name(int,int)const;
std::string param_value(int)const;
int param_count()const {return (4 + MODEL_CARD::param_count());}
};
/*--------------------------------------------------------------------------*/
class MODEL_SEMI_CAPACITOR : public MODEL_SEMI_BASE {
public:
PARAMETER _cj;
PARAMETER _cjsw;
private:
static double const _default_cj;
static double const _default_cjsw;
private:
explicit MODEL_SEMI_CAPACITOR(const MODEL_SEMI_CAPACITOR& p);
public:
explicit MODEL_SEMI_CAPACITOR();
private: // override virtual
std::string dev_type()const {return "c";}
void precalc_first();
//void precalc_last();
COMMON_COMPONENT* new_common()const {return new EVAL_BM_SEMI_CAPACITOR;}
CARD* clone()const {return new MODEL_SEMI_CAPACITOR(*this);}
void set_param_by_index(int, std::string&, int);
bool param_is_printable(int)const;
std::string param_name(int)const;
std::string param_name(int,int)const;
std::string param_value(int)const;
int param_count()const {return (2 + MODEL_SEMI_BASE::param_count());}
};
/*--------------------------------------------------------------------------*/
class MODEL_SEMI_RESISTOR : public MODEL_SEMI_BASE {
public:
PARAMETER _rsh;
private:
static double const _default_rsh;
private:
explicit MODEL_SEMI_RESISTOR(const MODEL_SEMI_RESISTOR& p);
public:
explicit MODEL_SEMI_RESISTOR();
private: // override virtual
std::string dev_type()const {return "r";}
void precalc_first();
//void precalc_last();
COMMON_COMPONENT* new_common()const {return new EVAL_BM_SEMI_RESISTOR;}
CARD* clone()const {return new MODEL_SEMI_RESISTOR(*this);}
void set_param_by_index(int, std::string&, int);
bool param_is_printable(int)const;
std::string param_name(int)const;
std::string param_name(int,int)const;
std::string param_value(int)const;
int param_count()const {return (1 + MODEL_SEMI_BASE::param_count());}
};
/*--------------------------------------------------------------------------*/
double const EVAL_BM_SEMI_BASE::_default_length = NOT_INPUT;
double const EVAL_BM_SEMI_BASE::_default_width = NOT_INPUT;
double const EVAL_BM_SEMI_BASE::_default_value = NOT_INPUT;
/*--------------------------------------------------------------------------*/
static MODEL_SEMI_RESISTOR p1;
static MODEL_SEMI_CAPACITOR p2;
static DISPATCHER::INSTALL
d1(&model_dispatcher, "r|res", &p1),
d2(&model_dispatcher, "c|cap", &p2);
/*--------------------------------------------------------------------------*/
EVAL_BM_SEMI_BASE::EVAL_BM_SEMI_BASE(int c)
:EVAL_BM_ACTION_BASE(c),
_length(_default_length),
_width(_default_width),
_va_lue(_default_value)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_SEMI_BASE::EVAL_BM_SEMI_BASE(const EVAL_BM_SEMI_BASE& p)
:EVAL_BM_ACTION_BASE(p),
_length(p._length),
_width(p._width),
_va_lue(p._va_lue)
{untested();
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SEMI_BASE::operator==(const COMMON_COMPONENT& x)const
{untested();
const EVAL_BM_SEMI_BASE* p = dynamic_cast(&x);
bool rv = p
&& _length == p->_length
&& _width == p->_width
&& EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {untested();
}else{untested();
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SEMI_BASE::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << modelname();
if (_value.has_hard_value()) {
o << " " << _value;
}else{
}
print_pair(o, lang, "l", _length, _length.has_hard_value());
print_pair(o, lang, "w", _width, _width.has_hard_value());
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SEMI_BASE::expand(const COMPONENT* d)
{
EVAL_BM_ACTION_BASE::expand(d);
attach_model(d);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SEMI_BASE::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_ACTION_BASE::precalc_last(Scope);
_length.e_val(_default_length, Scope);
_width.e_val(_default_width, Scope);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SEMI_BASE::tr_eval(ELEMENT* d)const
{
tr_finish_tdv(d, _va_lue);
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SEMI_BASE::parse_numlist(CS& cmd)
{
unsigned here = cmd.cursor();
PARAMETER val(NOT_VALID);
cmd >> val;
if (cmd.gotit(here)) {
_value = val;
return true;
}else{
return false;
}
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SEMI_BASE::parse_params_obsolete_callback(CS& cmd)
{
return ONE_OF
|| Get(cmd, "l", &_length)
|| Get(cmd, "w", &_width)
|| EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd)
;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SEMI_CAPACITOR::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_SEMI_CAPACITOR*
p = dynamic_cast(&x);
bool rv = p
&& EVAL_BM_SEMI_BASE::operator==(x);
if (rv) {untested();
}else{
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SEMI_CAPACITOR::expand(const COMPONENT* d)
{
EVAL_BM_SEMI_BASE::expand(d);
const MODEL_SEMI_CAPACITOR* m = dynamic_cast(model());
if (!m) {
unreachable();
throw Exception_Model_Type_Mismatch(d->long_label(), modelname(), "semi-capacitor (C)");
}else{
}
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SEMI_CAPACITOR::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_SEMI_BASE::precalc_last(Scope);
const MODEL_SEMI_CAPACITOR* m = prechecked_cast(model());
double width = (_width == NOT_INPUT) ? m->_defw : _width;
double eff_width = width - m->_narrow;
double eff_length = _length - m->_narrow;
_va_lue = m->_cj * eff_length * eff_width + 2. * m->_cjsw * (eff_length + eff_width);
double tempdiff = (_temp_c - m->_tnom_c);
_va_lue *= 1 + m->_tc1*tempdiff + m->_tc2*tempdiff*tempdiff;
if (eff_width <= 0.) {untested();
throw Exception_Precalc(modelname() + ": effective width is negative or zero\n");
}else{
}
if (eff_length <= 0.) {untested();
throw Exception_Precalc(modelname() + ": effective length is negative or zero\n");
}else{
}
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_SEMI_RESISTOR::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_SEMI_RESISTOR*
p = dynamic_cast(&x);
bool rv = p
&& EVAL_BM_SEMI_BASE::operator==(x);
if (rv) {untested();
}else{
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SEMI_RESISTOR::expand(const COMPONENT* d)
{
EVAL_BM_SEMI_BASE::expand(d);
const MODEL_SEMI_RESISTOR* m = dynamic_cast(model());
if (!m) {
unreachable();
throw Exception_Model_Type_Mismatch(d->long_label(), modelname(), "semi-resistor (R)");
}else{
}
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_SEMI_RESISTOR::precalc_last(const CARD_LIST* Scope)
{
assert(Scope);
EVAL_BM_SEMI_BASE::precalc_last(Scope);
const MODEL_SEMI_RESISTOR* m = prechecked_cast(model());
double width = (_width == NOT_INPUT) ? m->_defw : _width;
double eff_width = width - m->_narrow;
double eff_length = _length - m->_narrow;
trace4("EVAL_BM_SEMI_RESISTOR::precalc_last", value(), eff_width, eff_length, m->_rsh);
if (!has_hard_value(m->_rsh)) {
_va_lue = (value());
}else if (eff_width != 0.) {
_va_lue = m->_rsh * eff_length / eff_width;
}else{untested();
_va_lue = BIGBIG;
}
double tempdiff = (_temp_c - m->_tnom_c);
_va_lue *= 1 + m->_tc1*tempdiff + m->_tc2*tempdiff*tempdiff;
if (has_hard_value(m->_rsh)) {
if (eff_width <= 0.) {untested();
throw Exception_Precalc(modelname() + ": effective width is negative or zero\n");
}else{
}
if (eff_length <= 0.) {
throw Exception_Precalc(modelname() + ": effective length is negative or zero\n");
}else{
}
}else{
}
trace4("EVAL_BM_SEMI_RESISTOR::precalc_last done", value(), eff_width, m->_rsh, _va_lue);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
double const MODEL_SEMI_BASE::_default_narrow = 0.;
double const MODEL_SEMI_BASE::_default_defw = 1e-6;
double const MODEL_SEMI_BASE::_default_tc1 = 0.;
double const MODEL_SEMI_BASE::_default_tc2 = 0.;
/*--------------------------------------------------------------------------*/
MODEL_SEMI_BASE::MODEL_SEMI_BASE()
:MODEL_CARD(NULL),
_narrow(_default_narrow),
_defw(_default_defw),
_tc1(_default_tc1),
_tc2(_default_tc2)
{
}
/*--------------------------------------------------------------------------*/
MODEL_SEMI_BASE::MODEL_SEMI_BASE(const MODEL_SEMI_BASE& p)
:MODEL_CARD(p),
_narrow(p._narrow),
_defw(p._defw),
_tc1(p._tc1),
_tc2(p._tc2)
{
}
/*--------------------------------------------------------------------------*/
void MODEL_SEMI_BASE::set_param_by_index(int i, std::string& value, int offset)
{
switch (MODEL_SEMI_BASE::param_count() - 1 - i) {
case 0: _narrow = value; break;
case 1: _defw = value; break;
case 2: _tc1 = value; break;
case 3: _tc2 = value; break;
default: MODEL_CARD::set_param_by_index(i, value, offset); break;
}
}
/*--------------------------------------------------------------------------*/
bool MODEL_SEMI_BASE::param_is_printable(int i)const
{
switch (MODEL_SEMI_BASE::param_count() - 1 - i) {
case 0: return true;
case 1: return true;
case 2: return true;
case 3: return true;
default: return MODEL_CARD::param_is_printable(i);
}
}
/*--------------------------------------------------------------------------*/
std::string MODEL_SEMI_BASE::param_name(int i)const
{
switch (MODEL_SEMI_BASE::param_count() - 1 - i) {
case 0: return "narrow";
case 1: return "defw";
case 2: return "tc1";
case 3: return "tc2";
default: return MODEL_CARD::param_name(i);
}
}
/*--------------------------------------------------------------------------*/
std::string MODEL_SEMI_BASE::param_name(int i, int j)const
{
if (j == 0) {untested();
return param_name(i);
}else if (i >= MODEL_CARD::param_count()) {
return "";
}else{untested();
return MODEL_CARD::param_name(i, j);
}
}
/*--------------------------------------------------------------------------*/
std::string MODEL_SEMI_BASE::param_value(int i)const
{
switch (MODEL_SEMI_BASE::param_count() - 1 - i) {
case 0: return _narrow.string();
case 1: return _defw.string();
case 2: return _tc1.string();
case 3: return _tc2.string();
default: return MODEL_CARD::param_value(i);
}
}
/*--------------------------------------------------------------------------*/
void MODEL_SEMI_BASE::precalc_first()
{
MODEL_CARD::precalc_first();
const CARD_LIST* s = scope();
assert(s);
_narrow.e_val(_default_narrow, s);
_defw.e_val(_default_defw, s);
_tc1.e_val(_default_tc1, s);
_tc2.e_val(_default_tc2, s);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
double const MODEL_SEMI_CAPACITOR::_default_cj = 0.;
double const MODEL_SEMI_CAPACITOR::_default_cjsw = 0.;
/*--------------------------------------------------------------------------*/
MODEL_SEMI_CAPACITOR::MODEL_SEMI_CAPACITOR()
:MODEL_SEMI_BASE(),
_cj(_default_cj),
_cjsw(_default_cjsw)
{
}
/*--------------------------------------------------------------------------*/
MODEL_SEMI_CAPACITOR::MODEL_SEMI_CAPACITOR(const MODEL_SEMI_CAPACITOR& p)
:MODEL_SEMI_BASE(p),
_cj(p._cj),
_cjsw(p._cjsw)
{
}
/*--------------------------------------------------------------------------*/
void MODEL_SEMI_CAPACITOR::set_param_by_index(int i, std::string& value, int offset)
{
switch (MODEL_SEMI_CAPACITOR::param_count() - 1 - i) {
case 0: _cj = value; break;
case 1: _cjsw = value; break;
default:untested(); MODEL_SEMI_BASE::set_param_by_index(i, value, offset); break;
}
}
/*--------------------------------------------------------------------------*/
bool MODEL_SEMI_CAPACITOR::param_is_printable(int i)const
{
switch (MODEL_SEMI_CAPACITOR::param_count() - 1 - i) {
case 0: return true;
case 1: return true;
default: return MODEL_SEMI_BASE::param_is_printable(i);
}
}
/*--------------------------------------------------------------------------*/
std::string MODEL_SEMI_CAPACITOR::param_name(int i)const
{
switch (MODEL_SEMI_CAPACITOR::param_count() - 1 - i) {
case 0: return "cj";
case 1: return "cjsw";
default: return MODEL_SEMI_BASE::param_name(i);
}
}
/*--------------------------------------------------------------------------*/
std::string MODEL_SEMI_CAPACITOR::param_name(int i, int j)const
{
if (j == 0) {
return param_name(i);
}else if (i >= MODEL_SEMI_BASE::param_count()) {
return "";
}else{untested();
return MODEL_SEMI_BASE::param_name(i, j);
}
}
/*--------------------------------------------------------------------------*/
std::string MODEL_SEMI_CAPACITOR::param_value(int i)const
{
switch (MODEL_SEMI_CAPACITOR::param_count() - 1 - i) {
case 0: return _cj.string();
case 1: return _cjsw.string();
default: return MODEL_SEMI_BASE::param_value(i);
}
}
/*--------------------------------------------------------------------------*/
void MODEL_SEMI_CAPACITOR::precalc_first()
{
MODEL_SEMI_BASE::precalc_first();
const CARD_LIST* s = scope();
assert(s);
_cj.e_val(_default_cj, s);
_cjsw.e_val(_default_cjsw, s);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
double const MODEL_SEMI_RESISTOR::_default_rsh = NOT_INPUT;
/*--------------------------------------------------------------------------*/
MODEL_SEMI_RESISTOR::MODEL_SEMI_RESISTOR()
:MODEL_SEMI_BASE(),
_rsh(_default_rsh)
{
}
/*--------------------------------------------------------------------------*/
MODEL_SEMI_RESISTOR::MODEL_SEMI_RESISTOR(const MODEL_SEMI_RESISTOR& p)
:MODEL_SEMI_BASE(p),
_rsh(p._rsh)
{
}
/*--------------------------------------------------------------------------*/
void MODEL_SEMI_RESISTOR::set_param_by_index(int i, std::string& value, int offset)
{
switch (MODEL_SEMI_RESISTOR::param_count() - 1 - i) {
case 0: _rsh = value; break;
default: MODEL_SEMI_BASE::set_param_by_index(i, value, offset); break;
}
}
/*--------------------------------------------------------------------------*/
bool MODEL_SEMI_RESISTOR::param_is_printable(int i)const
{
switch (MODEL_SEMI_RESISTOR::param_count() - 1 - i) {
case 0: return true;
default: return MODEL_SEMI_BASE::param_is_printable(i);
}
}
/*--------------------------------------------------------------------------*/
std::string MODEL_SEMI_RESISTOR::param_name(int i)const
{
switch (MODEL_SEMI_RESISTOR::param_count() - 1 - i) {
case 0: return "rsh";
default: return MODEL_SEMI_BASE::param_name(i);
}
}
/*--------------------------------------------------------------------------*/
std::string MODEL_SEMI_RESISTOR::param_name(int i, int j)const
{
if (j == 0) {
return param_name(i);
}else if (i >= MODEL_SEMI_BASE::param_count()) {
return "";
}else{
return MODEL_SEMI_BASE::param_name(i, j);
}
}
/*--------------------------------------------------------------------------*/
std::string MODEL_SEMI_RESISTOR::param_value(int i)const
{
switch (MODEL_SEMI_RESISTOR::param_count() - 1 - i) {
case 0: return _rsh.string();
default: return MODEL_SEMI_BASE::param_value(i);
}
}
/*--------------------------------------------------------------------------*/
void MODEL_SEMI_RESISTOR::precalc_first()
{
MODEL_SEMI_BASE::precalc_first();
const CARD_LIST* par_scope = scope();
assert(par_scope);
_rsh.e_val(_default_rsh, par_scope);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/bmm_table.cc 0000664 0000000 0000000 00000020507 13165012111 0014245 0 ustar 00root root 0000000 0000000 /*$Id: bmm_table.cc,v 26.137 2010/04/10 02:37:05 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* behavioral modeling
* table as a .model card
*/
//testing=script 2006.04.18
#include "globals.h"
#include "u_lang.h"
#include "e_elemnt.h"
#include "m_spline.h"
#include "e_model.h"
#include "bm.h"
/*--------------------------------------------------------------------------*/
class SPLINE;
/*--------------------------------------------------------------------------*/
class EVAL_BM_TABLE : public EVAL_BM_ACTION_BASE {
protected:
explicit EVAL_BM_TABLE(const EVAL_BM_TABLE& p);
public:
explicit EVAL_BM_TABLE(int c=0);
~EVAL_BM_TABLE() {}
private: // override virtual
bool operator==(const COMMON_COMPONENT&)const;
COMMON_COMPONENT* clone()const {return new EVAL_BM_TABLE(*this);}
void print_common_obsolete_callback(OMSTREAM&, LANGUAGE*)const;
void expand(const COMPONENT*);
void tr_eval(ELEMENT*)const;
std::string name()const {untested();return modelname().c_str();}
bool ac_too()const {untested();return false;}
};
/*--------------------------------------------------------------------------*/
class MODEL_TABLE : public MODEL_CARD {
public:
PARAMETER _order;
PARAMETER _below;
PARAMETER _above;
std::vector,PARAMETER > > _table;
SPLINE* _spline;
private:
static int const _default_order;
static double const _default_below;
static double const _default_above;
private:
explicit MODEL_TABLE(const MODEL_TABLE& p);
public:
explicit MODEL_TABLE();
~MODEL_TABLE();
private: // override virtual
std::string dev_type()const {return "table";}
void precalc_first();
COMMON_COMPONENT* new_common()const {return new EVAL_BM_TABLE;}
CARD* clone()const {return new MODEL_TABLE(*this);}
bool use_obsolete_callback_print()const {return true;}
bool use_obsolete_callback_parse()const {return true;}
void print_args_obsolete_callback(OMSTREAM&,LANGUAGE*)const;
bool parse_params_obsolete_callback(CS&);
void tr_eval(COMPONENT*)const;
};
/*--------------------------------------------------------------------------*/
int const MODEL_TABLE::_default_order = 3;
double const MODEL_TABLE::_default_below = NOT_INPUT;
double const MODEL_TABLE::_default_above = NOT_INPUT;
/*--------------------------------------------------------------------------*/
static MODEL_TABLE p1;
static DISPATCHER::INSTALL
d1(&model_dispatcher, "table", &p1);
/*--------------------------------------------------------------------------*/
EVAL_BM_TABLE::EVAL_BM_TABLE(int c)
:EVAL_BM_ACTION_BASE(c)
{
}
/*--------------------------------------------------------------------------*/
EVAL_BM_TABLE::EVAL_BM_TABLE(const EVAL_BM_TABLE& p)
:EVAL_BM_ACTION_BASE(p)
{
}
/*--------------------------------------------------------------------------*/
bool EVAL_BM_TABLE::operator==(const COMMON_COMPONENT& x)const
{
const EVAL_BM_TABLE* p = dynamic_cast(&x);
bool rv = p && EVAL_BM_ACTION_BASE::operator==(x);
if (rv) {
untested();
}else{
}
return rv;
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_TABLE::print_common_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
o << modelname();
EVAL_BM_ACTION_BASE::print_common_obsolete_callback(o, lang);
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_TABLE::expand(const COMPONENT* d)
{
EVAL_BM_ACTION_BASE::expand(d);
attach_model(d);
const MODEL_TABLE* m = dynamic_cast(model());
if (!m) {untested();
throw Exception_Model_Type_Mismatch(d->long_label(), modelname(), "table");
}else{
}
}
/*--------------------------------------------------------------------------*/
void EVAL_BM_TABLE::tr_eval(ELEMENT* d)const
{
model()->tr_eval(d);
tr_final_adjust(&(d->_y[0]), d->f_is_value());
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
MODEL_TABLE::MODEL_TABLE()
:MODEL_CARD(NULL),
_order(_default_order),
_below(_default_below),
_above(_default_above),
_table(),
_spline(0)
{
}
/*--------------------------------------------------------------------------*/
MODEL_TABLE::MODEL_TABLE(const MODEL_TABLE& p)
:MODEL_CARD(p),
_order(p._order),
_below(p._below),
_above(p._above),
_table(p._table),
_spline(p._spline)
{
}
/*--------------------------------------------------------------------------*/
MODEL_TABLE::~MODEL_TABLE()
{
delete _spline;
}
/*--------------------------------------------------------------------------*/
bool MODEL_TABLE::parse_params_obsolete_callback(CS& cmd)
{
unsigned here1 = cmd.cursor();
{
Get(cmd, "order", &_order);
Get(cmd, "below", &_below);
Get(cmd, "above", &_above);
bool got_opening_paren = cmd.skip1b('(');
unsigned here = cmd.cursor();
for (;;) {
unsigned start_of_pair = here;
std::pair, PARAMETER > p;
cmd >> p.first; // key
if (cmd.stuck(&here)) {
break;
}else{
cmd >> p.second; // value
if (cmd.stuck(&here)) {
cmd.reset(start_of_pair);
break;
}else{
_table.push_back(p);
}
}
}
if (got_opening_paren && !cmd.skip1b(')')) {
untested();
cmd.warn(bWARNING, "need )");
}else if (!got_opening_paren && cmd.skip1b(')')) {
untested();
cmd.warn(bWARNING, here, "need (");
}
}
return !(cmd.stuck(&here1));
}
/*--------------------------------------------------------------------------*/
void MODEL_TABLE::print_args_obsolete_callback(OMSTREAM& o, LANGUAGE* lang)const
{
assert(lang);
print_pair(o, lang, "order", _order);
print_pair(o, lang, "below", _below, _below.has_hard_value());
print_pair(o, lang, "above", _above, _above.has_hard_value());
o << " (";
for (std::vector,PARAMETER > >::
const_iterator p = _table.begin(); p != _table.end(); ++p) {
o << p->first << ',' << p->second << ' ';
}
o << ')';
}
/*--------------------------------------------------------------------------*/
void MODEL_TABLE::precalc_first()
{
MODEL_CARD::precalc_first();
const CARD_LIST* par_scope = scope();
assert(par_scope);
_order.e_val(_default_order, par_scope);
_below.e_val(_default_below, par_scope);
_above.e_val(_default_above, par_scope);
{
double last = -BIGBIG;
for (std::vector,PARAMETER > >::
iterator p = _table.begin(); p != _table.end(); ++p) {
p->first.e_val(0, par_scope);
p->second.e_val(0, par_scope);
if (last > p->first) {
untested();
error(bWARNING, "%s: table is out of order: (%g, %g)\n",
long_label().c_str(), last, double(p->first));
}else{
//std::pair x(p->first, p->second);
//_num_table.push_back(x);
}
last = p->first;
}
}
delete _spline;
double below = _below.has_hard_value() ? _below : NOT_INPUT;
double above = _above.has_hard_value() ? _above : NOT_INPUT;
_spline = new SPLINE(_table, below, above, _order);
}
/*--------------------------------------------------------------------------*/
void MODEL_TABLE::tr_eval(COMPONENT* brh)const
{
ELEMENT* d = prechecked_cast(brh);
assert(d);
d->_y[0] = _spline->at(d->_y[0].x);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_clear.cc 0000664 0000000 0000000 00000004113 13165012111 0013706 0 ustar 00root root 0000000 0000000 /*$Id: c_clear.cc,v 26.81 2008/05/27 05:34:00 al Exp $ -*- C++ -*-
* Copyright (C) 2007 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* delete and clear commands
*/
//testing=script,complete 2006.07.16
#include "c_comand.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
/* cmd_clear: clear the whole circuit, including faults, etc
* equivalent to unfault; unkeep; delete all; title = (blank)
*/
class CMD_CLEAR : public CMD {
public:
void do_it(CS&, CARD_LIST* Scope)
{
command("unfault", Scope);
command("unmark", Scope);
//command("ic clear", Scope);
//command("nodeset clear", Scope);
command("alarm clear", Scope);
command("plot clear", Scope);
command("print clear", Scope);
command("delete all", Scope);
command("title '", Scope);
}
} p0;
DISPATCHER::INSTALL d0(&command_dispatcher, "clear", &p0);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_comand.cc 0000664 0000000 0000000 00000007704 13165012111 0014072 0 ustar 00root root 0000000 0000000 /*$Id: c_comand.cc,v 26.138 2013/04/24 02:44:30 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* simple commands and stubs for the missing commands
*/
//testing=script,sparse 2006.07.16
#include "constant.h"
#include "c_comand.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class CMD_END : public CMD {
public:
void do_it(CS&, CARD_LIST* Scope) {
switch (ENV::run_mode) {
case rPRE_MAIN: unreachable(); break;
case rPRESET: untested(); break; //BUG// this should close the file
case rINTERACTIVE:
itested();
command("quit", Scope);
break;
case rSCRIPT:
if (OPT::acct) {untested();
command("status", Scope);
}else{untested();
}
untested();
throw Exception("end");
break;
case rBATCH:
if (OPT::acct) {itested();
command("status", Scope);
}else{
}
command("quit", Scope);
break;
}
}
} p0;
DISPATCHER::INSTALL d0(&command_dispatcher, "end", &p0);
/*--------------------------------------------------------------------------*/
class CMD_PAUSE : public CMD {
public:
void do_it(CS&, CARD_LIST*) {untested();
//BUG// buffer problem
//BUG// redirection problem
IO::error << "Continue? ";
int ch = getchar();
if (ch=='n' || ch=='N' || ch=='C'-'@' || ch=='['-'@') {untested();
throw Exception("pause-stop");
}else{untested();
}
}
} p1;
DISPATCHER::INSTALL d1(&command_dispatcher, "pause", &p1);
/*--------------------------------------------------------------------------*/
class CMD_QUIT : public CMD {
public:
void do_it(CS&, CARD_LIST* Scope) {
switch (ENV::run_mode) {
case rPRE_MAIN: unreachable(); break;
case rINTERACTIVE:
case rSCRIPT:
case rBATCH: command("clear", Scope); exit(0); break;
case rPRESET: untested(); /*nothing*/ break;
}
}
} p2;
DISPATCHER::INSTALL d2(&command_dispatcher, "quit|exit", &p2);
/*--------------------------------------------------------------------------*/
class CMD_TEMP : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*) {itested();
double t = NOT_INPUT;
unsigned here = cmd.cursor();
cmd >> '=' >> t;
if (!cmd.stuck(&here)) {itested();
OPT::temp_c = t;
}else{itested();
IO::mstdout << ".temp = " << OPT::temp_c << '\n';
}
}
} p3;
DISPATCHER::INSTALL d3(&command_dispatcher, "temperature|temp", &p3);
/*--------------------------------------------------------------------------*/
class CMD_TITLE : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*) {
if (cmd.more()) {
head = cmd.tail();
}else{itested();
IO::mstdout << head << '\n';
}
}
} p4;
DISPATCHER::INSTALL d4(&command_dispatcher, "title", &p4);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_delete.cc 0000664 0000000 0000000 00000010277 13165012111 0014072 0 ustar 00root root 0000000 0000000 /*$Id: c_delete.cc 2016/09/17 $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* delete and clear commands
*/
//testing=script,complete 2006.07.16
//BUG// If someone deletes an element inside an instance of a subckt
// (like ".delete r1.x1", there is no error message, and the deleted
// element will reappear next time an elaboration occurs, which is
// usually before anything else.
#include "globals.h"
#include "e_cardlist.h"
#include "c_comand.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class CMD_DELETE : public CMD {
private:
bool delete_one_name(const std::string& name, CARD_LIST* Scope)const
{
assert(Scope);
std::string::size_type dotplace = name.find_first_of(".");
if (dotplace != std::string::npos) {
// has a dot, look deeper
// Split the name into two parts:
// "container" -- where to look (all following the dot)
// "dev_name" -- what to look for (all before the dot)
std::string dev_name = name.substr(dotplace+1, std::string::npos);
std::string container = name.substr(0, dotplace);
// container name must be exact match
CARD_LIST::iterator i = Scope->find_(container);
if (i == Scope->end()) {
// can't find "container" (probably .subckt) - no match
// try reverse
dotplace = name.find_last_of(".");
container = name.substr(dotplace+1, std::string::npos);
dev_name = name.substr(0, dotplace);
// container name must be exact match
i = Scope->find_(container);
}else{
}
if (i == Scope->end()) {
// can't find "container" (probably .subckt) - no match
return false;
}else if ((**i).is_device()) {
// found a match, but it isn't a container (subckt)
return false;
}else{
// found the container, look inside
return delete_one_name(dev_name, (**i).subckt());
}
unreachable();
}else{
// no dots, look here
if (name.find_first_of("*?") != std::string::npos) {
// there's a wild card. do linear search for all matches
bool didit = false;
{
CARD_LIST::iterator i = Scope->begin();
while (i != Scope->end()) {
CARD_LIST::iterator old_i = i++;
// ^^^^^^^^^^^^ move i past the item being deleted
if (wmatch((**old_i).short_label(), name)) {
Scope->erase(old_i);
didit = true;
}
}
}
return didit;
}else{
// no wild card. fast search for one exact match
CARD_LIST::iterator i = Scope->find_(name);
if (i != Scope->end()) {
Scope->erase(i);
return true;
}else{
return false;
}
}
unreachable();
}
unreachable();
return false;
}
//-----------------------------------
void do_it(CS& cmd, CARD_LIST* Scope)
{
if (cmd.umatch("all ")) {
CARD_LIST::card_list.erase_all();
}else{
while (cmd.more()) {
unsigned mark = cmd.cursor();
bool didit = delete_one_name(cmd.ctos(), Scope);
if (!didit) {
cmd.warn(bWARNING, mark, "no match");
}
}
}
}
} p1;
DISPATCHER::INSTALL d1(&command_dispatcher, "delete|rm", &p1);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_exp.cc 0000664 0000000 0000000 00000003405 13165012111 0013417 0 ustar 00root root 0000000 0000000 /*$Id: c_exp.cc,v 26.127 2009/11/09 16:06:11 al Exp $ -*- C++ -*-
* Copyright (C) 2007 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
*/
//testing=none
#include "globals.h"
#include "m_expression.h"
#include "c_comand.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class CMD_ : public CMD {
public:
void do_it(CS& cmd, CARD_LIST* Scope)
{
Expression e(cmd);
cmd.check(bDANGER, "syntax error");
Expression r(e, Scope);
std::cout << e << '=' << r << '\n';
}
} p0;
DISPATCHER::INSTALL d0(&command_dispatcher, "exp|eval", &p0);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_genrat.cc 0000664 0000000 0000000 00000010341 13165012111 0014100 0 ustar 00root root 0000000 0000000 /*$Id: c_genrat.cc 2015.01.08 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* set up generator for transient analysis
*/
//testing=script,complete 2015.01.08
//BUG// no step control
//BUG// encapsulation violation: gen() is global
#include "u_sim_data.h"
#include "globals.h"
#include "c_comand.h"
/*--------------------------------------------------------------------------*/
static double freq = 0;
static double ampl = 1;
static double phaz = 0.;
static double maxv = 1.;
static double minv = 0.;
static double offset = 0.;
static double init_ = 0.;
static double rise = 1e-12;
static double fall = 1e-12;
static double delay = 0.;
static double width = 0.;
static double period = 0.;
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class CMD_ : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
{
OMSTREAM where = (cmd.more()) ? OMSTREAM() : IO::mstdout;
unsigned here = cmd.cursor();
do{
ONE_OF
|| ::Get(cmd, "f{requency}",&freq, mPOSITIVE)
|| ::Get(cmd, "a{mplitude}",&l)
|| ::Get(cmd, "p{hase}", &phaz)
|| ::Get(cmd, "ma{x}", &maxv)
|| ::Get(cmd, "mi{n}", &minv)
|| ::Get(cmd, "o{ffset}", &offset)
|| ::Get(cmd, "i{nitial}", &init_)
|| ::Get(cmd, "r{ise}", &rise, mPOSITIVE)
|| ::Get(cmd, "f{all}", &fall, mPOSITIVE)
|| ::Get(cmd, "d{elay}", &delay, mPOSITIVE)
|| ::Get(cmd, "w{idth}", &width, mPOSITIVE)
|| ::Get(cmd, "pe{riod}", &period, mPOSITIVE)
;
}while (cmd.more() && !cmd.stuck(&here));
cmd.check(bWARNING, "what's this");
where.setfloatwidth(7);
where << "freq=" << freq;
where << " ampl=" << ampl;
where << " phase=" << phaz;
where << " max=" << maxv;
where << " min=" << minv;
where << " offset="<< offset;
where << " init=" << init_;
where << " rise=" << rise;
where << " fall=" << fall;
where << " delay=" << delay;
where << " width=" << width;
where << " period="<< period;
where << "\n";
}
} p;
DISPATCHER::INSTALL d(&command_dispatcher, "generator", &p);
}
/*--------------------------------------------------------------------------*/
double gen()
{
if (CKT_BASE::_sim->_time0 <= delay) {
return init_;
}else{
}
double loctime = CKT_BASE::_sim->_time0 - delay;
if (period > 0.) {
loctime = fmod(loctime, period);
}else{
// not periodic
}
double level;
if (CKT_BASE::_sim->_time0 <= delay + rise) { /* initial rise */
level = (maxv - 0) * (loctime/rise) + 0;
}else if (loctime <= rise) { /* rising */
level = (maxv - minv) * (loctime/rise) + minv;
}else if (width==0. || (loctime-=rise) <= width) { /* pulse on */
level = maxv;
}else if ((loctime-=width) <= fall) { /* falling */
level = (minv - maxv) * (loctime/fall) + maxv;
}else{ /* pulse off */
level = minv;
}
level *= (freq == 0.)
? ampl
: ampl * sin(M_TWO_PI * freq*(CKT_BASE::_sim->_time0-delay) + phaz * DTOR);
return (CKT_BASE::_sim->_time0 <= delay + rise)
? level + (offset - init_) * (loctime/rise) + init_
: level + offset;
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_help.cc 0000664 0000000 0000000 00000006374 13165012111 0013563 0 ustar 00root root 0000000 0000000 /*$Id: c_help.cc 2015/01/21 al $ -*- C++ -*-
* Copyright (C) 2014 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
*/
//testing=script,complete 2015.01.22
#include "l_dispatcher.h"
#include "c_comand.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
static DISPATCHER_BASE* dispatchers[] = {
&help_dispatcher,
&language_dispatcher,
&command_dispatcher,
&device_dispatcher,
&function_dispatcher,
&measure_dispatcher,
&model_dispatcher,
&bm_dispatcher,
&status_dispatcher,
&probe_dispatcher,
NULL };
// the order here determines the search order
/*--------------------------------------------------------------------------*/
class CMD_HELP : public CMD {
public:
void do_it(CS& Cmd, CARD_LIST*)
{
unsigned tail = Cmd.cursor();
std::string topic;
Cmd >> topic;
bool did_something = false;
unsigned here = Cmd.cursor();
for (DISPATCHER_BASE** ii = dispatchers; *ii; ++ii) {
CKT_BASE* object = (**ii)[topic];
if (object) {
did_something |= object->help(Cmd, IO::mstdout);
}else{
// nothing, it's ok
}
Cmd.reset(here);
}
if (!did_something) {
Cmd.warn(bWARNING, tail, "no help on topic " + Cmd.substr(tail));
}else{
}
}
std::string help_text()const
{
return
"help command\n"
"Provides help on a variety of topics\n"
"Syntax: help topic\n"
"In some cases, help on subtopics is available\n"
"Syntax: help topic subtopic\n"
"For a list of subtopics: help topic ?\n\n"
"@@subtopic\n"
"help subtopic\n"
"subtopics give you more detailed information\n\n"
"@@test\n"
"help test\n\n";//);
}
} p0;
DISPATCHER::INSTALL d0(&command_dispatcher, "help", &p0);
/*--------------------------------------------------------------------------*/
class HELP_ERROR_TEST : public CKT_BASE {
} p1;
DISPATCHER::INSTALL d1(&help_dispatcher, "help_error_test_with_no_help", &p1);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_list.cc 0000664 0000000 0000000 00000010017 13165012111 0013573 0 ustar 00root root 0000000 0000000 /*$Id: c_list.cc 2016/09/11 $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* list and save commands.
* save is list with direction to file
*/
//testing=script 2006.07.17
#include "e_cardlist.h"
#include "u_lang.h"
#include "c_comand.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
void list_save(CS& cmd, OMSTREAM out, CARD_LIST* scope)
{
CARD_LIST::card_list.precalc_first();
//out.setfloatwidth(7);
switch (ENV::run_mode) {
case rPRE_MAIN:
unreachable();
return;
case rPRESET:
/* do nothing */
return;
case rBATCH:
case rINTERACTIVE:
case rSCRIPT:
/* keep going */
break;
}
if (!OPT::language) {
throw Exception("no language");
}else{
}
(out - IO::mstdout) << head << '\n';
if (cmd.is_end()) { /* no args: list all */
for (CARD_LIST::const_iterator ci=scope->begin();ci!=scope->end();++ci) {
OPT::language->print_item(out, *ci);
}
}else{ /* some args: be selective */
unsigned arg1 = cmd.cursor();
CARD_LIST::fat_iterator ci = (cmd.match1('-'))
? CARD_LIST::fat_iterator(scope, scope->begin())
: findbranch(cmd, scope);
if (ci.is_end()) {itested();
throw Exception_CS("can't find", cmd);
}else{
}
if (cmd.match1('-')) { /* there is a dash: a range */
cmd.skip();
if (cmd.is_end()) { /* line ends with dash: all to end */
do {
OPT::language->print_item(out, *ci);
} while (++ci, !ci.is_end());
}else{
CARD_LIST::fat_iterator stop = ci;
stop = findbranch(cmd, ++stop);
if (stop.is_end()) {itested();
throw Exception_CS("can't find", cmd);
}else{
do {
OPT::language->print_item(out, *ci);
} while (ci++ != stop); // note subtle difference
}
}
}else{ /* no dash: a list */
do { /* each arg */
unsigned next = cmd.cursor();
do { /* all that match this arg */
OPT::language->print_item(out, *ci);
cmd.reset(arg1);
assert(!ci.is_end());
ci = findbranch(cmd, ++ci); // next match
} while (!ci.is_end());
cmd.reset(arg1 = next);
ci = findbranch(cmd, scope); // next arg
} while (!ci.is_end());
}
}
}
/*--------------------------------------------------------------------------*/
class CMD_LIST : public CMD {
public:
void do_it(CS& cmd, CARD_LIST* Scope)
{
list_save(cmd, IO::mstdout, Scope);
}
} p1;
DISPATCHER::INSTALL d1(&command_dispatcher, "list", &p1);
/*--------------------------------------------------------------------------*/
class CMD_SAVE : public CMD {
public:
void do_it(CS& cmd, CARD_LIST* Scope)
{itested();
cmd.reset(); /* back up to beginning of input line */
OMSTREAM out; // = IO::mstdout;
list_save(cmd, *outset(cmd,&out), Scope);
}
} p2;
DISPATCHER::INSTALL d2(&command_dispatcher, "save", &p2);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_measure.cc 0000664 0000000 0000000 00000004355 13165012111 0014271 0 ustar 00root root 0000000 0000000 /*$Id: c_measure.cc,v 26.113 2009/08/12 03:37:19 al Exp $ -*- C++ -*-
* Copyright (C) 2008 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
*/
//testing=none
#include "u_parameter.h"
#include "u_function.h"
#include "c_comand.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class CMD_MEASURE : public CMD {
public:
void do_it(CS& Cmd, CARD_LIST* Scope)
{
std::string assign_to, function;
Cmd >> assign_to >> '=' >> function >> '(';
if (FUNCTION* f = measure_dispatcher[function]) {
std::string value = f->eval(Cmd, Scope);
if (!Cmd.skip1b(')')) {
Cmd.warn(bWARNING, "need )");
}else{
}
OMSTREAM out = IO::mstdout;
outset(Cmd, &out);
out << assign_to << '=' << value << '\n';
PARAM_LIST* pl = Scope->params();
pl->set(assign_to, value);
}else{
throw Exception_No_Match(function);
}
}
} p0;
DISPATCHER::INSTALL d0(&command_dispatcher, "measure", &p0);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_modify.cc 0000664 0000000 0000000 00000012661 13165012111 0014116 0 ustar 00root root 0000000 0000000 /*$Id: c_modify.cc,v 26.137 2010/04/10 02:37:05 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
//testing=script,sparse 2006.07.17
#include "globals.h"
#include "e_elemnt.h"
#include "u_cardst.h"
#include "c_comand.h"
extern const int swp_type[];
extern const int swp_count[], swp_steps[];
extern const int swp_nest;
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
enum WHATTODO {FAULT, MODIFY};
std::list faultstack;
/*--------------------------------------------------------------------------*/
/* faultbranch: "fault" a single branch. (temporarily change a value)
* save the existing info in "faultlist", then patch
*/
void faultbranch(CARD* brh, double value)
{
if (!brh->is_device()) {
untested();
error(bWARNING, brh->long_label() + ": not a device, can't fault:\n");
}else if (brh->subckt()) {
untested();
error(bWARNING, brh->long_label() + " has subckt, can't fault:\n");
}else{
faultstack.push_back(CARDSTASH(brh));
ELEMENT* e = prechecked_cast(brh);
assert(e);
e->set_value(value, 0);
//BUG// messy way to do this, loses other attributes
}
}
/*--------------------------------------------------------------------------*/
/* sweep_fix: fix the value for sweep command.
* (find value by interpolation)
* if not sweeping, return "start" (the first arg).
*/
double sweep_fix(CS& cmd, const CARD *brh)
{
double start = cmd.ctof();
double value = start;
if (swp_steps[swp_nest] != 0 && cmd.is_float()) {
untested();
double last = cmd.ctof();
double offset = static_cast(swp_count[swp_nest])
/ static_cast(swp_steps[swp_nest]);
if (swp_type[swp_nest]=='L') {
untested();
if (start == 0.) {
untested();
throw Exception("log sweep can't pass zero");
value = 0;
}else{
untested();
value = start * pow( (last/start), offset );
}
}else{
untested();
value = start + (last-start) * offset;
}
IO::mstdout.setfloatwidth(7)
<< swp_count[swp_nest]+1 << "> sweep " << brh->long_label()
<< " =" << value << '\n';
}
return value;
}
/*--------------------------------------------------------------------------*/
void modify_fault(CS& cmd, WHATTODO command, CARD_LIST* scope)
{
CKT_BASE::_sim->uninit();
while (cmd.is_alpha()) {
unsigned mark = cmd.cursor();
unsigned cmax = cmd.cursor();
CARD_LIST::fat_iterator ci(scope, scope->begin());
for (;;) {
cmd.reset(mark);
ci = findbranch(cmd, ci);
cmax = std::max(cmax, cmd.cursor());
if (ci.is_end()) {
break;
}
cmd.skip1b('=');
CARD* brh = *ci;
switch (command) {
case MODIFY:{
ELEMENT* e = prechecked_cast(brh);
assert(e);
e->set_value(cmd.ctof(), 0);
//BUG// messy way to do this, loses other attributes
} break;
case FAULT:{
faultbranch(brh, sweep_fix(cmd,brh));
} break;
}
cmax = std::max(cmax, cmd.cursor());
++ci;
}
cmd.reset(cmax);
if (mark == cmax) {
untested();
cmd.check(bWARNING, "what's this?");
cmd.skiparg();
}
}
}
/*--------------------------------------------------------------------------*/
class CMD_MODIFY : public CMD {
public:
void do_it(CS& cmd, CARD_LIST* Scope)
{
modify_fault(cmd, MODIFY, Scope);
}
} p1;
DISPATCHER::INSTALL d1(&command_dispatcher, "modify|alter", &p1);
/*--------------------------------------------------------------------------*/
class CMD_FAULT : public CMD {
public:
void do_it(CS& cmd, CARD_LIST* Scope)
{
modify_fault(cmd, FAULT, Scope);
}
} p2;
DISPATCHER::INSTALL d2(&command_dispatcher, "fault", &p2);
/*--------------------------------------------------------------------------*/
class CMD_RESTORE : public CMD {
public:
void do_it(CS&, CARD_LIST* Scope)
{untested();
command("unfault", Scope);
command("unmark", Scope);
}
} p3;
DISPATCHER::INSTALL d3(&command_dispatcher, "restore", &p3);
/*--------------------------------------------------------------------------*/
class CMD_UNFAULT : public CMD {
public:
void do_it(CS&, CARD_LIST*)
{
while (!faultstack.empty()) {
faultstack.back().restore();
faultstack.pop_back();
}
_sim->uninit();
}
} p4;
DISPATCHER::INSTALL d4(&command_dispatcher, "unfault", &p4);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_param.cc 0000664 0000000 0000000 00000003532 13165012111 0013724 0 ustar 00root root 0000000 0000000 /*$Id: c_param.cc,v 26.130 2009/11/15 21:51:59 al Exp $ -*- C++ -*-
* Copyright (C) 2005 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
*/
//testing=script,complete 2006.07.17
#include "c_comand.h"
#include "u_parameter.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class CMD_PARAM : public CMD {
public:
void do_it(CS& cmd, CARD_LIST* Scope)
{
PARAM_LIST* pl = Scope->params();
if (cmd.is_end()) {
pl->print(IO::mstdout, OPT::language);
IO::mstdout << '\n';
}else{
pl->parse(cmd);
}
}
} p;
DISPATCHER::INSTALL d(&command_dispatcher, "param|parameters|parameter", &p);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_prbcmd.cc 0000664 0000000 0000000 00000012251 13165012111 0014071 0 ustar 00root root 0000000 0000000 /*$Id: c_prbcmd.cc,v 26.137 2010/04/10 02:37:05 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* probe and plot commands
* set up print and plot (select points, maintain probe lists)
* command line operations
*/
//testing=script,sparse 2006.07.17
#include "u_sim_data.h"
#include "c_comand.h"
#include "u_prblst.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
void do_probe(CS& cmd, PROBELIST *probes)
{
assert(probes);
CKT_BASE::_sim->set_command_none();
enum {aADD, aDELETE, aNEW} action;
SIM_MODE simtype = s_NONE;
if (cmd.match1('-')) {untested(); /* handle .probe - ac ...... */
action = aDELETE; /* etc. */
cmd.skip();
}else if (cmd.match1('+')) {untested();
action = aADD;
cmd.skip();
}else{ /* no -/+ means clear, but wait for */
action = aNEW; /* .probe ac + ..... */
} /* which will not clear first */
ONE_OF
|| Set(cmd, "tr{ansient}", &simtype, s_TRAN)
|| Set(cmd, "ac", &simtype, s_AC)
|| Set(cmd, "dc", &simtype, s_DC)
|| Set(cmd, "op", &simtype, s_OP)
|| Set(cmd, "fo{urier}", &simtype, s_FOURIER)
;
if (!simtype) { /* must be all simtypes */
if (cmd.is_end()) { /* list all */
probes[s_TRAN].listing("tran");
probes[s_AC].listing("ac");
probes[s_DC].listing("dc");
probes[s_OP].listing("op");
probes[s_FOURIER].listing("fourier");
}else if (cmd.umatch("clear ")) { /* clear all */
for (int ii = sSTART; ii < sCOUNT; ++ii) {
probes[ii].clear();
}
}else{itested(); /* error */
throw Exception_CS("what's this?", cmd);
}
}else{
if (cmd.is_end()) {untested(); /* list */
probes[simtype].listing("");
}else if (cmd.umatch("clear ")) {untested();/* clear */
probes[simtype].clear();
}else{ /* add/remove */
CKT_BASE::_sim->init();
if (cmd.match1('-')) {itested(); /* setup cases like: */
action = aDELETE; /* .probe ac + .... */
cmd.skip();
}else if (cmd.match1('+')) {
action = aADD;
cmd.skip();
}else{
}
if (action == aNEW) { /* no +/- here or at beg. */
probes[simtype].clear(); /* means clear first */
action = aADD;
}else{
}
while (cmd.more()) { /* do-it */
if (cmd.match1('-')) { /* handle cases like: */
action = aDELETE; /* .pr ac +v(7) -e(6) +r(8) */
cmd.skip();
}else if (cmd.match1('+')) {itested();
action = aADD;
cmd.skip();
}else{
}
if (action == aDELETE) {
probes[simtype].remove_list(cmd);
}else{
probes[simtype].add_list(cmd);
}
}
}
}
}
/*--------------------------------------------------------------------------*/
class CMD_STORE : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
{
assert(_probe_lists);
assert(_probe_lists->store);
do_probe(cmd,_probe_lists->store);
}
} p0;
DISPATCHER::INSTALL d0(&command_dispatcher, "store", &p0);
/*--------------------------------------------------------------------------*/
class CMD_ALARM : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
{
assert(_probe_lists);
assert(_probe_lists->alarm);
do_probe(cmd,_probe_lists->alarm);
}
} p1;
DISPATCHER::INSTALL d1(&command_dispatcher, "alarm", &p1);
/*--------------------------------------------------------------------------*/
class CMD_PLOT : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
{
IO::plotset = true;
assert(_probe_lists);
assert(_probe_lists->plot);
do_probe(cmd,_probe_lists->plot);
}
} p2;
DISPATCHER::INSTALL d2(&command_dispatcher, "iplot|plot", &p2);
/*--------------------------------------------------------------------------*/
class CMD_PRINT : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
{
IO::plotset = false;
assert(_probe_lists);
assert(_probe_lists->print);
do_probe(cmd,_probe_lists->print);
}
} p3;
DISPATCHER::INSTALL d3(&command_dispatcher, "iprint|print|probe", &p3);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_sim.cc 0000664 0000000 0000000 00000004000 13165012111 0013403 0 ustar 00root root 0000000 0000000 /*$Id: c_sim.cc,v 26.133 2009/11/26 04:58:04 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* command interface functions associated with the SIM base class
*/
//testing=script 2006.07.17
#include "u_sim_data.h"
#include "c_comand.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class CMD_MARK : public CMD {
public:
void do_it(CS&, CARD_LIST*)
{itested();
_sim->_freezetime = true;
}
} p6;
DISPATCHER::INSTALL d6(&command_dispatcher, "mark|freeze", &p6);
/*--------------------------------------------------------------------------*/
class CMD_UNMARK : public CMD {
public:
void do_it(CS&, CARD_LIST*)
{
_sim->_freezetime = false;
}
} p7;
DISPATCHER::INSTALL d7(&command_dispatcher, "unmark|unfreeze", &p7);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_status.cc 0000664 0000000 0000000 00000006673 13165012111 0014160 0 ustar 00root root 0000000 0000000 /*$Id: c_status.cc,v 26.133 2009/11/26 04:58:04 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* Displays the status of the system. Makes all the calculations associated
* with allocating memory but does not actually allocate it, unless necessary
* to make the rest of the calculations.
*
* If "allocate" is changed, this must also be changed.
*/
//testing=script 2006.07.17
#include "u_sim_data.h"
#include "u_status.h"
#include "c_comand.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class CMD_STATUS : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
{
IO::mstdout << "Gnucap System status\n";
if (!cmd.umatch("n{otime} ")) {
::status.compute_overhead();
IO::mstdout
<< "command ------ last -- total\n"
<< ::status.get
<< ::status.op
<< ::status.dc
<< ::status.tran
<< ::status.four
<< ::status.ac
<< "function ----- last -- total\n"
<< ::status.set_up
<< ::status.order
<< "function ----- last -- total\n"
<< ::status.advance
<< ::status.queue
<< ::status.evaluate
<< ::status.load
<< ::status.lud
<< ::status.back
<< ::status.review
<< ::status.accept
<< ::status.output
<< ::status.overhead;
if (OPT::showall) {itested();
IO::mstdout
<< ::status.aux1
<< ::status.aux2
<< ::status.aux3;
}
IO::mstdout << ::status.total;
}
IO::mstdout
<< "iterations: op=" << _sim->_iter[s_OP]
<< ", dc=" << _sim->_iter[s_DC]
<< ", tran=" << _sim->_iter[s_TRAN]
<< ", fourier=" << _sim->_iter[s_FOURIER]
<< ", total=" << _sim->_iter[iTOTAL]
<< "\n";
for(DISPATCHER::const_iterator
i = status_dispatcher.begin();
i != status_dispatcher.end();
++i) {
CKT_BASE* c = i->second;
if (c) {
IO::mstdout << c->status();
}else{
}
}
IO::mstdout
<< "nodes: user=" << _sim->_user_nodes
<< ", subckt=" << _sim->_subckt_nodes
<< ", model=" << _sim->_model_nodes
<< ", total=" << _sim->_total_nodes
<< "\n";
IO::mstdout.form("dctran density=%.1f%%, ac density=%.1f%%\n",
_sim->_aa.density()*100., _sim->_acx.density()*100.);
}
} p;
DISPATCHER::INSTALL d(&command_dispatcher, "status", &p);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_sweep.cc 0000664 0000000 0000000 00000010526 13165012111 0013750 0 ustar 00root root 0000000 0000000 /*$Id: c_sweep.cc,v 26.83 2008/06/05 04:46:59 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* Step a parameter and repeat a group of commands
*/
//testing=none 2006.07.17
#include "c_comand.h"
#include "globals.h"
extern int swp_count[], swp_steps[];
extern int swp_type[];
extern int swp_nest;
/*--------------------------------------------------------------------------*/
namespace {
static std::string tempfile = STEPFILE;
/*--------------------------------------------------------------------------*/
static void setup(CS& cmd)
{
for (;;) {
if (cmd.is_digit()) {
swp_steps[swp_nest] = cmd.ctoi() ;
swp_steps[swp_nest] = (swp_steps[swp_nest])
? swp_steps[swp_nest]-1
: 0;
}else if (cmd.umatch("li{near} ")) {
swp_type[swp_nest] = 0;
}else if (cmd.umatch("lo{g} ")) {
swp_type[swp_nest] = 'L';
}else{
break;
}
}
}
/*--------------------------------------------------------------------------*/
static void buildfile(CS& cmd)
{
static FILE *fptr;
setup(cmd);
if (fptr) {
fclose(fptr);
}else{
}
fptr = fopen(tempfile.c_str(), "w");
if (!fptr) {
throw Exception_File_Open("can't open temporary file:" + tempfile);
}else{
}
fprintf(fptr, "%s\n", cmd.fullstring().c_str());
for (;;) {
char buffer[BUFLEN];
getcmd(">>>", buffer, BUFLEN);
if (Umatch(buffer,"go ")) {
break;
}else{
}
fprintf(fptr, "%s\n", buffer);
}
fclose(fptr);
fptr = NULL;
}
/*--------------------------------------------------------------------------*/
static void doit(CARD_LIST* scope)
{
static FILE *fptr;
for (swp_count[swp_nest]=0; swp_count[swp_nest]<=swp_steps[swp_nest];
++swp_count[swp_nest]) {
if (fptr) {
fclose(fptr);
}else{
}
fptr = fopen(tempfile.c_str(), "r");
if (!fptr) {
throw Exception_File_Open("can't open " + tempfile);
}else{
}
char buffer[BUFLEN];
fgets(buffer,BUFLEN,fptr);
{
CS cmd(CS::_STRING, buffer); //fgets from local file, obsolete
if (cmd.umatch("sw{eep} ")) {
setup(cmd);
}else{
throw Exception("bad file format: " + tempfile);
}
unsigned ind = cmd.cursor();
strncpy(buffer, "fault ", ind);
buffer[ind-1] = ' '; /* make sure there is a delimiter */
} /* in case the words run together */
for (;;) { /* may wipe out one letter of fault */
{
CS cmd(CS::_STRING, buffer); //fgets from local file, obsolete
CMD::cmdproc(cmd, scope);
}
if (!fgets(buffer,BUFLEN,fptr)) {
break;
}else{
}
{
CS cmd(CS::_STRING, buffer); //fgets from local file, obsolete
if (cmd.umatch("sw{eep} ")) {
cmd.warn(bDANGER, "command not allowed in sweep");
buffer[0] = '\'';
}else{
}
}
IO::mstdout << swp_count[swp_nest]+1 << "> " << buffer;
}
}
fclose(fptr);
fptr = NULL;
swp_count[swp_nest] = 0;
}
/*--------------------------------------------------------------------------*/
class CMD_SWEEP : public CMD {
public:
void do_it(CS& cmd, CARD_LIST* Scope)
{
if (cmd.more()) {
buildfile(cmd);
}else{
}
doit(Scope);
command("unfault", Scope);
}
} p;
DISPATCHER::INSTALL d(&command_dispatcher, "sweep", &p);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/c_system.cc 0000664 0000000 0000000 00000006114 13165012111 0014147 0 ustar 00root root 0000000 0000000 /*$Id: c_system.cc,v 26.83 2008/06/05 04:46:59 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* system calls: change directory, invoke another program, invoke editor, etc.
*/
//testing=none 2006.07.17
#include "c_comand.h"
#include "globals.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
/* cmd_edit: (command) invoke user defined editor on the netlist
* if command has an argument, it edits that file instead
* else actually edits a temporary file, and reads it back.
*/
class CMD_EDIT : public CMD {
public:
void do_it(CS& cmd, CARD_LIST* Scope)
{itested();
std::string editor(OS::getenv("EDITOR"));
if (editor == "") {
throw Exception("no editor defined\n"
"You need to set the EDITOR environment variable.");
}else{
if (cmd.more()) {itested();
OS::system(editor + ' ' + cmd.tail());
}else{
std::string temp_file("/tmp/gnucap" + to_string(unsigned(time(NULL))));
command("save " + temp_file + " quiet", Scope);
OS::system(editor + ' ' + temp_file);
command("get " + temp_file + " quiet", Scope);
OS::remove(temp_file);
}
}
}
} p1;
DISPATCHER::INSTALL d1(&command_dispatcher, "edit", &p1);
/*--------------------------------------------------------------------------*/
class CMD_SYSTEM : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
{itested();
if (cmd.more()) {itested();
OS::system(cmd.tail());
}else{
OS::system(SHELL);
}
}
} p2;
DISPATCHER::INSTALL d2(&command_dispatcher, "system|!", &p2);
/*--------------------------------------------------------------------------*/
class CMD_CHDIR : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
{itested();
if (cmd.more()) {
OS::chdir(cmd.ctos(""));
}else{
}
IO::mstdout << OS::getcwd() << '\n';
}
} p3;
DISPATCHER::INSTALL d3(&command_dispatcher, "chdir|cd", &p3);
/*--------------------------------------------------------------------------*/
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/configure 0000775 0000000 0000000 00000003347 13165012111 0013726 0 ustar 00root root 0000000 0000000 #!/bin/sh
# configure for library (shared object)
mkdir -p O
#------------- Stuff added to enable --prefix --------------
if test "x$1" != "x"; then
# echo Found input parameter -- $1
# Now see if the parameter is --prefix=
if test "x${1#--prefix=}" != "x$1"; then
# echo "Found --prefix in input args. Setting prefix directory."
prefix=${1#--prefix=}
else
# echo "Found unrecognized parameter in input args."
# Just use the default prefix dir.
prefix=/usr/local
fi
else
# echo "No input parameter found."
# Just use the default prefix dir
prefix=/usr/local
fi
sed -e "s#/usr/local#$prefix#" ../Makefile.template > Makefile
#----------------------------------------------------------------
echo "CCFLAGS = -fPIC \\" >Make.ccflags
echo "-DUNIX -O2 -DNDEBUG -I. -I../include -I../../include -W" >>Make.ccflags
echo "LIBS = \\" >Make.libs
echo "" >>Make.libs
echo "PREFIX = " $prefix >>Make.libs
echo "" >>Make.libs
cat <Make.sys
#------------------------------------------------------------------------
VPATH = .:..
CCC = c++
TARGET_EXT = .so
LDFLAGS = -shared
.SUFFIXES:
.SUFFIXES: .o .cc
.cc.o:; \$(CCC) \$(CXXFLAGS) \$(CPPFLAGS) \$(CCFLAGS) -c \$<
#------------------------------------------------------------------------
\$(TARGET)\$(TARGET_EXT): \$(TARGET_DEPENDS)
rm -f \$@
\$(CCC) \$(CXXFLAGS) \$(CPPFLAGS) \$(CCFLAGS) \$(OBJS) \$(LIBS) \$(LDFLAGS) -o \$@
#------------------------------------------------------------------------
CAT_EOF
echo \# created by $PWD/$0. do not edit >Make2
echo \#------------------------------------------------------------------------ >>Make2
cat Make.ccflags Make.libs Make.sys >>Make2
rm Make.ccflags Make.libs Make.sys
exit 0
apps/d_admit.cc 0000664 0000000 0000000 00000014076 13165012111 0013730 0 ustar 00root root 0000000 0000000 /*$Id: d_admit.cc,v 26.138 2013/04/24 02:44:30 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* admittance devices:
* self-admittance (old Y device)
* y.x = volts, y.f0 = amps, ev = y.f1 = mhos.
* m.x = volts, m.c0 = amps, acg = m.c1 = mhos.
* trans-admittance (VCCS, G device)
* voltage controlled admittance
* y.x = volts(control), y.f0 = mhos, ev = y.f1 = mhos/volt
* m.x = volts(control), m.c0 = 0, acg = m.c1 = mhos
* _loss0 == 1/R. (mhos)
*/
//testing=script 2006.07.17
#include "globals.h"
#include "e_elemnt.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class DEV_ADMITTANCE : public ELEMENT {
protected:
explicit DEV_ADMITTANCE(const DEV_ADMITTANCE& p) :ELEMENT(p) {}
public:
explicit DEV_ADMITTANCE() :ELEMENT() {}
protected: // override virtual
char id_letter()const {return 'Y';}
std::string value_name()const {return "g";}
std::string dev_type()const {return "admittance";}
int max_nodes()const {return 2;}
int min_nodes()const {return 2;}
int matrix_nodes()const {return 2;}
int net_nodes()const {return 2;}
bool has_iv_probe()const {return true;}
bool use_obsolete_callback_parse()const {return true;}
CARD* clone()const {return new DEV_ADMITTANCE(*this);}
void precalc_last();
void tr_iwant_matrix() {tr_iwant_matrix_passive();}
void tr_begin();
bool do_tr();
void tr_load() {tr_load_passive();}
void tr_unload() {tr_unload_passive();}
double tr_involts()const {return tr_outvolts();}
double tr_involts_limited()const {return tr_outvolts_limited();}
void ac_iwant_matrix() {ac_iwant_matrix_passive();}
void ac_begin() {_acg = _ev = _y[0].f1;}
void do_ac();
void ac_load() {ac_load_passive();}
COMPLEX ac_involts()const {untested();return ac_outvolts();}
std::string port_name(int i)const {
assert(i >= 0);
assert(i < 2);
static std::string names[] = {"p", "n"};
return names[i];
}
};
/*--------------------------------------------------------------------------*/
class DEV_VCCS : public DEV_ADMITTANCE {
protected:
explicit DEV_VCCS(const DEV_VCCS& p) :DEV_ADMITTANCE(p) {}
public:
explicit DEV_VCCS() :DEV_ADMITTANCE() {}
protected: // override virtual
char id_letter()const {return 'G';}
std::string value_name()const {return "gm";}
std::string dev_type()const {return "vccs";}
int max_nodes()const {return 4;}
int min_nodes()const {return 4;}
int matrix_nodes()const {return 4;}
int net_nodes()const {return 4;}
bool has_iv_probe()const {return false;}
CARD* clone()const {return new DEV_VCCS(*this);}
void tr_iwant_matrix() {tr_iwant_matrix_active();}
void tr_load() {tr_load_active();}
void tr_unload() {untested();tr_unload_active();}
double tr_involts()const {return dn_diff(_n[IN1].v0(), _n[IN2].v0());}
double tr_involts_limited()const {return volts_limited(_n[IN1],_n[IN2]);}
void ac_iwant_matrix() {ac_iwant_matrix_active();}
void ac_load() {ac_load_active();}
COMPLEX ac_involts()const {untested();return _n[IN1]->vac() - _n[IN2]->vac();}
std::string port_name(int i)const {
assert(i >= 0);
assert(i < 4);
static std::string names[] = {"sink", "src", "ps", "ns"};
return names[i];
}
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
void DEV_ADMITTANCE::precalc_last()
{
ELEMENT::precalc_last();
set_constant(!has_tr_eval());
set_converged(!has_tr_eval());
}
/*--------------------------------------------------------------------------*/
void DEV_ADMITTANCE::tr_begin()
{
ELEMENT::tr_begin();
_m0.x = _y[0].x;
_m0.c1 = _y[0].f1;
_m0.c0 = 0.;
_m1 = _m0;
assert(_loss0 == 0.);
assert(_loss1 == 0.);
}
/*--------------------------------------------------------------------------*/
bool DEV_ADMITTANCE::do_tr()
{
if (using_tr_eval()) {
_y[0].x = _m0.x = tr_involts_limited();
_y[0].f0 = _m0.c1 * _m0.x + _m0.c0; //BUG// patch for diode
tr_eval();
assert(_y[0].f0 != LINEAR);
store_values();
q_load();
_m0 = CPOLY1(_y[0]);
}else{
assert(_y[0].f0 == LINEAR);
assert(_y[0].f1 == value());
assert(_m0.c1 == _y[0].f1);
assert(_m0.c0 == 0.);
assert(_y1 == _y[0]);
assert(converged());
}
return converged();
}
/*--------------------------------------------------------------------------*/
void DEV_ADMITTANCE::do_ac()
{
if (using_ac_eval()) {itested();
ac_eval();
_acg = _ev;
}else{
assert(_ev == _y[0].f1);
assert(has_tr_eval() || _ev == double(value()));
}
assert(_acg == _ev);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
DEV_ADMITTANCE p1;
DEV_VCCS p2;
DISPATCHER::INSTALL
d1(&device_dispatcher, "Y|admittance", &p1),
d2(&device_dispatcher, "G|vccs", &p2);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// vim:ts=8:sw=2:noet:
apps/d_bjt.model 0000664 0000000 0000000 00000063037 13165012111 0014125 0 ustar 00root root 0000000 0000000 /* $Id: d_bjt.model 2014/11/23 al$ -*- C++ -*-
* Copyright (C) 2002 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* Berkeley BJT model
* Derived from Spice code, both from 2g6 and 3f4
* Recoded for Gnucap model compiler, Al Davis, 2002
*------------------------------------------------------------------
* data structures and defaults for bjt model.
*
* netlist syntax:
* device: qxxxx c b e s mname
* model: .model mname NPN
* or .model mname PNP
*
* known BUGs
* 1. excess phase partially implemented, disabled, as if PTF == 0.
*/
/*--------------------------------------------------------------------------*/
h_headers {
#include "d_diode.h"
}
cc_headers {
#include "u_limit.h"
}
/*--------------------------------------------------------------------------*/
device BUILT_IN_BJT {
parse_name bjt;
model_type BUILT_IN_BJT;
id_letter Q;
circuit {
sync;
ports {c b e} {s short_to=e};
local_nodes {
ic short_to=c short_if="!OPT::rstray || m->rc == 0.";
ib short_to=b
short_if="!OPT::rstray || (m->rb == 0. && m->rbm == 0.)";
ie short_to=e short_if="!OPT::rstray || m->re == 0.";
}
// basics
cpoly_g Ice {ic,ie ib,ie} state=ccexxx; // cce, go, gm
cpoly_g Ipi {ib ie} state=cpixxx; // cpi, gpi
cpoly_g Imu {ib ic} state=cmuxxx; // cmu, gmu
// junction charge effects
fpoly_cap Cbx {b ic} state=qbx; // qbx, cqbx
fpoly_cap Cbc {ib ic} state=qbc; // qbc, cqbc
fpoly_cap Ccs {s ic} state=qcs // qcs, cqcs
omit="!(_n[n_s].n_())";
fpoly_cap Cbe {ib ie ib ic} state=qbe; // qbe, cqbe, geqbc
// parasitics
resistor Rc {c ic} value="m->rc / c->area"
omit="!OPT::rstray || m->rc == 0."; // gcpr
resistor Re {e ie} value="m->re / c->area"
omit="!OPT::rstray || m->re == 0."; // gepr
cpoly_g Yb {b ib} state=ixxxx // gx. should be "eval"
omit="!OPT::rstray || (m->rb == 0. && m->rbm == 0.)";
capacitor Cbcp {b c} value="m->cbcp * c->area"
omit="!OPT::cstray || m->cbcp == 0.";
capacitor Cbep {b e} value="m->cbep * c->area"
omit="!OPT::cstray || m->cbep == 0.";
capacitor Cbs {b s} value="(m->cbsp + m->ccsp) * c->area"
omit="!OPT::cstray || ((m->cbsp + m->ccsp) == 0.)";
}
tr_probe {
v = "@n_c[V] - @n_e[V]";
"vbei{nt}" = "vbe";
"vbci{nt}" = "vbc";
"vbxi{nt}" = "vbx";
"vcsi{nt}" = "vcs";
vbs = "@n_b[V] - @n_s[V]";
vbe = "@n_b[V] - @n_e[V]";
vbc = "@n_b[V] - @n_c[V]";
vbx = "@n_b[V] - @n_ib[V]";
vcs = "@n_c[V] - @n_s[V]";
vcb = "@n_c[V] - @n_b[V]";
vce = "@n_c[V] - @n_e[V]";
ves = "@n_e[V] - @n_s[V]";
veb = "@n_e[V] - @n_b[V]";
vec = "@n_e[V] - @n_c[V]";
vb = "@n_b[V]";
vc = "@n_c[V]";
ve = "@n_e[V]";
vs = "@n_s[V]";
vbi = "@n_ib[V]";
vci = "@n_ic[V]";
vei = "@n_ie[V]";
"i" = "cce";
"ice" = "cce";
"iceo{ffset}" = "ccexxx";
hoe = "go";
"ro{e}" = "(go != 0.) ? 1/go : BIGBIG";
ipi = "cpi";
"ipio{ffset}" = "cpixxx";
rpi = "(gpi != 0.) ? 1/gpi : BIGBIG";
hie = "(gpi != 0.) ? 1/gpi : BIGBIG";
imu = "cmu";
"imuo{ffset}" = "cmuxxx";
rmu = "(gmu != 0.) ? 1/gmu : BIGBIG";
ib = "cpi + cmu";
rx = "(gx != NA) ? 1/gx : 0.";
ic = "cce - cmu";
ie = "-cce -cpi";
cbx = "cqbx";
cbc = "cqbc";
cmu = "cqbc";
ccs = "cqcs";
cbe = "cqbe";
cpi = "cqbe";
p = "@Ice[P] + @Ipi[P] + @Imu[P] + @Rc[P] + @Re[P] + @Yb[P]
+ @Cbx[P] + @Cbc[P] + @Ccs[P] + @Cbe[P]";
pd = "@Ice[PD] + @Ipi[PD] + @Imu[PD] + @Rc[PD] + @Re[PD] + @Yb[PD]
+ @Cbx[PD] + @Cbc[PD] + @Ccs[PD] + @Cbe[PD]";
ps = "@Ice[PS] + @Ipi[PS] + @Imu[PS] + @Rc[PS] + @Re[PS] + @Yb[PS]
+ @Cbx[PS] + @Cbc[PS] + @Ccs[PS] + @Cbe[PS]";
status = "static_cast(converged() * 2)";
}
device {
calculated_parameters {
double vbe "B-E voltage"; // gather
double vbc "B-C voltage";
double vbx "B-C voltage (ext base)";
double vcs "C-S voltage";
double cce "collector-emitter current";
double ccexxx;
double go "Small signal output conductance";
double gm "Small signal transconductance";
double cpi "emitter-base current";
double cpixxx;
double gpi "Small signal input conductance - pi";
double cmu "collector-base current";
double cmuxxx;
double gmu "Small signal conductance - mu";
double ixxxx "Current offset at base node, constant" default=0.;
double gx "dix/dvbb Conductance from base to internal base";
double qbx "Charge storage B-X junction";
double cqbx "Cap. due to charge storage in B-X jct."; // cbx, capbx
double qbc "Charge storage B-C junction";
double cqbc "Cap. due to charge storage in B-C jct."; // cmu, capbc
double qcs "Charge storage C-S junction";
double cqcs "Cap. due to charge storage in C-S jct."; // ccs, capcs
double qbe "Charge storage B-E junction";
double cqbe "Cap. due to charge storage in B-E jct."; // cpi, capbe
double geqcb "d(Ieb)/d(Vcb)";
double cexbc_0 "Total Capacitance in B-X junction"; // ??
double cexbc_1 "";
double cexbc_2 "";
double _dt_0 "time step";
double _dt_1 "";
}
}
common {
unnamed area;
raw_parameters {
double area "area factor" name=Area positive default=1.;
bool off "device initially off" name=OFF default=false print_test=off;
double icvbe "Initial B-E voltage" name="ICVBE" default=NA;
double icvce "Initial C-E voltage" name="ICVCE" default=NA;
double temp_c "instance temperature" name="TEMP" default=NA;
}
calculated_parameters {
double oik "" calculate="m->invrollofff / c->area";
double oikr "" calculate="m->invrolloffr / c->area";
}
}
tr_eval {
int foo=3;
}
}
/*--------------------------------------------------------------------------*/
model BUILT_IN_BJT {
level 1;
dev_type BUILT_IN_BJT;
hide_base;
inherit BUILT_IN_DIODE;
public_keys {
npn polarity=pN;
pnp polarity=pP;
npn1 polarity=pN;
pnp1 polarity=pP;
}
independent {
override {
double kf "Flicker Noise Coefficient" name=KF default=0.;
double af "Flicker Noise Exponent" name=AF default=1.;
}
raw_parameters {
int level "dummy" name=LEVEL default=1 print_test=false;
// basic
double bf "Ideal forward beta" name=BF alt_name=BFM default=100.;
double br "Ideal reverse beta" name=BR alt_name=BRM default=1.;
double ibc "bc Saturation Current"
name=IBC default=NA print_test="ibe != ibc"
final_default="((has_hard_value(i_s)) ? i_s : 1e-16)";
double ibe "be Saturation Current"
name=IBE default=NA print_test="ibe != ibc"
final_default="((has_hard_value(i_s)) ? i_s : 1e-16)";
double i_s "Saturation Current"
name=IS default=NA print_test="ibe == ibc"
final_default="((ibe == ibc) ? ibe : NA)";
//double iss "bulk to collector or base sat current (ignored)"
//name=ISS default=0;
//double expli "current explosion factor (ignored)"
//name=EXPLI default=1e15;
double nf "Forward emission coefficient" name=NF default=1.;
double nr "Reverse emission coefficient" name=NR default=1.;
//double ns "substrate leakage emission coefficient (ignored)"
//name=NS default=1;
//int subs "geometry, +1=vertical, -1=lateral (ignored)", name=SUBS
//default="(polarity==pP) ? -1 : 1";
// base width modulation
double vaf "Forward Early voltage" name=VAf alt_name=VA\0VBF default=NA;
double var "Reverse Early voltage" name=VAR alt_name=VB default=NA;
// low current beta degeneration
double isc "B-C leakage saturation current"
name=ISC default=NA final_default="(c4*ibc)";
double c4 "obsolete, don't use" name=C4 alt_name=JLC default=0.;
double nc "B-C leakage emission coefficient" name=NC default=2.;
double ise "B-E leakage saturation current"
name=ISE default=NA final_default="(c2*ibe)";
double c2 "obsolete, don't use" name=C2 alt_name=JLE default=0.;
double ne "B-E leakage emission coefficient" name=NE default=1.5;
// high current beta degeneration
double ikf "Forward beta roll-off corner current"
name=IKf alt_name=IK\0JBF default=NA;
double ikr "reverse beta roll-off corner current"
name=IKR alt_name=JBR default=NA;
// parasitic resistance
double irb "Current for base resistance=(rb+rbm)/2"
name=IRB alt_name=JRB\0IOB default=NA;
double rb "Zero bias base resistance" name=RB default=0.;
double rbm "Minimum base resistance"
name=RBM default=NA final_default=rb;
double re "Emitter resistance" name=RE default=0.;
double rc "Collector resistance" name=RC default=0.;
// parasitic capacitance
double cbcp "external BC capacitance"
name=CBCP print_test="cbcp!=0." default=0.;
double cbep "external BE capacitance"
name=CBEP print_test="cbep!=0." default=0.;
double cbsp "external BS capacitance (lateral)"
name=CBSP print_test="cbsp!=0." default=0.;
double ccsp "external BS capacitance (vertical)"
name=CCSP print_test="ccsp!=0." default=0.;
// junction capacitance
double cjc "Zero bias B-C depletion capacitance" name=CJC default=0.;
double cje "Zero bias B-E depletion capacitance" name=CJE default=0.;
double cjs "Zero bias C-S capacitance"
name=CJS alt_name=CCS\0CSUB default=0.;
double fc "Forward bias junction fit parameter"
name=FC default=NA final_default=.5 quiet_max=.9999;
double mjc "B-C junction grading coefficient"
name=MJC alt_name=MC\0MJ default=.33;
double mje "B-E junction grading coefficient"
name=MJE alt_name=ME default=.33;
double mjs "Substrate junction grading coefficient"
name=MJS alt_name=MSub\0MS\0ESUB default=0.; // alt name ESUB??
double vjc "B-C built in potential" name=VJC alt_name=PC default=.75;
double vje "B-E built in potential" name=VJE alt_name=PE default=.75;
double vjs "Substrate junction built in potential"
name=VJS alt_name=PSub\0PS default=.75;
double xcjc "Fraction of B-C cap to internal base"
name=XCJC alt_name=CDIS default=1.;
// transit time
double itf "High current dependence of TF"
name=ITF alt_name=JTF default=0.;
double ptf "Excess phase" name=PTf default=0.;
double tf "Ideal forward transit time" name=TF default=0.;
double tr "Ideal reverse transit time" name=TR default=0.;
double vtf "Voltage giving VBC dependence of TF" name=VTF default=NA;
double xtf "Coefficient for bias dependence of TF" name=XTF default=0.;
// temperature effects
double xtb "Forward and reverse beta temp. exp."
name=XTB alt_name=TB default=0.; // alt name TCB
double xti "Temp. exponent for IS" name=XTI default=3.;
double eg "Energy gap for IS temp. dependency" name=EG default=1.11;
}
calculated_parameters {
double tnom_k "nominal temperature, kelvin"
calculate="_tnom_c + P_CELSIUS0";
polarity_t polarity "" default=pN;
double invearlyvoltf "Inverse early voltage:forward" name=INVEARLYVOLTF
calculate="(has_nz_value(vaf)) ? 1./vaf : 0.";
double invearlyvoltr "Inverse early voltage:reverse" name=INVEARLYVOLTR
calculate="(has_nz_value(var)) ? 1./var : 0.";
double invrollofff "Inverse roll off - forward" name=INVROLLOFFF
calculate="(has_nz_value(ikf)) ? 1./ikf : 0.";
double invrolloffr "Inverse roll off - reverse" name=INVROLLOFFR
calculate="(has_nz_value(ikr)) ? 1./ikr : 0.";
double transtimevbcfact "Transit time VBC factor" name=TRANSTIMEVBCFACT
calculate="(has_nz_value(vtf)) ? 1./(vtf*1.44) : 0.";
double excessphasefactor "Excess phase fact." name=EXCESSPHASEFACTOR
calculate="(ptf * DTOR) * tf";
double xfc "" calculate="log(1 - fc)";
double f2 "" calculate="exp((1 + mje) * xfc)";
double f3 "" calculate="1 - fc * (1 + mje)";
double f6 "" calculate="exp((1 + mjc) * xfc)";
double f7 "" calculate="1 - fc * (1 + mjc)";
}
}
temperature_dependent {
calculated_parameters {
double vt "";
//double is "BJTtSatCur" calculate = "m->is * factor";
double ibc "BJTtSatCur" calculate = "m->ibc * factor";
double ibe "BJTtSatCur" calculate = "m->ibe * factor";
double BetaF "BJTtBetaF" calculate = "m->bf * bfactor";
double BetaR "BJTtBetaR" calculate = "m->br * bfactor";
double BEleakCur "BJTtBEleakCur"
calculate = "m->ise * exp(factlog/m->ne) / bfactor";
double BCleakCur "BJTtBCleakCur"
calculate = "m->isc * exp(factlog/m->nc) / bfactor";
double BEpot "BJTtBEpot";
double BEcap "BJTtBEcap";
double DepCap "";
double f1 "";
double BCpot "BJTtBCpot";
double BCcap "BJTtBCcap";
double f4 "";
double f5 "";
double Vcrit "" calculate="vt * log(vt / (M_SQRT2 * m->ibe))";
}
code_pre {
const double reftemp = 300.15;
double temp_k =
((has_hard_value(c->temp_c)) ? c->temp_c : d->_sim->_temp_c) + P_CELSIUS0;
double fact1 = m->tnom_k / reftemp;
double fact2 = temp_k / reftemp;
double tempratio = temp_k / m->tnom_k; // fact2/fact1
double kt = temp_k * P_K;
vt = temp_k * P_K_Q;
double egap = 1.16 - (7.02e-4*temp_k*temp_k) / (temp_k+1108.); // egfet
// double arg = (m->eg*tempratio - egap) / (2*kt);
double arg = -egap/(2 * kt) + 1.1150877 / (P_K * (reftemp+reftemp));
double pbfact = -2 * vt * (1.5 * log(fact2) + P_Q * arg);
double ratlog = log(tempratio);
double ratio1 = tempratio - 1;
double factlog = ratio1 * m->eg / vt + m->xti * ratlog;
double factor = exp(factlog);
double bfactor = exp(ratlog * m->xtb);
}
code_post {
{
double pbo = (m->vje - pbfact) / fact1;
BEpot = fact2 * pbo + pbfact;
double gmaold = (m->vje - pbo) / pbo;
double gmanew = (BEpot - pbo) / pbo;
BEcap = (m->cje / (1 + m->mje * (4e-4*(m->tnom_k-reftemp)-gmaold)))
* (1 + m->mje * (4e-4*(temp_k-reftemp)-gmanew));
DepCap = m->fc * BEpot;
f1 = BEpot * (1 - exp((1 - m->mje) * m->xfc)) / (1 - m->mje);
}
{
double pbo = (m->vjc - pbfact) / fact1;
BCpot = fact2 * pbo + pbfact;
double gmaold = (m->vjc - pbo) / pbo;
double gmanew = (BCpot - pbo) / pbo;
BCcap = (m->cjc / (1 + m->mjc
* (4e-4*(m->tnom_k-reftemp)-gmaold)))
* (1 + m->mjc * (4e-4*(temp_k-reftemp)-gmanew));
f4 = m->fc * BCpot;
f5 = BCpot * (1 - exp((1 - m->mjc) * m->xfc)) / (1 - m->mjc);
}
}
}
tr_eval {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
trace0("--------------------------");
trace0(d->long_label().c_str());
trace4("", d->vbe, d->vbc, d->vbx, d->vcs);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
double cbe, gbe;
{ // d->cpi, d->gpi, d->cpixxx
// uses: d->vbe
double cben, gben;
double vtn = t->vt * m->nf;
double csat = t->ibe * c->area;
double C2 = t->BEleakCur * c->area;
if (d->vbe > -5 * vtn) {
double evbe = exp(d->vbe / vtn);
cbe = csat * (evbe-1) + OPT::gmin * d->vbe;
gbe = csat * evbe/vtn + OPT::gmin;
if (C2 == 0.) {
cben = 0.;
gben = 0.;
}else{
double vte = m->ne * t->vt;
double evben = exp(d->vbe / vte);
cben = C2 * (evben-1);
gben = C2 * evben/vte;
}
trace4("vbe on", cbe, gbe, cben, gben);
}else{
gbe = -csat/d->vbe + OPT::gmin;
cbe = gbe * d->vbe;
gben = -C2 / d->vbe;
cben = gben * d->vbe;
trace4("vbe off", cbe, gbe, cben, gben);
}
d->cpi = cbe / t->BetaF + cben;
d->gpi = gbe / t->BetaF + gben;
d->cpixxx = d->cpi - d->vbe * d->gpi;
trace3("", t->BetaF, d->cpi, d->gpi);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
double cbc, gbc, cbcn;
{ // d->cmu, d->gmu, d->cmuxxx
// uses: d->vbc
double gbcn;
double vtn = t->vt * m->nr;
double csat = t->ibc * c->area;
double C4 = t->BCleakCur * c->area;
if (d->vbc > -5 * vtn) {
double evbc = exp(d->vbc / vtn);
cbc = csat * (evbc-1) + OPT::gmin * d->vbc;
gbc = csat * evbc/vtn + OPT::gmin;
if (C4 == 0.) {
cbcn = 0.;
gbcn = 0.;
}else{
double vtc = m->nc * t->vt;
double evbcn = exp(d->vbc / vtc);
cbcn = C4 * (evbcn-1);
gbcn = C4 * evbcn/vtc;
}
trace4("vbc on", cbc, gbc, cbcn, gbcn);
}else{
gbc = -csat/d->vbc + OPT::gmin;
cbc = gbc * d->vbc;
gbcn = -C4 / d->vbc;
cbcn = gbcn * d->vbc;
trace4("vbc off", cbc, gbc, cbcn, gbcn);
}
d->cmu = cbc / t->BetaR + cbcn;
d->gmu = gbc / t->BetaR + gbcn;
d->cmuxxx = d->cmu - d->vbc * d->gmu;
trace3("", t->BetaR, d->cmu, d->gmu);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// determine base charge terms
double qb, dqbdve, dqbdvc;
{
double q1 = 1 / (1 - m->invearlyvoltf*d->vbc - m->invearlyvoltr*d->vbe);
if(c->oik == 0. && c->oikr == 0.) {
qb = q1;
dqbdve = q1 * qb * m->invearlyvoltr;
dqbdvc = q1 * qb * m->invearlyvoltf;
trace4("!oik", q1, qb, dqbdve, dqbdvc);
}else{
double q2 = c->oik * cbe + c->oikr * cbc;
double arg = std::max(0., 1+4*q2);
double sqarg = (arg == 0.) ? 1 : sqrt(arg);
qb = q1 * (1+sqarg) / 2;
dqbdve = q1 * (qb * m->invearlyvoltr + c->oik * gbe / sqarg);
dqbdvc = q1 * (qb * m->invearlyvoltf + c->oikr * gbc / sqarg);
trace2("", c->oik, c->oikr);
trace4("oik", q1, qb, dqbdve, dqbdvc);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// weil's approx. for excess phase applied with backward-euler integration
{
double cc = 0.;
double cex = cbe;
double gex = gbe;
if (0 && m->excessphasefactor != 0.) {
unreachable();
incomplete(); // doesn't save old values of cexbc, so disabled
double arg1 = d->_dt_0 / m->excessphasefactor;
double arg2 = 3 * arg1;
arg1 *= arg2;
double denom = 1 + arg1 + arg2;
double arg3 = arg1 / denom;
if (_sim->is_initial_step()) {
d->cexbc_2 = d->cexbc_1 = cbe / qb;
}else{
}
cc = (d->cexbc_1 * (1 + d->_dt_0/d->_dt_1 + arg2)
- d->cexbc_2 * d->_dt_0/d->_dt_1) / denom;
cex *= arg3;
gex *= arg3;
}
d->cexbc_0 = cc + cex / qb;
d->cce = cc + (cex-cbc)/qb - cbc/t->BetaR - cbcn;
d->go = (gbc + (cex-cbc)*dqbdvc / qb) / qb;
d->gm = (gex - (cex-cbc)*dqbdve / qb) / qb - d->go;
d->ccexxx = d->cce - ((d->vbe - d->vbc) * d->go + d->vbe * d->gm);
trace4("", d->cce, d->go, d->gm, d->cce/t->vt);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// d->gx
// should be moved to a private eval
// may use d->cpi, d->cmu, qb
{
if (!OPT::rstray || (!has_nz_value(m->rb) && !has_nz_value(m->rbm))) {
trace3("", m->rb, m->irb, d->gx);
assert(d->gx == NA);
}else{
double rx = NA;
double rbpr = m->rbm / c->area;
double rbpi = m->rb / c->area - rbpr;
if (has_nz_value(m->irb)) {itested();//554
// base resistance lowering at high current
double cb = d->cpi + d->cmu;
double xjrb = m->irb * c->area;
double arg1 = std::max(cb/xjrb, 1e-9);
double arg2 = (-1 + sqrt(1+14.59025*arg1)) / 2.4317 / sqrt(arg1);
arg1 = tan(arg2);
rx = rbpr + 3 * rbpi * (arg1-arg2) / arg2 / arg1 / arg1;
}else{
rx = rbpr + rbpi / qb;
}
trace3("", m->rb, m->irb, rx);
assert(rx != NA);
assert(rx != 0.);
d->gx = 1 / rx;
trace1("", d->gx);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const bool charge_computation_needed = OPT::cstray;
if (charge_computation_needed) {
if (has_nz_value(m->tf) && d->vbe > 0.) {
double argtf = NA;
double arg2 = NA;
double arg3 = NA;
if (has_nz_value(m->xtf)) {itested();//579
if (m->transtimevbcfact != 0.) {
argtf = m->xtf * exp(d->vbc * m->transtimevbcfact);
}else{untested();
argtf = m->xtf;
}
arg2 = argtf;
if(has_nz_value(m->itf)) {
double temp = cbe / (cbe + m->itf * c->area);
argtf *= temp*temp;
arg2 *= (3-temp-temp);
}else{
}
arg3 = cbe * argtf * m->transtimevbcfact;
}else{
arg3 = arg2 = argtf = 0.;
}
assert(argtf != NA);
assert(arg2 != NA);
assert(arg3 != NA);
cbe *= (1+argtf) / qb;
gbe = (gbe * (1+arg2) - cbe * dqbdve) / qb;
d->geqcb=m->tf*(arg3-cbe*dqbdvc)/qb;
}else{
d->geqcb=0.;
}
{ // d->qbe, d->cqbe
// uses: d->vbe, cbe, gbe
double czbe = t->BEcap * c->area;
if (d->vbe < t->DepCap) {
double arg = 1 - d->vbe / t->BEpot;
double sarg = pow(arg, -m->mje);
d->qbe = m->tf * cbe + t->BEpot * czbe * (1-arg*sarg) / (1 - m->mje);
d->cqbe = m->tf * gbe + czbe * sarg;
}else{
double czbef2 = czbe / m->f2;
d->qbe = m->tf * cbe + czbe * t->f1
+ czbef2 * (m->f3 * (d->vbe - t->DepCap)
+ (m->mje / (2. * t->BEpot))
* (d->vbe * d->vbe - t->DepCap * t->DepCap));
d->cqbe = m->tf * gbe + czbef2 * (m->f3 + m->mje*d->vbe / t->BEpot);
}
}
{ // d->qbc, d->cqbc
// uses: d->vbc, cbc, gbc
double czbc = t->BCcap * c->area * m->xcjc;
if (d->vbc < t->f4) {
double arg = 1 - d->vbc / t->BCpot;
double sarg = pow(arg, -m->mjc);
d->qbc = m->tr *cbc + t->BCpot *czbc * (1 - arg*sarg) / (1 - m->mjc);
d->cqbc = m->tr * gbc + czbc * sarg;
}else{
double czbcf2 = czbc / m->f6;
d->qbc = m->tr * cbc + czbc * t->f5
+ czbcf2 * (m->f7 * (d->vbc-t->f4)
+ (m->mjc/(t->BCpot+t->BCpot)) * (d->vbc*d->vbc-t->f4*t->f4));
d->cqbc = m->tr * gbc + czbcf2 * (m->f7 + m->mjc * d->vbc/t->BCpot);
}
}
{ // d->qbx, d->cqbx
// uses: d->vbx
double czbx = t->BCcap * c->area * (1 - m->xcjc);
if (d->vbx < t->f4) {
double arg = 1 - d->vbx / t->BCpot;
double sarg = pow(arg, -m->mjc);
d->qbx = t->BCpot * czbx * (1 - arg*sarg) / (1 - m->mjc);
d->cqbx = czbx * sarg;
}else{
double czbxf2 = czbx / m->f6;
d->qbx = czbx * t->f5 + czbxf2
* (m->f7 * (d->vbx-t->f4)
+ (m->mjc / (t->BCpot+t->BCpot)) * (d->vbx*d->vbx-t->f4*t->f4));
d->cqbx = czbxf2 * (m->f7 + m->mjc * d->vbx / t->BCpot);
}
}
{ // d->qcs, d->cqcs
// uses: d->vcs
double czcs = m->cjs * c->area;
if (d->vcs < 0.) {
double arg = 1 - d->vcs / m->vjs;
double sarg = pow(arg, -m->mjs);
d->qcs = m->vjs * czcs * (1 - arg*sarg) / (1 - m->mjs);
d->cqcs = czcs * sarg;
}else{
d->qcs = d->vcs * czcs * (1 + m->mjs * d->vcs / (2 * m->vjs));
d->cqcs = czcs * (1 + m->mjs * d->vcs / m->vjs);
}
}
}
}
}
/*--------------------------------------------------------------------------*/
cc_direct {
/*--------------------------------------------------------------------------*/
bool DEV_BUILT_IN_BJT::tr_needs_eval()const
{
if (is_q_for_eval()) {
untested();
return false;
}else if (!converged()) {
return true;
}else{
const COMMON_BUILT_IN_BJT* c = prechecked_cast(common());
assert(c);
const MODEL_BUILT_IN_BJT* m=prechecked_cast(c->model());
assert(m);
polarity_t polarity = m->polarity;
return !(conchk(vbc, polarity*(_n[n_ib].v0()-_n[n_ic].v0()),
OPT::vntol)
&& conchk(vbe, polarity*(_n[n_ib].v0()-_n[n_ie].v0()),
OPT::vntol)
&& conchk(vcs, polarity*(_n[n_ic].v0()-_n[n_s].v0()),
OPT::vntol));
}
}
/*--------------------------------------------------------------------------*/
bool DEV_BUILT_IN_BJT::do_tr()
{
const COMMON_BUILT_IN_BJT* c = prechecked_cast(common());
assert(c);
const MODEL_BUILT_IN_BJT* m = prechecked_cast(c->model());
assert(m);
const TDP_BUILT_IN_BJT T(this);
const TDP_BUILT_IN_BJT* t = &T;
if(_sim->is_initial_step()) { // initial guess
if (c->off) {
vbe = 0.;
}else{
double vt = (_sim->_temp_c + P_CELSIUS0) * P_K_Q;
vbe = vt * log(vt / (M_SQRT2 * m->ibe));
}
vbc = 0.;
/* ERROR: need to initialize VCS, VBX here */
vcs = vbx = 0.;
}else{ // normal gather
vbe = pnj_limit((m->polarity * volts_limited(_n[n_ib], _n[n_ie])),
vbe, t->vt, t->Vcrit);
vbc = pnj_limit((m->polarity * volts_limited(_n[n_ib], _n[n_ic])),
vbc, t->vt, t->Vcrit);
vbx = m->polarity * volts_limited(_n[n_b], _n[n_ic]);
vcs = m->polarity * volts_limited(_n[n_s], _n[n_ic]);
}
if (_sim->uic_now()) {itested();//736
if (has_good_value(c->icvbe)) {untested();//737
vbe = m->polarity * c->icvbe;
}else{itested();//739
}
if (has_good_value(c->icvce)) {untested();//741
vbc = vbe - m->polarity * c->icvce;
vbx = vbc;
}else{itested();//744
}
}else{
}
m->tr_eval(this);
switch (m->polarity) {
case pP:
cce = -cce;
ccexxx = -ccexxx;
cpi = -cpi;
cpixxx = -cpixxx;
cmu = -cmu;
cmuxxx = -cmuxxx;
assert(ixxxx == 0.);
qbx = -qbx;
qbc = -qbc;
qcs = -qcs;
qbe = -qbe;
break;
case pN:
// leave it as is
break;
}
assert(subckt());
set_converged(subckt()->do_tr());
return converged();
}
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
apps/d_cap.cc 0000664 0000000 0000000 00000017671 13165012111 0013401 0 ustar 00root root 0000000 0000000 /*$Id: d_cap.cc,v 26.137 2010/04/10 02:37:05 al Exp $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis
*
* This file is part of "Gnucap", the Gnu Circuit Analysis Package
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*------------------------------------------------------------------
* capacitance devices:
* self-capacitance (C device)
* trans-capacitance (non-spice charge transfer device)
*------------------------------------------------------------------
* capacitor models
* y.x = volts, y.f0 = coulombs, ev = y.f1 = farads
* q = y history in time
* i.x = volts, i.f0 = amps, i.f1 = mhos
* m.x = volts, m.c0 = amps, acg = m.c1 = mhos
*/
//testing=script 2006.07.17
#include "globals.h"
#include "e_storag.h"
/*--------------------------------------------------------------------------*/
namespace {
/*--------------------------------------------------------------------------*/
class DEV_CAPACITANCE : public STORAGE {
protected:
explicit DEV_CAPACITANCE(const DEV_CAPACITANCE& p) :STORAGE(p) {}
public:
explicit DEV_CAPACITANCE() :STORAGE() {}
protected: // override virtual
char id_letter()const {return 'C';}
std::string value_name()const {return "c";}
std::string dev_type()const {return "capacitor";}
int max_nodes()const {return 2;}
int min_nodes()const {return 2;}
int matrix_nodes()const {return 2;}
int net_nodes()const {return 2;}
bool has_iv_probe()const {return true;}
bool use_obsolete_callback_parse()const {return true;}
CARD* clone()const {return new DEV_CAPACITANCE(*this);}
void tr_iwant_matrix() {tr_iwant_matrix_passive();}
bool do_tr();
void tr_load() {tr_load_passive();}
void tr_unload() {tr_unload_passive();}
double tr_involts()const {return tr_outvolts();}
double tr_involts_limited()const {return tr_outvolts_limited();}
double tr_probe_num(const std::string&)const;
void ac_iwant_matrix() {ac_iwant_matrix_passive();}
void ac_begin() {_ev = _y[0].f1;}
void do_ac();
void ac_load() {ac_load_passive();}
COMPLEX ac_involts()const {itested();return ac_outvolts();}
std::string port_name(int i)const {
assert(i >= 0);
assert(i < 2);
static std::string names[] = {"p", "n"};
return names[i];
}
};
/*--------------------------------------------------------------------------*/
class DEV_TRANSCAP : public DEV_CAPACITANCE {
private:
explicit DEV_TRANSCAP(const DEV_TRANSCAP& p) :DEV_CAPACITANCE(p){}
public:
explicit DEV_TRANSCAP() :DEV_CAPACITANCE() {}
private: // override virtual
char id_letter()const {untested();return '\0';}
std::string value_name()const {untested(); return "c";}
std::string dev_type()const {return "tcap";}
int max_nodes()const {return 4;}
int min_nodes()const {return 4;}
int matrix_nodes()const {return 4;}
int net_nodes()const {return 4;}
bool has_iv_probe()const {untested(); return false;}
bool f_is_value()const {untested();return true;}
CARD* clone()const {return new DEV_TRANSCAP(*this);}
void tr_iwant_matrix() {tr_iwant_matrix_active();}
void tr_load() {tr_load_active();}
double tr_involts()const {return dn_diff(_n[IN1].v0(),_n[IN2].v0());}
double tr_involts_limited()const {return volts_limited(_n[IN1],_n[IN2]);}
void ac_iwant_matrix() {ac_iwant_matrix_active();}
void ac_load() {untested(); ac_load_active();}
std::string port_name(int i)const {untested();
assert(i >= 0);
assert(i < 4);
static std::string names[] = {"p", "n", "ps", "ns"};
return names[i];
}
};
/*--------------------------------------------------------------------------*/
//BUG// doesn't model dynamic effects of control.
class DEV_VCCAP : public DEV_CAPACITANCE {
private:
explicit DEV_VCCAP(const DEV_VCCAP& p) :DEV_CAPACITANCE(p) {}
public:
explicit DEV_VCCAP() :DEV_CAPACITANCE() {}
private: // override virtual
char id_letter()const {untested();return '\0';}
std::string value_name()const {untested(); return "c";}
std::string dev_type()const {return "vccap";}
int max_nodes()const {return 4;}
int min_nodes()const {return 4;}
int matrix_nodes()const {return 4;}
int net_nodes()const {return 4;}
bool has_iv_probe()const {untested(); return false;}
bool f_is_value()const {untested();return true;}
CARD* clone()const {return new DEV_VCCAP(*this);}
void tr_iwant_matrix() {tr_iwant_matrix_extended();}
bool do_tr();
double tr_involts()const {return dn_diff(_n[IN1].v0(),_n[IN2].v0());}
double tr_involts_limited()const {return volts_limited(_n[IN1],_n[IN2]);}
void ac_iwant_matrix() {ac_iwant_matrix_extended();}
std::string port_name(int i)const {untested();
assert(i >= 0);
assert(i < 4);
static std::string names[] = {"p", "n", "ps", "ns"};
return names[i];
}
};
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
bool DEV_CAPACITANCE::do_tr()
{
if (using_tr_eval()) {
_y[0].x = tr_input_limited();
tr_eval();
}else{
_y[0].x = tr_input(); // tr_involts();
assert(_y[0].f1 == value());
_y[0].f0 = _y[0].x * _y[0].f1;
assert(converged());
}
store_values();
q_load();
trace3("q", _y[0].x, _y[0].f0, _y[0].f1);
_i[0] = differentiate(_y, _i, _time, _method_a);
trace3("i", _i[0].x, _i[0].f0, _i[0].f1);
_m0 = CPOLY1(_i[0]);
return converged();
}
/*--------------------------------------------------------------------------*/
void DEV_CAPACITANCE::do_ac()
{
if (using_ac_eval()) {
ac_eval();
}else{
assert(_ev == _y[0].f1);
assert(has_tr_eval() || _ev == double(value()));
}
_acg = _ev * _sim->_jomega;
}
/*--------------------------------------------------------------------------*/
double DEV_CAPACITANCE::tr_probe_num(const std::string& x)const
{
if (Umatch(x, "q{cap} |ch{arge} ")) {
return _y[0].f0;
}else if (Umatch(x, "c{apacitance} ")) {
return _y[0].f1;
}else if (Umatch(x, "dcdt ")) {untested();
return (_y[0].f1 - _y[1].f1) / _dt;
}else if (Umatch(x, "dc ")) {untested();
return (_y[0].f1 - _y[1].f1);
}else if (Umatch(x, "dqdt ")) {
return (_y[0].f0 - _y[1].f0) / _dt;
}else if (Umatch(x, "dq ")) {
return (_y[0].f0 - _y[1].f0);
}else{
return STORAGE::tr_probe_num(x);
}
}
/*--------------------------------------------------------------------------*/
bool DEV_VCCAP::do_tr()
{
_y[0].x = tr_input_limited();
tr_eval();
store_values();
q_load();
_y[0].x = tr_outvolts();
_y[0].f1 = _y[0].f0; // self capacitance
_y[0].f0 = _y[0].x * _y[0].f1; // charge
_i[0] = differentiate(_y, _i, _time, _method_a);
_m0.x = _i[0].x;
_m0.c1 = _i[0].f1;
_m0.c0 = _i[0].f0 - _i[0].x * _i[0].f1;
return converged();
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
DEV_CAPACITANCE p1;
DEV_TRANSCAP p2;
DEV_VCCAP p3;
DISPATCHER