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


Tutorials



PHASE 9 TESTCASE




In this phase we will write a constraint random testcase.
Lets verify the DUT by sending large packets of length above 200.

1) In testcase file, define a small_packet class.
This calls is inherited from the packet class and data.size() field is constraint to generate the packet with size greater than 200.



class small_packet extends packet;

constraint small_c { data.size > 200 ; }

endclass



2) In program block, create an object of the small_packet class.
Then call the build method of env.


small_packet spkt;


3) Pass the object of the small_packet to the packet handle which is in driver.


env.drvr.gpkt = spkt;


Then call the reset(),cfg_dut(),start(),wait_for_end() and report() methods as in the run method.


env.reset();
env.cfg_dut();
env.start();
env.wait_for_end();
env.report();



Source Code Of Constraint Testcase:


`ifndef GUARD_TESTCASE
`define GUARD_TESTCASE

class small_packet extends packet;

constraint small_c { data.size > 200 ; }

endclass

program testcase(mem_interface.MEM mem_intf,input_interface.IP input_intf,output_interface.OP output_intf[4]);

Environment env;
small_packet spkt;

initial
begin
$display(" ******************* Start of testcase ****************");
spkt = new();
env = new(mem_intf,input_intf,output_intf);
env.build();
env.drvr.gpkt = spkt;
env.reset();
env.cfg_dut();
env.start();
env.wait_for_end();
env.report();
#1000;
end

final
$display(" ******************** End of testcase *****************");

endprogram
`endif

(S)Download the phase 9 source code:


switch_9.tar
Browse the code in switch_9.tar


(S)Run the simulation:
vcs -sverilog -f filelist -R -ntb_opts dtm
urg -dir simv.cm








Index
Introduction
Specification
Verification Plan
Phase 1 Top
Phase 2 Environment
Phase 3 Reset
Phase 4 Packet
Phase 5 Driver
Phase 6 Receiver
Phase 7 Scoreboard
Phase 8 Coverage
Phase 9 Testcase

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