SV Assertions
SV Assertions
sv Page 1
// Property to check rising edge of 'data' within 5 clock cycles after reset deas
sertion
property check_data_rise_after_reset;
@(posedge clk) disable iff (reset)
(reset == 0) |-> ##[1:5] (data == 1);
endproperty
Question 2:Write a SystemVerilog assertion to verify that the signal data remains st
able (unchanged) for at least 4 clock cycles after the signal start is high.
Question 3:Write an assertion that ensures the signal valid transitions from 0 to 1
only after the signal ready has been 1 for at least 3 clock cycles.
// Property to check that 'valid' can only go high after 'ready' has been hig
h for 3 cycles
property valid_transition_check;
@(posedge clk) disable iff (reset)
(ready==1) ##[2:4] (valid==1);
endproperty
// Property to check that at least one of 'a', 'b', or 'c' is high, but not mo
re than one
property one_high_at_a_time;
@(posedge clk) disable iff (reset)
(a || b || c) && ! (a && b) && ! (b && c) && ! (a && c);
endproperty
Question 5:Write an assertion that checks that a signal data follows a certain patte
ASSERTIONS.sv Page 2
rn: 1 cycle low, 2 cycles high, 1 cycle low, repeating for 10 cycles.
property data_out_reset_check;
@(posedge clk) disable iff (!reset)
reset==1 |-> (data_out == 0);
endproperty
property sync_check;
@(posedge clk_b) disable iff (reset)
(data_valid_a == 1) |-> ##1 [data_valid_b == 1);
endproperty
Question 8:In a FIFO design, write an assertion to ensure that the FIFO's empty sign
al is high when the FIFO is empty and the full signal is high when t he FIFO is full.
Assume that the FIFO is 16 entries deep.
property fifo_empty_full_check;
@(posedge clk) disable iff (reset)
(fifo_depth==0) |-> fifo_empty = 1;
(fifo_depth == 16) |-> fifo_full = 1;
endproperty
Question 9:Write an assertion that checks if a parallel bus data_bus [7:0] is stable
ASSERTIONS.sv Page 3
for 3 cycles when the signal data_valid is high. The bus should not change during thi
s time, and any change should be flagged as an error.
property data_bus_stability;
@(posedge clk) disable iff (reset)
data_valid == 1 |-> ##[2] (data_bus==$past (data_bus, 2));
endproperty
Question 10:In a design, an asynchronous reset signal reset should clear all flip-fl
ops (ff_reset). However, there is a requirement that the reset signal should be deasse
rted for at least 3 cycles before the registers are allowed to change their state. Wri
te an assertion to ensure this condition.
property reset_deassertion_check;
@(posedge clk) disable iff (reset)
reset==0 |-> ## [3] (ff_reset == 0);
endproperty
// Assertion to ensure the reset deassertion timing
assert property (reset_deassertion_check)
else $fatal ("Reset was deasserted too soon, not enough cycle
s for registers to settle.");