Page tree
Skip to end of metadata
Go to start of metadata



Subcircuits and Hierarchy

What is Hierarchy?

"Hierarchy" refers to the ability to have a "device" symbol in a schematic actually represent an arbitrary circuit block. The "pins" on the device symbol represent connections to specific input output points on the internal circuit. For clarity, a device symbol that represents an internal circuit will be called a "hierarchical block".
Subcircuits (also called subnetworks) are the building blocks of hierarchy.
Hierarchical design provides a powerful way of representing complex designs in compact and readable form. A top-level diagram of your system can show only major functional blocks. These blocks can then be opened to show more and more design details.
Hierarchical design in effect adds a "third dimension" to a schematic diagram. It also raises some complex issues that should be understood before embarking on a major design.
Please review this chapter carefully before making extensive use of the hierarchical features of HYPERSIM® and manipulating subcircuits.
A simple example is given by this circuit.

The subcircuit is located in a parent circuit. It has a parent device (its symbol with optional pins). The subcircuit contents are actually the contents of the parent device, but to simplify the terminology, the subcircuit parent device is called "subcircuit" and its contents are also called "subcircuit".

HYPERSIM® offers several methods for creating subcircuits. Subcircuits can be created from any location in a circuit. It is also possible to make a subcircuit from the entire circuit.

  • The subcircuit above is created from the switch device connected to ground. The "Options>Subcircuit> Create Subcircuit Block" (Ctrl+Shift+Q) menu is used to create a subcircuit from parts of a circuit. If port connectors (the interface between the subcircuit contents and the holding circuit) are not placed before using Ctrl+Shift+Q, then HYPERSIM® suggests automatic port positions, such as "Add port connectors to all signals with visible names" or "Add port connectors to all signals with loose ends".
  • A subcircuit may have zero, one or more pins. Any pin types can be used.
  • The top circuit can contain several subcircuits and each subcircuit can also contain subcircuits with unlimited number of levels.
  • The default subcircuit symbol is a square box. The Symbol Editor can be used to modify the subcircuit symbol.
  • After creating the subcircuit it can be opened in a separate circuit drawing by double-clicking on its symbol. The available keyboard shortcuts are: "Ctrl+Shift+I" (in) for getting into the subcircuit and "Ctrl+Shift+U" (up) for going up.
  • The first time a subcircuit is entered it is locked. It is needed to unlock the subcircuit for making changes. There are two methods for unlocking: through the "Circuit Info" menu (Ctrl+I) or by moving a device and accepting to unlock from the subsequent panel popup.

After the subcircuit is created, it may be required to modify its port interface by adding or deleting pins.

Subcircuit Uniqueness and Encapsulation


You must read this section before using subcircuits.
The contents of a subcircuit are hidden (encapsulated) from the holding circuit or subcircuit. The holding circuit is also called the parent circuit. The only connection between the parent and its subcircuit is through the interfacing pins. This means that two signals may have the same name in the parent circuit and in the subcircuit, but they are not connected. The global naming system used in HYPERSIM® is based on concatenating a subcircuit path name to all its internal names. If the device named Brk1 is located in a subcircuit named DEV1 then its global name becomes DEV1/Brk1. If there are more levels, then the path name changes to account for all levels. In DEV1/DEV2/XX1/power_line, the power_line signal is located in the subcircuit XX1 which is located in the subcircuit DEV2 and which is located in the subcircuit DEV1.
The following options are available:

  • A subcircuit may have one or more pins. Standard pins and bundle pins may be used.
  • A subcircuit may have no pins. In which case it is an electrically stand-alone circuit.
  • A subcircuit can be also made of non-electrical objects.
  • A subcircuit may hold (be parent to) one more subcircuits.
  • A subcircuit may be multipage (see Adding, Deleting and Titling Circuit Pages).
  • Subcircuits can be created from any point in a design and from any part of a circuit. The subcircuit interface pins are fully controllable. It is also allowed to create subcircuits from entire designs.

When a subcircuit is created and duplicated, HYPERSIM® continues keeping only one copy of its internal circuit. This means that any changes inside one subcircuit are automatically reflected into the other subcircuit instances (copy). HYPERSIM® can sees only one copy of the circuit, but two separate calls. This is similar to programming using a given function from different locations

in the program. The two subcircuits of below are identical. They have the same Part attribute and same Type name. This is a powerful feature for large designs. If a large number of subcircuit
devices of the same type are used in a design, then by changing only one device allows changing all other devices automatically.

The Type name of a device can be found by selecting the device and using the right-click Properties command.
It is very important to understand the implications of the "Make Unique Type" command and the notion of subcircuit uniqueness before making any changes to subcircuits. The user should never
modify a built-in HYPERSIM® subcircuit based device before applying the "Make Unique Type" command to the device. A built-in device may be used by other devices and thus modify
their contents if not made unique before changing.

Make Unique Type

If it desired to detach one subcircuit definition from the other, then the detached subcircuit must be made unique. This is completed through the "Options> Part Type> Make Unique Type" menu.


In the figure below, the subcircuit DEV2 is first created by duplicating DEV1 and then made unique. To ensure circuit data integrity and to manage subcircuits, it is very important to enable visual feedback for distinguishing dissimilar subcircuits. A suggested approach is to show the Part name. An even better approach is to change the subcircuit symbol using the Symbol Editor.
HYPERSIM® also keeps a separate attribute PartTemp for verifying uniqueness when the user makes mistakes by using existing part names or makes attribute changes without making a unique type.

At this stage DEV2 is detached from DEV1 and FAULT_switch: it has its own copy of the original subcircuit. This is similar to making a copy of a function and renaming it to allow new contents, calling methods and usage.

  • If a subcircuit is available in a library and if it is dragged into the design and modified, then it becomes automatically unique: detached from the library copy. The user should change the symbol and make the new Part name visible to avoid confusion. Any new copy dragged in from the original library remains detached from the one modified in the design.
  • Locking the contents of a subcircuit after its creation is used for reminding the user about the potential repercussions of changes made in the subcircuit. See Locking and Unlocking Subcircuits for more information on this option.
  • It is allowed to add and delete subnetwork pins after subnetwork creation. When a signal line type is changed in a subnetwork it will not propagate to its parent circuit. Such changes must be performed manually.
  • In the current version of HYPERSIM®, subcircuit control input and output pins are not automatically given an arrow tip. This is only achievable by modifying the subcircuit symbol using the Symbol Editor.
  • If after exiting a subcircuit, the user receives an error message, it means that there is pin interface corruption in the subcircuit and the resulting Netlist will also have problems. Error and warning messages should not be ignored before continuing.

PartTemp attribute

As explained earlier, in addition to the Part attribute which is used to distinguish subcircuits, HYPERSIM® uses one more attribute: PartTemp. This attribute is used to verify uniqueness when the user makes changes that may affect the uniqueness of a subcircuit. An example of change that automatically creates a new copy of a subnetwork is shown below.

The original device DEV1 is copied and then its pin name is changed. It automatically changes the internal port and makes DEV2 different from DEV1. HYPERSIM® modifies the ParTemp to account for this condition. Notice that the PartTemp attribute is corrected only after the first subsequent Netlist generation. The pin name can be changed by selecting the subcircuit, opening the right-click menu "Subcircuit Info" and moving into the Pins tab.

The listed pin names can be clicked on and modified.

Subcircuits within subcircuits

A subcircuit may contain other subcircuits and the contained subcircuits may contain subcircuits, which results into a tree of subcircuits.
The best way to understand multilevel designs and Unique property of a subcircuit, is to view a subcircuit as a program function. A function is a program building block. A given function has only one version and can be called from other functions. If it is desired to change a function, then its name must be changed (made unique) in order to change its contents. A subcircuit level can be viewed as the body of the function. The best way to illustrate this concept is to create a simple example. Two subcircuits FUN1 and FUN2 are contained in a subcircuit TOPSUB.

Initially there is only one copy of TOPSUB in the memory. There is also only one copy of FUN1 and one copy of FUN2. Making any changes in the TOPSUB level is automatically reflected into all copies of TOPSUB. The same is true for FUN1 and FUN2. If we make a copy of TOPSUB to create DEV4 it is like calling the same function tree from another location in the main program (the top circuit).

Making any changes in the DEV4 level is automatically reflected into DEV3 level. If it is desired to modify FUN2 in DEV3 without modifying FUN2 in DEV4, DEV3 must be first converted to become unique using the Make Unique Type procedure. Its level will then become separated in memory from DEV4. Then DEV2 can be also set to a new type using again Make Unique Type. This last action will detach DEV2 and allow modifying its level contents. Here is a visual representation of the steps. First DEV3 and DEV4 are sharing the same body:

This means that if you want to modify a multilevel subcircuit to make it completely detached from others in all its levels and used subcircuits, you must modify all hierarchical levels.

It is also feasible to propagate uniqueness from top down for a subcircuit device containing other subcircuits by checking the option “Apply to subcircuit contents” on the Make Unique Type command panel.

Subcircuit Properties

When a subcircuit is created and right-clicked, the "Subcircuit Info" menu becomes available:

  • The "New Type Name" input field allows changing the type name. This changes the Part attribute of the subcircuit.
  • The second radio button ("Make the selected…") is similar to the "Make Unique Type" command available from "Options>Part Type".
  • If you select this option and keep the same type name and if other subcircuits of the same type are available in the design, then HYPERSIM® will use the PartTemp attribute to distinguish this device.
  • The Mask tab allows masking the subcircuit and selecting a mask name.

Subcircuit creation methods

HYPERSIM® offers a large number of methods for creating and maintaining subcircuits. The starting point is the "Subcircuit Wizard" opened from "Options> Subcircuit> Create Subcircuit Block":

  • The "Quick Subcircuit" option is activated only when a device or several interconnected devices are selected in the design that will become the parent of the subcircuit.
  • Subcircuits can be created "top down" or "bottom up".
  • Working top down means creating the highest level of the design first and then working downward to more detailed levels.
  • In practice, this means that you create and place the symbol for a hierarchy block first, before you necessarily even know what the internals of the block will look like.
  • Once you have completely created the higher-level circuit including the symbols for all the hierarchy blocks it uses, you then proceed to define the internal circuits of the blocks.
  • In the "bottom up" approach any part of an open design or entire designs can be made into the subcircuit of a hierarchical block symbol. The block is automatically created by the program, but can be modified using the Symbol Editor.

Saving Part Type to Library

After creating a subcircuit you can save it into a library for later usage or for sharing with other users. To place a subcircuit into a library, simply select the subcircuit symbol and select the menu "Options>Part Type>Save to Lib":

Since the subcircuit is a part with an internal circuit, you must select "Save internal circuit definition". If this option is not checked the subcircuit contents will not be saved with the symbol!

Attaching Subcircuit

The "Attach Subcircuit" command (from Options>Subcircuit>Subcircuit Operations) is not yet supported in HYPERSIM®.

Detaching Subcircuit

The "Detach Subcircuit" command (from Options>Subcircuit) makes the currently displayed subcircuit into a separate design and redefines the parent device as having no internal circuit.
This operation permanently removes the subcircuit from the selected device and all other devices of the same type in the selected design. If you do not wish to update other devices in the design, use the "Make Unique Type" command to isolate the selected device first.
The Detach operation cannot be Undone!
In particular, Detaching performs the following operations on the subcircuit displayed in the front most window:

  • The circuit is unlinked from its parent device, making it into a separate design.
  • The title of the subcircuit is set to a default name.
  • The internal circuits of all other devices of the same type in the design are removed.

Discarding a Subcircuit

The "Discard Subcircuit" command (from Options>Subcircuit) discards the subcircuit associated with a parent device. To perform this action:

  • Locate and select the parent device in its circuit.
  • Select the "Discard Subcircuit" command in the Subcircuit menu.

All data associated with the subcircuit is destroyed by this command. This cannot be undone!
The "Discard Subcircuit" command redefines the selected device (and all others of the same type) as having no internal circuit.

Locking and Unlocking Subcircuits

A subcircuit can be locked to prevent accidental opening. This is intended for cases where the subcircuit is derived from a library or is used only to implement a simulation model which should not be edited as part of the parent design.
To lock and unlock a subcircuit from the schematic:

  • Locate the subcircuit’s parent device symbol in the schematic and select it.
  • Select the Properties command in the subcircuit right-click menu.
  • Check or uncheck the "Lock opening subcircuit" box, as desired.
  • Click OK

Printing Hierarchical Designs
A hierarchical design has an extra dimension which must be taken into account in determining the order of page printing.

Determining Print Page Order
When a design is printed, the master circuit of the design is printed first in its entirety. Then, each hierarchical block is printed, followed by all hierarchical blocks it contains. For example, given the following structure of nested hierarchical blocks:

The print order would be: A, L, W, X, M, Y, Z. The order of printing of hierarchical blocks inside a single circuit is determined only by internal storage order and cannot be controlled by the user. W and X could be reversed above.

Design Preferences: Printing

To set the scope of printing in a hierarchical design, choose the "Design Preferences" command in the “Options>Design” toolbar and select the Printing tab.

Three options are available:

  • Print current circuit level only: With this setting, the Print command will print only pages belonging to the circuit level in the current window.
  • Print all unrestricted circuits in current design: With this setting, the design's master circuit and all unlocked internal circuits will be printed. The "locked" setting is controlled by a check box in the Properties command for the parent device.
  • Print all circuits in current design: Print the design's master circuit and all internal circuits, regardless of "locked" status.

Printing Sequential Page Numbers in a Hierarchical Design

When a hierarchical design is printed, the $PRINTPAGENUMBER text variable can be used to apply sequential page numbers to the printed sheets.
This text variable only applies during a Print operation. When it is drawn on the screen, it is interpreted the same way as the $PAGENUMBER variable, i.e. it gives the page number within the circuit.
See more information on text variables in Using Text Variables.

  • No labels