Line 36... |
Line 36... |
from http://www.opencores.org/lgpl.shtml.
|
from http://www.opencores.org/lgpl.shtml.
|
*/
|
*/
|
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all;
|
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all;
|
--library tauhop; use tauhop.axiTransactor.all;
|
--library tauhop; use tauhop.axiTransactor.all;
|
|
|
--/* TODO remove once generic packages are supported. */
|
/* TODO remove once generic packages are supported. */
|
library tauhop; use tauhop.tlm.all, tauhop.axiTLM.all;
|
library tauhop; use tauhop.tlm.all, tauhop.axiTLM.all;
|
|
|
entity axiBfmMaster is
|
entity axiBfmMaster is
|
port(aclk,n_areset:in std_ulogic;
|
port(aclk,n_areset:in std_ulogic;
|
/* BFM signalling. */
|
/* BFM signalling. */
|
readRequest,writeRequest:in t_bfm:=((others=>'X'),(others=>'X'),false);
|
readRequest,writeRequest:in t_bfm:=(address=>(others=>'X'), message=>(others=>'X'), trigger=>false);
|
readResponse,writeResponse:buffer t_bfm; -- use buffer until synthesis tools support reading from out ports.
|
readResponse,writeResponse:buffer t_bfm; -- use buffer until synthesis tools support reading from out ports.
|
|
|
/* AXI Master interface */
|
/* AXI Master interface */
|
axiMaster_in:in t_axi4StreamTransactor_s2m;
|
axiMaster_in:in t_axi4StreamTransactor_s2m;
|
axiMaster_out:buffer t_axi4StreamTransactor_m2s;
|
axiMaster_out:buffer t_axi4StreamTransactor_m2s;
|
Line 67... |
Line 67... |
|
|
architecture rtl of axiBfmMaster is
|
architecture rtl of axiBfmMaster is
|
/* Finite-state Machines. */
|
/* Finite-state Machines. */
|
signal axiTxState,next_axiTxState:axiBfmStatesTx:=idle;
|
signal axiTxState,next_axiTxState:axiBfmStatesTx:=idle;
|
|
|
/* BFM signalling. */
|
signal i_axiMaster_out:t_axi4StreamTransactor_m2s;
|
signal i_readRequest:t_bfm:=((others=>'0'),(others=>'0'),false);
|
signal i_trigger,trigger:boolean;
|
signal i_writeRequest:t_bfm:=((others=>'0'),(others=>'0'),false);
|
|
|
|
signal i_readResponse,i_writeResponse:t_bfm;
|
/* BFM signalling. */
|
|
-- signal i_readRequest,i_writeRequest:t_bfm:=(address=>(others=>'X'),message=>(others=>'X'),trigger=>false);
|
|
-- signal i_readResponse,i_writeResponse:t_bfm;
|
|
signal i_writeRequest:t_bfm:=(address=>(others=>'X'),message=>(others=>'X'),trigger=>false);
|
|
signal i_writeResponse:t_bfm;
|
|
|
begin
|
begin
|
|
i_trigger<=writeRequest.trigger xor i_writeRequest.trigger;
|
|
|
/* next-state logic for AXI4-Stream Master Tx BFM. */
|
/* next-state logic for AXI4-Stream Master Tx BFM. */
|
axi_bfmTx_ns: process(all) is begin
|
axi_bfmTx_ns: process(all) is begin
|
axiTxState<=next_axiTxState;
|
axiTxState<=next_axiTxState;
|
|
|
if not n_areset then axiTxState<=idle;
|
if not n_areset then axiTxState<=idle;
|
else
|
else
|
case next_axiTxState is
|
case next_axiTxState is
|
when idle=>
|
when idle=>
|
if writeRequest.trigger xor i_writeRequest.trigger then axiTxState<=payload; end if;
|
if i_trigger then axiTxState<=payload; end if;
|
when payload=>
|
when payload=>
|
if outstandingTransactions<1 then axiTxState<=endOfTx; end if;
|
if outstandingTransactions<1 then axiTxState<=endOfTx; end if;
|
when endOfTx=>
|
when endOfTx=>
|
axiTxState<=idle;
|
axiTxState<=idle;
|
when others=>axiTxState<=idle;
|
when others=>axiTxState<=idle;
|
Line 96... |
Line 101... |
|
|
/* output logic for AXI4-Stream Master Tx BFM. */
|
/* output logic for AXI4-Stream Master Tx BFM. */
|
axi_bfmTx_op: process(all) is begin
|
axi_bfmTx_op: process(all) is begin
|
i_writeResponse<=writeResponse;
|
i_writeResponse<=writeResponse;
|
|
|
axiMaster_out.tValid<=false;
|
i_axiMaster_out.tValid<=false;
|
axiMaster_out.tLast<=false;
|
i_axiMaster_out.tLast<=false;
|
axiMaster_out.tData<=(others=>'Z');
|
i_axiMaster_out.tData<=(others=>'Z');
|
i_writeResponse.trigger<=false;
|
i_writeResponse.trigger<=false;
|
|
|
if writeRequest.trigger xor i_writeRequest.trigger then
|
|
axiMaster_out.tData<=writeRequest.message;
|
|
axiMaster_out.tValid<=true;
|
|
end if;
|
|
|
|
if not n_areset then axiMaster_out.tData<=(others=>'Z');
|
|
else
|
|
case next_axiTxState is
|
case next_axiTxState is
|
|
when idle=>
|
|
if i_trigger then
|
|
i_axiMaster_out.tData<=writeRequest.message;
|
|
i_axiMaster_out.tValid<=true;
|
|
end if;
|
when payload=>
|
when payload=>
|
axiMaster_out.tData<=writeRequest.message;
|
i_axiMaster_out.tData<=writeRequest.message;
|
axiMaster_out.tValid<=true;
|
i_axiMaster_out.tValid<=true;
|
|
|
if axiMaster_in.tReady then
|
if axiMaster_in.tReady then
|
i_writeResponse.trigger<=true;
|
i_writeResponse.trigger<=true;
|
end if;
|
end if;
|
|
|
/* TODO change to a flag at user.vhdl. Move outstandingTransactions to user.vhdl. */
|
if outstandingTransactions<1 then i_axiMaster_out.tLast<=true; end if;
|
if outstandingTransactions<1 then axiMaster_out.tLast<=true; end if;
|
|
when others=> null;
|
when others=> null;
|
end case;
|
end case;
|
end if;
|
|
end process axi_bfmTx_op;
|
end process axi_bfmTx_op;
|
|
|
/* state registers and pipelines for AXI4-Stream Tx BFM. */
|
/* state registers and pipelines for AXI4-Stream Tx BFM. */
|
process(n_areset,aclk) is begin
|
process(aclk) is begin
|
if falling_edge(aclk) then
|
if falling_edge(aclk) then
|
next_axiTxState<=axiTxState;
|
next_axiTxState<=axiTxState;
|
i_writeRequest<=writeRequest;
|
i_writeRequest<=writeRequest;
|
end if;
|
|
end process;
|
|
|
|
process(aclk) is begin
|
|
if rising_edge(aclk) then
|
|
writeResponse<=i_writeResponse;
|
writeResponse<=i_writeResponse;
|
|
axiMaster_out<=i_axiMaster_out;
|
|
trigger<=i_trigger;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
dbg_axiTxFSM<=axiTxState;
|
dbg_axiTxFSM<=axiTxState;
|
end architecture rtl;
|
end architecture rtl;
|