Created
March 4, 2020 15:42
-
-
Save larshb/e84438d7f002cc0b54ad5119b773f126 to your computer and use it in GitHub Desktop.
Transaction interface for VHDL AXI slave
This file contains hidden or 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
sync: process (S_AXI_ACLK) begin | |
if rising_edge(S_AXI_ACLK) then | |
if S_AXI_ARESETN = '0' then | |
axi_awready <= '0'; | |
aw_en <= '1'; | |
axi_awaddr <= (others => '0'); | |
axi_wready <= '0'; | |
axi_bvalid <= '0'; | |
axi_bresp <= "00"; | |
axi_arready <= '0'; | |
axi_araddr <= (others => '1'); | |
axi_rvalid <= '0'; | |
axi_rresp <= "00"; | |
axi_rdata <= (others => '0'); | |
else | |
if (axi_awready = '0' and S_AXI_AWVALID = '1' and S_AXI_WVALID = '1' and aw_en = '1') then | |
axi_awready <= '1'; | |
aw_en <= '0'; | |
elsif (S_AXI_BREADY = '1' and axi_bvalid = '1') then | |
aw_en <= '1'; | |
axi_awready <= '0'; | |
else | |
axi_awready <= '0'; | |
end if; | |
if (axi_awready = '0' and S_AXI_AWVALID = '1' and S_AXI_WVALID = '1' and aw_en = '1') then | |
axi_awaddr <= S_AXI_AWADDR; | |
end if; | |
if (axi_wready = '0' and S_AXI_WVALID = '1' and S_AXI_AWVALID = '1' and aw_en = '1') then | |
axi_wready <= '1'; | |
else | |
axi_wready <= '0'; | |
end if; | |
if (axi_awready = '1' and S_AXI_AWVALID = '1' and axi_wready = '1' and S_AXI_WVALID = '1' and axi_bvalid = '0' ) then | |
axi_bvalid <= '1'; | |
axi_bresp <= "00"; | |
elsif (S_AXI_BREADY = '1' and axi_bvalid = '1') then --check if bready is asserted while bvalid is high) | |
axi_bvalid <= '0'; -- (there is a possibility that bready is always asserted high) | |
end if; | |
if (axi_arready = '0' and S_AXI_ARVALID = '1') then | |
axi_arready <= '1'; | |
axi_araddr <= S_AXI_ARADDR; | |
else | |
axi_arready <= '0'; | |
end if; | |
if (axi_arready = '1' and S_AXI_ARVALID = '1' and axi_rvalid = '0') then | |
axi_rvalid <= '1'; | |
axi_rresp <= "00"; -- 'OKAY' response | |
elsif (axi_rvalid = '1' and S_AXI_RREADY = '1') then | |
axi_rvalid <= '0'; | |
end if; | |
if (slv_reg_rden = '1') then | |
axi_rdata <= reg_data_out; -- register read data | |
end if; | |
end if; | |
end if; | |
end process; | |
slv_reg_rden <= axi_arready and S_AXI_ARVALID and (not axi_rvalid); | |
slv_reg_wren <= axi_wready and S_AXI_WVALID and axi_awready and S_AXI_AWVALID; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment