Simulation Models in EDWinXP
|
EDWinXP is equipped with two different simulation engines. First, we
have Mixed-Mode simulator that has been developed by Visionics.
The other is EDSpice simulator based on Berkeley SPICE3 with a number
of extensions and improvements. Both allow analysis of circuits containing digital and analog
elements. Similar for both simulators is that they are operated through Schematic Diagram Editor.
This part of EDWinXP has a dual purpose. Its basic functions allow capturing electronic circuits
in graphical form. Additional feature are provided for selecting simulation engine, setting up
circuit for simulation, starting analysis and finally presenting results in the form of waveforms
or textually. Functionality of circuit elements can be achieved only when they have simulation
model attached to them. System Library supplied with EDWinXP contains hundreds of models specific
for each simulator engine. They are not interchangeable due to different nature of both simulators.
You cannot use Spice so called "code models" with Visionics native Mixed-mode simulators and vice versa,
but in most case we provide equivalents. |
| Various forms of modeling |
Simulation models have various forms depending on simulator engine. Models for basic analog circuit elements like resistors, capacitors, diodes or transistors are inbuilt in SPICE3 and subsequently in EDSpice simulation engine. Digital parts are simulated in EDSpice with help of code models. These are small programs that simulation engine executes when analysis is in progress. Functionality of particular commercially sold electronic parts may also be simulated using sub-circuit in SPICE format that are provided by manufactures. Visionics has adapted hundreds of them for use with EDSpice and included them in libraries supplied with the package. Visionics' Mixed-mode simulator relies solely on code models. They vary much in complexity – from simple digital gates to sophisticated
emulator models for microcontrollers with inbuilt program code editors, compilers and debuggers.
These latter have no equivalents in EDSpice because such sophistication is impossible to implement
in SPICE3 code models. Nevertheless, the general software principle of code models is for both
simulators the same. They are so called DLLs (dynamic link libraries in Windows operating systems),
coded in C programming language.
|
| Link between library parts and models |
Code models and most of SPICE sub-circuits supplied with EDWinXP are already linked to their respective parts in the System Library and ready for use. Existing models may be also assigned to the new parts created by the users. This operation is usually done while symbol representing a part on the schematic diagram is created (Library Editor).
The relevant model is selected from the list and assigned to the symbol. At this point,
it is also necessary to assign functions to the pins in the symbol (we call them “entries”).
Those pin functions (entry simulation names like “input”, “output”,“clock” etc ) are stored
within the models and displayed in the list. From there, they can be picked up and assigned.
Once the model is assigned to a symbol – every part using this symbol may be simulated.
For example, parts like 7400 and 74LS00 use the same gate symbol and model. User has to set
only different model parameters when preparing circuit for simulation. In some instances,
it may be useful to assign simulation model individually to a circuit element (component) on the
schematic diagram. This assignment will apply only to component in the project and there is a
feature in Schematic Diagram Editor to do so in similar fashion as it is done in Library Editor.
|
| Issue of models availability |
Visionics constantly adds new models to the library and new entries are available either through Live Update or through new releases of EDWinXP. However, we will never be able to cover million types of electronic parts manufactured today. For this reason, EDWinXP has been equipped with tools allowing user to create required code models himself. |
| Adding SPICE sub-circuits |
The easiest way to extend repertoire of parts simulated by EDSpice is to add new sub-circuits provided by manufactures. These are usually supplied as plain ASCII text file containing SPICE format net list. This is a common format used to describe functionality of commercially available
analog parts. There is a function in EDWinXP (Sub-circuit Adapter) allowing adapting such
sub-circuits for inclusion in EDSpice Sub-Circuit Library. Adaptation means that specially
formatted comments that are necessary for future recognition of the sub-circuit and proper
assignment to symbols or components are inserted at the beginning of the net list.
Another method is to create a schematic diagram of a part, simulate it to ensure that
it works and store as a sub-circuit in the library. Once this is done, the sub-circuit
may be linked to a part symbol and reused in projects. In both cases, the linking
is the same and is equivalent of assigning code models. The only difference here is that
instead of executing software module during analysis, the sub-circuit is attached to SPICE
net list generated by Schematic Editor and then parsed by simulation engine before simulation. |
| Code models |
Code models are used to
simulate digital circuit elements in EDSpice and both digital and analog elements in Mixed-mode simulator.
There is no provision for library sub-circuits for Mixed-model even though it may simulate hierarchical
circuits when sub-circuits are defined in the project database. There are various methods for
creating code models. The text of the program has to be coded according to certain rules and then
compiled and debugged. This task requires knowledge about electronic part modeling and programming
skills in C language. For creating EDSpice code models, Visionics provides special package EDComX
that allows preparing correctly structured source code of the model (also in C language).
User interested in creating models for Mixed-Mode simulator may obtain a kit containing basic code modules and software
templates as well as code samples of complete models. | | Schematic net list and digital code models
|
Schematic diagrams captured
in EDWinXP may be exported to ASCII text file in net list format. Such file contains list of
components on the diagram with library names of corresponding parts and list of connections
between nodes in the circuit.The exported net list may be converted to functionally equivalent
code model, providing that ALL parts used in a circuit were taken from special purpose library
“VHDL-GATE.PART”. The principle here is similar to adding sub-circuits to EDSpice library.
Functionality of complicated digital parts may be captured as a schematic diagram of a circuit
consisting of basic logic gates, latches, buffers and flip-flops (found in “VHDL-GATE.PART” library).
Proper functioning of the circuit may be checked through simulation. When it works, its net list
may be subsequently turned into code model. There is no need to draw schematics – this is
just one of the options. Digital function may be described in form of truth table or in VHDL.
Schematic editor allows either to convert the truth table or VHDL code into schematic diagram,
or directly into code model DLL. |
| Analog code models in Mixed-Mode simulator |
As already stated, library sub-circuits in textual form cannot be used with Mixed-Mode simulator.
To solve this problem we have recently included a new function in Schematic Editor called
“Assign analog function”. This feature allows conversion of selected SPICE format sub-circuit into a
code model and attaching it to a component in edited diagram. Only un-nested sub-circuits consisting
of basic elements supported by Mixed-Mode simulator are allowed.
| | “Instrumental” code model for Mixed-Mode simulator |
Our emulator models for microcontrollers are in fact complete development environments
for designing circuits that these devices are employed. This environment is seamlessly integrated with EDWinXP. Once the circuit is created in Schematic Diagram Editor, the user can edit the code of the program either in C programming language or in assembler and compile it. The logic of the program may be the tested and debugged during simulation of the whole circuit. The main advantage of this approach is that testing of the control program is done dynamically with all other circuitry sending / receiving signals to/from the controller in real time. Therefore, while the controller program is running, it is possible to record states of any node in the circuit on the oscilloscope and examine contents of memory and registers.
The program in controller has to react for asynchronous events happening in environment
– key strokes on the keyboard, strings of data sent from outside or hardware interrupts.
This kind of event may be simulated by introducing on the diagram special components that
work like laboratory instruments - “serial pattern generator”, “parallel pattern generator”
or “interrupt”. Each these components has code model and they are considered by simulation
engine as part of the circuit. In difference to normal code models, the functioning of
“instrumental” models may be controlled by user while the simulation is in progress.
For example, user may click on button “interrupt” that appears on the screen while simulation
starts in order to check how microcontroller reacts to hardware interrupts or cause a string of
characters to be sent asynchronously to controller parallel port. |
| |