Académique Documents
Professionnel Documents
Culture Documents
RTL
moduledff(clk,reset,din,dout);
inputclk,reset,din;
outputdout;
logicdout;
always@(posedgeclk,negedgereset)
if(!reset)
dout<=0;
else
dout<=din;
endmodule
moduleones_counter(clk,reset,data,count);
inputclk,reset,data;
output[0:3]count;
dff
dff
dff
dff
d1(clk,reset,data,count[0]);
d2(count[0],reset,~count[1],count[1]);
d3(count[1],reset,~count[2],count[2]);
d4(count[2],reset,~count[3],count[3]);
endmodule
Test Plan :
Block Diagram
Verification environment
hierarchy
TOP
|-- Clock generator
|-- Dut Instance
|-- Interface
|-- Assertion block instance ( assertion coverage)
|-- Testcase instance
|-- Environment
|-- Driver
| |-- Stimulus
| |-- Covergroup
|-- Monitor
|-- Scoreboard
Testbench Components
Stimulus
Stimulus is a single bit value.
classstimulus;
randbitvalue;
constraintdistribution{valuedist{0:=1,1:=
1};}
endclass
Driver
This driver consists of reset and drive
method.
Reset method resets the DUT and drive
method generates the stimulus and sends it
to DUT.
Driver also calculates the expected DUT
output and stores in scoreboard.
Coverage is also sampled in this
component.
Feature 1 and 2 which are mentioned in
Testplan are covered in this cover group.
classdriver;
stimulus sti;
Scoreboard sb;
covergroupcov;
Feature_1:coverpointsb.store;
Feature_2:coverpointsb.store{binstrans=(15=>0);}
endgroup
virtualintf_cnt intf;
functionnew(virtualintf_cnt intf,scoreboard sb);
this.intf=intf;
this.sb=sb;
cov=new();
endfunction
taskreset();// Reset method
intf.data=0;
@(negedgeintf.clk);
intf.reset=1;
@(negedgeintf.clk);
intf.reset=0;
@(negedgeintf.clk);
intf.reset=1;
endtask
taskdrive(inputintegeriteration);
repeat(iteration)
begin
sti=new();
@(negedgeintf.clk);
if(sti.randomize())// Generate stimulus
intf.data=sti.value;// Drive to DUT
cov.sample();
end
endtask
Monitor
The monitor collects the DUT output and then gets the expected value from the
score board and compares them.
classmonitor;
scoreboard sb;
virtualintf_cnt intf;
Assertion Coverage
moduleassertion_cov(intf_cnt intf);
F3:coverproperty(@(posedgeintf.clk)
(intf.count!=0)|->intf.reset==0);
endmodule
Scoreboard
Environment
classenvironment;
driver drvr;
scoreboard sb;
monitor mntr;
virtualintf_cnt intf;
functionnew(virtualintf_cnt intf);
this.intf=intf;
sb=new();
drvr=new(intf,sb);
mntr=new(intf,sb);
fork
mntr.check();
join_none
endfunction
endclass
Interface
interfaceintf_cnt(inputclk);
wireclk;
wirereset;
wiredata;
wire[0:3]count;
endinterface
Top
moduletop();
regclk=0;
initial// clock generator
forever#5clk=~clk;
// DUT/assertion monitor/testcase instances
intf_cnt intf(clk);
ones_counterDUT(clk,intf.reset,intf.data,intf.count);
testcase test(intf);
assertion_cov acov(intf);
endmodule
Tests
programtestcase(intf_cnt intf);
environment env=new(intf);
initial
begin
env.drvr.reset();
env.drvr.drive(10);
end
endprogram
Coverage Report
Tests
programtestcase(intf_cnt intf);
environment env=new(intf);
initial
begin
env.drvr.reset();
env.drvr.drive(100);
env.drvr.reset();
env.drvr.drive(100);
end
endprogram
Simulation Report
is0001
is0001
is0001
is0001
is0010
is0011
is0100
Phases of Verification
Verification Plan:
Test plan includes, introduction,
assumptions, list of test cases, list of
features to be tested, approach,
deliverables, resources, risks and
scheduling, entry and exit criteria.
Test plan helps verification engineer to
understand how the verification should be
done. A test plan could come in many
forms, such as a spreadsheet, a document
or a simple text file.
Building Testbench:
Writing Tests:
Analyze coverage:
Thank You!