111819SChristian.Menard@tu-dresden.de/*
211819SChristian.Menard@tu-dresden.de * Copyright (c) 2016, Dresden University of Technology (TU Dresden)
311819SChristian.Menard@tu-dresden.de * All rights reserved.
411819SChristian.Menard@tu-dresden.de *
511819SChristian.Menard@tu-dresden.de * Redistribution and use in source and binary forms, with or without
611819SChristian.Menard@tu-dresden.de * modification, are permitted provided that the following conditions are
711819SChristian.Menard@tu-dresden.de * met:
811819SChristian.Menard@tu-dresden.de *
911819SChristian.Menard@tu-dresden.de * 1. Redistributions of source code must retain the above copyright notice,
1011819SChristian.Menard@tu-dresden.de *    this list of conditions and the following disclaimer.
1111819SChristian.Menard@tu-dresden.de *
1211819SChristian.Menard@tu-dresden.de * 2. Redistributions in binary form must reproduce the above copyright
1311819SChristian.Menard@tu-dresden.de *    notice, this list of conditions and the following disclaimer in the
1411819SChristian.Menard@tu-dresden.de *    documentation and/or other materials provided with the distribution.
1511819SChristian.Menard@tu-dresden.de *
1611819SChristian.Menard@tu-dresden.de * 3. Neither the name of the copyright holder nor the names of its
1711819SChristian.Menard@tu-dresden.de *    contributors may be used to endorse or promote products derived from
1811819SChristian.Menard@tu-dresden.de *    this software without specific prior written permission.
1911819SChristian.Menard@tu-dresden.de *
2011819SChristian.Menard@tu-dresden.de * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2111819SChristian.Menard@tu-dresden.de * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2211819SChristian.Menard@tu-dresden.de * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2311819SChristian.Menard@tu-dresden.de * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
2411819SChristian.Menard@tu-dresden.de * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2511819SChristian.Menard@tu-dresden.de * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2611819SChristian.Menard@tu-dresden.de * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2711819SChristian.Menard@tu-dresden.de * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
2811819SChristian.Menard@tu-dresden.de * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2911819SChristian.Menard@tu-dresden.de * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3011819SChristian.Menard@tu-dresden.de * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3111819SChristian.Menard@tu-dresden.de *
3211819SChristian.Menard@tu-dresden.de * Authors: Christian Menard
3311819SChristian.Menard@tu-dresden.de */
3411819SChristian.Menard@tu-dresden.de
3511819SChristian.Menard@tu-dresden.de#ifndef __TRAFFIC_GENERATOR_HH__
3611819SChristian.Menard@tu-dresden.de#define __TRAFFIC_GENERATOR_HH__
3711819SChristian.Menard@tu-dresden.de
3811819SChristian.Menard@tu-dresden.de#include <tlm_utils/peq_with_cb_and_phase.h>
3911819SChristian.Menard@tu-dresden.de#include <tlm_utils/simple_initiator_socket.h>
4011819SChristian.Menard@tu-dresden.de
4111819SChristian.Menard@tu-dresden.de#include <systemc>
4211819SChristian.Menard@tu-dresden.de#include <tlm>
4311819SChristian.Menard@tu-dresden.de
4411819SChristian.Menard@tu-dresden.de#include "sc_mm.hh"
4511819SChristian.Menard@tu-dresden.de
4611819SChristian.Menard@tu-dresden.declass TrafficGenerator : public sc_core::sc_module
4711819SChristian.Menard@tu-dresden.de{
4811819SChristian.Menard@tu-dresden.de  private:
4911819SChristian.Menard@tu-dresden.de    Gem5SystemC::MemoryManager mm;
5011819SChristian.Menard@tu-dresden.de
5111819SChristian.Menard@tu-dresden.de    tlm::tlm_generic_payload* requestInProgress;
5211819SChristian.Menard@tu-dresden.de
5311819SChristian.Menard@tu-dresden.de    uint32_t dataBuffer;
5411819SChristian.Menard@tu-dresden.de
5511819SChristian.Menard@tu-dresden.de    sc_core::sc_event endRequestEvent;
5611819SChristian.Menard@tu-dresden.de
5711819SChristian.Menard@tu-dresden.de    tlm_utils::peq_with_cb_and_phase<TrafficGenerator> peq;
5811819SChristian.Menard@tu-dresden.de
5911819SChristian.Menard@tu-dresden.de  public:
6011819SChristian.Menard@tu-dresden.de    tlm_utils::simple_initiator_socket<TrafficGenerator> socket;
6111819SChristian.Menard@tu-dresden.de
6211819SChristian.Menard@tu-dresden.de    SC_HAS_PROCESS(TrafficGenerator);
6311819SChristian.Menard@tu-dresden.de
6411819SChristian.Menard@tu-dresden.de    TrafficGenerator(sc_core::sc_module_name name);
6511819SChristian.Menard@tu-dresden.de
6611819SChristian.Menard@tu-dresden.de    void process();
6711819SChristian.Menard@tu-dresden.de
6811819SChristian.Menard@tu-dresden.de    void peq_cb(tlm::tlm_generic_payload& trans, const tlm::tlm_phase& phase);
6911819SChristian.Menard@tu-dresden.de
7011819SChristian.Menard@tu-dresden.de    void checkTransaction(tlm::tlm_generic_payload& trans);
7111819SChristian.Menard@tu-dresden.de
7211819SChristian.Menard@tu-dresden.de    virtual tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload& trans,
7311819SChristian.Menard@tu-dresden.de                                               tlm::tlm_phase& phase,
7411819SChristian.Menard@tu-dresden.de                                               sc_core::sc_time& delay);
7511819SChristian.Menard@tu-dresden.de};
7611819SChristian.Menard@tu-dresden.de
7711819SChristian.Menard@tu-dresden.de#endif
78