The Complete Electronics Lab
  • Analog,Digital,Mixed,RF simulation
  • Spice,HDL and S-parameter models
  • VHDL,Verilog,Verilog-A & AMS
  • MCU simulation in mixed circuits
  • Monte-Carlo,Worst Case & Stress Analysis
  • Symbolic Analysis
  • Interactive simulation and animation
  • Virtual Instruments
  • Remote measurements
  • Distance Teaching & Learning
Tina 10 slideshow
  • Upload your designs to TINACLOUD
  • Run anywhere on any platforms
  • Download projects from TINACloud to PC
TinaCloud slideshow
Mixed HDL Simulation
  • VHDL & Verilog
  • VHDL and Verilog Debugger
  • Verilog-A and Verilog-AMS
  • Spice & HDL in same Circuit
Tina VHDL slideshow
  • Use in office and at home
  • Use while you are mobile
  • Educational site licenses
  • Industrial site licenses
Tina student slideshow
  • MCU simulation in digital and mixed circuits
  • Hex, ASM, C, Flowchart programming
  • Hex, ASM, C, Flowchart Debugger
  • PIC, AVR, ARM, XMC, 8051, over 800 MCUs
Tina spice mcu slideshow
  • Fast multi-core analysis
  • Large number of SMPS devices
  • DC, AC and Transient Analysis
  • Startup, Input and load step
Tina SMPS slideshow
Free Trial What's new in TINACloud? What's new in TINACloud? What is TINACloud? What is TINACloud? Buy TINACloud AccessBuy TINACloud Access Buy TINA with FREE TINACloud access!Buy TINA with FREE TINACloud access!

Login TinaCloud

Mixed Mode Simulation (Spice - VHDL - MCU co-simulation)

TINA version 8 and above include a new powerful mixed mode simulation engine. It is based on the XSPICE mixed mode algorithm, extended with MCU and VHDL components. In your circuits you may freely mix any analog or digital components of TINA, including microcontrollers (MCUs) and macros with Spice or VHDL content. You can modify these components on the fly along with the code in the MCUs. TINA will analyze the analog parts in analog, the digital parts in digital, and will automatically create the interfaces among the components. This ensures synchronization and fast convergence.

Let's explore some of the uses of this mode through a few examples.

Waveform generation with VHDL and Spice subcircuits

The following circut generates an analog sine or sawtooth signal depending on the status of the left SW-MODE switch.


Tina mixed mode

Click the picture to run this circuit online with TINACloud

The Digital Wave box on the left of the circuit includes VHDL code with a lookup table (Sine_LUT ) for the sine wave and a counter for the sawtooth signal. The essential part of the VHDL code is:

   process(Reset, Clk)
   begin
        if (Reset = '1') then
               Wave <= (others => '0');
               LUT_index <= 0;
   elsif rising_edge(Clk) then
   if (Enable = '0') then
     Wave <= (others => '0');
   elsif (Sel = '0') then
     Wave <= Sine_LUT(LUT_index);
       else
         Wave <= conv_std_logic_vector(LUT_index,5);
       end if;

       if (LUT_index = LUT_index_max) then
         LUT_index <= 0;
       else
         LUT_index <= LUT_index + 1;
       end if;

   end if;
   end process;
   d0 <= Wave(0); d1 <= Wave(1); d2 <= Wave(2); d3 <= Wave(3); d4 <= Wave(4);

The digital output of the counter is converted into an analog signal in the 5 bit DA converter of TINA shown in the middle of the circuit.

The DAC sine wave output needs to be cleaned up with a low pass filter. We will use a Spice opamp model of the TL081 in a Sallen and Key low pass filter configuration. Press the Enter Macro button on the property dialog and TINA will open the macro. You can review and, if necessary, modify the Spice code inside the macro.

Here are the final waveforms of the full circuit, including the five counter output waveforms. SW_MODE is in the High state, selecting the sawtooth signal.

If we change the SW-MODE switch to Low and run Transient analysis again, the waveforms are:

To see the effect of the analog filter, delete curves d0 to d4 from the diagram by clicking the curves and pressing the Del key.

MCU controlled SMPS circuit

The mixed mode simulator of TINA not only allows MCUs, but also any linear or nonlinear parts in TINA's libraries. As an example, let's study the following circuit, which realizes a DC-DC converter, converting 5V DC to 13V DC, and operating in boost mode.



Click the picture to run this circuit online with TINACloud

The waveforms below demonstrate how the analog parts and the MCU interact in TINA.

Mixed circuit example consisting of simple analog and digital components



Click the picture to run this circuit online with TINACloud

Mixed Mode Circuit

 

You can display the results in one diagram or as separate diagrams shown below by simply appending a colon ( : ) and  a number to each output name.

mixed circuit result

Mixed mode results





TINA - Circuit Simulator for Analog, RF, Digital, MCU, HDL & Mixed Circuit Simulation and PCB Design
Copyright © 2016DesignSoft, Inc. All rights reserved.