3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-04-27 23:45:50 +00:00

Add formal_bind example

Demonstrate binding SVA properties to a VHDL design.
Mention example code (with snippets) in section on Verific.
This commit is contained in:
Krystine Sherwin 2024-03-05 15:29:08 +13:00
parent 5c649c8e75
commit 549c5f33f5
No known key found for this signature in database
5 changed files with 89 additions and 0 deletions

1
docs/examples/vhd/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
formal_bind*/

View file

@ -0,0 +1,20 @@
[tasks]
bmc
cover
[options]
bmc: mode bmc
cover: mode cover
depth 16
[engines]
smtbmc bitwuzla
[script]
verific -vhdl updowncount.vhd
verific -sv formal_bind.sv
prep -top updowncount
[files]
updowncount.vhd
formal_bind.sv

View file

@ -0,0 +1,10 @@
module formal_bind(input clk, rst, up, down, [3:0] count);
initial assume(rst);
assert property(@(posedge clk) count != 4'd15);
cover property(@(posedge clk) count == 4'd10);
endmodule
bind updowncount formal_bind fb_inst(.*);

View file

@ -0,0 +1,33 @@
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
entity updowncount is
port (
rst, clk : in std_logic ;
up, down : in std_logic ;
o: out std_logic_vector(0 to 3)
);
end updowncount;
architecture rtl of updowncount is
signal count : std_logic_vector(0 to 3) := "0000";
begin
process(clk)
begin
if (rising_edge(clk)) then
if (rst = '1') then
count <= "0000";
else
if (up = '1' and count <= "1010") then
count <= count + "0001";
end if;
if (down = '1' and count > "0000") then
count <= count - "0001";
end if;
end if;
end if;
end process;
o <= count;
end rtl;