OpenCores
URL https://opencores.org/ocsvn/axi4_tlm_bfm/axi4_tlm_bfm/trunk

Subversion Repositories axi4_tlm_bfm

[/] [axi4_tlm_bfm/] [trunk/] [rtl/] [user.vhdl] - Diff between revs 10 and 11

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 10 Rev 11
Line 34... Line 34...
        Public License along with this source; if not, download it
        Public License along with this source; if not, download it
        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; use ieee.math_real.all;
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all; use ieee.math_real.all;
library tauhop; use tauhop.transactor.all, tauhop.axiTransactor.all;            --TODO just use axiTransactor here as transactor should already be wrapped up.
library tauhop; use tauhop.transactor.all, tauhop.axiTransactor.all;            --TODO just use axiTransactor here as transactor should already be wrapped up.
 
 
 
/* TODO remove once generic packages are supported. */
 
--library tauhop; use tauhop.tlm.all, tauhop.axiTLM.all;
 
 
/* synthesis translate_off */
/* synthesis translate_off */
library osvvm; use osvvm.RandomPkg.all; use osvvm.CoveragePkg.all;
library osvvm; use osvvm.RandomPkg.all; use osvvm.CoveragePkg.all;
/* synthesis translate_on */
/* synthesis translate_on */
 
 
entity user is port(
entity user is port(
        /* Comment-out for simulation. */
        /* Comment-out for simulation. */
--      clk,reset:in std_ulogic;
--      clk,nReset:in std_ulogic;
 
 
        /* 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 64... Line 68...
        signal readResponse:t_bfm;
        signal readResponse:t_bfm;
        signal writeResponse:t_bfm;
        signal writeResponse:t_bfm;
 
 
        type txStates is (idle,transmitting);
        type txStates is (idle,transmitting);
        signal txFSM,i_txFSM:txStates;
        signal txFSM,i_txFSM:txStates;
        --signal response,i_response:boolean;
 
 
 
        /* Tester signals. */
        /* Tester signals. */
        /* synthesis translate_off */
        /* synthesis translate_off */
        signal clk,reset:std_ulogic:='0';
        signal clk,nReset:std_ulogic:='0';
        signal axiMaster_in:t_axi4StreamTransactor_s2m;
 
        /* synthesis translate_on */
        /* synthesis translate_on */
 
 
 
        signal axiMaster_in:t_axi4StreamTransactor_s2m;
        signal irq_write:std_ulogic;            -- clock gating.
        signal irq_write:std_ulogic;            -- clock gating.
 
 
begin
begin
        /* Bus functional models. */
        /* Bus functional models. */
        axiMaster: entity work.axiBfmMaster(rtl)
        axiMaster: entity work.axiBfmMaster(rtl)
                port map(
                port map(
                        aclk=>irq_write, n_areset=>not reset,
                        aclk=>irq_write, n_areset=>nReset,
 
 
                        readRequest=>readRequest,       writeRequest=>writeRequest,
                        readRequest=>readRequest,       writeRequest=>writeRequest,
                        readResponse=>readResponse,     writeResponse=>writeResponse,
                        readResponse=>readResponse,     writeResponse=>writeResponse,
                        axiMaster_in=>axiMaster_in,
                        axiMaster_in=>axiMaster_in,
                        axiMaster_out=>axiMaster_out,
                        axiMaster_out=>axiMaster_out,
Line 90... Line 93...
                        symbolsPerTransfer=>symbolsPerTransfer,
                        symbolsPerTransfer=>symbolsPerTransfer,
                        outstandingTransactions=>outstandingTransactions
                        outstandingTransactions=>outstandingTransactions
        );
        );
 
 
        /* Interrupt-request generator. */
        /* Interrupt-request generator. */
        irq_write<=clk when not reset else '0';
        irq_write<=clk when nReset else '0';
 
 
        /* Simulation Tester. */
        /* Simulation Tester. */
        /* synthesis translate_off */
        /* synthesis translate_off */
        clk<=not clk after 10 ps;
        clk<=not clk after 10 ps;
        process is begin
        process is begin
                reset<='0'; wait for 1 ps;
                nReset<='1'; wait for 1 ps;
                reset<='1'; wait for 500 ps;
                nReset<='0'; wait for 500 ps;
                reset<='0';
                nReset<='1';
                wait;
                wait;
        end process;
        end process;
        /* synthesis translate_on */
        /* synthesis translate_on */
 
 
        /* Hardware tester. */
        /* Hardware tester. */
 
 
 
 
        /* Stimuli sequencer. TODO move to tester/stimuli.
        /* Stimuli sequencer. TODO move to tester/stimuli.
                This emulates the AXI4-Stream Slave.
                This emulates the AXI4-Stream Slave.
        */
        */
 
        /* Simulation-only stimuli sequencer. */
        /* synthesis translate_off */
        /* synthesis translate_off */
        process is begin
        process is begin
                /* Fast read. */
                /* Fast read. */
                while not axiMaster_out.tLast loop
                while not axiMaster_out.tLast loop
                        /* Wait for tValid to assert. */
                        /* Wait for tValid to assert. */
Line 154... Line 158...
 
 
                wait;
                wait;
        end process;
        end process;
        /* synthesis translate_on */
        /* synthesis translate_on */
 
 
 
        /* Synthesisable stimuli sequencer. */
 
 
 
 
        /* Data transmitter. */
        /* Data transmitter. */
        sequencer: process(reset,irq_write) is
        sequencer: process(nReset,irq_write) is
                /* Local procedures to map BFM signals with the package procedure. */
                /* Local procedures to map BFM signals with the package procedure. */
                procedure read(address:in t_addr) is begin
                procedure read(address:in t_addr) is begin
                        read(readRequest,address);
                        read(readRequest,address);
                end procedure read;
                end procedure read;
 
 
Line 167... Line 174...
                        write(request=>writeRequest, address=>(others=>'-'), data=>data);
                        write(request=>writeRequest, address=>(others=>'-'), data=>data);
                end procedure write;
                end procedure write;
 
 
                variable isPktError:boolean;
                variable isPktError:boolean;
 
 
 
                /* Tester variables. */
 
        /* Synthesis-only randomisation. */
 
 
                /* Simulation-only randomisation. */
                /* Simulation-only randomisation. */
 
                /* synthesis translate_off */
                variable rv0:RandomPType;
                variable rv0:RandomPType;
 
                /* synthesis translate_on */
 
 
        begin
        begin
                if reset then
                if not nReset then
 
                        /*simulation only. */
 
                        /* synthesis translate_off */
                        rv0.InitSeed(rv0'instance_name);
                        rv0.InitSeed(rv0'instance_name);
 
                        /* synthesis translate_on */
 
 
                        txFSM<=idle;
                        txFSM<=idle;
                elsif falling_edge(irq_write) then
                elsif falling_edge(irq_write) then
                        case txFSM is
                        case txFSM is
                                when idle=>
                                when idle=>
                                        if outstandingTransactions>0 then
                                        if outstandingTransactions>0 then
 
                                                /* synthesis translate_off */
                                                write(rv0.RandSigned(axiMaster_out.tData'length));
                                                write(rv0.RandSigned(axiMaster_out.tData'length));
 
                                                /* synthesis translate_on */
                                                txFSM<=transmitting;
                                                txFSM<=transmitting;
                                        end if;
                                        end if;
                                when transmitting=>
                                when transmitting=>
                                        if writeResponse.trigger then
                                        if writeResponse.trigger then
 
                                                /* synthesis translate_off */
                                                write(rv0.RandSigned(axiMaster_out.tData'length));
                                                write(rv0.RandSigned(axiMaster_out.tData'length));
 
                                                /* synthesis translate_on */
                                        end if;
                                        end if;
 
 
                                        if axiMaster_out.tLast then
                                        if axiMaster_out.tLast then
                                                txFSM<=idle;
                                                txFSM<=idle;
                                        end if;
                                        end if;
Line 195... Line 215...
                        end case;
                        end case;
                end if;
                end if;
        end process sequencer;
        end process sequencer;
 
 
        /* Reset symbolsPerTransfer to new value (prepare for new transfer) after current transfer has been completed. */
        /* Reset symbolsPerTransfer to new value (prepare for new transfer) after current transfer has been completed. */
        process(reset,irq_write) is
        process(nReset,irq_write) is
 
                /* synthesis translate_off */
                variable rv0:RandomPType;
                variable rv0:RandomPType;
 
                /* synthesis translate_on */
        begin
        begin
                if reset then
                if not nReset then
 
                        /* synthesis translate_off */
                        rv0.InitSeed(rv0'instance_name);
                        rv0.InitSeed(rv0'instance_name);
                        symbolsPerTransfer<=120x"0" & rv0.RandUnsigned(8);
                        symbolsPerTransfer<=120x"0" & rv0.RandUnsigned(8);
                        report "symbols per transfer = 0x" & ieee.numeric_std.to_hstring(rv0.RandUnsigned(axiMaster_out.tData'length));
                        report "symbols per transfer = 0x" & ieee.numeric_std.to_hstring(rv0.RandUnsigned(axiMaster_out.tData'length));
 
                        /* synthesis translate_on */
                elsif rising_edge(irq_write) then
                elsif rising_edge(irq_write) then
                        if axiMaster_out.tLast then
                        if axiMaster_out.tLast then
 
                                /* synthesis translate_off */
                                symbolsPerTransfer<=120x"0" & rv0.RandUnsigned(8);
                                symbolsPerTransfer<=120x"0" & rv0.RandUnsigned(8);
                                report "symbols per transfer = 0x" & ieee.numeric_std.to_hstring(rv0.RandUnsigned(axiMaster_out.tData'length));
                                report "symbols per transfer = 0x" & ieee.numeric_std.to_hstring(rv0.RandUnsigned(axiMaster_out.tData'length));
 
                                /* synthesis translate_on */
                        end if;
                        end if;
                end if;
                end if;
        end process;
        end process;
end architecture rtl;
end architecture rtl;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.