SVA Question

Guest
I am new to SVAs. I am trying to detect when a signal is a pulse (i.e.
either asserted or de-asserted for just one clock cycle). The signal
can change state, but I want it to remain in the state for at least 2
clock cycles. I may want to change this to at least n clock cycles
once I have the asertion working correctly. Below is the construct I
am using.

assert_packet_mem_afull_0_not_a_pulse:
assert property (@(posedge clk) disable iff(!reset_n) (!
packet_mem_afull_0_temp [*2:$] ##1 packet_mem_afull_0_temp [*2:$] ##1 !
packet_mem_afull_0_temp [*2:$]))
else $error ("ERROR: packet_mem_afull_0 was a pulse");

The signal I am monitoring is packet_mem_afull_0_temp. I am forcing
the signal to violate this assertion by de-asserting it for one clock
cycle when it is asserted and by asserting it for one clock cycle when
it is de-asserted. The stimulus is as follows: the signal powers up de-
asserted. It remains de-asserted for approximately 12,000 clock
cycles, then it asserts for 5 clock cycles, it de-asserts for one
clock cycle, then it asserts for 20 clock cycles, then it de-asserts
for 5 clock cycles, then it asserts for one clock cycle, then it de-
asserts for the rest of the simulation.

The assertion fires at the end of every cycle that the signal is
asserted and also one cycle after the signal is asserted for the final
time. The assertion does not fire at the end of cycles when the signal
is deasserted.

Any help would be greatly appreciated.

Brian
 
On Mon, 25 Aug 2008 09:09:22 -0700 (PDT), bmyrick8724@gmail.com wrote:

I am new to SVAs. I am trying to detect when a signal is a pulse (i.e.
either asserted or de-asserted for just one clock cycle).
I think it's a lot easier than you might expect.
Note the use of the sampled-value function $stable()
to find clock cycles in which the signal has changed.
If there's a change, !$stable() will be true.

// Property to check that "signal" never has pulses
// narrower than N clocks (N clocks wide is OK)
//
property no_narrow_pulse(signal, N);
!$stable(signal) |-> $stable(signal)[*N];
endproperty : no_narrow_pulse
//
assert property (
@(posedge clk) disable iff (!reset_n)
no_narrow_pulse(packet_mem_afull_0, 2)
);

HTH
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
On Mon, 01 Sep 2008 09:13:39 +0100, Jonathan Bromley wrote:

I am new to SVAs. I am trying to detect when a signal is a pulse (i.e.
either asserted or de-asserted for just one clock cycle).

I think it's a lot easier than you might expect.
Hah! It *is* easy, but only if you concentrate....
apologies for my silly error:

// Property to check that "signal" never has pulses
// narrower than N clocks (N clocks wide is OK)
//
property no_narrow_pulse(signal, N);
!$stable(signal) |-> $stable(signal)[*N];
endproperty : no_narrow_pulse
No, that's no good. Try this instead:

property no_narrow_pulse(signal, N);
!$stable(signal) |=> $stable(signal)[*(N-1)];
endproperty : no_narrow_pulse

Too many neurons killed-off by wine and warm weather on
my vacation last week :)
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

Welcome to EDABoard.com

Sponsor

Back
Top