Professional Documents
Culture Documents
Da1 Verification
Da1 Verification
Da1 Verification
input clk,a,rst;
output q;
reg q;
always@(posedge clk)
begin
if(rst)
cs=2'b00;
else
cs=ns;
end
always@(a or cs)
begin
case(cs)
s0:begin
if(a)
begin
ns=s1;
q=0;
end
else
begin
ns=s0;
q=0;
end
end
s1:begin
if(a)
begin
ns=s1;
q=0;
end
else
begin
ns=s2;
q=0;
end
end
s2:begin
if(a)
begin
ns=s1;
q=1;
end
else
begin
ns=s0;
q=0;
end
end
endcase
end
endmodule
SELF-CHECKING TESTBENCH
module seqtestbench();
reg a,clk,rst;
wire q;
reg [1:0] cs=2'b00,ns=2'b00;
parameter s0=2'b00,s1=2'b01,s2=2'b10;
reg new_q;
initial
begin
rst=1'b1;
clk=0;
#20 rst=1'b0;
end
always #5 clk=~clk;
initial
begin
repeat(30)
begin
test_vector();
if(q==new_q)
begin
end
else
end
$stop;
end
task test_vector();
begin
a=$random;@(posedge clk);
end
endtask
always@(posedge clk)
begin
if(rst)
cs=2'b00;
else
cs=ns;
end
always@(a or cs)
begin
case(cs)
s0:begin
if(a)
begin
ns=s1;
new_q=0;
end
else
begin
ns=s0;
new_q=0;
end
end
s1:begin
if(a)
begin
ns=s1;
new_q=0;
end
else
begin
ns=s2;
new_q=0;
end
end
s2:begin
if(a)
begin
ns=s1;
new_q=1;
end
else
begin
ns=s0;
new_q=0;
end
end
endcase
end
endmodule
a is the input sequence, q is the output of the DUT and q_out is the self-checking test bench output to
compare with the actual output of DUT.
TRANSCRIPT WINDOW
input clk,a,rst;
output q;
reg q;
parameter s0=2'b00,s1=2'b01,s2=2'b10;
always@(posedge clk)
begin
if(rst)
cs=2'b00;
else
cs=ns;
end
always@(a or cs)
begin
case(cs)
s0:begin
if(a)
begin
ns=s1;
q=0;
end
else
begin
ns=s0;
q=0;
end
end
s1:begin
if(a)
begin
ns=s1;
q=0;
end
else
begin
ns=s2;
q=0;
end
end
s2:begin
if(a)
begin
ns=s1;
q=0;
end
else
begin
ns=s0;
q=1;
end
end
endcase
end
endmodule
OUTPUT WAVFORM OF SEQUENCE DETECTOR WITH A BUG
TRANSCRIPT WINDOW
Here we can see the testbench indicates wrong sequence is being detected
output q;
Endmodule
ALL THE PORTS OF RTL CODE AND ITS NETLIST ARE MATCHED
VERIFICATION OF RTL AND IMPLEMETED DESIGN
REFERENCE DESIGN
IMPLEMENTED DESIGN
b) Perform Logic equivalence check between the buggy RTL code
and the netlist generated using bug free RTL code and show the
results.
LOGIC EQUIVALENCE CHECKING BETWEEN RTL WITH BUG AND BUGFREE RTL NETLIST
Matching analysis
Here the 3 ports of reference are not matched to the implemented design.
Verification analysis