|HOME |ABOUT |ARTICLES |ACK |FEEDBACK |TOC |LINKS |BLOG |JOBS |


Tutorials



ENV



Env is a module which contains all the components of verification. A logic to increment the error counter.
Take a Driver instance and creat four reciever instancess. connect it to specific port.
Creat instance of scoreboard
Call then packet gen and drive task in driver
Creat a finish task which display the tesults of the test.


CODE:env.v

module sw_tb(clock,
packet_valid,
data ,
data_0 ,
data_1 ,
data_2 ,
data_3 ,
ready_0 ,
ready_1 ,
ready_2 ,
ready_3 ,
read_0 ,
read_1 ,
read_2 ,
read_3
);
input clock;
output packet_valid;
output [7:0] data;
input [7:0] data_0;
input [7:0] data_1;
input [7:0] data_2;
input [7:0] data_3;
input ready_0;
input ready_1;
input ready_2;
input ready_3;
output read_0;
output read_1;
output read_2;
output read_3;
reg pkt_status;
integer error_count=0;
event error;

//Incriment the error counter on error.
always@(error)
begin
#0 error_count=error_count+1;
$display(" ERROR RECIVED");
end

// Driver instance
driver dv(clock,packet_valid,data,busy);

// Make four reciever instancess. connect it to specific port.
receiver rec0(.clk(clock),.data(data_0), .ready(ready_0),
.read(read_0),
.port(0)
);
receiver rec1(.clk(clock),.data(data_1), .ready(ready_1),
.read(read_1),
.port(1)
);
receiver rec2(.clk(clock),.data(data_2), .ready(ready_2),
.read(read_2),
.port(2)
);
receiver rec3(.clk(clock),.data(data_3), .ready(ready_3),
.read(read_3),
.port(3)
);

// Creat instance of scoreboard
scoreboard sb();

// Call then packet gen and drive task in driver
initial
begin
#100;
dv.gen_and_drive(9);
#1000;
finish;
end

// finish task which display the tesults of the test.
task finish();
begin
if(error_count!=0)
$display("############# TEST FAILED ###############");
else
$display("############# TEST PASSED ###############");

$finish;
end
endtask

endmodule









Index
Dut Specification
Rtl
Top
Packet
Driver
Reciever
Scoreboard
Env

Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!





<< PREVIOUS PAGE

TOP

NEXT PAGE >>

copyright 2007-2017 :: all rights reserved www.testbench.in::Disclaimer