`timescale 1ns / 100ps
module top;
bit a;
bit [2:0] bin;
bit lock;
bit clk;
initial begin
$timeformat(-9,0,"ns",8);
clk <= 0;
forever #5 clk = !clk;
end
initial begin
repeat(100) begin
@(posedge clk);
std::randomize(a);
end
$finish;
end
always @ (posedge clk) begin
bin <= { bin[1:0], a };
if(bin == 'b110) lock <= 1;
if(bin == 'b111) lock <= 0;
end
property check_lock;
@(posedge clk) (bin == 'b110) |=> lock throughout (bin == 'b111)[->1];
endproperty
property check_lock_deassertion;
@(posedge clk) (bin == 'b111) && lock |=> $fell(lock);
endproperty
check_lock_assertion : assert property (check_lock);
check_lock_de_assertion : assert property (check_lock_deassertion);
initial
$monitor("%0t - Lock:%0d A:%0d B:%0b",$time,lock,a,bin);
endmodule: top
Subscribe to:
Post Comments (Atom)
Generating prime numbers between 1 to 100
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 class test ; int prime_q[$]; function voi...
-
Following is the SV code for knight tour. On each randomisation, we get the next position of knight. The concept is simple, based on which w...
-
Array of size 100 You have elements from 100 to 199 randomly shuffled. One number is replaced with another number in the same range .. Fin...
No comments:
Post a Comment