applies cklang-tidy fixes
This commit is contained in:
@@ -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_
|
||||
|
Reference in New Issue
Block a user