applies cklang-tidy fixes
This commit is contained in:
@ -32,10 +32,10 @@
|
||||
#define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_INITIATOR_H_
|
||||
|
||||
#include <cci_configuration>
|
||||
#include <tlm>
|
||||
#include <string>
|
||||
#include <tlm_utils/simple_initiator_socket.h>
|
||||
#include <scc/report.h>
|
||||
#include <string>
|
||||
#include <tlm>
|
||||
#include <tlm_utils/simple_initiator_socket.h>
|
||||
|
||||
/**
|
||||
* @class initiator
|
||||
@ -46,7 +46,7 @@ SC_MODULE(initiator) {
|
||||
public:
|
||||
int data;
|
||||
|
||||
tlm_utils::simple_initiator_socket<initiator, 32> initiator_socket; ///< Instance of TLM2 simple initiator socket
|
||||
tlm_utils::simple_initiator_socket<initiator, 32> initiator_socket; ///< Instance of TLM2 simple initiator socket
|
||||
|
||||
/**
|
||||
* @fn initiator
|
||||
@ -54,13 +54,13 @@ public:
|
||||
* @return void
|
||||
*/
|
||||
SC_CTOR(initiator)
|
||||
:
|
||||
data(0), initiator_socket("initiator_socket"), initiator_ID("initiator_ID", "initiator_default") {
|
||||
: data(0)
|
||||
, initiator_socket("initiator_socket")
|
||||
, initiator_ID("initiator_ID", "initiator_default") {
|
||||
SCCINFO(SCMOD) << "[" << initiator_ID.get_value() << " C_TOR] ------- [INITIATOR CONSTRUCTOR BEGINS HERE] --------";
|
||||
|
||||
// initiator's SC_THREAD declaration
|
||||
SC_THREAD(run_initiator);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,18 +69,18 @@ public:
|
||||
* @return void
|
||||
*/
|
||||
void run_initiator(void) {
|
||||
tlm::tlm_generic_payload *trans = new tlm::tlm_generic_payload;
|
||||
tlm::tlm_generic_payload* trans = new tlm::tlm_generic_payload;
|
||||
|
||||
int i = 0;
|
||||
|
||||
static tlm::tlm_command cmds[8] =
|
||||
{ tlm::TLM_WRITE_COMMAND, tlm::TLM_READ_COMMAND, tlm::TLM_WRITE_COMMAND, tlm::TLM_READ_COMMAND, tlm::TLM_READ_COMMAND,
|
||||
tlm::TLM_READ_COMMAND, tlm::TLM_WRITE_COMMAND, tlm::TLM_WRITE_COMMAND };
|
||||
while (1) {
|
||||
static tlm::tlm_command cmds[8] = {tlm::TLM_WRITE_COMMAND, tlm::TLM_READ_COMMAND, tlm::TLM_WRITE_COMMAND, tlm::TLM_READ_COMMAND,
|
||||
tlm::TLM_READ_COMMAND, tlm::TLM_READ_COMMAND, tlm::TLM_WRITE_COMMAND, tlm::TLM_WRITE_COMMAND};
|
||||
while(1) {
|
||||
tlm::tlm_command cmd = cmds[(i >> 2) % 8];
|
||||
//static_cast<tlm::tlm_command>(cmd_dist(rng));
|
||||
// static_cast<tlm::tlm_command>(cmd_dist(rng));
|
||||
|
||||
if (cmd == tlm::TLM_WRITE_COMMAND) data = 0xFF000000 | i;
|
||||
if(cmd == tlm::TLM_WRITE_COMMAND)
|
||||
data = 0xFF000000 | i;
|
||||
|
||||
trans->set_command(cmd);
|
||||
trans->set_address(i);
|
||||
@ -92,27 +92,28 @@ public:
|
||||
trans->set_response_status(tlm::TLM_INCOMPLETE_RESPONSE);
|
||||
sc_core::sc_time delay = sc_core::sc_time(0, sc_core::SC_NS);
|
||||
|
||||
if (cmd == tlm::TLM_WRITE_COMMAND) {
|
||||
if(cmd == tlm::TLM_WRITE_COMMAND) {
|
||||
SCCINFO(SCMOD) << "[Initiators Message]=>At address " << std::hex << i << " sending transaction with command = Write"
|
||||
<< ", data=" << std::hex << data << " at time " << sc_core::sc_time_stamp();
|
||||
<< ", data=" << std::hex << data << " at time " << sc_core::sc_time_stamp();
|
||||
} else {
|
||||
SCCINFO(SCMOD) << "[Initiators Message]=>At address " << std::hex << i << " sending transaction with command= Read "
|
||||
<< " at time " << sc_core::sc_time_stamp();
|
||||
<< " at time " << sc_core::sc_time_stamp();
|
||||
}
|
||||
|
||||
initiator_socket->b_transport(*trans, delay);
|
||||
|
||||
if (trans->is_response_error())
|
||||
SCCERR(SCMOD) << "TLM_2" << trans->get_response_string().c_str();
|
||||
if(trans->is_response_error())
|
||||
SCCERR(SCMOD) << "TLM_2" << trans->get_response_string().c_str();
|
||||
|
||||
if (delay.to_double() != 0) wait(delay);
|
||||
if(delay.to_double() != 0)
|
||||
wait(delay);
|
||||
|
||||
if (cmd == tlm::TLM_WRITE_COMMAND) {
|
||||
if(cmd == tlm::TLM_WRITE_COMMAND) {
|
||||
SCCINFO(SCMOD) << "[Initiators Message]=>At address " << std::hex << i << " received response of Write transaction "
|
||||
<< " at time " << sc_core::sc_time_stamp();
|
||||
<< " at time " << sc_core::sc_time_stamp();
|
||||
} else {
|
||||
SCCINFO(SCMOD) << "[Initiators Message]=>At address " << std::hex << i << " received response of Read transaction "
|
||||
<< " data " << data << " at time " << sc_core::sc_time_stamp();
|
||||
<< " data " << data << " at time " << sc_core::sc_time_stamp();
|
||||
}
|
||||
|
||||
SCCINFO(SCMOD) << "--------------------------------------------------------";
|
||||
@ -124,17 +125,15 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
cci::cci_param<std::string, cci::CCI_MUTABLE_PARAM> initiator_ID; ///< Elab Time Param for assigning initiator ID (initialized by top_module)
|
||||
cci::cci_param<std::string, cci::CCI_MUTABLE_PARAM>
|
||||
initiator_ID; ///< Elab Time Param for assigning initiator ID (initialized by top_module)
|
||||
/**
|
||||
* @fn void end_of_elaboration()
|
||||
* @brief end of elaboration function to lock structural param
|
||||
* @return void
|
||||
*/
|
||||
void end_of_elaboration() {
|
||||
initiator_ID.lock();
|
||||
}
|
||||
|
||||
void end_of_elaboration() { initiator_ID.lock(); }
|
||||
};
|
||||
// initiator
|
||||
// initiator
|
||||
|
||||
#endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_INITIATOR_H_
|
||||
#endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_INITIATOR_H_
|
||||
|
@ -35,13 +35,13 @@
|
||||
#endif
|
||||
|
||||
#include <cci_configuration>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <tlm>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <tlm_utils/multi_passthrough_target_socket.h>
|
||||
#include <tlm_utils/multi_passthrough_initiator_socket.h>
|
||||
#include <tlm_utils/multi_passthrough_target_socket.h>
|
||||
|
||||
/**
|
||||
* @class router
|
||||
@ -59,9 +59,13 @@ public:
|
||||
* @return void
|
||||
*/
|
||||
SC_CTOR(router)
|
||||
:
|
||||
Router_target("Router_target"), Router_initiator("Router_initiator"), r_initiators("r_initiators", 0), r_targets("r_targets",
|
||||
0), addr_limit("addr_max", 64), m_broker(cci::cci_get_broker()), addrSize(0) {
|
||||
: Router_target("Router_target")
|
||||
, Router_initiator("Router_initiator")
|
||||
, r_initiators("r_initiators", 0)
|
||||
, r_targets("r_targets", 0)
|
||||
, addr_limit("addr_max", 64)
|
||||
, m_broker(cci::cci_get_broker())
|
||||
, addrSize(0) {
|
||||
SCCINFO(SCMOD) << "[ROUTER C_TOR] ----- [ROUTER CONSTRUCTOR BEGINS HERE] ------";
|
||||
|
||||
// Register b_transport
|
||||
@ -78,8 +82,8 @@ public:
|
||||
SCCINFO(SCMOD) << "[ROUTER in beoe] : Number of target(s) : " << r_targets.get_value();
|
||||
SCCINFO(SCMOD) << "[ROUTER in beoe] : Maximum Addressable Limit of the router : " << addr_limit.get_value();
|
||||
|
||||
char targetName[10]; ///< Holds router table's fields' names
|
||||
addrSize = (unsigned int) (addr_limit.get_value() / r_targets);
|
||||
char targetName[10]; ///< Holds router table's fields' names
|
||||
addrSize = (unsigned int)(addr_limit.get_value() / r_targets);
|
||||
|
||||
// Printing the Router Table contents
|
||||
SCCINFO(SCMOD) << "============= ROUTER TABLE INFORMATION ==============";
|
||||
@ -89,7 +93,7 @@ public:
|
||||
|
||||
// Sets the contents of the routing table with (default) values
|
||||
// calculated within 'beoe' phase
|
||||
for (int i = 0; i < r_targets; i++) {
|
||||
for(int i = 0; i < r_targets; i++) {
|
||||
snprintf(targetName, sizeof(targetName), "r_index_%d", i);
|
||||
r_target_index.push_back(new cci::cci_param<unsigned int, cci::CCI_IMMUTABLE_PARAM>(targetName, i));
|
||||
|
||||
@ -100,37 +104,37 @@ public:
|
||||
r_addr_end.push_back(new cci::cci_param<unsigned int, cci::CCI_IMMUTABLE_PARAM>(targetName, ((i + 1) * addrSize - 1)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < r_targets; i++) {
|
||||
for(int i = 0; i < r_targets; i++) {
|
||||
snprintf(stringName, sizeof(stringName), "top_module_inst.target_%d.s_base_addr", i);
|
||||
|
||||
base_handle = m_broker.get_param_handle(stringName);
|
||||
if (!base_handle.is_valid()) {
|
||||
if(!base_handle.is_valid()) {
|
||||
sc_assert(!"target Base Address Handle returned is NULL");
|
||||
}
|
||||
std::stringstream row_ss;
|
||||
row_ss << "| " << std::setw(10) << r_target_index[i]->get_value() << " | " << std::setw(10) << std::hex << std::showbase
|
||||
<< r_addr_start[i]->get_value() << " | " << std::setw(10) << r_addr_end[i]->get_value() << " | " << std::setw(10)
|
||||
<< base_handle.get_cci_value().to_json() << " |";
|
||||
<< r_addr_start[i]->get_value() << " | " << std::setw(10) << r_addr_end[i]->get_value() << " | " << std::setw(10)
|
||||
<< base_handle.get_cci_value().to_json() << " |";
|
||||
SCCINFO(SCMOD) << row_ss.str().c_str();
|
||||
SCCINFO(SCMOD) << "-----------------------------------------------------";
|
||||
}
|
||||
}
|
||||
|
||||
// Blocking transport implementation of the router
|
||||
void b_transport(int i_, tlm::tlm_generic_payload &trans, sc_core::sc_time &delay) {
|
||||
void b_transport(int i_, tlm::tlm_generic_payload& trans, sc_core::sc_time& delay) {
|
||||
wait(delay);
|
||||
|
||||
delay = sc_core::SC_ZERO_TIME;
|
||||
|
||||
sc_dt::uint64 addr = trans.get_address();
|
||||
|
||||
if (addr >= static_cast<sc_dt::uint64>(addr_limit.get_value())) {
|
||||
if(addr >= static_cast<sc_dt::uint64>(addr_limit.get_value())) {
|
||||
trans.set_response_status(tlm::TLM_ADDRESS_ERROR_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < r_target_index.size(); i++) {
|
||||
if ((addr >= (r_addr_start[i]->get_value())) && (addr <= (r_addr_end[i]->get_value()))) {
|
||||
for(unsigned int i = 0; i < r_target_index.size(); i++) {
|
||||
if((addr >= (r_addr_start[i]->get_value())) && (addr <= (r_addr_end[i]->get_value()))) {
|
||||
SCCINFO(SCMOD) << "[Router in 'b_transport' layer]";
|
||||
SCCINFO(SCMOD) << "Address = " << std::hex << addr;
|
||||
SCCINFO(SCMOD) << "Index = " << (r_target_index[i])->get_value();
|
||||
@ -145,15 +149,15 @@ public:
|
||||
private:
|
||||
/// Demonstrates Model-to-Model Configuration (UC12)
|
||||
/// Elaboration Time Parameters for setting up the model hierarcy;
|
||||
cci::cci_param<int, cci::CCI_MUTABLE_PARAM> r_initiators; ///< initiator ID assigned by the top_module upon instantiation
|
||||
cci::cci_param<int, cci::CCI_MUTABLE_PARAM> r_targets; ///< target ID assigned by the top_module upon instantiation
|
||||
cci::cci_param<unsigned int, cci::CCI_MUTABLE_PARAM> addr_limit; ///< Router Addressing Range
|
||||
cci::cci_broker_handle m_broker; ///< CCI configuration broker handle
|
||||
cci::cci_param<int, cci::CCI_MUTABLE_PARAM> r_initiators; ///< initiator ID assigned by the top_module upon instantiation
|
||||
cci::cci_param<int, cci::CCI_MUTABLE_PARAM> r_targets; ///< target ID assigned by the top_module upon instantiation
|
||||
cci::cci_param<unsigned int, cci::CCI_MUTABLE_PARAM> addr_limit; ///< Router Addressing Range
|
||||
cci::cci_broker_handle m_broker; ///< CCI configuration broker handle
|
||||
|
||||
/// Router Table contents holding targets related information
|
||||
std::vector<cci::cci_param<unsigned int, cci::CCI_IMMUTABLE_PARAM>*> r_target_index; ///< Router table target index
|
||||
std::vector<cci::cci_param<unsigned int, cci::CCI_IMMUTABLE_PARAM>*> r_addr_start; ///< Router table start address
|
||||
std::vector<cci::cci_param<unsigned int, cci::CCI_IMMUTABLE_PARAM>*> r_addr_end; ///< Router table end address
|
||||
std::vector<cci::cci_param<unsigned int, cci::CCI_IMMUTABLE_PARAM>*> r_target_index; ///< Router table target index
|
||||
std::vector<cci::cci_param<unsigned int, cci::CCI_IMMUTABLE_PARAM>*> r_addr_start; ///< Router table start address
|
||||
std::vector<cci::cci_param<unsigned int, cci::CCI_IMMUTABLE_PARAM>*> r_addr_end; ///< Router table end address
|
||||
|
||||
cci::cci_param_handle base_handle; ///< CCI base parameter handle for target base address
|
||||
|
||||
@ -170,6 +174,6 @@ private:
|
||||
int addrSize;
|
||||
char stringName[50];
|
||||
};
|
||||
// router
|
||||
// router
|
||||
|
||||
#endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_ROUTER_H_
|
||||
#endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_ROUTER_H_
|
||||
|
@ -31,10 +31,10 @@
|
||||
* @date 29th April, 2011 (Friday)
|
||||
*/
|
||||
|
||||
#include "top_module.h"
|
||||
#include <cci_configuration>
|
||||
#include <cci_utils/broker.h>
|
||||
#include <string>
|
||||
#include "top_module.h"
|
||||
|
||||
/**
|
||||
* @fn int sc_main(int argc, char* argv[])
|
||||
@ -43,7 +43,7 @@
|
||||
* @param argv The list of input arguments
|
||||
* @return An integer for the execution status
|
||||
*/
|
||||
int sc_main(int sc_argc, char *sc_argv[]) {
|
||||
int sc_main(int sc_argc, char* sc_argv[]) {
|
||||
scc::init_logging(scc::log::INFO);
|
||||
cci::cci_originator me = cci::cci_originator("sc_main");
|
||||
// Get handle to the default broker
|
||||
@ -83,4 +83,4 @@ int sc_main(int sc_argc, char *sc_argv[]) {
|
||||
SCCINFO("sc_main") << "End Simulation.";
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
} // End of 'sc_main'
|
||||
} // End of 'sc_main'
|
||||
|
@ -32,10 +32,10 @@
|
||||
#define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TARGET_H_
|
||||
|
||||
#include <cci_configuration>
|
||||
#include <tlm>
|
||||
#include <string>
|
||||
#include <tlm_utils/simple_target_socket.h>
|
||||
#include <scc/report.h>
|
||||
#include <string>
|
||||
#include <tlm>
|
||||
#include <tlm_utils/simple_target_socket.h>
|
||||
|
||||
/**
|
||||
* @class target
|
||||
@ -47,8 +47,10 @@ public:
|
||||
sc_core::sc_time read_latency, write_latency;
|
||||
|
||||
SC_CTOR(target)
|
||||
:
|
||||
target_socket("target_socket"), target_ID("target_ID", "target_default"), s_base_addr("s_base_addr", 0), s_size("s_size", 256) {
|
||||
: target_socket("target_socket")
|
||||
, target_ID("target_ID", "target_default")
|
||||
, s_base_addr("s_base_addr", 0)
|
||||
, s_size("s_size", 256) {
|
||||
SCCINFO(SCMOD) << "[" << target_ID.get_value() << " C_TOR] ------- [TARGET CONSTRUCTOR BEGINS HERE] --------";
|
||||
SCCINFO(SCMOD) << "[" << target_ID.get_value() << " C_TOR] : Base Address : " << s_base_addr.get_value();
|
||||
|
||||
@ -60,7 +62,7 @@ public:
|
||||
|
||||
mem = new int[s_size.get_value()];
|
||||
|
||||
for (unsigned int i = 0; i < s_size.get_value(); i++)
|
||||
for(unsigned int i = 0; i < s_size.get_value(); i++)
|
||||
mem[i] = 0xAABBCCDD | i;
|
||||
|
||||
// target's SC_THREAD declaration
|
||||
@ -72,8 +74,7 @@ public:
|
||||
* @brief The run thread of the modeul (does nothing)
|
||||
* @return void
|
||||
*/
|
||||
void run_target(void) {
|
||||
}
|
||||
void run_target(void) {}
|
||||
|
||||
/**
|
||||
* @fn void b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& delay)
|
||||
@ -82,49 +83,49 @@ public:
|
||||
* @param delay The annotated delay associated with the transaction
|
||||
* @return void
|
||||
*/
|
||||
void b_transport(tlm::tlm_generic_payload &trans, sc_core::sc_time &delay) {
|
||||
void b_transport(tlm::tlm_generic_payload & trans, sc_core::sc_time & delay) {
|
||||
tlm::tlm_command cmd = trans.get_command();
|
||||
sc_dt::uint64 adr = trans.get_address() - s_base_addr.get_value();
|
||||
unsigned char *ptr = trans.get_data_ptr();
|
||||
unsigned char* ptr = trans.get_data_ptr();
|
||||
unsigned int len = trans.get_data_length();
|
||||
unsigned char *byt = trans.get_byte_enable_ptr();
|
||||
unsigned char* byt = trans.get_byte_enable_ptr();
|
||||
unsigned int wid = trans.get_streaming_width();
|
||||
|
||||
SCCINFO(SCMOD) << "[TARGET] : adr ---- " << std::hex << adr;
|
||||
SCCINFO(SCMOD) << "[TARGET] : base addr ---- " << std::hex << s_base_addr.get_value();
|
||||
|
||||
// Check for storage address overflow
|
||||
if (adr > s_size.get_value()) {
|
||||
if(adr > s_size.get_value()) {
|
||||
trans.set_response_status(tlm::TLM_ADDRESS_ERROR_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Target unable to support byte enable attribute
|
||||
if (byt) {
|
||||
if(byt) {
|
||||
trans.set_response_status(tlm::TLM_BYTE_ENABLE_ERROR_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Target unable to support streaming width attribute
|
||||
if (wid < len) {
|
||||
if(wid < len) {
|
||||
trans.set_response_status(tlm::TLM_BURST_ERROR_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd == tlm::TLM_READ_COMMAND) {
|
||||
if(cmd == tlm::TLM_READ_COMMAND) {
|
||||
memcpy(ptr, &mem[adr], len);
|
||||
delay = delay + read_latency;
|
||||
} else
|
||||
if (cmd == tlm::TLM_WRITE_COMMAND) {
|
||||
memcpy(&mem[adr], ptr, len);
|
||||
delay = delay + write_latency;
|
||||
}
|
||||
} else if(cmd == tlm::TLM_WRITE_COMMAND) {
|
||||
memcpy(&mem[adr], ptr, len);
|
||||
delay = delay + write_latency;
|
||||
}
|
||||
|
||||
trans.set_response_status(tlm::TLM_OK_RESPONSE);
|
||||
}
|
||||
|
||||
private:
|
||||
cci::cci_param<std::string, cci::CCI_MUTABLE_PARAM> target_ID; ///< Elaboration Time Param for assigning target ID (initialized by top_module)
|
||||
cci::cci_param<std::string, cci::CCI_MUTABLE_PARAM>
|
||||
target_ID; ///< Elaboration Time Param for assigning target ID (initialized by top_module)
|
||||
|
||||
cci::cci_param<int, cci::CCI_MUTABLE_PARAM> s_base_addr; ///< Mutable time param for setting target's base addr (initialized by router)
|
||||
|
||||
@ -140,8 +141,8 @@ private:
|
||||
s_base_addr.lock();
|
||||
}
|
||||
|
||||
int *mem;
|
||||
int* mem;
|
||||
};
|
||||
// target
|
||||
// target
|
||||
|
||||
#endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TARGET_H_
|
||||
#endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TARGET_H_
|
||||
|
@ -32,13 +32,13 @@
|
||||
#define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TOP_MODULE_H_
|
||||
|
||||
#include <cci_configuration>
|
||||
#include <scc/report.h>
|
||||
#include <sstream>
|
||||
#include <tlm>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <scc/report.h>
|
||||
|
||||
#include "router.h"
|
||||
#include "initiator.h"
|
||||
#include "router.h"
|
||||
#include "target.h"
|
||||
|
||||
/**
|
||||
@ -52,8 +52,9 @@ public:
|
||||
* @brief The class constructor
|
||||
*/
|
||||
SC_CTOR(top_module)
|
||||
:
|
||||
n_initiators("number_of_initiators", 0), n_targets("number_of_targets", 0), m_broker(cci::cci_get_broker()) {
|
||||
: n_initiators("number_of_initiators", 0)
|
||||
, n_targets("number_of_targets", 0)
|
||||
, m_broker(cci::cci_get_broker()) {
|
||||
std::stringstream ss;
|
||||
|
||||
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] -- [TOP MODULE CONSTRUCTOR BEGINS HERE]";
|
||||
@ -80,14 +81,14 @@ public:
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
cci::cci_param_handle r_addr_limit_handle = m_broker.get_param_handle("top_module_inst.RouterInstance.addr_limit");
|
||||
if (r_addr_limit_handle.is_valid()) {
|
||||
if(r_addr_limit_handle.is_valid()) {
|
||||
r_addr_max = atoi((r_addr_limit_handle.get_cci_value().to_json()).c_str());
|
||||
|
||||
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Router's maximum addressable limit : " << r_addr_max;
|
||||
}
|
||||
|
||||
/// Creating instances of initiator(s)
|
||||
for (int i = 0; i < n_initiators; i++) {
|
||||
for(int i = 0; i < n_initiators; i++) {
|
||||
snprintf(initiatorName, sizeof(initiatorName), "initiator_%d", i);
|
||||
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Creating initiator : " << initiatorName;
|
||||
|
||||
@ -107,7 +108,7 @@ public:
|
||||
targetSize = 128;
|
||||
|
||||
// Creating instances of target(s)
|
||||
for (int i = 0; i < n_targets; i++) {
|
||||
for(int i = 0; i < n_targets; i++) {
|
||||
snprintf(targetName, sizeof(targetName), "target_%d", i);
|
||||
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Creating target : " << targetName;
|
||||
|
||||
@ -131,7 +132,7 @@ public:
|
||||
}
|
||||
|
||||
// Try re-setting locked values for Router Table contents
|
||||
for (int i = 0; i < n_targets; i++) {
|
||||
for(int i = 0; i < n_targets; i++) {
|
||||
snprintf(targetName, sizeof(targetName), "%s.RouterInstance.r_index_%d", name(), i);
|
||||
ss.clear();
|
||||
ss.str("");
|
||||
@ -140,7 +141,7 @@ public:
|
||||
try {
|
||||
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Re-setting fields of target_" << i;
|
||||
m_broker.set_preset_cci_value(targetName, cci::cci_value::from_json(ss.str()));
|
||||
} catch (sc_core::sc_report const &exception) {
|
||||
} catch(sc_core::sc_report const& exception) {
|
||||
SCCINFO(SCMOD) << "[ROUTER : Caught] : " << exception.what();
|
||||
}
|
||||
|
||||
@ -157,7 +158,7 @@ public:
|
||||
try {
|
||||
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Re-setting start addr of target_" << i;
|
||||
m_broker.set_preset_cci_value(targetName, cci::cci_value::from_json(ss.str()));
|
||||
} catch (sc_core::sc_report const &exception) {
|
||||
} catch(sc_core::sc_report const& exception) {
|
||||
SCCINFO(SCMOD) << "[ROUTER : Caught] : " << exception.what();
|
||||
}
|
||||
|
||||
@ -169,7 +170,7 @@ public:
|
||||
try {
|
||||
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Re-setting end addr of target_" << i;
|
||||
m_broker.set_preset_cci_value(targetName, cci::cci_value::from_json(ss.str()));
|
||||
} catch (sc_core::sc_report const &exception) {
|
||||
} catch(sc_core::sc_report const& exception) {
|
||||
SCCINFO(SCMOD) << "[ROUTER : Caught] : " << exception.what();
|
||||
}
|
||||
}
|
||||
@ -181,16 +182,16 @@ public:
|
||||
* @return void
|
||||
*/
|
||||
~top_module() {
|
||||
if (!initiatorList.empty()) {
|
||||
for (std::vector<initiator*>::iterator it = initiatorList.begin(); it != initiatorList.end(); ++it) {
|
||||
delete (*it);
|
||||
if(!initiatorList.empty()) {
|
||||
for(std::vector<initiator*>::iterator it = initiatorList.begin(); it != initiatorList.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
initiatorList.clear();
|
||||
}
|
||||
|
||||
if (!targetList.empty()) {
|
||||
for (std::vector<target*>::iterator it = targetList.begin(); it != targetList.end(); ++it) {
|
||||
delete (*it);
|
||||
if(!targetList.empty()) {
|
||||
for(std::vector<target*>::iterator it = targetList.begin(); it != targetList.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
targetList.clear();
|
||||
}
|
||||
@ -199,26 +200,25 @@ public:
|
||||
private:
|
||||
// Immutable type cci-parameters
|
||||
cci::cci_param<int, cci::CCI_IMMUTABLE_PARAM> n_initiators; ///< Number of initiators to be instantiated
|
||||
cci::cci_param<int, cci::CCI_IMMUTABLE_PARAM> n_targets; ///< Number of targets to be instantiated
|
||||
cci::cci_param<int, cci::CCI_IMMUTABLE_PARAM> n_targets; ///< Number of targets to be instantiated
|
||||
|
||||
cci::cci_broker_handle m_broker; ///< Configuration broker handle
|
||||
|
||||
router *routerInstance; ///< Declaration of a router pointer
|
||||
router* routerInstance; ///< Declaration of a router pointer
|
||||
|
||||
// STD::VECTORs for creating instances of initiator and target
|
||||
std::vector<initiator*> initiatorList; ///< STD::VECTOR for initiators
|
||||
std::vector<target*> targetList; ///< STD::VECTOR for targets
|
||||
std::vector<initiator*> initiatorList; ///< STD::VECTOR for initiators
|
||||
std::vector<target*> targetList; ///< STD::VECTOR for targets
|
||||
|
||||
char initiatorName[50]; ///< initiator_ID
|
||||
char targetName[50]; ///< target_ID
|
||||
char stringMisc[50]; ///< String to be used for misc things
|
||||
char targetBaseAddr[50]; ///< The base address of the target
|
||||
char initiatorName[50]; ///< initiator_ID
|
||||
char targetName[50]; ///< target_ID
|
||||
char stringMisc[50]; ///< String to be used for misc things
|
||||
char targetBaseAddr[50]; ///< The base address of the target
|
||||
|
||||
int addrValue
|
||||
{ 0 }; ///< Address Value
|
||||
int targetSize; ///< Maximum target Size (preset value)
|
||||
int r_addr_max; ///< Maximum Router Table's memory range
|
||||
int addrValue{0}; ///< Address Value
|
||||
int targetSize; ///< Maximum target Size (preset value)
|
||||
int r_addr_max; ///< Maximum Router Table's memory range
|
||||
};
|
||||
// top_module
|
||||
// top_module
|
||||
|
||||
#endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TOP_MODULE_H_
|
||||
#endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TOP_MODULE_H_
|
||||
|
Reference in New Issue
Block a user