Hierarchical Blocks in LTSPICE

LTSPICE is offering very nice possibility to incorporate repeatable portions of schematic into simulation, that is not available in many other SPICE simulation programs- hierarchical blocks. Hierarchical blocks represent reusable portions of schematic, visible on higher level of schematic as a symbol. While LTSPICE is missing multipage schematic editor, hierarchical blocks are offering another simple way of creating complex schematics.

Hierarchical blocks have very much in common with subcircuits. The main difference is that hierarchical block in LTSPICE is schematic, not the netlist in the library.

The other difference is that you can pass different parameter values for different instances of the part, using the same subcircuit. You can pass parameters to hierarchical blocks also, but they would be the same for all different instances that you may have on main schematic.

One big advantage of hierarchical block is simplicity of probing internal nodes. Click on hierarchical block symbol opening schematic of hierarchical block, and probe any point of it’s schematic the same way as in main schematic. Just enable “Save Subcircuit Node Voltages” and “Save Subcircuit Device Currents” in Tools –> Control Panel –> Save Defaults tab of control panel menu.

To create a hierarchical block :

  • Create schematic that will represent a hierarchical block in LTSPICE schematic editor.
  • Label all nodes that should have outside visibility. To do so, press F4 or select Edit menu –>Label Net.
  • Save schematic in working directory as LTSPICE schematic file (schname.asc).
  • Create a symbol to represent your hierarchical block.

To create a symbol, representing hierarchical block:

  • Select File –> New Symbol. Draw the symbol using the tools available from Draw menu.
  • Add pins. Label them properly. Netlist order does not matter, but the label name should correspond to schematic net label from hierarchical block schematic (different from subcircuit).
  • Add Instance Name by selecting Edit –>  Attributes –>  Attribute Window
  • Open the Symbol Attribute Editor. Select Edit –> Attributes –> Edit Attributes. Select Block from the Symbol Type drop- down box. Leave all attributes blank.
  • Save the symbol as a schname.asy.

Important: Name of schematic, representing hierarchical block and name of it’s symbol should be the same. Just extensions are different. Otherwise, LTSPICE would not be able to establish relationships between them.

You are ready to use your new hierarchical block. Don’t forget to create a simple test-bench for your newly created hierarchical block to make sure it operate’s properly.

I made a couple of pictures illustrating creation of hierarchical block. I will use schematic of LM317, that I created by converting LM317 SPICE subcircuit model in this example. You can download example files LM317HB.

1. Create schematic of hierarchical block.

2. Label all nodes that should have outside visibility.

Label all nodes that should have outside visibility

Label all nodes that should have outside visibility

3. Create  a symbol for hierarchical block.

Label symbol pins

Label symbol pins

4. Set symbol type as a block and save it withe same name as schematic it represents (just different extension).

Edit symbol attributes

Edit symbol attributes

Next —>>> Passing parameters to Hierarchical Blocks

Comments

15 Responses to Hierarchical Blocks in LTSPICE

  1. Pingback: Passing Parameters to Hierarchical Block | Audio Perfection