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. Just wish to say your article is as astonishing. The clarity on your submit is simply cool and i can think you are an expert in this subject. Well together with your permission let me to clutch your RSS feed to keep up to date with approaching post. Thank you one million and please keep up the enjoyable work.

  2. Lewis says:

    I’m finding this information for 2 hours. I just found it. Thank you for a detail information about LTspice. I’m likely to sleep well. Good luck^^

  3. Excellent post at Hierarchical Blocks in LTSPICE | Audio Perfection. I was checking constantly this blog and I’m impressed! Very useful information specifically the last part :) I care for such info much. I was looking for this particular info for a very long time. Thank you and good luck.

  4. Martin says:

    Hello,
    Is it possible to pass parameters to hierarchical block (different instances)?
    How?

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

  6. tomphasor says:

    re: 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.

    This is not true: given a .param statement in the block, you can pass different parameter values to each instance of (symbol occurrence) in the parent schematic.

  7. RamCoz says:

    Thanks for the tutorial. one thing though, I’m actually want to use the adjustable regulator in my SPICE, so I need to built one. is it possible to actually publish somewhere your circuit? I can see it is very similar to the datasheet’s circuit but much more clear.
    thanks in advanced..

  8. Markein says:

    Thanks for the tutorial, it is very useful and clear.
    I had some additional question on hierarchical blocks.

    1) It is possible to make more than one hierarchy level?
    (i.e.: a symbol containing symbols)

    2) How to use “cells” instead of “blocks” in LTSpice?

    Many thanks in advance.

  9. Philipp says:

    Thanks for the article! I’d like to add one little thing: It seems to be a requirement that both the included schematic and its symbol reside in the same directory as the main simulation file. Otherwise LTspice may complain about not finding the schematic file.