/*****************************************************************************
The following code is derived, directly or indirectly, from the SystemC
source code Copyright (c) 1996-2008 by all Contributors.
All Rights reserved.
The contents of this file are subject to the restrictions and limitations
set forth in the SystemC Open Source License Version 3.0 (the "License");
You may not use this file except in compliance with such restrictions and
limitations. You may obtain instructions on how to receive a copy of the
License at http://www.systemc.org/. Software distributed by Contributors
under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License.
*****************************************************************************/
//=============================================================================
/// @file select_initiator.cpp
/// @Details Implements a AT non blocking initiator
//
//=============================================================================
// Original Authors:
// Bill Bunton, ESLX
// Charles Wilson, ESLX
// Anna Keist, ESLX
//=============================================================================
#include "reporting.h" // Reporting convenience macros
#include "select_initiator.h" // Our header
#include "tlm.h" // TLM headers
using namespace sc_core;
static const char *filename = "select_initiator.cpp"; /// filename for reporting
//=============================================================================
///Constructor
select_initiator::select_initiator // constructor
( sc_module_name name // module name
, const unsigned int ID // initiator ID
, sc_core::sc_time end_rsp_delay // delay
)
: sc_module (name) /// init module name
, initiator_socket ("initiator_socket") /// init socket name
, m_send_end_rsp_PEQ ("send_end_rsp_PEQ") /// init PEQ name
, m_ID (ID) /// init initiator ID
, m_end_rsp_delay (end_rsp_delay) /// init end response delay
{
m_enable_target_tracking = true; /// init style tracking mode????
// bind initiator to the export
initiator_socket (*this);
// register thread process
SC_THREAD(initiator_thread);
// register method process
SC_METHOD(send_end_rsp_method)
sensitive << m_send_end_rsp_PEQ.get_event();
dont_initialize();
}
//=============================================================================
//
// Initiator thread
//
//=============================================================================
void select_initiator::initiator_thread(void) // initiator thread
{
tlm::tlm_generic_payload *transaction_ptr; // transaction pointer
std::ostringstream msg; // log message
while (true)
{
//=============================================================================
// Read FIFO to Get new transaction GP from the traffic generator
//=============================================================================
transaction_ptr = request_in_port->read(); // get request from input fifo //怎么一直读不判断?? //是读fifo,有缓冲函数,这里可能就yield了;
tlm::tlm_phase phase = tlm::BEGIN_REQ; // Create phase objects
sc_time delay = SC_ZERO_TIME; // Create delay objects
std::ostringstream msg; // log message
msg.str("");
msg << "Initiator: " << m_ID
<< " starting new transaction"
<< " for Addr:0x" << hex << setw(8) << setfill('0') << uppercase
<< transaction_ptr->get_address()
<< endl << " " ;
msg << "Initiator: " << dec << m_ID
<< " nb_transport_fw (GP, "
<< report::print(phase) << ", "
<< delay << ")";
REPORT_INFO(filename, __FUNCTION__, msg.str());
//-----------------------------------------------------------------------------
// Make the non-blocking call and decode returned status (tlm_sync_enum)
//-----------------------------------------------------------------------------
tlm::tlm_sync_enum
return_value = initiator_socket->nb_transport_fw(*transaction_ptr, phase, delay); //直接return了??这里边延时怎么实现的??; //nb的,当然要实时返回,然后读return_value,phase和delay;
msg.str("");
msg << "Initiator: " << m_ID
<< " " << report::print(return_value) << " (GP, "
<< report::print(phase) << ", "
<< delay << ")" << endl;
switch (return_value)
{
//-----------------------------------------------------------------------------
// The target returned COMPLETED this is a single phase transaction
// Wait the annotated delay
// Return the transaction to the traffic generator
//-----------------------------------------------------------------------------
case tlm::TLM_COMPLETED:
{
wait(delay + m_end_rsp_delay); // wait the annotated delay
msg << " "
<< "Initiator: " << m_ID
<< " target returned COMPLETED with annotated time ";
REPORT_INFO (filename, __FUNCTION__, msg.str() );
response_out_port->write(transaction_ptr); // return txn to traffic gen
break;
}// end case TLM_COMPLETED
//-----------------------------------------------------------------------------
// Target returned UPDATED this will be 2 phase transaction
// Add the transaction pointer to the waiting backward path map
// Set tracking enum to Rcved_UPDATED
// Wait the annotated delay
//-----------------------------------------------------------------------------
case tlm::TLM_UPDATED:
{
if( phase == tlm::END_REQ) { ////////////??可能target让稍等,这里没有货了??就加map里去备用。加map里的作用就是存从前的phase;
if (m_enable_target_tracking) { //////////干什么的!!!不知道!!;
m_waiting_bw_path_map.insert(make_pair(transaction_ptr
,Rcved_UPDATED_enum
));
}
else {
m_waiting_bw_path_map.insert(make_pair(transaction_ptr
,Rcved_END_REQ_enum
));
}
wait(delay); // wait the annotated delay
msg << " "
<< "Initiator: " << m_ID
<< " transaction waiting begin-response on backward path";
REPORT_INFO (filename, __FUNCTION__, msg.str() );
}
else if( phase == tlm::BEGIN_RESP) {
//
}
else {
msg << " "
<< "Initiator: " << m_ID
<< " Unexpected phase for UPDATED return from target ";
REPORT_FATAL (filename, __FUNCTION__, msg.str() );
}
break;
} // end case TLM_UPDATED
//-----------------------------------------------------------------------------
// Target returned ACCEPTED this will be 4 phase transaction
// Add the transaction pointer to the waiting backward path map
// Set tracking enum to Rcved_END_REQ
// When the END REQUEST RULE is active wait for the target to response
//-----------------------------------------------------------------------------
case tlm::TLM_ACCEPTED:
{
msg << " "
<< "Initiator: " << m_ID
<< " transaction waiting end-request on backward-path ";
REPORT_INFO (filename, __FUNCTION__, msg.str
没有合适的资源?快使用搜索试试~ 我知道了~
TLM-BUS_1_phase.zip_TLM_systemc tlm
共48个文件
h:23个
cpp:22个
filters:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 192 浏览量
2022-09-19
19:50:11
上传
评论
收藏 96KB ZIP 举报
温馨提示
SystemC的bus, 在例程的基础上增加了多模块机制
资源推荐
资源详情
资源评论
收起资源包目录
TLM-BUS_1_phase.zip (48个子文件)
at_initiator_temporal_decoupling.cpp 9KB
lt_target.h 4KB
TLM-多模块寻址总线_1_phase.vcxproj 4KB
at_target_1_phase_dmi.h 7KB
lt_initiator.cpp 4KB
memory.h 4KB
initiator_top.cpp 5KB
at_target_1_phase.h 7KB
at_1_phase_top.cpp 4KB
TLM-多模块寻址总线_1_phase.vcxproj.user 143B
lt_dmi_target.cpp 8KB
at_initiator_annotated.cpp 18KB
at_initiator_explicit.h 6KB
memory.cpp 8KB
at_1_phase.cpp 3KB
at_1_phase_top.h 2KB
extension_initiator_id.h 3KB
dmi_memory.cpp 7KB
at_initiator_annotated.h 6KB
select_initiator.h 6KB
lt_td_initiator.cpp 5KB
at_target_4_phase.h 7KB
lt_initiator.h 3KB
at_target_2_phase.cpp 13KB
traffic_generator.h 6KB
lt_synch_target.cpp 4KB
select_initiator.cpp 20KB
at_target_2_phase.h 7KB
at_initiator_temporal_decoupling.h 4KB
TLM-多模块寻址总线_1_phase.vcxproj.filters 2KB
reporting.h 7KB
SimpleBusLT.h 6KB
lt_td_initiator.h 4KB
initiator_top.h 4KB
lt_dmi_initiator.h 4KB
at_target_1_phase_dmi.cpp 14KB
lt_synch_target.h 4KB
at_target_4_phase.cpp 17KB
at_initiator_explicit.cpp 17KB
SimpleBusAT.h 11KB
at_target_1_phase.cpp 14KB
extension_initiator_id.cpp 2KB
traffic_generator.cpp 10KB
lt_dmi_initiator.cpp 8KB
report.cpp 7KB
lt_target.cpp 4KB
lt_dmi_target.h 5KB
dmi_memory.h 4KB
共 48 条
- 1
资源评论
四散
- 粉丝: 49
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功