In reply to sai_pra99:
I have made all the possible changes and modifications as you have mentioned
Sorry, but you did not do the changes I asked.
I can’t debug your code, but I’ll give you pointers about your style that is Verilog instead of SystemVerilog.
- Below is a SystemVerilog style port list
typedef enum{IDLE, SETUP_PHASE,ACCESS_PHASE} state_fsm;
//*******************Program**************************
module APB_assertions
#(D_WIDTH=16,A_WIDTH=8,DEPTH=16)
(input logic p_clk, p_rstn,
input logic[A_WIDTH-1:0] p_addr, wr_data, rd_data,
input logic p_wren, trans,
input state_fsm state,
input logic out, p_ready, p_sel, p_enable,
input logic[A_WIDTH-1:0] tmp_addr, tmp_data);
- DO NOT use “reg”, use "logic’ // reg is not recommended for SystemVerilog.
- You still use sequences of one term. If you like this style because the name of the sequence is meaningful to you, then use the let instead. thus,
// instead of
sequence setup_state;
(state==SETUP_PHASE);
endsequence
// USE
let setup_state = (state==SETUP_PHASE);
- I did not see a clock generator in your testbench
- I see in your testbench a lot of directed tests. That is OK, but you are using blocking assignments (the var = a_value;) instead of nonblocking assignment; this is needed for the assertions to work. Specifically, for directed tests:
// BAD STYLE
initial
begin
p_rstn=0; p_ready=0; trans=0;
#20 p_rstn=1; trans=1; p_wren=1; wr_data=16'h3456; p_addr=8'h44;
#60 p_ready=1;
// USE
initial
begin
p_rstn<=0; p_ready<=0; trans<=0;
@(posedge clk) // assuming clk is your clock
p_rstn<=1; trans<=1; p_wren<=1; wr_data<=16'h3456; p_addr<=8'h44;
repeat(3) @(posedge clk) p_ready< =1;
//
/ Your clock gen
initial forever #10 clk=!clk; // fix the delay
- consider randomizing your variables. For example:
initial begin
repeat(200) begin
@(posedge clk);
if (!randomize(a, b) with
{ a dist {1'b1:=1, 1'b0:=1};
b dist {1'b1:=1, 1'b0:=2};
}) `uvm_error("MYERR", "This is a randomize error");
end
$finish;
end
Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact Home - My cvcblr
** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448
…
- SVA Package: Dynamic and range delays and repeats SVA: Package for dynamic and range delays and repeats - SystemVerilog - Verification Academy
- Free books: Component Design by Example https://rb.gy/9tcbhl
Real Chip Design and Verification Using Verilog and VHDL($3) https://rb.gy/cwy7nb
- Papers: