|
|
@ -6,8 +6,9 @@ library ieee; |
|
|
|
|
|
|
|
entity WishBoneSlaveE is |
|
|
|
generic ( |
|
|
|
AddressWidth : natural := 8; |
|
|
|
DataWidth : natural := 8 |
|
|
|
Formal : boolean := false; |
|
|
|
AddressWidth : natural := 32; |
|
|
|
DataWidth : natural := 32 |
|
|
|
); |
|
|
|
port ( |
|
|
|
--+ wishbone system if |
|
|
@ -84,49 +85,109 @@ begin |
|
|
|
|
|
|
|
--+ wishbone if outputs |
|
|
|
WbDat_o <= LocalData_i when s_wb_slave_fsm = DATA and WbWe_i = '0' else (others => '0'); |
|
|
|
WbAck_o <= '1' when s_wb_slave_fsm = DATA or (s_wb_slave_fsm = ADDRESS and s_wb_active and WbWe_i = '1') else '0'; |
|
|
|
WbErr_o <= '0'; |
|
|
|
|
|
|
|
|
|
|
|
-- psl default clock is rising_edge(WbClk_i); |
|
|
|
-- |
|
|
|
-- psl LOCAL_WRITE : assert always |
|
|
|
-- ((WbCyc_i and WbStb_i and WbWe_i) -> |
|
|
|
-- (LocalWen_o = '1' and WbAck_o = '1' and LocalAdress_o = WbAdr_i and LocalData_o = WbDat_i)) abort WbRst_i |
|
|
|
-- report "PSL ERROR: Local write error"; |
|
|
|
-- |
|
|
|
-- psl LOCAL_READ : assert always |
|
|
|
-- ({not(WbCyc_i) and not(WbStb_i); WbCyc_i and WbStb_i and not(WbWe_i)} |-> |
|
|
|
-- {LocalRen_o = '1' and LocalAdress_o = WbAdr_i and WbAck_o = '0'; LocalRen_o = '0' and WbDat_o = LocalData_i and WbAck_o = '1'}) abort WbRst_i |
|
|
|
-- report "PSL ERROR: Local read error"; |
|
|
|
-- |
|
|
|
-- psl WB_ACK : assert always |
|
|
|
-- WbAck_o -> |
|
|
|
-- (WbCyc_i and WbStb_i) |
|
|
|
-- report "PSL ERROR: WbAck invalid"; |
|
|
|
-- |
|
|
|
-- psl WB_ERR : assert always |
|
|
|
-- WbErr_o -> |
|
|
|
-- (WbCyc_i and WbStb_i) |
|
|
|
-- report "PSL ERROR: WbErr invalid"; |
|
|
|
-- |
|
|
|
-- psl LOCAL_WE : assert always |
|
|
|
-- LocalWen_o -> |
|
|
|
-- (WbCyc_i and WbStb_i and WbWe_i and not(LocalRen_o)) and |
|
|
|
-- (next not(LocalWen_o)) |
|
|
|
-- report "PSL ERROR: LocalWen invalid"; |
|
|
|
-- |
|
|
|
-- psl LOCAL_RE : assert always |
|
|
|
-- LocalRen_o -> |
|
|
|
-- (WbCyc_i and WbStb_i and not(WbWe_i) and not(LocalWen_o)) and |
|
|
|
-- (next not(LocalRen_o)) |
|
|
|
-- report "PSL ERROR: LocalRen invalid"; |
|
|
|
-- |
|
|
|
-- psl RESET : assert always |
|
|
|
-- WbRst_i -> |
|
|
|
-- (to_integer(unsigned(WbDat_o)) = 0 and WbAck_o = '0' and WbErr_o = '0' and |
|
|
|
-- LocalWen_o = '0' and LocalRen_o = '0' and to_integer(unsigned(LocalAdress_o)) = 0 and to_integer(unsigned(LocalData_o)) = 0) |
|
|
|
-- report "PSL ERROR: Reset error"; |
|
|
|
WbAck_o <= '1' when (s_wb_slave_fsm = DATA and WbWe_i = '0') or (s_wb_slave_fsm = ADDRESS and s_wb_active and WbWe_i = '1') else '0'; |
|
|
|
WbErr_o <= '1' when s_wb_slave_fsm = DATA and WbWe_i = '1' else '0'; |
|
|
|
|
|
|
|
|
|
|
|
FormalG : if Formal generate |
|
|
|
|
|
|
|
-- Glue logic |
|
|
|
signal s_wb_data : std_logic_vector(DataWidth-1 downto 0); |
|
|
|
signal s_wb_address : std_logic_vector(AddressWidth-1 downto 0); |
|
|
|
|
|
|
|
begin |
|
|
|
|
|
|
|
SyncWbSignals : process is |
|
|
|
begin |
|
|
|
wait until rising_edge(WbClk_i); |
|
|
|
if (s_wb_slave_fsm = ADDRESS and WbCyc_i = '1' and WbStb_i = '1') then |
|
|
|
if (WbWe_i = '1') then |
|
|
|
s_wb_data <= WbDat_i; |
|
|
|
end if; |
|
|
|
s_wb_address <= WbAdr_i; |
|
|
|
end if; |
|
|
|
end process SyncWbSignals; |
|
|
|
|
|
|
|
|
|
|
|
default clock is rising_edge(WbClk_i); |
|
|
|
|
|
|
|
restrict {WbRst_i = '1'; WbRst_i = '0'[+]}[*1]; |
|
|
|
|
|
|
|
assume always WbCyc_i = WbStb_i; |
|
|
|
assume always WbWe_i -> WbStb_i; |
|
|
|
assume always WbWe_i and WbAck_o -> next not WbWe_i; |
|
|
|
|
|
|
|
-- FSM state checks |
|
|
|
FSM_IDLE_TO_ADDRESS : assert always |
|
|
|
not WbRst_i and s_wb_slave_fsm = IDLE -> |
|
|
|
next s_wb_slave_fsm = ADDRESS abort WbRst_i; |
|
|
|
|
|
|
|
FSM_ADDRESS_TO_DATA : assert always |
|
|
|
not WbRst_i and s_wb_slave_fsm = ADDRESS and WbStb_i and WbCyc_i and not WbWe_i -> |
|
|
|
next s_wb_slave_fsm = DATA abort WbRst_i; |
|
|
|
|
|
|
|
FSM_ADDRESS_TO_ADDRESS : assert always |
|
|
|
not WbRst_i and s_wb_slave_fsm = ADDRESS and not (WbStb_i and WbCyc_i and not WbWe_i) -> |
|
|
|
next s_wb_slave_fsm = ADDRESS abort WbRst_i; |
|
|
|
|
|
|
|
FSM_DATA_TO_ADDRESS : assert always |
|
|
|
not WbRst_i and s_wb_slave_fsm = DATA -> |
|
|
|
next s_wb_slave_fsm = ADDRESS abort WbRst_i; |
|
|
|
|
|
|
|
-- Wishbone write cycle checks |
|
|
|
WB_WRITE_CYCLE_0 : assert always |
|
|
|
s_wb_slave_fsm = ADDRESS and WbStb_i and WbCyc_i and WbWe_i -> |
|
|
|
LocalWen_o and WbAck_o; |
|
|
|
|
|
|
|
WB_WRITE_CYCLE_1 : assert always |
|
|
|
LocalWen_o -> LocalAdress_o = WbAdr_i; |
|
|
|
|
|
|
|
WB_WRITE_CYCLE_2 : assert always |
|
|
|
LocalWen_o -> LocalData_o = WbDat_i; |
|
|
|
|
|
|
|
-- Wishbone read cycle checks |
|
|
|
WB_READ_CYCLE_0 : assert always |
|
|
|
s_wb_slave_fsm = ADDRESS and WbStb_i and WbCyc_i and not WbWe_i -> |
|
|
|
LocalRen_o and not WbAck_o; |
|
|
|
|
|
|
|
WB_READ_CYCLE_1 : assert always |
|
|
|
LocalRen_o -> LocalAdress_o = WbAdr_i; |
|
|
|
|
|
|
|
WB_READ_CYCLE_2 : assert always |
|
|
|
s_wb_slave_fsm = DATA and not WbWe_i -> |
|
|
|
WbAck_o and WbDat_o = LocalData_i; |
|
|
|
|
|
|
|
WB_READ_ERROR : assert always |
|
|
|
s_wb_slave_fsm = DATA and WbWe_i -> |
|
|
|
WbErr_o; |
|
|
|
|
|
|
|
WB_NEVER_ACK_AND_ERR : assert never |
|
|
|
WbAck_o and WbErr_o; |
|
|
|
|
|
|
|
WB_ERR : assert always |
|
|
|
WbErr_o -> |
|
|
|
(WbCyc_i and WbStb_i) |
|
|
|
report "PSL ERROR: WbErr invalid"; |
|
|
|
|
|
|
|
LOCAL_WE : assert always |
|
|
|
LocalWen_o -> |
|
|
|
(WbCyc_i and WbStb_i and WbWe_i and not LocalRen_o) and |
|
|
|
(next not LocalWen_o) |
|
|
|
report "PSL ERROR: LocalWen invalid"; |
|
|
|
|
|
|
|
LOCAL_RE : assert always |
|
|
|
LocalRen_o -> |
|
|
|
(WbCyc_i and WbStb_i and not WbWe_i and not LocalWen_o) and |
|
|
|
(next not LocalRen_o) |
|
|
|
report "PSL ERROR: LocalRen invalid"; |
|
|
|
|
|
|
|
RESET : assert always |
|
|
|
WbRst_i -> next |
|
|
|
(to_integer(unsigned(WbDat_o)) = 0 and WbAck_o = '0' and WbErr_o = '0' and |
|
|
|
LocalWen_o = '0' and LocalRen_o = '0' and to_integer(unsigned(LocalAdress_o)) = 0 and to_integer(unsigned(LocalData_o)) = 0) |
|
|
|
report "PSL ERROR: Reset error"; |
|
|
|
|
|
|
|
end generate FormalG; |
|
|
|
|
|
|
|
|
|
|
|
end architecture rtl; |