Mach-TA Tutorial 

Updated September 25, 2004


Introduction

Mach-TA is Mentor Graphics fast timing analysis tool.  At Notre Dame, it currently runs only under the Solaris operating system.  This is a quick intro to Mach-TA--another tutorial will follow illustrating additional features.

Simulating a Combinational Circuit: NAND gate

source /usr/local/src/idea_en2002/machta/.mentor_en2002

mpa -t $ADK/technology/mta/ami05 -tc TYP nand.sp

Because we'll be using the AMI 0.5 micron process frequently, we've created a shell script in the course directory to invoke mpa with the settings for this process.  The script is in the directory /usr/local/courses/cse/cse462.01/cad/bin and is called mpa05.  Add this directory to your path in your .cshrc file, and then you can simply invoke mpa on the nand gate as

mpa05 nand.sp

The first time you run Mach-TA on the circuit, you may get an error "Cannot update file nand.spdo". Ignore it.


L a
L b
run 10

The node voltages in the Signal View should now change.  In particular, the value for "out" should now be 5 volts.

CODEFILE
UNITS nS
RISE_TIME .5
FALL_TIME .5
INPUTS a, b;
OUTPUTS out(to=max);
CODING(ROM)
# start vectors
@0 <00>1;
@10 <01>1;
@20 <10>0;
@30 <11>0;
END

Using the Waveform Viewer (SimWave)

Hierarchical Design and Subcircuits

.subckt name portlist
netlist
.ends

where name is the name of the subcircuit, portlist is a list of all the ports on the netlist (including VDD and GND), and netlist is the list of interconnected devices on nets, where the nets that are ports have the same names as defined in portlist.  For example, a subcircuit for a 2-input NAND gate, using the same schematic as the example above, would be:

*file: nand2.sp

.subckt nand2 a b out vdd gnd
m1 out a vdd vdd p L=0.5u W=5u
m2 out b vdd vdd p L=0.5u W=5u
m3 out a n1  gnd n L=0.5u W=5u
m4 n1  b gnd gnd n L=0.5u W=5u
.ends

Similarly, we can define a subcircuit for an inverter

*file: inv.sp

.subckt inv in out vdd gnd
m1 out in vdd vdd p L=0.5u W=5u
m2 out in gnd gnd n L=0.5u W=5u
.ends

xinstance_name portmap subcircuit_name

All instances of subcircuits must begin with "x" (like all MOSFETS begin with "m" or capacitors begin with "c").  The portmap is the list of nets--in order--to which each of the ports in the portlist of the subcircuit are connected.  Finally subcircuit_name is the name of the subcircuit being instantiated.  The figure below illustrates the AND gate composed of instances of "nand2" and "inv".  Note that devices and nets defined within a subcircuit are local to the subcircuit; hence the net "n1" within "nand2" is not the same net as "n1" defined in and2.  Also note that it's possible to define subcircuits that instantiate other subcircuits within them, to form a hierarchy of subcircuits.

*file: and2.sp

.model n nmos
.model p pmos

Vvdd vdd 0 5
Vgnd gnd 0 0

.include nand2.sp
.include inv.sp

xnand2_1 IN1 IN2 n1  vdd gnd nand2
xinv_1   n1  OUT vdd gnd inv

.end

Simulating a Sequential Circuit: Counter

  • In order to simulate a sequential circuit, you need a clock. While it's possible to define a clock as an input signal in a test vector file, this is awkward. A better way is to define the clock as a pulse train separate from the test vectors, and to specify only the combinational inputs and outputs in the vector file. For this example we'll consider a 2-bit counter with asynchronous reset.
  • To begin, copy the file count2.sp (which was extracted from the counter in the automatic layout tutorial) to your working directory and invoke Mach TA on it as above.
  • A test vector file, count2.tv, is shown below. Note that the only input to the circuit is the reset signal, r. Also note that the period for sequencing through the test vectors is 10 nS.
# count2.tv
CODEFILE
UNITS nS
RISE_TIME .5
FALL_TIME .5
INPUTS r;
OUTPUTS q1(to=max), q0(to=max);
CODING(ROM)
# start vectors
@0 <1>00;
@10 <0>01;
@20 <0>10;
@30 <0>11;
@40 <0>00;
END
  • Define the clock by entering a "pulse" statement in the Mach TA command window as shown below. Since a new test vector is applied every 10 nS, we define the clock to have the same period. The clock rising edge should be asserted, however, in the middle of each cycle. To do so, we simply delay the clock pulse by 5 nS.

 pulse v(clk) clk gnd pulse(0 5 5n .5n .5n 5n 10n)

# ------------------------(Vlo Vhi delay trise tfall delay period)

  • You can now run the test vector file and plot the results as before.

Power Measurement

Suppose that you want to measure the total power dissipation between 0 and 40 ns in simulating the counter. Use the following command before running the test vector file:

measure irms RMS I(Vvdd) from=0n to=40n