00001 // sampalib.org ESL library and tools 00002 // Copyright (C) 2007 Thierry Grellier 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License version 2 as 00006 // published by the Free Software Foundation. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along 00014 // with this program; if not, write to the Free Software Foundation, Inc., 00015 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00016 // 00017 // contact: www.sampalib.org 00018 00019 #ifndef SAMPA_FIX_LATENCY_SLAVE_H 00020 #define SAMPA_FIX_LATENCY_SLAVE_H 00021 00022 #include "sampa/component/protocol.h" 00023 #include "sampa/core/fifo.h" 00024 #include "sampa/core/select.h" 00025 #include "sampa/core/sarray.h" 00026 00027 namespace Sampa { 00028 00029 struct SAMPA_PERSISTENT_CLASS(ResponseForecast) { 00030 ResponseForecast(DefaultCtrTag); 00031 Response m_response; 00032 unsigned long long m_date; 00033 SAMPA_PERSISTENT(ResponseForecast); 00034 }; 00035 00036 class FixLatencySlave : public Module, public TargetRequestInterface { 00037 SAMPA_MODULE(FixLatencySlave); 00038 public: 00039 FixLatencySlave(const Name& name); 00040 00041 void bind_clock(Clock* clock); 00042 Target* get_target() { return &p_target; } 00043 void bind_initiator(Initiator* initiator); 00044 00045 bool recieve_request(const Request& request); 00046 00047 protected: 00048 bool check_elaboration(); 00049 void complete_restart(); 00050 void execute(); 00051 00052 private: 00053 Target p_target; 00054 Clock* p_clock; 00055 EventListenerSingle e_new_request_or_response_accepted; 00056 EventListenerSingle e_new_request_or_send_response; 00057 ClockedEvent e_send_response; 00058 unsigned long long m_stalled; 00059 unsigned long long m_date; 00060 Response m_current; 00061 bool m_pending; 00062 Fifo m_fifo; 00063 Array<Response> m_response_to_send; 00064 Gated<Request> m_request; 00065 Gated<bool> m_new_request; 00066 int m_burst; 00067 int m_command_latencies[2*CMD_NUM]; 00068 }; 00069 00070 } 00071 00072 #endif
1.5.3