-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fwft-fifo & use that for vai-fifo; minor fixes
- Loading branch information
Showing
7 changed files
with
157 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
DUT := fwft_fifo | ||
SRC := ../fifo/fifo.vhd ${DUT}.vhd | ||
|
||
.PHONY: cover bmc prove synth all clean | ||
|
||
all: cover bmc prove | ||
|
||
cover bmc prove: ${DUT}.vhd symbiyosys.sby | ||
sby --yosys "yosys -m ghdl" -f -d work/${DUT}-$@ symbiyosys.sby $@ | ||
|
||
${DUT}_synth.vhd: ${SRC} | ||
ghdl --synth --std=08 --no-formal -gDepth=16 -gWidth=16 ${SRC} -e ${DUT} > $@ | ||
|
||
synth: ${DUT}.json | ||
${DUT}.json: ${DUT}_synth.vhd | ||
yosys -m ghdl -p 'ghdl --std=08 --no-formal -gDepth=16 -gWidth=16 ${SRC} -e ${DUT}; synth_ice40 -top ${DUT} -json $@' | ||
|
||
clean: | ||
rm -rf work ${DUT}.json ${DUT}_synth.vhd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
use ieee.numeric_std.all; | ||
|
||
|
||
|
||
entity fwft_fifo is | ||
generic ( | ||
Formal : boolean := true; | ||
Depth : positive := 16; | ||
Width : positive := 16 | ||
); | ||
port ( | ||
Reset_n_i : in std_logic; | ||
Clk_i : in std_logic; | ||
-- write | ||
Wen_i : in std_logic; | ||
Din_i : in std_logic_vector(Width-1 downto 0); | ||
Full_o : out std_logic; | ||
Werror_o : out std_logic; | ||
-- read | ||
Ren_i : in std_logic; | ||
Dout_o : out std_logic_vector(Width-1 downto 0); | ||
Empty_o : out std_logic; | ||
Rerror_o : out std_logic | ||
); | ||
end entity fwft_fifo; | ||
|
||
|
||
architecture rtl of fwft_fifo is | ||
|
||
|
||
signal s_empty : std_logic; | ||
signal s_ren : std_logic; | ||
|
||
|
||
begin | ||
|
||
|
||
i_fifo : entity work.fifo | ||
generic map ( | ||
Formal => Formal, | ||
Depth => Depth, | ||
Width => Width | ||
) | ||
port map ( | ||
Reset_n_i => Reset_n_i, | ||
Clk_i => Clk_i, | ||
-- write | ||
Wen_i => Wen_i, | ||
Din_i => Din_i, | ||
Full_o => Full_o, | ||
Werror_o => Werror_o, | ||
-- read | ||
Ren_i => s_ren, | ||
Dout_o => Dout_o, | ||
Empty_o => s_empty, | ||
Rerror_o => open | ||
); | ||
|
||
|
||
|
||
s_ren <= not s_empty and (Empty_o or Ren_i); | ||
|
||
|
||
ReadFlagsP : process (Reset_n_i, Clk_i) is | ||
begin | ||
if (Reset_n_i = '0') then | ||
Empty_o <= '1'; | ||
Rerror_o <= '0'; | ||
elsif (rising_edge(Clk_i)) then | ||
Rerror_o <= Ren_i and Empty_o; | ||
if (s_ren = '1') then | ||
Empty_o <= '0'; | ||
elsif (Ren_i = '1') then | ||
Empty_o <= '1'; | ||
end if; | ||
end if; | ||
end process ReadFlagsP; | ||
|
||
|
||
FormalG : if Formal generate | ||
|
||
default clock is rising_edge(Clk_i); | ||
|
||
-- Initial reset | ||
RESTRICT_RESET : restrict | ||
{not Reset_n_i[*3]; Reset_n_i[+]}[*1]; | ||
|
||
-- Inputs are low during reset for simplicity | ||
ASSUME_INPUTS_DURING_RESET : assume always | ||
not Reset_n_i -> | ||
not Wen_i and not Ren_i; | ||
|
||
end generate FormalG; | ||
|
||
|
||
end architecture rtl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[tasks] | ||
cover | ||
bmc | ||
prove | ||
|
||
[options] | ||
depth 25 | ||
cover: mode cover | ||
bmc: mode bmc | ||
prove: mode prove | ||
|
||
[engines] | ||
cover: smtbmc z3 | ||
bmc: abc bmc3 | ||
prove: abc pdr | ||
|
||
[script] | ||
ghdl --std=08 -gFormal=true -gDepth=16 -gWidth=16 fifo.vhd fwft_fifo.vhd -e fwft_fifo | ||
prep -top fwft_fifo | ||
|
||
# Convert all assumes to asserts in sub-units | ||
chformal -assume2assert fwft_fifo/* %M | ||
|
||
# Remove selected covers in i_fifo sub-unit as they cannot be reached | ||
chformal -cover -remove */formalg.read_pnt_stable_when_empty.cover | ||
chformal -cover -remove */formalg.rerror.cover | ||
|
||
[files] | ||
../fifo/fifo.vhd | ||
fwft_fifo.vhd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
alu | ||
counter | ||
fifo | ||
fwft_fifo | ||
vai_fifo | ||
vai_reg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters