2.0 APPLICATIONS The Comit-TX can be used to extract testbenches
for any sub- module or sub-system of a system provided a system level
testbench exists. Here is an interesting question which must be answered
before going further! When the sub-system for which the testbench is
to be extracted was part of the full-system, it was verified and validated
anyway! What is that we are achieving extra by extracting and re-testing
that sub-module? The answer is there are many possible scenarios where
it may be very helpful and in fact nece- ssary to test the sub-module
stand-alone! Here are a few cases.
1.
Even if the sub-system was validated as part of the system, a method
is required to demonstrate to the customer that the sub-system really
does what it is intended to do, as a stand-alone entity.
2.
The sub-system or sub-module as a stand-alone entity may be subject
to some modifications and/or optimi- zations that could not be done
when it was part of the full system. Now, we need to make sure that
the beha- vior of the sub-system didn't change because of the optimizations
and/or modifications.
3.
Say, in a big system some of the modules could have been represented
at higher levels of abstraction and the system specifications, including
timing, were frozen. When these modules are replaced by RTL or structural
level design to include all the details, we need to make sure that
the module behaves exactly as it's higher level counter part does.
In
all the above cases the testbench extractor can help, by automatically
extracting the testbench from the system- level testbench and setting
tests to detect any deviations in the behavior and promptly reporting
them.
3.0 USAGE The system task used to extract the testbench is $comit_tx.
This new system task is obtained by integrating Comit-TX PLI with the
Verilog-XL. For extracting the testbench the system task needs the hierarchical-name
of the instance for which to extract the testbench and the non-hierarchical
name of the sub-system. Also if the sub-system under consideration has
bidirectional ports, the designer is expected to specify them along
with their control signals, and the logic values of the control signals
at which the bidirectional bus acts as input.
3.1 ARGUMENTS
$comit_tx(instance_name,
sub_module_name, [inout_count]
[io_1], [ctl_1],
[cval_1], ...,
[io_n], [ctl_n],
[cval_n]);
instance_name
: Hierarchical instance name of the sub- system for which
the testbench is to be extracted.
sub_module_name:
Non-hierarchical name of the sub-system for which
the testbench is to be extracted.
io_cnt:
The count of the bidirectional (inout) signals.
io_n
: Non-hierarchical name of the bidirectional signal.
ctl_n
: Non-hierarchical name of the control signal of io_n.
cval_n:
Value of the ctl_n signal at which io_n would act as
input.
3.2 ARGUMENT SPECIFICATION EXAMPLES Typically the $comit_tx would
be called from within an initial block. 3.2.1 Without any bidirectional
signals the call to $comit_tx would appear as:
initial
begin
$comit_tx("test.micro.ALU.mult", "multiplier");
...
end
3.2.2
With a bidirectional signal the call to $comit_tx would appear as:
initial
begin
$comit_tx("test.micro.CTL",
"controller",
1, "io1", "ctl1", 1);
....
end
4.0
INPUTS & OUTPUTS In the following discussion, Comit-TX is
used to mean Verilog-XL with Comit-TX PLI integrated.
4.1 INPUTS The following are the inputs to the Comit-TX that shall be
required for extracting the testbench.
1.
The Verilog model of the System.
2.
The system level testbench with $comit_tx called with appro- priate
arguments.
4.2 OUTPUTS
The outputs from the extractor are:
1. instance.v: Contains the top level test module with all
the declarations and instantiation of the module. This file also
contains a statement to include instance.vlg
2. instance.vlg: This file contains the actual testbench
and and the self-testing commands.
When
the module under test is simulated with the extracted testbench a report
(instance.rpt) is generated. This report contains difference,
if any, in the behavior of the module when simulated independently and
when simulated as part of the system.
5.0 INTEGRATION WITH VERILOG-XL The Comit-TX is generated
by integrating TX PLI with Verilog-XL, by running the script create_vlg.pl
from the directory where comit_tx.o file exists.
A
full_adder.v
B full_adder_tb.v
C H1.v & H1.vlg
D H1.rpt
Appendix
A: full_adder.v
/**********************************************************
* Design : Full Adder *
* Purpose: To be used as an example in the Testbench *
* eXtractor [TX] document. *
* Author : Venkat Talapaneni *
* Date : October 29, 1997. *
**********************************************************/
`timescale
100ps/1ps
module
full_adder(carry_out, sum, carry_in, in2, in1);
input in1; // First Addend
input in2; // Second Addend
input carry_in; // Input Carry
output [1:0] sum; // Sum
output carry_out; // Output Carry
half_adder
H1 (carry, sum[0], in2, in1);
half_adder H2 (carry_out, sum[1], carry, carry_in);
endmodule
module
half_adder(carry, sum, in1, in2);
input in1;
input in2;
output carry;
output sum;
xor X1 (sum, in1, in2);
and A1 (carry, in1, in2);
endmodule
Appendix
B: full_adder_tb.v
/**********************************************************
* Design : Testbench for Full Adder (see add.v) *
* Purpose: To be used as an example for illustrating the *
* Testbench eXtractor [TX] operation. *
* Author : Venkat Talapaneni *
* Date : October 29, 1997 *
**********************************************************/
module test;
reg in2, in1, carry_in;
wire [1:0] sum;
wire carry_out;
full_adder I1 (carry_out, sum, carry_in, in2, in1);
always
begin
#10 in1 = ~in1;
end
always
begin
#20 in2 = ~in2;
end
always
begin
#40 carry_in = ~carry_in;
end
initial
begin
$display("\t\t TIME CIN IN2 IN1 COUT SUM\n");
$monitor($time,," %b %b %b %b %b",
carry_in, in2, in1, carry_out, sum);
// $comit_tx (Hierarchical_name_of_Instance, Non_hierarchical_name_of_module);
$comit_tx("test.I1.H1", "half_adder");
#0 in1=0; in2=0; carry_in=0;
#100 $finish;
end
endmodule
Appendix
C.1: H1.v
/**************************************************************
* *
* Testbench of half_adder *
* Generated by Testbench Extractor Version: 1.0 31/Oct/1997. *
* *
**************************************************************/
module H1_test;
reg in1;
reg in2;
wire carry;
reg exp_carry;
event txTest_carry;
wire sum;
reg exp_sum;
event txTest_sum;
integer report; // Report file
half_adder H1_tx(
.in1(in1),
.in2(in2),
.carry(carry),
.sum(sum));
initial
begin
report = $fopen("H1.rpt");
txApplyTests;
end
`include "H1.vlg"
end
endtask
endmodule
Appendix C.2: H1.vlg
/**************************************************************
* *
* Testbench of half_adder *
* Generated by Testbench Extractor Version: 1.0 31/Oct/1997. *
* *
**************************************************************/
always @(txTest_carry)
begin
#1;
if (carry !== exp_carry)
$fdisplay(report, "%t OUTPUT: carry exp: %b act: %b\n",
$time, exp_carry, carry);
end
always
@(txTest_sum)
begin
#1;
if (sum !== exp_sum)
$fdisplay(report, "%t OUTPUT: sum exp: %b act: %b\n",
$time, exp_sum, sum);
end
task
txApplyTests;
begin
#0 // 0
in1=1'b0;
in2=1'b0;
exp_carry=1'b0; ->txTest_carry;
exp_sum=1'b0; ->txTest_sum;
#1000
// 1000
in2=1'b1;
exp_sum=1'b1; ->txTest_sum;
#1000
// 2000
in1=1'b1;
in2=1'b0;
#1000
// 3000
in2=1'b1;
exp_carry=1'b1; ->txTest_carry;
exp_sum=1'b0; ->txTest_sum;
#1000
// 4000
in1=1'b0;
in2=1'b0;
exp_carry=1'b0; ->txTest_carry;
#1000
// 5000
in2=1'b1;
exp_sum=1'b1; ->txTest_sum;
#1000
// 6000
in1=1'b1;
in2=1'b0;
#1000
// 7000
in2=1'b1;
exp_carry=1'b1; ->txTest_carry;
exp_sum=1'b0; ->txTest_sum;
#1000
// 8000
in1=1'b0;
in2=1'b0;
exp_carry=1'b0; ->txTest_carry;
Appendix D: H1.rpt
+------------------------------------------------------+
| THIS FILE IS NULL BECAUSE THE ACTUAL BEHAVIOR OF THE |
| HALF-ADDER WAS IDENTICAL TO WHAT WAS EXPECTED! |
+------------------------------------------------------+
However,
the format of the report is:
TIME
signal_name actual_val expected_value