Using Hardware Description Languages in TINA, Part 2: Creating Macros from Verilog

Creating Macros from Verilog

Hardware Description Languages (HDL) are powerful tools to describe and simulate complex electronic devices.

In this tutorial video

we will show how you can create a macro from a Verilog (.v) code and use       in TINA. You can create macros from VHDL, Verilog-A and Verilog-AMS files in a similar way.

Watch our tutorial video to see how  you can create a macro from a Verilog (.v) code and use  in TINA.

 usinghardwaredescriptionlanguagesintinapart2-voiceover-yt

Download the FREE trial demo of TINA Design Suite and get:

  1. One year free access to TINACloud (the cloud-based, multi-language, installation-free online version of TINA now running in your browser anywhere in the world.)
  2. An immediate 20% discount from the offline version of TINA
  3. Free license for your second computer, laptop etc.
Click here to download the FREE trial demo of TINA.

 

www.tina.com

You can also find below the script of the video: 

Using Hardware Description Languages in TINA, Part 2: Creating Macros from Verilog

In this tutorial video we will show how you can create a macro from a Verilog (.v) code and use in TINA. You can create macros from VHDL, Verilog-A and Verilog-AMS files in a similar way.

For example consider the following Verilog interface:

module half_add (A, B, S, C);   

input A, B;

output S, C;

In this case the A,B ports will appear on the left side and the S,C ports will appear on the right side of the macro shape.

Let’s see how to make a macro from the following Verilog code (a half adder):

module half_add(A, B, S, C);  

input A, B;

output S, C;

assign S = A ^ B;

assign C = A & B;

endmodule

Note that this Verilog code is much simpler than the equivalent VHDL code. This is one of the great advantages of Verilog.

The essential Verilog code of the half adder is 2 lines long only.

Let’s demonstrate the details.

Open TINA

Click the Tools menu

Select New Macro Wizard

Type a name for the new macro In our case: Half adder Verilog

Change the Settings from Current circuit to From file

Click the Open icon

Change the file type to .v

Select TINA examples

Select Examples

Click the Verilog folder

Click Open

Select the Half adder Verilog.v file and press Open

Press the Next button to save the macro,

and save the macro into the default Macrolib folder.

Now you can insert the Macro by pressing the Insert button or you can select the “Insert/Macro…” from the menu.

Click the Insert button

The macro will be attached to your cursor. Place it wherever you wish on the workspace.

To see the content of the macro double-click on it and press the Enter Macro button

The content of the macro appears.

Close the TINA HDL Editor window

Let’s test our newly created macro in TINA’s Digital interactive mode along with the previously created VHDL macro

(See Using Hardware Description languages in TINA, part 1)

Let’s open our previously created Half_ Adder VHDL macro.TSC circuit.

Here is the circuit with two High-Low digital switches, one for each of the A,B inputs, and two logic indicators. We will copy the circuit, then we will change the macro into the Half adder Verilog macro

To select the circuit click at the corner of the area to be selected, hold down the left mouse button then move the mouse and release the left mouse button at the opposite corner.

Click the Copy then the Paste button on the toolbar. Your circuit will be attached to your cursor.  Position it by moving the mouse to the required position and press the left mouse button.

Deselect the circuit by clicking an empty spot.

Click the Half adder VHDL macro to be selected then delete it by pressing the Del key on the keyboard.

Click the Insert menu

Select Macro

Select User Macros

Select the Half adder Verilog.TSM, then click Open

The Verilog macro will be attached to your cursor, you can move and insert it into the place of the deleted VHDL macro.

Let’s test the 2 circuits

Select the Digital interactive mode with the narrow “Select Interactive mode” button on the Toolbar

Press the Dig  button

The logic levels of the nodes appear, Red for High. Blue for Low.

The logic indicators will also show the logic level of the outputs in a Red square for High, and empty square for Low.

Both Half_adder circuits work as required.

Using Hardware Description Languages in TINA, Part 1: Creating Macros from a VHDL code

Creating Macros from a VHDL code

Hardware Description Languages (HDL) are powerful tools to describe and simulate complex electronic devices.

In this tutorial video

we will show how you can create a macro from a VHDL (.vhd) code and use     in TINA. You can create macros from Verilog, Verilog-A and Verilog-AMS files in a similar way.

Watch our tutorial video to see how  you can create a macro from a VHDL (.vhd) code and use         in TINA.

 usinghardwaredescriptionlanguagesintinapart1-voiceover-yt

Download the FREE trial demo of TINA Design Suite and get:

  1. One year free access to TINACloud (the cloud-based, multi-language, installation-free online version of TINA now running in your browser anywhere in the world.)
  2. An immediate 20% discount from the offline version of TINA
  3. Free license for your second computer, laptop etc.
Click here to download the FREE trial demo of TINA

 

www.tina.com

You can also find below the script of the video:

Using Hardware Description Languages in TINA, Part 1: Creating Macros from a VHDL code

Hardware Description Languages are powerful tools to describe and simulate complex electronic devices. In this tutorial video we will show how you can create a macro from a VHDL code and use in TINA. You can create macros from Verilog, Verilog-A and Verilog-AMS files in a similar way.

You can create a macro from any .vhd , .v , .va, .vams file that contains an entity (interface to the outside world) with its architecture (description of the hardware).

The meaning of the file extensions is as follows:

Files with .vhd extension are VHDL files,

with .v extension are Verilog files,

With .va extension are Verilog-A files and

with .vams extension are Verilog-AMS files.

The ports declared in the interface part will automatically appear in the macro symbol (shape). By default, the input ports of the interface will appear on the left side of the generated macro shape and the output ports of the interface will appear on the right side, but by editing the generated macro you can change this arrangement.

For example consider the following VHDL interface:

ENTITY e_Half_add_entity IS PORT(

A : IN std_logic;

S : OUT std_logic;

C : OUT std_logic;

B : IN std_logic );

END e_Half_add_entity;

In this case the A,B ports will appear on the left side

and the S,C ports will appear on the right side of the macro shape.

Now let’s see how to make a macro from the following VHDL code (a half adder):

LIBRARY ieee, tina;

use ieee.std_logic_1164.all;

use std.textio.all;

USE tina.primitives.all;

————————————

— entity section

————————————

ENTITY e_Half_add_entity IS PORT(

A : IN std_logic;

S : OUT std_logic;

C : OUT std_logic;

B : IN std_logic );

END e_Half_add_entity;

————————————

— architecture section

————————————

ARCHITECTURE a_Half_add_arch of e_Half_add_entity IS

constant delay : time := 20 ns;

BEGIN

S< = (A xor B) after delay;

C< = (A and B) after delay;

END a_Half_add_arch;

Note that the essential code of the half adder is 2 lines long only

Open TINA

Click the Tools menu

Select New Macro Wizard

Type a name for the new macro

In our case: Half_adder_VHDL

Change the Settings from Current circuit to From file

Click the Open icon

Change the file type to VHDL

From the TINA program folder

Select Examples

Open the VHDL folder

Select the Half_adder_VHDL.vhd file and press Open

Press the Next button to save the macro and save the macro into the default Macrolib folder.

You can insert the Macro by pressing the Insert button or you can select the “Insert/Macro” from the menu.

Click the Insert button

To see the content of the macro double-click on it and press the Enter Macro button

The content of the macro appears

Let’s test our newly created macro in TINA’s Digital interactive mode.

To do this, place two High-Low digital switches from the Switches toolbar, one for each of the A,B inputs, and two logic indicators.

Now select the Digital interactive mode with the narrow “Select Interactive mode” button on the Toolbar

then press the  Dig   button

The logic levels of the nodes appears, Red for High. Blue for Low.

Click the switches to change the input states.

The logic indicators will also show the logic level of the outputs in a

Red square for High, and empty square for Low.

The Half adder circuit works as required.

In our example so far the terminals or pins of the macro were placed automatically.

You can change the automatic pin arrangement of an automatically generated macro by editing its header.

For example the header in the previous example is

————————————

— TINA HDL Macro Description Begin

— entity_name:e_half_add_entity;

— arch_name:ignored;

— ports:a,b;s,c;

— Mode:VHDLTyp;

— TINA HDL Macro Description End

———————————-

The pin arrangement is determined by the following line:

ports:A,B;S,C;

the ports before the first semicolon (;) are placed on the left while the rest are

placed on the right side of the macro box.

If you change the port line to Ports as follows:

A,B,S;C

A, B, S will be placed on the left side and C on the right side of the macro box.

You can also change the vertical order of the pins by changing the order of the pins in the list.

Let’s see how to convert the previous Macro:

Half_adder_VHDL into a new Macro called: Half_adder_VHDL_modified

Double-click the macro and press the Enter Macro button

Let’s change the ports line to as follows:

ports:A,B,S;C;

Select File

Select Save as

Save the modified code. We will save it under the name: Half_adder_VHDL_modified.vhd

Close the TINA HDL Editor

In the pop-up window the following message appears:

Macro has been modified. Confirm changes?

Click No

Let’s create a new macro with the modified pin arrangement

Click the Tools menu

Select New Macro Wizard Enter the name of the new macro:In our case: Half_adder_VHDL_modified

Change the Settings from Current circuit to From file

Click the  Open icon

Invoke the place where your newly created macro is saved. In our case the Downloads folder

Change the file type to VHDL

Select the Half_adder_VHDL_modified file, then click Open

Press the Next button to save the macro,

and save the .TSM file into the default Macrolib folder.

Click the Insert button

The modified macro with the revised pinout version will be attached to your cursor and you can place it anywhere on the workspace

By double-clicking the modified Macro, then pressing the Enter Macro button you can see the content of the macro with the revised pin arrangement

Using the Footprint Editor in TINA, part 2: Setting and checking footprint names

Setting and checking footprint names

In this video

we will present how to check and set the mapping between TINA’s Schematic Symbols and the Footprints used in TINA’s Integrated PCB Designer.

Watch our tutorial video to see how to check and set the mapping between TINA’s Schematic Symbols and the Footprints used in TINA’s Integrated PCB Designer

Setting and checking footprint names
Setting and checking footprint names

Download the FREE trial demo of TINA Design Suite and get:

1. One year free access to TINACloud (the cloud-based, multi-language, installation-free online version of TINA now running in your browser anywhere in the world.)
2. An immediate 20% discount from the offline version of TINA
3. Free license for your second computer, laptop etc.
Click here to download the FREE trial demo of TINA

www.tina.com

You can also find below the script of the video:

Using the Footprint Editor in TINA, part 2: Setting and checking footprint names

In this video we will present how to check and set the mapping between TINA’s Schematic Symbols and the Footprints used in TINA’s Integrated PCB Designer

Start TINA

Assume we have created a macro of an existing IC and now we want to assign a PCB Footprint to it, so we can use the part in PCB design.

Click the Insert menu

Select Macro

From the Macrolib folder open the MAX11166.TSM

Double-click the macro

Click the …  in the Footprint Name field

We will create a user package database to store the symbol and footprint pin pairs.

Package database will be created in the Private Catalog folder.

Check in the Create Library button

Enter the name: MyPackageDB

Click the Create Library icon

Press the Add icon

then click OK to add the MAX11166 to the Component list

Next, click the Add button under the Footprint list

Select MyPackage from the Library list, then click the appropriate footprint SON12_3x3_0.5_TP and click OK

Note: we will use the previously created footprint (see our video: Using the Footprint Editor in TINA: IC Wizard)

To set the pin pairs click the Add button next to the Node list

We will match the pins based on the MAX11166 pin configuration

Click OK

Click OK again

Now the PCB Footprint is associated with the macro.

If you open the TINA PCB Designer the PCB Footprint of the part will appear

Open the TINA PCB Designer

The PCB Footprint of the part appears

Using the Footprint Editor in TINA, part 1: IC Wizard

Using the Footprint Editor in TINA, part 1: IC Wizard

If you want to create a footprint of an Integrated Circuit the IC Wizard of TINA can assist you.
Activate the IC Wizard from the Insert menu of the Footprint Editor of TINA PCB Designer.  The wizard presents several properties of the IC which you can set.

usingthefootprinteditorintina-icwizardvoice-overyt

In this tutorial video we will use the MAX11166 converter  to show how to use the IC Wizard of TINA Footprint Editor.

Watch our tutorial video 

to see how  to use the IC Wizard of  TINA Footprint Editor.

Download the FREE trial demo of TINA Design Suite and get:

  1. One year free access to TINACloud (the cloud-based, multi-language, installation-free online version of TINA now running in your browser anywhere in the world.)
  2. An immediate 20% discount from the offline version of TINA
  3. Free license for your second computer, laptop etc.
Click here to download the FREE trial demo of TINA

 

www.tina.com

 

You can also find below the script of the video:

Using the Footprint Editor in TINA, part 1: IC Wizard

Start TINA PCB Designer by using the Start menu of Windows 10

Click the Tools menu

Select Footprint Editor

First, select View

Options

and change the Unit into mm and the Precision into 3

then click OK

Create a new Footprint Library by using the File

Save Library As command

in the Private Catalog Folder of TINA

under the name: MyPackage

Press the Save button

Click the Insert menu

Select IC Wizard

In the Technology group,

you can set the mounting mode and the package type of the IC. The mounting mode can be through hole or surface mounted. Depending on the mounting mode the following packages are available: DIP (Dual in line packag e), PGA (Pin grid array package), SPGA (Staggered pin grid array package), SOP (Small outline package), LCC (Leaded chip carrier package), QFP (Quad flat package), BGA (Ball grid array package), SBGA (Staggered ball grid array package), SIP (Single in line package) and ZIP (Zigzag in line package) respectively.

In the Package dimension group,

the dimensions (length, width,

3D height) of the package can be set. Depending on the selected package, the 4th parameter is either notch, corner cutoff, or ignored.

The Pad dimension

defines the shape and dimensions (length, width)

of the pad. If the mounting mode is through hole, the shape of the

drilled pad can be round, square or octagon. Moreover, the shape

and dimensions of the drill diameter can be defined.

However, if the mounting mode is surface mounted, the shape of the pad

can be circular, rectangular or rounded corner and the appropriate

dimensions can be also set.

In the Pad position, the number of pins and the distances between them can be set according to the package type.

Finally, in the Pad numbering group, the type and direction for pad numbering can be entered, depending on the package type.

Set the data as shown in the IC Wizard window above

Click OK

In the pop-up window the following message appears:

Create IC

Click Yes

You can enlarge the image by using the Zoom option

Next, we will position the Smd Pad

Click the Smd icon, then click on the Editor workspace to place it

Double-click the SMD Pad

and in the SMD Pad Properties Window enter 13 in the name field, 0 in the Center X and Center Y fields

Double-click the Size field and enter 2.5 in the Width and 1.7 in the Height fields

Click OK

Click OK again

We will now position the labels which belong to another layer

Click the little arrow next to the TOP layer icon and select the Silkscreen Top layer

Now you can easily move the Name and the Value labels by holding down the left-mouse button while dragging them

Select again the Top layer when you are done

Click the New Footprint Group icon

Click the <New group> folder and rename it by entering the name: SON then press the Enter button on the keyboard

Note: SON is small-outline no leads type of circuit

Click the Footprint Properties icon

and in the Name field enter: SON12_3x3_12_0.5TP

Click OK

Click the Add Footprint to the library icon

Save the footprint by clicking the Save button

Close the Footprint Editor

You can check the newly created Footprint

Reopen the Footprint Editor

Click File

Open Library

Open the MyPackage.FPL

Next, double-click the SON library, then the new Footprint

The mapping between TINA’s Schematic Symbols and the Footprints used in TINA’s Integrated PCB Designer will be presented in another video.

Creating Subcircuits from Spice Models with TINACloud: .MODEL format

Creating Subcircuits from Spice Models with TINACloud: .MODEL format

In TINACloud you can create your own components from any Spice models given in .MODEL format that you have made or downloaded from the Internet.

Watch our tutorial video

to see how to create a  TINA macro component using a BC846 NPN Bipolar transistor downloaded previously from the web.

Creating Subcircuits from Spice Models with TINACloud: .MODEL format
Creating Subcircuits from Spice Models with TINACloud: .MODEL format
 Download the FREE trial demo of TINA Design Suite and get:
  1. One year free access to TINACloud (the cloud-based, multi-language, installation-free online version of TINA now running in your browser anywhere in the world.)
  2. An immediate 20% discount from the offline version of TINA
  3. Free license for your second computer, laptop etc.
Click here to download the FREE trial demo of TINA

www.tina.com

You can also find below the script of the video:

Creating Subcircuits from Spice Models with TINACloud: .MODEL format

In TINACloud you can  create your own components from any Spice models given in .MODEL format that you have made or downloaded from the Internet.

Some device models are stored in Spice .MODEL format.

Let’s download one from the internet and add the model to TINACloud

Here is the model of the BC846 NPN Bipolar transistor

Let’ save this model

In Google Chrome click the right mouse button.

In other browsers find the Save as command

Select Save as

Switch the Save as type into All files

and Save it as a .cir file, as this is one of the extensions that TINACloud expects.

Start TINACloud

To invoke the Schematic Editor

Select New from the File menu

The Schematic Editor appears

Click the Insert button denoted by a  green + sign to invoke the Insert menu

Select Upload macro

Let’s name the new Macro as BC846

Switch into From File from Current Circuit

then Click Choose Files

Enter BC846.cir into the file name field , then click Open

Now click Upload

In the dialog box the following message appears: Macro uploaded.

Click OK

You can simularly add any Spice models in Spice .MODEL format.

Let’s check how to insert the new model into TINACloud.

Select Insert macro from the Insert (+) menu

Now select BC846 then press OK

The new component will appear attached to your cursor and you can place it anywhere on the workspace by moving the mouse and clicking the left mouse button.

Now let’s create the following test circuit by adding a few more components to test the new model.

Select the Resistor from the Basic Toolbar

Use the Rotate left or Rotate right icon then hold the left-mouse button down while moving it and connect it to the Transistor

Repeat this procedure for R2 & R3

Double click the Resistances (R1 & R2) and in their Properties window set the parameters as shown

R2=47k; R3=3k

click OK

Now select the Ground and connect it to the Transistor

Next add the remaining parts and the wires

then Click the Save button to save the file

Let’s save it under the name BC846_test.tsc

Let’s test this circuit using DC Interactive mode.

Press the DC button

The model works as expected.