3 #include "xtlm_simple_interconnect_model.h"
6 uint64_t num_mi=properties.getLongLong(
"C_NUM_MASTER_SLOTS");
7 uint64_t num_si=properties.getLongLong(
"C_NUM_SLAVE_SLOTS");
8 uint64_t axi_data_width=properties.getLongLong(
"C_AXI_DATA_WIDTH");
9 uint64_t axi_addr_width=properties.getLongLong(
"C_AXI_ADDR_WIDTH");
10 properties.addLong(
"C_NUM_MI", std::to_string(num_mi));
11 properties.addLong(
"C_NUM_SI", std::to_string(num_si));
14 for(uint64_t i=0;i<num_si;i++) {
20 ss<<i<<
"_AXI_DATA_WIDTH";
21 properties.addLong(ss.str().c_str(),std::to_string(axi_data_width));
23 for(uint64_t i=0;i<num_mi;i++) {
29 ss<<i<<
"_AXI_DATA_WIDTH";
30 properties.addLong(ss.str().c_str(),std::to_string(axi_data_width));
32 for(uint64_t i=0;i<num_si;i++) {
38 ss<<i<<
"_AXI_ADDR_WIDTH";
39 properties.addLong(ss.str().c_str(),std::to_string(axi_addr_width));
41 for(uint64_t i=0;i<num_mi;i++) {
47 ss<<i<<
"_AXI_ADDR_WIDTH";
48 properties.addLong(ss.str().c_str(),std::to_string(axi_addr_width));
51 std::string axi_conn=properties.getBitString(
"C_M_AXI_WRITE_CONNECTIVITY",len);
53 for(uint64_t j=0;j<num_mi;j++) {
54 std::string m_axi_conn=axi_conn.substr(j*32,32);
55 for(
int start=0;start<num_si;start++)
64 ss<<start<<
"_CONNECTIVITY";
65 std::string connectivity=m_axi_conn.substr(i,1);
66 properties.addLong(ss.str().c_str(),connectivity);
67 if(
m_report_handler->get_verbosity_level()==xsc::common_cpp::VERBOSITY::DEBUG) {
68 std::stringstream m_ss;
70 m_ss<<this->name()<<
"ADD PROPERTY CONNECTIVITY"<<ss.str().c_str()<<
" "<<connectivity<<std::endl;
71 XSC_REPORT_INFO_VERB((*
m_report_handler),
"crossbar",m_ss.str().c_str(),DEBUG);
75 uint64_t num_addr_ranges= properties.getLongLong(
"C_NUM_ADDR_RANGES");
76 properties.addLong(
"C_ADDR_RANGES",std::to_string(num_addr_ranges));
78 std::string addr_range=properties.getBitString(
"C_M_AXI_BASE_ADDR",range);
79 for(
int start=0;start<num_mi;start++)
81 std::string base_addr_range=addr_range.substr(start*num_addr_ranges*64,64*num_addr_ranges);
82 auto tmpstr = base_addr_range.c_str();
83 const char *ptr =
nullptr;
84 unsigned long long toValue;
86 for(uint64_t j=0;j<num_addr_ranges;j++) {
87 int num_range=num_addr_ranges -j -1;
90 for(
int i = 0 ; i < 64 ; i++)
93 toValue += ((
unsigned long long)1 << i);
101 if(num_range<10) ss<<
"0";
104 properties.addLong(ss.str().c_str(),std::to_string(toValue));
105 if(
m_report_handler->get_verbosity_level()==xsc::common_cpp::VERBOSITY::DEBUG) {
106 std::stringstream m_ss;
108 m_ss<<this->name()<<
"ADD PROPERTY BASE"<<std::hex<<ss.str().c_str()<<
" "<<toValue<<std::endl;
109 XSC_REPORT_INFO_VERB((*
m_report_handler),
"crossbar",m_ss.str().c_str(),DEBUG);
113 unsigned int addr_rng;
114 std::string master_addr_range=properties.getBitString(
"C_M_AXI_ADDR_WIDTH",addr_rng);
115 for(
int start=0;start<num_mi;start++)
117 std::string master_base_addr_range=master_addr_range.substr(start*32*num_addr_ranges,32*num_addr_ranges);
118 auto tmpstr = master_base_addr_range.c_str();
119 const char *ptr =
nullptr;
120 unsigned long long toValue;
122 for(uint64_t j=0;j<num_addr_ranges;j++) {
123 int num_range=num_addr_ranges -j -1;
126 for(
int i = 0 ; i < 32 ; i++)
129 toValue += ((
unsigned long long)1 << i);
131 int t=num_mi-start-1;
132 std::stringstream ss;
137 if(num_range<10) ss<<
"0";
140 toValue=((toValue<=64)?toValue:64);
141 unsigned long long rangeVal= pow(2,toValue);
142 properties.addLong(ss.str().c_str(),std::to_string(rangeVal));
143 if(
m_report_handler->get_verbosity_level()==xsc::common_cpp::VERBOSITY::DEBUG) {
144 std::stringstream m_ss;
146 m_ss<<this->name()<<
"ADD PROPERTY RANGE"<<std::hex<<ss.str().c_str()<<
" "<<rangeVal<<std::endl;
147 XSC_REPORT_INFO_VERB((*
m_report_handler),
"crossbar",m_ss.str().c_str(),DEBUG);
150 std::stringstream ss;
155 if(num_range<10) ss<<
"0";
158 properties.addLong(ss.str().c_str(),std::to_string(0));
159 if(
m_report_handler->get_verbosity_level()==xsc::common_cpp::VERBOSITY::DEBUG) {
160 std::stringstream m_ss;
162 m_ss<<this->name()<<
"ADD PROPERTY BASE"<<std::hex<<ss.str().c_str()<<
" "<<toValue<<std::endl;
163 XSC_REPORT_INFO_VERB((*
m_report_handler),
"crossbar",m_ss.str().c_str(),DEBUG);
168 m_model =
new xtlm_simple_interconnect_model(
"icn", properties);