github bitbucket linkedin googlescholar email rss
YCircuit Symbol tutorial

Introduction

This tutorial assumes that you have already completed the previous tutorial. If you haven’t done so yet, it is highly recommended that you go back and finish that first. In this tutorial, we will create our very first custom symbol for a transconductance (g_m) element.

Key differences between schematic and symbol generation

While the intention has been to keep these two processes as similar to each other as possible, there are some key differences that should be noted:

  • While the use of Wire is encouraged for drawing schematic nets, it is recommended to use the Line from the shape menu (Alt+A -> L) to draw the complex shapes that are typically used in symbols. The Wire can inherently only do right angles whereas the Line is free to move in any arbitrary direction. Crucially, a Line has clean overlap near the endpoints of successive segments.
  • Save and load commands for the schematic require an extra Shift character when used for symbols.
  • Schematics are saved as a .sch file whereas symbols are saved as a .sym file. In terms of code, however, these are identical.
  • When you select save symbol from the file menu (or press Ctrl+Shift+S), you are first asked to pick an origin for the symbol. When you later instantiate the symbol in another context, the origin point is the one that will be right under the cursor. For example, you would pick the origin for a resistor symbol to be the left terminal of the resistor.

The g_m symbol

  • Open a new window in YCircuit and select the line from the shapes menu (Alt+A -> L).

  • We first draw the trapezoidal outline of the symbol. Consistency in symbol sizes is an important issue. It is recommended to instantiate a resistor symbol (Alt+S -> R) for a scale comparison.

  • Draw the trapezoid with 2 major grid points as the long side and 5 minor grid points as the short side (remember to press Esc when you’re done drawing). Try to keep it symmetric!

    You can right click while drawing a line to cancel the current segment that you were drawing. Left clicking after this starts a new line object from where you left clicked, so you don’t need to hit Esc and then select Line from the shapes menu every time you want to start drawing a new line immediately after finishing the current one.

  • Draw the + and - symbols using the line element. The + symbol would be drawn using 2 separate lines. You can copy the horizontal one and use it as the - symbol. Place these at suitable locations on the long side.
  • Add lines indicating the input and output terminals.
  • Create a text box element (Alt+A -> T) and use it to create a g_m text item. Once you have this created, move it to the center of the trapezoid (remember that in the dialog for editing text, Ctrl+Enter hits OK while Esc hits cancel). You can customize the font family and size through Font in the Edit menu (Alt+E -> F).
  • Place pins (P) on the input and output terminals of the g_m element so that wires drawn when the symbol is used in a schematic will automatically snap to these points.
  • Select save symbol from the file menu (or press Ctrl+Shift+S) to save your symbol. Notice on the lower left hand corner of the window, you will see Pick an origin for the symbol (press ESC to cancel). Click on the left end of the + terminal to select that as the origin. Save your symbol as gm.sym. By default, new symbols get saved in the Custom directory inside Resources/Symbols.
  • That’s it! You can now load this symbol in another schematic by selecting load symbol from the file menu (Ctrl+Shift+L) and use it just like any other standard symbol.