Using the VHDL Trace Component to Generate an input file for MachTA


1. Setup your environment for QSPro
 
The trace component is written in VHDL. It is possible to simulate VHDL in combination with regular gen_lib-based schematic, but it takes a tool called QSPro to do so. QSPro uses a different version of the VHDL simulator that is currently in the standard MGC environment, so we must modify our setup to accommodate this (make sure you are using the default VHDL simulator for all of your EGRE426 assignments - don't put this command in your .profile!):

>> . /mentor/c4/etc/qspro_setup.ksh


2. Create a "functional model" to simulate

In this example we will use Quicksim to generate a "dofile" for simulating the nor2 gate you built in Lab4 in MachTA.
1.1 Create a new directory for this lab and start DA:

>> cd egre429
>> mkdir lab9
>> cd lab9
>> da &

1.2 Use DA to create a schematic of a 2 input nor gate like the one shown below:
 
 

1.3 Now select the Choose Symbol button and navigate to the /mentor/examples/quicksim/trace_component and select the trace symbol and place it on the sheet. Add rippers from gen_lib and wires and busses so that the schematic looks like the one below:

Note that there is no ripper on out_port because the number_of_outputs property is set to 1, so it is in fact, not a bus, but a single wire. If number_of_outputs was greated than 1, rippers would be needed just as for the in_port.

Check and save the sheet and exit DA.

1.3 The VHDL trace component uses a file called names.dat to know what the names of each input signal that is connected to it is and what the names of the outputs of the component you will be simulating in MachTA. Note that the names of the signals in the names.dat file MUST match the names of the ports in the layout that you will simulate with MachTA - the names of the signals in the schematic used for functional simulation in QSPro do not matter. Also note the the inputs names must be listed in descending order. Use the text editor to create a file called names.dat in the SAME directory as the functional schematic you just created which contains the following three lines:

a
b
y
 
 

2. Simulate the "functional model" Using QSPro
2.1 Create a VHDL library and map the VHDL library where the trace component resides and then start the QSPro simulator on the example nor2 functional schematic you just created:

>> vlib work
>> vmap trace_lib /mentor/examples/quicksim/trace_component/work
>> qspro -tim typ nor2_test &

You will see both a Quicksim and a ModelSim window appear as shown below:

Bring the Quicksim window to the top and trace the inputs and outputs of the nor gate. Force values on the inputs to the nor gate and run the simulation. The trace should look like the one below.

Print out the trace window and exit QSPro by exiting the Quicksim window.

2.2 Examine the file test.do that was created by the trace component. You should see a file like this:

view wave
plot v(a)
plot v(b)
plot v(y)
run -tvend test.tv

Note that this file simply opens the wave window, plots the input and outputs, and runs the test vector file.

2.3 Open the file test.tv in a text editor. You should see a file like this:

CODEFILE
UNITS ns
RISE_TIME 1
FALL_TIME 1
INPUTS a,b ;
OUTPUTS y(to=max) ;
CODING(ROM)
# start
@0 <00>1 ;
@10 <11>0 ;
@20 <00>1 ;
@30 <01>0 ;
@40 <10>0 ;
@50 <11>0 ;
@60 <00>1 ;
@70 <01>0 ;
@80 <00>1 ;

Edit the file and add an END line at the end of the test vectors so that the file looks like this now:

CODEFILE
UNITS ns
RISE_TIME 1
FALL_TIME 1
INPUTS a,b ;
OUTPUTS y(to=max) ;
CODING(ROM)
# start
@0 <00>1 ;
@10 <11>0 ;
@20 <00>1 ;
@30 <01>0 ;
@40 <10>0 ;
@50 <11>0 ;
@60 <00>1 ;
@70 <01>0 ;
@80 <00>1 ;
END

Save and close the test vector file.

3. Use the file generated by the trace component to simulate the nor2 gate you created in lab 4
 
3.1 Move back to your lab 4 directory and copy the files created by the QSPro simulation to that directory:

>> cd ../lab4
>> cp ../lab9/test.do test.do
>> cp ../lab9/test.tv test.tv
 

3.2 Start the MachTA simulator on your nor2 design:

>> mta -t $ADK/technology/mta/ami05 -tc TYP mta_nor2.sp

Use the Tools->Run Commands menu item to bring up the Execute Command File dialog box. Use the Browse... button to select the test.do file and click OK. The MachTA simulator will run and produce a wave window like the one below (after using the Zoom Fit menu item or button):

You will notice that it is almost exactly like the trace from the functional simulation in QSPro. Also notice that in the MachTA main window you will see the following message:

Launching SimWave and loading database  .  Test Vector Time = 90ns
  TV_Results: file "test.tv" completed, total vectors = 9.
  TV_Results: no errors on 9 compared vectors.
  Done

This indicates that the values on the outputs compared correctly the the values specified in the test vector file. Viola, one validated design!