Mason Flow

This page will seek to explain how one can use Mason efficiently, at a top level. By documenting how the developer uses the code, and the philosophy with which the code was developed, perhaps some degree of frustration can be spared the user... especially how to use Circuit Mason in conjunction with a Layout tool, which is described towards the bottom.

Please remember that Circuit Mason is under constant development; features are added as I find the need and time.

Mason is a Simulation Tool

TinyCAD with Mason is only for simulating the RF portion of circuits, and creating layouts for the RF portions. While TinyCAD itself is a generic schematic capture tool, but Circuit Mason only works with a model view of the circuit. A distinction must be made between the "physical" schematic and the "simulation" schematic. The "physical" schematic is concerned with the actual layout (surface mount and through hole parts), but the "simulation" schematic is only concerned with the model (amplifiers and lumped elements).

For example, if you have an amplifier which is packaged in a six-pin surface mount part, the schematic with Mason will only use a two-port model mapping the S-Parameters: RF input and RF output.

Mason S-Parameter OutputsMason outputs an S-Parameter file describing the model simulated. That's really the core of its function. The plotting tool (launched from the Mason
toolbar) just reads this file. After a normal run, and after each optimization set is completed, the S-Parameter file is updated.

Mason Optimization Run ProcedureMason has relatively robust optimization and analysis features. The standard procedure is to run Mason ("M" in the toolbar), and if you are happy with the results (probably plotted using "P" in the toolbar) you can update the view ("U" in the toolbar). Updating the view actually opens a new (temporary) design file and shows you the results from the optimization- values have changed. If you are happy with the changes, no anomalies appear to be creeping in, then you can save the new design file over the original ("S" in the toolbar). If you are not happy with the new values, open up the old file.Mason Layout ToolsMason generates two layout files, both are designed to work with Mentor's PADS Layout. These are ASCII input files, which can actually be imported into a number of tools... but I use PADS. The two files are useful for different cases.Case 1: Connected Microstrip/ Stripline ComponentsComponents such as Wilkinson combiners, or certain filters, are made up of a number of interconnected microstrip components. The important part is that the microstrip is continuous. It is useful to make a decal (footprint) of just those microstrip components. Then, in a second "physical" schematic (I use DxDesigner, but another instance of TinyCAD could be used), this decal of the microstrip can be used and linked to a schematic "Wilkinson" component. So the design is simulated and optimized in a "simulation" schematic, and then Mason generates a decal which can be imported into a "physical" schematic for the board layout. A normal two-way Wilkinson would be a three port "box", and the "physical" schematic would need to have a resistor across the two output ports.

Only the microstrip is described in this decal from the "simulation" schematic. Anything that is attached to a simulation port, or a lumped element part
(e.g. 0402 resistor), will be routable in the layout and available as a "physical" schematic
pin. The second "physical" schematic would have the lumped elements defined in it. This is the most useful flow I've worked out for a couple of reasons:

The Bill of Materials for all placed components is in a single schematic

Layout tools do not handle linking to multiple schematics well. Synchronizing with one tends to delete components from the other.

The drawbacks are:

The resistor values aren't linked between simulation and physical schematics

This file follows the pattern filename.asccombined.asc

Case 2: Amplifiers, and other complex designsAnother output treats each microstrip component as a separate part in the layout. This is useful when parts are not continuous, for example the input and output matching elements for an amplifier. Importing a circuit such as this will provide layouts where the microstrip components are accurately placed in relation to each other, and the lumped elements will also be imported with appropriate net connections. In contrast with the Wilkinson example above, rather than having a single decal for the entire structure, each microstrip line, bend, tee, and curve will have its own decal defined.

This file follows the pattern filename.asc

Mason Extension Tools
Mason generates a few other files which help extend its usability. These aren't in the primary work flow but could be useful to some.

For example, Mason can take a circuit design and output a new dynamic component: the microstrip tee-junction was created in this way. Dynamic components are components that can be defined (or approximated) purely in algebra. While the tee-junction can be represented with a handful of components, it's painful to solve the algebra by hand. Fortunately, I had a tool that implicitly solved that algebra... I just made it explicit.

Also, Mason can take a circuit design and output a Matlab/Octave m-file whose input arguments are the variables of the circuit and whose outputs are the S-Parameters. This may be useful for people who primarily have a Matlab work flow, but want to fold in a circuit model without the pain of hand calculations. I haven't had a need for this, but it was trivial once I wrote the code for dynamic components.

Final Word: Sub-circuitsI don't really use sub-circuits. It's not something to neglect in a "general-purpose" code, I suppose, and I did spend a fair amount of effort making it so I can next subcircuits. However, I tend to use multiple pages in TinyCAD for large designs, rather than break the circuit up into a bunch of subcircuits. If I need to reuse a part of the circuit a bunch of times, I use Mason to generate a new dynamic component that encapsulates what would otherwise be a sub-circuit.

I actually have a reason for this, something that bothered me in other work flows. Let's say I have certain variables I want to flow from the top down, global variables if you will. These might be fixed physical dimensions, or electrical properties that are used in calculations; let's say they're our microstrip properties. But, I also have local variables that should take precedence over some global variables- variables that are optimized locally to make the subcircuit work; what if my subcircuit happens to have the same variable "ms_width_1". It is generally accepted that local variables trump global variables... but we have created the potential for name conflicts and unintended behavior. It takes effort to make sure our variables are copacetic. Proper coding standards should be that we keep a defined "barrier" between the internals of the subcircuit and the externals of the calling circuit- which is the philosophy behind creating a new dynamic component rather than using subcircuits.

A second problem with subcircuits: the temptation of reuse between multiple projects. Reuse is often a good thing, but the concern is that multiple projects can link to a subcircuit and optimize the internal values. What may be optimal for one project might ruin the performance for the other. If one pulls the optimization variables out of the subcircuit, it eliminates the one useful thing about the subcircuit... one can optimize a subcircuit independent of the rest of the design. Of course, one can have a shell schematic with just the optimization variables and the subcircuit... but what if...

The final problem I have with reuses is what if you want to use the same circuit multiple times, but allow each to be somewhat independently optimized. Every Wilkinson along a corporate feed structure (seven Wilkinson subcircuits in an eight-way splitter) doesn't necessarily have to share the same parameters, in particular if the input impedance is not equal to the output impedance. The world is not perfect 50-ohm inputs.