CORE Generator
Creating a Test Bench for a Verilog Design Containing Cores
To simulate a design containing a core, create a test bench file. The test bench should instantiate the top level module and should contain stimuli to drive the input ports of the design. The following example displays the framework for a test bench file used to simulate a design, with some sample simulation stimuli. The test bench file is named adder_tb.v.
Verilog Test Bench File:  adder_tb.v
 
’timescale 1 ns/1 ps
module adder_tb;
reg CLKT;
reg C_INT;
reg [7:0] AT;
reg [7:0] BT;
wire [8:0] QT;
/* Instantiation of top level design */
myadder8_top uut (
.A_P(AT),
.B_P(BT),
.C_INP(C_INT),
.Q_P(QT),
.CLK_P(CLKT)
);
/* Add stimulus here */
always #10 CLKT = ~CLKT;
initial begin
$timeformat(-9,3,"ns",12);
end
initial begin
C_INT = 0;
AT = 0;
BT = 0;
CLKT = 1;
#100
AT = 8’b10000000;
BT = 8’b00000001;
#40;
AT = 8’b11100001;
#40
BT = 8’b00000010;
#1000 $stop;
// #1000 $finish;
end
/* end stimulus section */
See Also

© Copyright 1995–2009, Xilinx® Inc. All rights reserved.