Browse Source

Add example for dlatchsr error

T. Meissner 5 months ago
parent
commit
445c013e5c
4 changed files with 102 additions and 0 deletions
  1. 7
    0
      dlatchsr/Makefile
  2. 42
    0
      dlatchsr/dlatch.vhd
  3. 17
    0
      dlatchsr/dlatch_f.sby
  4. 36
    0
      dlatchsr/dlatch_t.sv

+ 7
- 0
dlatchsr/Makefile View File

@@ -0,0 +1,7 @@
1
+.PHONY: dlatch
2
+dlatch: dlatch.vhd dlatch_t.sv dlatch_f.sby
3
+	sby -f -d work dlatch_f.sby
4
+
5
+.PHONY: clean
6
+clean:
7
+	rm -rf work

+ 42
- 0
dlatchsr/dlatch.vhd View File

@@ -0,0 +1,42 @@
1
+library ieee;
2
+use ieee.std_logic_1164.all;
3
+use ieee.numeric_std.all;
4
+
5
+
6
+
7
+entity dlatch is
8
+  generic (
9
+    Init : std_logic_vector(31 downto 0) := x"DEADBEEF"
10
+  );
11
+  port (
12
+    Reset_n_i : in  std_logic;
13
+    Clk_i     : in  std_logic;
14
+    Wen_i     : in  std_logic;
15
+    Data_i    : in  std_logic_vector(15 downto 0);
16
+    Data_o    : out std_logic_vector(31 downto 0)
17
+  );
18
+end entity dlatch;
19
+
20
+
21
+
22
+architecture rtl of dlatch is
23
+
24
+
25
+begin
26
+
27
+
28
+  process (Reset_n_i, Clk_i) is
29
+  begin
30
+    if (Reset_n_i = '0') then
31
+      Data_o <= Init;
32
+    elsif (rising_edge(Clk_i)) then
33
+      if (Wen_i = '1') then
34
+        Data_o(7 downto 0) <= Data_i(7 downto 0);
35
+	Data_o(23 downto 16) <= Data_i(15 downto 8);
36
+      end if;
37
+    end if;
38
+  end process;
39
+
40
+
41
+end architecture rtl;
42
+

+ 17
- 0
dlatchsr/dlatch_f.sby View File

@@ -0,0 +1,17 @@
1
+[options]
2
+mode prove
3
+depth 20
4
+# falis with multiclock disabled
5
+multiclock off
6
+
7
+[engines]
8
+smtbmc
9
+
10
+[script]
11
+verific -vhdl dlatch.vhd
12
+verific -formal dlatch_t.sv
13
+prep -top dlatch_t
14
+
15
+[files]
16
+dlatch.vhd
17
+dlatch_t.sv

+ 36
- 0
dlatchsr/dlatch_t.sv View File

@@ -0,0 +1,36 @@
1
+module dlatch_t (
2
+    input         Reset_n_i,
3
+    input         Clk_i,
4
+    input         Wen_i,
5
+    input  [15:0] Data_i,
6
+    output [31:0] Data_o
7
+);
8
+
9
+
10
+  `define INIT_VALUE 32'hDEADBEEF
11
+
12
+
13
+  dlatch #(.Init(`INIT_VALUE)) dlatch_i (
14
+    .Reset_n_i(Reset_n_i),
15
+    .Clk_i(Clk_i),
16
+    .Wen_i(Wen_i),
17
+    .Data_i(Data_i),
18
+    .Data_o(Data_o)
19
+  );
20
+
21
+
22
+  reg init_state = 1;
23
+
24
+  always @(*)
25
+    if (init_state) assume (!Reset_n_i);
26
+
27
+  always @(posedge Clk_i)
28
+    init_state = 0;
29
+
30
+
31
+  always @(*)
32
+    if (!Reset_n_i) assert (Data_o == `INIT_VALUE);
33
+
34
+
35
+endmodule
36
+