|
@ -3,9 +3,11 @@ library ieee; |
|
|
use ieee.numeric_std.all; |
|
|
use ieee.numeric_std.all; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entity WishBoneMasterE is |
|
|
entity WishBoneMasterE is |
|
|
generic ( |
|
|
generic ( |
|
|
Coverage : boolean := false; |
|
|
|
|
|
|
|
|
Coverage : boolean := true; |
|
|
|
|
|
Formal : boolean := true; |
|
|
AddressWidth : natural := 8; |
|
|
AddressWidth : natural := 8; |
|
|
DataWidth : natural := 8 |
|
|
DataWidth : natural := 8 |
|
|
); |
|
|
); |
|
@ -97,8 +99,8 @@ begin |
|
|
--+ registered wishbone if outputs |
|
|
--+ registered wishbone if outputs |
|
|
OutRegsP : process (WbClk_i) is |
|
|
OutRegsP : process (WbClk_i) is |
|
|
begin |
|
|
begin |
|
|
if(rising_edge(WbClk_i)) then |
|
|
|
|
|
if(WbRst_i = '1') then |
|
|
|
|
|
|
|
|
if (rising_edge(WbClk_i)) then |
|
|
|
|
|
if (WbRst_i = '1') then |
|
|
WbAdr_o <= (others => '0'); |
|
|
WbAdr_o <= (others => '0'); |
|
|
WbDat_o <= (others => '0'); |
|
|
WbDat_o <= (others => '0'); |
|
|
s_wb_wen <= '0'; |
|
|
s_wb_wen <= '0'; |
|
@ -117,41 +119,89 @@ begin |
|
|
end process OutRegsP; |
|
|
end process OutRegsP; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- psl default clock is rising_edge(WbClk_i); |
|
|
|
|
|
|
|
|
FormalG : if Formal generate |
|
|
|
|
|
|
|
|
|
|
|
-- Glue logic |
|
|
|
|
|
signal s_local_data : std_logic_vector(DataWidth-1 downto 0); |
|
|
|
|
|
signal s_local_address : std_logic_vector(AddressWidth-1 downto 0); |
|
|
|
|
|
|
|
|
|
|
|
begin |
|
|
|
|
|
|
|
|
|
|
|
process is |
|
|
|
|
|
begin |
|
|
|
|
|
wait until rising_edge(WbClk_i); |
|
|
|
|
|
if (s_wb_master_fsm = IDLE) then |
|
|
|
|
|
if (LocalWen_i = '1') then |
|
|
|
|
|
s_local_data <= LocalData_i; |
|
|
|
|
|
s_local_address <= LocalAdress_i; |
|
|
|
|
|
end if; |
|
|
|
|
|
if (LocalRen_i = '1') then |
|
|
|
|
|
s_local_address <= LocalAdress_i; |
|
|
|
|
|
end if; |
|
|
|
|
|
end if; |
|
|
|
|
|
end process; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default clock is rising_edge(WbClk_i); |
|
|
|
|
|
|
|
|
|
|
|
restrict {WbRst_i = '1'; WbRst_i = '0'[+]}[*1]; |
|
|
|
|
|
|
|
|
-- PSL assert directives |
|
|
|
|
|
|
|
|
RESET : assert always |
|
|
|
|
|
WbRst_i -> next |
|
|
|
|
|
WbCyc_o = '0' and WbStb_o = '0' and WbWe_o = '0' and |
|
|
|
|
|
to_integer(unsigned(WbAdr_o)) = 0 and to_integer(unsigned(WbDat_o)) = 0 and |
|
|
|
|
|
LocalAck_o = '0' and LocalError_o = '0' and to_integer(unsigned(LocalData_o)) = 0 |
|
|
|
|
|
report "WB master: Reset error"; |
|
|
|
|
|
|
|
|
-- psl RESET : assert always |
|
|
|
|
|
-- WbRst_i -> |
|
|
|
|
|
-- WbCyc_o = '0' and WbStb_o = '0' and WbWe_o = '0' and |
|
|
|
|
|
-- to_integer(unsigned(WbAdr_o)) = 0 and to_integer(unsigned(WbDat_o)) = 0 and |
|
|
|
|
|
-- LocalAck_o = '0' and LocalError_o = '0' and to_integer(unsigned(LocalData_o)) = 0 |
|
|
|
|
|
-- report "WB master: Reset error"; |
|
|
|
|
|
-- |
|
|
|
|
|
-- psl WB_WRITE : assert always |
|
|
|
|
|
-- ((not(WbCyc_o) and not(WbStb_o) and LocalWen_i and not (LocalRen_i)) -> |
|
|
|
|
|
-- next (WbCyc_o = '1' and WbStb_o = '1' and WbWe_o = '1')) abort WbRst_i |
|
|
|
|
|
-- report "WB master: Write error"; |
|
|
|
|
|
-- |
|
|
|
|
|
-- psl WB_READ : assert always |
|
|
|
|
|
-- ((not(WbCyc_o) and not(WbStb_o) and LocalRen_i and not(LocalWen_i)) -> |
|
|
|
|
|
-- next (WbCyc_o = '1' and WbStb_o = '1' and WbWe_o = '0')) abort WbRst_i |
|
|
|
|
|
-- report "WB master: Read error"; |
|
|
|
|
|
|
|
|
WB_WRITE : assert always |
|
|
|
|
|
((not WbCyc_o and not WbStb_o and LocalWen_i and not LocalRen_i) -> |
|
|
|
|
|
next (WbCyc_o and WbStb_o and WbWe_o)) abort WbRst_i |
|
|
|
|
|
report "WB master: Write error"; |
|
|
|
|
|
|
|
|
|
|
|
WB_READ : assert always |
|
|
|
|
|
((not WbCyc_o and not WbStb_o and LocalRen_i and not LocalWen_i) -> |
|
|
|
|
|
next (WbCyc_o and WbStb_o and not WbWe_o)) abort WbRst_i |
|
|
|
|
|
report "WB master: Read error"; |
|
|
|
|
|
|
|
|
|
|
|
assert never LocalError_o and LocalAck_o; |
|
|
|
|
|
|
|
|
|
|
|
assert always WbStb_o = WbCyc_o; |
|
|
|
|
|
|
|
|
|
|
|
assert always |
|
|
|
|
|
not WbRst_i and WbCyc_o and not WbAck_i and not WbErr_i -> |
|
|
|
|
|
next (WbCyc_o until (WbAck_i or WbErr_i)) abort WbRst_i; |
|
|
|
|
|
|
|
|
|
|
|
assert always WbCyc_o and WbAck_i -> next not WbCyc_o; |
|
|
|
|
|
assert always WbWe_o and WbAck_i -> next not WbWe_o; |
|
|
|
|
|
assert always WbWe_o -> WbCyc_o; |
|
|
|
|
|
|
|
|
|
|
|
assert always WbWe_o -> WbDat_o = s_local_data abort WbRst_i; |
|
|
|
|
|
assert always WbWe_o -> WbAdr_o = s_local_address abort WbRst_i; |
|
|
|
|
|
|
|
|
|
|
|
assert always WbCyc_o and not WbWe_o -> WbAdr_o = s_local_address abort WbRst_i; |
|
|
|
|
|
|
|
|
|
|
|
end generate FormalG; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CoverageG : if Coverage generate |
|
|
CoverageG : if Coverage generate |
|
|
|
|
|
|
|
|
-- psl COVER_LOCAL_WRITE : cover {s_wb_master_fsm = IDLE and LocalWen_i = '1' and |
|
|
|
|
|
-- LocalRen_i = '0' and WbRst_i = '0'} |
|
|
|
|
|
-- report "WB master: Local write"; |
|
|
|
|
|
-- |
|
|
|
|
|
-- psl COVER_LOCAL_READ : cover {s_wb_master_fsm = IDLE and LocalRen_i = '1' and |
|
|
|
|
|
-- LocalWen_i = '0' and WbRst_i = '0'} |
|
|
|
|
|
-- report "WB master: Local read"; |
|
|
|
|
|
-- |
|
|
|
|
|
-- psl COVER_LOCAL_WRITE_READ : cover {s_wb_master_fsm = IDLE and LocalWen_i = '1' and |
|
|
|
|
|
-- LocalRen_i = '1' and WbRst_i = '0'} |
|
|
|
|
|
-- report "WB master: Local write & read"; |
|
|
|
|
|
|
|
|
default clock is rising_edge(WbClk_i); |
|
|
|
|
|
|
|
|
|
|
|
restrict {WbRst_i = '1'; WbRst_i = '0'[+]}[*1]; |
|
|
|
|
|
|
|
|
|
|
|
COVER_LOCAL_WRITE : cover {s_wb_master_fsm = IDLE and LocalWen_i = '1' and |
|
|
|
|
|
LocalRen_i = '0' and WbRst_i = '0'} |
|
|
|
|
|
report "WB master: Local write"; |
|
|
|
|
|
|
|
|
|
|
|
COVER_LOCAL_READ : cover {s_wb_master_fsm = IDLE and LocalRen_i = '1' and |
|
|
|
|
|
LocalWen_i = '0' and WbRst_i = '0'} |
|
|
|
|
|
report "WB master: Local read"; |
|
|
|
|
|
|
|
|
|
|
|
COVER_LOCAL_WRITE_READ : cover {s_wb_master_fsm = IDLE and LocalWen_i = '1' and |
|
|
|
|
|
LocalRen_i = '1' and WbRst_i = '0'} |
|
|
|
|
|
report "WB master: Local write & read"; |
|
|
|
|
|
|
|
|
|
|
|
test_cover : cover {s_wb_master_fsm = IDLE and LocalWen_i = '1'; s_wb_master_fsm = ADDRESS; s_wb_master_fsm = DATA}; |
|
|
|
|
|
|
|
|
end generate CoverageG; |
|
|
end generate CoverageG; |
|
|
|
|
|
|
|
|