[331] | 1 | /* -*- c++ -*- |
---|
[346] | 2 | * |
---|
[331] | 3 | * File : vci_cc_vcache_wrapper.h |
---|
| 4 | * Copyright (c) UPMC, Lip6, SoC |
---|
| 5 | * Authors : Alain GREINER, Yang GAO |
---|
| 6 | * Date : 27/11/2011 |
---|
| 7 | * |
---|
| 8 | * SOCLIB_LGPL_HEADER_BEGIN |
---|
| 9 | * |
---|
| 10 | * This file is part of SoCLib, GNU LGPLv2.1. |
---|
| 11 | * |
---|
| 12 | * SoCLib is free software; you can redistribute it and/or modify it |
---|
| 13 | * under the terms of the GNU Lesser General Public License as published |
---|
| 14 | * by the Free Software Foundation; version 2.1 of the License. |
---|
| 15 | * |
---|
| 16 | * SoCLib is distributed in the hope that it will be useful, but |
---|
| 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 19 | * Lesser General Public License for more details. |
---|
| 20 | * |
---|
| 21 | * You should have received a copy of the GNU Lesser General Public |
---|
| 22 | * License along with SoCLib; if not, write to the Free Software |
---|
| 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
---|
| 24 | * 02110-1301 USA |
---|
| 25 | * |
---|
| 26 | * SOCLIB_LGPL_HEADER_END |
---|
| 27 | * |
---|
| 28 | * Maintainers: cesar.fuguet-tortolero@lip6.fr |
---|
| 29 | * alexandre.joannou@lip6.fr |
---|
| 30 | */ |
---|
| 31 | |
---|
| 32 | #ifndef SOCLIB_CABA_VCI_CC_VCACHE_WRAPPER_H |
---|
| 33 | #define SOCLIB_CABA_VCI_CC_VCACHE_WRAPPER_H |
---|
| 34 | |
---|
| 35 | #include <inttypes.h> |
---|
| 36 | #include <systemc> |
---|
| 37 | #include "caba_base_module.h" |
---|
| 38 | #include "multi_write_buffer.h" |
---|
| 39 | #include "generic_fifo.h" |
---|
| 40 | #include "generic_tlb.h" |
---|
| 41 | #include "generic_cache.h" |
---|
| 42 | #include "vci_initiator.h" |
---|
| 43 | #include "dspin_interface.h" |
---|
| 44 | #include "dspin_dhccp_param.h" |
---|
| 45 | #include "mapping_table.h" |
---|
| 46 | #include "static_assert.h" |
---|
| 47 | #include "iss2.h" |
---|
| 48 | |
---|
| 49 | #define LLSC_TIMEOUT 10000 |
---|
| 50 | |
---|
| 51 | namespace soclib { |
---|
| 52 | namespace caba { |
---|
| 53 | |
---|
| 54 | using namespace sc_core; |
---|
| 55 | |
---|
| 56 | //////////////////////////////////////////// |
---|
[386] | 57 | template<typename vci_param, |
---|
| 58 | size_t dspin_in_width, |
---|
| 59 | size_t dspin_out_width, |
---|
| 60 | typename iss_t> |
---|
[331] | 61 | class VciCcVCacheWrapper |
---|
| 62 | //////////////////////////////////////////// |
---|
| 63 | : public soclib::caba::BaseModule |
---|
| 64 | { |
---|
| 65 | |
---|
[394] | 66 | typedef typename vci_param::fast_addr_t paddr_t; |
---|
[331] | 67 | |
---|
[394] | 68 | enum icache_fsm_state_e |
---|
| 69 | { |
---|
[331] | 70 | ICACHE_IDLE, |
---|
| 71 | // handling XTN processor requests |
---|
| 72 | ICACHE_XTN_TLB_FLUSH, |
---|
| 73 | ICACHE_XTN_CACHE_FLUSH, |
---|
| 74 | ICACHE_XTN_CACHE_FLUSH_GO, |
---|
| 75 | ICACHE_XTN_TLB_INVAL, |
---|
| 76 | ICACHE_XTN_CACHE_INVAL_VA, |
---|
| 77 | ICACHE_XTN_CACHE_INVAL_PA, |
---|
| 78 | ICACHE_XTN_CACHE_INVAL_GO, |
---|
| 79 | // handling tlb miss |
---|
| 80 | ICACHE_TLB_WAIT, |
---|
| 81 | // handling cache miss |
---|
| 82 | ICACHE_MISS_SELECT, |
---|
| 83 | ICACHE_MISS_CLEAN, |
---|
| 84 | ICACHE_MISS_WAIT, |
---|
| 85 | ICACHE_MISS_DATA_UPDT, |
---|
| 86 | ICACHE_MISS_DIR_UPDT, |
---|
| 87 | // handling unc read |
---|
| 88 | ICACHE_UNC_WAIT, |
---|
| 89 | // handling coherence requests |
---|
| 90 | ICACHE_CC_CHECK, |
---|
[468] | 91 | ICACHE_CC_UPDT, |
---|
[331] | 92 | ICACHE_CC_INVAL, |
---|
| 93 | }; |
---|
| 94 | |
---|
[394] | 95 | enum dcache_fsm_state_e |
---|
| 96 | { |
---|
[331] | 97 | DCACHE_IDLE, |
---|
| 98 | // handling itlb & dtlb miss |
---|
| 99 | DCACHE_TLB_MISS, |
---|
| 100 | DCACHE_TLB_PTE1_GET, |
---|
| 101 | DCACHE_TLB_PTE1_SELECT, |
---|
| 102 | DCACHE_TLB_PTE1_UPDT, |
---|
| 103 | DCACHE_TLB_PTE2_GET, |
---|
| 104 | DCACHE_TLB_PTE2_SELECT, |
---|
| 105 | DCACHE_TLB_PTE2_UPDT, |
---|
| 106 | DCACHE_TLB_LR_UPDT, |
---|
| 107 | DCACHE_TLB_LR_WAIT, |
---|
| 108 | DCACHE_TLB_RETURN, |
---|
| 109 | // handling processor XTN requests |
---|
| 110 | DCACHE_XTN_SWITCH, |
---|
| 111 | DCACHE_XTN_SYNC, |
---|
| 112 | DCACHE_XTN_IC_INVAL_VA, |
---|
| 113 | DCACHE_XTN_IC_FLUSH, |
---|
| 114 | DCACHE_XTN_IC_INVAL_PA, |
---|
| 115 | DCACHE_XTN_IT_INVAL, |
---|
| 116 | DCACHE_XTN_DC_FLUSH, |
---|
[477] | 117 | DCACHE_XTN_DC_FLUSH_DATA, |
---|
[331] | 118 | DCACHE_XTN_DC_FLUSH_GO, |
---|
| 119 | DCACHE_XTN_DC_INVAL_VA, |
---|
| 120 | DCACHE_XTN_DC_INVAL_PA, |
---|
| 121 | DCACHE_XTN_DC_INVAL_END, |
---|
| 122 | DCACHE_XTN_DC_INVAL_GO, |
---|
[477] | 123 | DCACHE_XTN_DC_INVAL_DATA, |
---|
[331] | 124 | DCACHE_XTN_DT_INVAL, |
---|
| 125 | //handling dirty bit update |
---|
| 126 | DCACHE_DIRTY_GET_PTE, |
---|
| 127 | DCACHE_DIRTY_WAIT, |
---|
| 128 | // handling processor miss requests |
---|
| 129 | DCACHE_MISS_SELECT, |
---|
| 130 | DCACHE_MISS_CLEAN, |
---|
[477] | 131 | DCACHE_MISS_DATA, |
---|
[331] | 132 | DCACHE_MISS_WAIT, |
---|
| 133 | DCACHE_MISS_DATA_UPDT, |
---|
| 134 | DCACHE_MISS_DIR_UPDT, |
---|
| 135 | // handling processor unc, ll and sc requests |
---|
| 136 | DCACHE_UNC_WAIT, |
---|
| 137 | DCACHE_LL_WAIT, |
---|
| 138 | DCACHE_SC_WAIT, |
---|
| 139 | // handling coherence requests |
---|
| 140 | DCACHE_CC_CHECK, |
---|
[468] | 141 | DCACHE_CC_UPDT, |
---|
[331] | 142 | DCACHE_CC_INVAL, |
---|
[477] | 143 | DCACHE_CC_INVAL_DATA, |
---|
[331] | 144 | // handling TLB inval (after a coherence or XTN request) |
---|
| 145 | DCACHE_INVAL_TLB_SCAN, |
---|
| 146 | }; |
---|
| 147 | |
---|
[394] | 148 | enum cmd_fsm_state_e |
---|
| 149 | { |
---|
[331] | 150 | CMD_IDLE, |
---|
| 151 | CMD_INS_MISS, |
---|
| 152 | CMD_INS_UNC, |
---|
| 153 | CMD_DATA_MISS, |
---|
| 154 | CMD_DATA_UNC, |
---|
| 155 | CMD_DATA_WRITE, |
---|
| 156 | CMD_DATA_LL, |
---|
| 157 | CMD_DATA_SC, |
---|
| 158 | CMD_DATA_CAS, |
---|
| 159 | }; |
---|
| 160 | |
---|
[394] | 161 | enum rsp_fsm_state_e |
---|
| 162 | { |
---|
[331] | 163 | RSP_IDLE, |
---|
| 164 | RSP_INS_MISS, |
---|
| 165 | RSP_INS_UNC, |
---|
| 166 | RSP_DATA_MISS, |
---|
| 167 | RSP_DATA_UNC, |
---|
| 168 | RSP_DATA_LL, |
---|
| 169 | RSP_DATA_WRITE, |
---|
| 170 | }; |
---|
| 171 | |
---|
[394] | 172 | enum cc_receive_fsm_state_e |
---|
| 173 | { |
---|
[331] | 174 | CC_RECEIVE_IDLE, |
---|
| 175 | CC_RECEIVE_BRDCAST_HEADER, |
---|
| 176 | CC_RECEIVE_BRDCAST_NLINE, |
---|
[468] | 177 | CC_RECEIVE_INS_INVAL_HEADER, |
---|
| 178 | CC_RECEIVE_INS_INVAL_NLINE, |
---|
| 179 | CC_RECEIVE_INS_UPDT_HEADER, |
---|
| 180 | CC_RECEIVE_INS_UPDT_NLINE, |
---|
| 181 | CC_RECEIVE_DATA_INVAL_HEADER, |
---|
| 182 | CC_RECEIVE_DATA_INVAL_NLINE, |
---|
| 183 | CC_RECEIVE_DATA_UPDT_HEADER, |
---|
| 184 | CC_RECEIVE_DATA_UPDT_NLINE, |
---|
[495] | 185 | CC_RECEIVE_INS_UPDT_DATA, |
---|
[468] | 186 | CC_RECEIVE_DATA_UPDT_DATA, |
---|
[331] | 187 | }; |
---|
| 188 | |
---|
[394] | 189 | enum cc_send_fsm_state_e |
---|
| 190 | { |
---|
[331] | 191 | CC_SEND_IDLE, |
---|
| 192 | CC_SEND_CLEANUP_1, |
---|
| 193 | CC_SEND_CLEANUP_2, |
---|
[477] | 194 | CC_SEND_CLEANUP_DATA_UPDT, |
---|
[331] | 195 | CC_SEND_MULTI_ACK, |
---|
| 196 | }; |
---|
| 197 | |
---|
| 198 | /* transaction type, pktid field */ |
---|
| 199 | enum transaction_type_e |
---|
| 200 | { |
---|
| 201 | // b3 unused |
---|
| 202 | // b2 READ / NOT READ |
---|
| 203 | // if READ |
---|
| 204 | // b1 DATA / INS |
---|
| 205 | // b0 UNC / MISS |
---|
| 206 | // else |
---|
| 207 | // b1 accÚs table llsc type SW / other |
---|
| 208 | // b2 WRITE/CAS/LL/SC |
---|
| 209 | TYPE_READ_DATA_UNC = 0x0, |
---|
| 210 | TYPE_READ_DATA_MISS = 0x1, |
---|
| 211 | TYPE_READ_INS_UNC = 0x2, |
---|
| 212 | TYPE_READ_INS_MISS = 0x3, |
---|
| 213 | TYPE_WRITE = 0x4, |
---|
| 214 | TYPE_CAS = 0x5, |
---|
| 215 | TYPE_LL = 0x6, |
---|
| 216 | TYPE_SC = 0x7 |
---|
| 217 | }; |
---|
| 218 | |
---|
| 219 | /* SC return values */ |
---|
| 220 | enum sc_status_type_e |
---|
| 221 | { |
---|
| 222 | SC_SUCCESS = 0x00000000, |
---|
| 223 | SC_FAIL = 0x00000001 |
---|
| 224 | }; |
---|
| 225 | |
---|
| 226 | // cc_send_type |
---|
[394] | 227 | typedef enum |
---|
| 228 | { |
---|
[331] | 229 | CC_TYPE_CLEANUP, |
---|
| 230 | CC_TYPE_MULTI_ACK, |
---|
| 231 | } cc_send_t; |
---|
| 232 | |
---|
| 233 | // cc_receive_type |
---|
[394] | 234 | typedef enum |
---|
| 235 | { |
---|
[331] | 236 | CC_TYPE_CLACK, |
---|
| 237 | CC_TYPE_BRDCAST, |
---|
| 238 | CC_TYPE_INVAL, |
---|
| 239 | CC_TYPE_UPDT, |
---|
| 240 | } cc_receive_t; |
---|
| 241 | |
---|
| 242 | // TLB Mode : ITLB / DTLB / ICACHE / DCACHE |
---|
[394] | 243 | enum |
---|
| 244 | { |
---|
[331] | 245 | INS_TLB_MASK = 0x8, |
---|
| 246 | DATA_TLB_MASK = 0x4, |
---|
| 247 | INS_CACHE_MASK = 0x2, |
---|
| 248 | DATA_CACHE_MASK = 0x1, |
---|
| 249 | }; |
---|
| 250 | |
---|
| 251 | // Error Type |
---|
| 252 | enum mmu_error_type_e |
---|
| 253 | { |
---|
| 254 | MMU_NONE = 0x0000, // None |
---|
| 255 | MMU_WRITE_PT1_UNMAPPED = 0x0001, // Write & Page fault on PT1 |
---|
| 256 | MMU_WRITE_PT2_UNMAPPED = 0x0002, // Write & Page fault on PT2 |
---|
| 257 | MMU_WRITE_PRIVILEGE_VIOLATION = 0x0004, // Write & Protected access in user mode |
---|
| 258 | MMU_WRITE_ACCES_VIOLATION = 0x0008, // Write to non writable page |
---|
| 259 | MMU_WRITE_UNDEFINED_XTN = 0x0020, // Write & undefined external access |
---|
| 260 | MMU_WRITE_PT1_ILLEGAL_ACCESS = 0x0040, // Write & Bus Error accessing PT1 |
---|
| 261 | MMU_WRITE_PT2_ILLEGAL_ACCESS = 0x0080, // Write & Bus Error accessing PT2 |
---|
| 262 | MMU_WRITE_DATA_ILLEGAL_ACCESS = 0x0100, // Write & Bus Error in cache access |
---|
| 263 | MMU_READ_PT1_UNMAPPED = 0x1001, // Read & Page fault on PT1 |
---|
| 264 | MMU_READ_PT2_UNMAPPED = 0x1002, // Read & Page fault on PT2 |
---|
| 265 | MMU_READ_PRIVILEGE_VIOLATION = 0x1004, // Read & Protected access in user mode |
---|
| 266 | MMU_READ_EXEC_VIOLATION = 0x1010, // Read & Exec access to a non exec page |
---|
| 267 | MMU_READ_UNDEFINED_XTN = 0x1020, // Read & Undefined external access |
---|
| 268 | MMU_READ_PT1_ILLEGAL_ACCESS = 0x1040, // Read & Bus Error accessing PT1 |
---|
| 269 | MMU_READ_PT2_ILLEGAL_ACCESS = 0x1080, // Read & Bus Error accessing PT2 |
---|
| 270 | MMU_READ_DATA_ILLEGAL_ACCESS = 0x1100, // Read & Bus Error in cache access |
---|
| 271 | }; |
---|
| 272 | |
---|
| 273 | // miss types for data cache |
---|
| 274 | enum dcache_miss_type_e |
---|
| 275 | { |
---|
| 276 | PTE1_MISS, |
---|
| 277 | PTE2_MISS, |
---|
| 278 | PROC_MISS, |
---|
| 279 | }; |
---|
| 280 | |
---|
| 281 | enum transaction_type_d_e |
---|
| 282 | { |
---|
| 283 | // b0 : 1 if cached |
---|
| 284 | // b1 : 1 if instruction |
---|
| 285 | TYPE_DATA_UNC = 0x0, |
---|
| 286 | TYPE_DATA_MISS = 0x1, |
---|
| 287 | TYPE_INS_UNC = 0x2, |
---|
| 288 | TYPE_INS_MISS = 0x3, |
---|
| 289 | }; |
---|
| 290 | |
---|
[477] | 291 | //////////////////MODIFIED//////////////// |
---|
| 292 | enum content_line_cache_status_e |
---|
| 293 | { |
---|
| 294 | LINE_CACHE_DATA_NOT_DIRTY, |
---|
| 295 | LINE_CACHE_DATA_DIRTY, |
---|
| 296 | LINE_CACHE_IN_TLB, |
---|
| 297 | LINE_CACHE_CONTAINS_PTD, |
---|
| 298 | }; |
---|
| 299 | ////////////////////////////////////////// |
---|
| 300 | |
---|
[331] | 301 | public: |
---|
[468] | 302 | sc_in<bool> p_clk; |
---|
| 303 | sc_in<bool> p_resetn; |
---|
| 304 | sc_in<bool> p_irq[iss_t::n_irq]; |
---|
| 305 | soclib::caba::VciInitiator<vci_param> p_vci; |
---|
| 306 | soclib::caba::DspinInput<dspin_in_width> p_dspin_m2p; |
---|
| 307 | soclib::caba::DspinOutput<dspin_out_width> p_dspin_p2m; |
---|
| 308 | soclib::caba::DspinInput<dspin_in_width> p_dspin_clack; |
---|
[331] | 309 | |
---|
| 310 | private: |
---|
| 311 | |
---|
| 312 | // STRUCTURAL PARAMETERS |
---|
[346] | 313 | soclib::common::AddressDecodingTable<uint32_t, bool> m_cacheability_table; |
---|
[331] | 314 | |
---|
[394] | 315 | const size_t m_srcid; |
---|
[346] | 316 | const size_t m_cc_global_id; |
---|
| 317 | const size_t m_nline_width; |
---|
[331] | 318 | const size_t m_itlb_ways; |
---|
| 319 | const size_t m_itlb_sets; |
---|
| 320 | const size_t m_dtlb_ways; |
---|
| 321 | const size_t m_dtlb_sets; |
---|
| 322 | const size_t m_icache_ways; |
---|
| 323 | const size_t m_icache_sets; |
---|
| 324 | const paddr_t m_icache_yzmask; |
---|
| 325 | const size_t m_icache_words; |
---|
| 326 | const size_t m_dcache_ways; |
---|
| 327 | const size_t m_dcache_sets; |
---|
| 328 | const paddr_t m_dcache_yzmask; |
---|
| 329 | const size_t m_dcache_words; |
---|
| 330 | const size_t m_x_width; |
---|
| 331 | const size_t m_y_width; |
---|
| 332 | const size_t m_proc_id; |
---|
| 333 | const uint32_t m_max_frozen_cycles; |
---|
| 334 | const size_t m_paddr_nbits; |
---|
[346] | 335 | uint32_t m_debug_start_cycle; |
---|
| 336 | bool m_debug_ok; |
---|
[331] | 337 | |
---|
| 338 | //////////////////////////////////////// |
---|
| 339 | // Communication with processor ISS |
---|
| 340 | //////////////////////////////////////// |
---|
| 341 | typename iss_t::InstructionRequest m_ireq; |
---|
| 342 | typename iss_t::InstructionResponse m_irsp; |
---|
| 343 | typename iss_t::DataRequest m_dreq; |
---|
| 344 | typename iss_t::DataResponse m_drsp; |
---|
| 345 | |
---|
| 346 | ///////////////////////////////////////////// |
---|
[394] | 347 | // debug variables |
---|
[331] | 348 | ///////////////////////////////////////////// |
---|
[394] | 349 | bool m_debug_previous_i_hit; |
---|
| 350 | bool m_debug_previous_d_hit; |
---|
| 351 | bool m_debug_activated; |
---|
[331] | 352 | |
---|
| 353 | /////////////////////////////// |
---|
| 354 | // Software visible REGISTERS |
---|
| 355 | /////////////////////////////// |
---|
| 356 | sc_signal<uint32_t> r_mmu_ptpr; // page table pointer register |
---|
| 357 | sc_signal<uint32_t> r_mmu_mode; // mmu mode register |
---|
| 358 | sc_signal<uint32_t> r_mmu_word_lo; // mmu misc data low |
---|
| 359 | sc_signal<uint32_t> r_mmu_word_hi; // mmu misc data hight |
---|
| 360 | sc_signal<uint32_t> r_mmu_ibvar; // mmu bad instruction address |
---|
| 361 | sc_signal<uint32_t> r_mmu_dbvar; // mmu bad data address |
---|
| 362 | sc_signal<uint32_t> r_mmu_ietr; // mmu instruction error type |
---|
| 363 | sc_signal<uint32_t> r_mmu_detr; // mmu data error type |
---|
| 364 | uint32_t r_mmu_params; // read-only |
---|
| 365 | uint32_t r_mmu_release; // read_only |
---|
| 366 | |
---|
| 367 | |
---|
| 368 | ////////////////////////////// |
---|
| 369 | // ICACHE FSM REGISTERS |
---|
| 370 | ////////////////////////////// |
---|
| 371 | sc_signal<int> r_icache_fsm; // state register |
---|
| 372 | sc_signal<int> r_icache_fsm_save; // return state for coherence op |
---|
| 373 | sc_signal<paddr_t> r_icache_vci_paddr; // physical address |
---|
| 374 | sc_signal<uint32_t> r_icache_vaddr_save; // virtual address from processor |
---|
| 375 | |
---|
| 376 | // icache miss handling |
---|
| 377 | sc_signal<size_t> r_icache_miss_way; // selected way for cache update |
---|
| 378 | sc_signal<size_t> r_icache_miss_set; // selected set for cache update |
---|
| 379 | sc_signal<size_t> r_icache_miss_word; // word index ( cache update) |
---|
| 380 | sc_signal<bool> r_icache_miss_inval; // coherence request matching a miss |
---|
| 381 | sc_signal<bool> r_icache_miss_clack; // waiting for a cleanup acknowledge |
---|
| 382 | |
---|
| 383 | // coherence request handling |
---|
| 384 | sc_signal<size_t> r_icache_cc_way; // selected way for cc update/inval |
---|
| 385 | sc_signal<size_t> r_icache_cc_set; // selected set for cc update/inval |
---|
| 386 | sc_signal<size_t> r_icache_cc_word; // word counter for cc update |
---|
| 387 | sc_signal<bool> r_icache_cc_need_write; // activate the cache for writing |
---|
| 388 | |
---|
[468] | 389 | // coherence clack handling |
---|
| 390 | sc_signal<bool> r_icache_clack_req; // clack request |
---|
| 391 | sc_signal<size_t> r_icache_clack_way; // clack way |
---|
| 392 | sc_signal<size_t> r_icache_clack_set; // clack set |
---|
| 393 | |
---|
[331] | 394 | // icache flush handling |
---|
| 395 | sc_signal<size_t> r_icache_flush_count; // slot counter used for cache flush |
---|
| 396 | |
---|
| 397 | // communication between ICACHE FSM and VCI_CMD FSM |
---|
| 398 | sc_signal<bool> r_icache_miss_req; // cached read miss |
---|
| 399 | sc_signal<bool> r_icache_unc_req; // uncached read miss |
---|
| 400 | |
---|
| 401 | // communication between ICACHE FSM and DCACHE FSM |
---|
| 402 | sc_signal<bool> r_icache_tlb_miss_req; // (set icache/reset dcache) |
---|
| 403 | sc_signal<bool> r_icache_tlb_rsp_error; // tlb miss response error |
---|
| 404 | |
---|
[495] | 405 | // Filp-Flop in ICACHE FSM for saving the cleanup victim request |
---|
| 406 | sc_signal<bool> r_icache_cleanup_victim_req; |
---|
| 407 | sc_signal<paddr_t> r_icache_cleanup_victim_nline; |
---|
| 408 | |
---|
[331] | 409 | // communication between ICACHE FSM and CC_SEND FSM |
---|
| 410 | sc_signal<bool> r_icache_cc_send_req; // ICACHE cc_send request |
---|
[477] | 411 | sc_signal<int> r_icache_cc_send_type; // ICACHE cc_send request type |
---|
[331] | 412 | sc_signal<paddr_t> r_icache_cc_send_nline; // ICACHE cc_send nline |
---|
| 413 | sc_signal<size_t> r_icache_cc_send_way; // ICACHE cc_send way |
---|
| 414 | sc_signal<size_t> r_icache_cc_send_updt_tab_idx; // ICACHE cc_send update table index |
---|
| 415 | |
---|
| 416 | /////////////////////////////// |
---|
| 417 | // DCACHE FSM REGISTERS |
---|
| 418 | /////////////////////////////// |
---|
| 419 | sc_signal<int> r_dcache_fsm; // state register |
---|
| 420 | sc_signal<int> r_dcache_fsm_cc_save; // return state for coherence op |
---|
| 421 | sc_signal<int> r_dcache_fsm_scan_save; // return state for tlb scan op |
---|
| 422 | // registers written in P0 stage (used in P1 stage) |
---|
| 423 | sc_signal<bool> r_dcache_wbuf_req; // WBUF must be written in P1 stage |
---|
| 424 | sc_signal<bool> r_dcache_updt_req; // DCACHE must be updated in P1 stage |
---|
| 425 | sc_signal<uint32_t> r_dcache_save_vaddr; // virtual address (from proc) |
---|
| 426 | sc_signal<uint32_t> r_dcache_save_wdata; // write data (from proc) |
---|
[394] | 427 | sc_signal<uint32_t> r_dcache_save_be; // byte enable (from proc) |
---|
[331] | 428 | sc_signal<paddr_t> r_dcache_save_paddr; // physical address |
---|
| 429 | sc_signal<bool> r_dcache_save_cacheable; // address cacheable |
---|
| 430 | sc_signal<size_t> r_dcache_save_cache_way; // selected way (from dcache) |
---|
| 431 | sc_signal<size_t> r_dcache_save_cache_set; // selected set (from dcache) |
---|
| 432 | sc_signal<size_t> r_dcache_save_cache_word; // selected word (from dcache) |
---|
| 433 | // registers used by the Dirty bit sub-fsm |
---|
| 434 | sc_signal<paddr_t> r_dcache_dirty_paddr; // PTE physical address |
---|
| 435 | sc_signal<size_t> r_dcache_dirty_way; // way to invalidate in dcache |
---|
| 436 | sc_signal<size_t> r_dcache_dirty_set; // set to invalidate in dcache |
---|
| 437 | |
---|
| 438 | // communication between DCACHE FSM and VCI_CMD FSM |
---|
| 439 | sc_signal<paddr_t> r_dcache_vci_paddr; // physical address for VCI command |
---|
| 440 | sc_signal<bool> r_dcache_vci_miss_req; // read miss request |
---|
| 441 | sc_signal<bool> r_dcache_vci_unc_req; // uncacheable read request |
---|
[421] | 442 | sc_signal<uint32_t> r_dcache_vci_unc_be; // uncacheable read byte enable |
---|
[331] | 443 | sc_signal<bool> r_dcache_vci_cas_req; // atomic write request CAS |
---|
| 444 | sc_signal<uint32_t> r_dcache_vci_cas_old; // previous data value for a CAS |
---|
| 445 | sc_signal<uint32_t> r_dcache_vci_cas_new; // new data value for a CAS |
---|
| 446 | sc_signal<bool> r_dcache_vci_ll_req; // atomic read request LL |
---|
| 447 | sc_signal<bool> r_dcache_vci_sc_req; // atomic write request SC |
---|
[394] | 448 | sc_signal<uint32_t> r_dcache_vci_sc_data; // SC data (command) |
---|
[331] | 449 | |
---|
[477] | 450 | //RWT: local cas |
---|
| 451 | sc_signal<bool> r_cas_islocal; |
---|
| 452 | sc_signal<size_t> r_cas_local_way; |
---|
| 453 | sc_signal<size_t> r_cas_local_set; |
---|
| 454 | sc_signal<size_t> r_cas_local_word; |
---|
| 455 | |
---|
[331] | 456 | // register used for XTN inval |
---|
| 457 | sc_signal<size_t> r_dcache_xtn_way; // selected way (from dcache) |
---|
| 458 | sc_signal<size_t> r_dcache_xtn_set; // selected set (from dcache) |
---|
| 459 | |
---|
| 460 | // write buffer state extension |
---|
| 461 | sc_signal<bool> r_dcache_pending_unc_write; // pending uncacheable write in WBUF |
---|
| 462 | |
---|
| 463 | // handling dcache miss |
---|
| 464 | sc_signal<int> r_dcache_miss_type; // depending on the requester |
---|
| 465 | sc_signal<size_t> r_dcache_miss_word; // word index for cache update |
---|
| 466 | sc_signal<size_t> r_dcache_miss_way; // selected way for cache update |
---|
| 467 | sc_signal<size_t> r_dcache_miss_set; // selected set for cache update |
---|
| 468 | sc_signal<bool> r_dcache_miss_inval; // coherence request matching a miss |
---|
| 469 | sc_signal<bool> r_dcache_miss_clack; // waiting for a cleanup acknowledge |
---|
| 470 | |
---|
| 471 | // handling coherence requests |
---|
| 472 | sc_signal<size_t> r_dcache_cc_way; // selected way for cc update/inval |
---|
| 473 | sc_signal<size_t> r_dcache_cc_set; // selected set for cc update/inval |
---|
[477] | 474 | sc_signal<int> r_dcache_cc_state; // state of selected cache slot |
---|
[331] | 475 | sc_signal<size_t> r_dcache_cc_word; // word counter for cc update |
---|
| 476 | sc_signal<bool> r_dcache_cc_need_write; // activate the cache for writing |
---|
[477] | 477 | sc_signal<paddr_t> r_dcache_cc_inval_addr; // address for a cleanup transaction |
---|
| 478 | sc_signal<uint32_t> r_dcache_cc_inval_data_cpt; |
---|
[331] | 479 | |
---|
[468] | 480 | // coherence clack handling |
---|
| 481 | sc_signal<bool> r_dcache_clack_req; // clack request |
---|
| 482 | sc_signal<size_t> r_dcache_clack_way; // clack way |
---|
| 483 | sc_signal<size_t> r_dcache_clack_set; // clack set |
---|
| 484 | |
---|
[331] | 485 | // dcache flush handling |
---|
| 486 | sc_signal<size_t> r_dcache_flush_count; // slot counter used for cache flush |
---|
| 487 | |
---|
| 488 | // ll response handling |
---|
| 489 | sc_signal<size_t> r_dcache_ll_rsp_count; // flit counter used for ll rsp |
---|
| 490 | |
---|
| 491 | // used by the TLB miss sub-fsm |
---|
| 492 | sc_signal<uint32_t> r_dcache_tlb_vaddr; // virtual address for a tlb miss |
---|
| 493 | sc_signal<bool> r_dcache_tlb_ins; // target tlb (itlb if true) |
---|
| 494 | sc_signal<paddr_t> r_dcache_tlb_paddr; // physical address of pte |
---|
| 495 | sc_signal<uint32_t> r_dcache_tlb_pte_flags; // pte1 or first word of pte2 |
---|
| 496 | sc_signal<uint32_t> r_dcache_tlb_pte_ppn; // second word of pte2 |
---|
| 497 | sc_signal<size_t> r_dcache_tlb_cache_way; // selected way in dcache |
---|
| 498 | sc_signal<size_t> r_dcache_tlb_cache_set; // selected set in dcache |
---|
| 499 | sc_signal<size_t> r_dcache_tlb_cache_word; // selected word in dcache |
---|
| 500 | sc_signal<size_t> r_dcache_tlb_way; // selected way in tlb |
---|
| 501 | sc_signal<size_t> r_dcache_tlb_set; // selected set in tlb |
---|
| 502 | |
---|
| 503 | // ITLB and DTLB invalidation |
---|
| 504 | sc_signal<paddr_t> r_dcache_tlb_inval_line; // line index |
---|
| 505 | sc_signal<size_t> r_dcache_tlb_inval_set; // tlb set counter |
---|
| 506 | |
---|
| 507 | // communication between DCACHE FSM and ICACHE FSM |
---|
| 508 | sc_signal<bool> r_dcache_xtn_req; // xtn request (caused by processor) |
---|
| 509 | sc_signal<int> r_dcache_xtn_opcode; // xtn request type |
---|
| 510 | |
---|
[495] | 511 | // Filp-Flop in DCACHE FSM for saving the cleanup victim request |
---|
| 512 | sc_signal<bool> r_dcache_cleanup_victim_req; |
---|
| 513 | sc_signal<bool> r_dcache_cleanup_victim_line_ncc; |
---|
| 514 | sc_signal<bool> r_dcache_cleanup_victim_updt_data; |
---|
| 515 | sc_signal<paddr_t> r_dcache_cleanup_victim_nline; |
---|
| 516 | |
---|
[331] | 517 | // communication between DCACHE FSM and CC_SEND FSM |
---|
| 518 | sc_signal<bool> r_dcache_cc_send_req; // DCACHE cc_send request |
---|
[477] | 519 | sc_signal<int> r_dcache_cc_send_type; // DCACHE cc_send request type |
---|
[331] | 520 | sc_signal<paddr_t> r_dcache_cc_send_nline; // DCACHE cc_send nline |
---|
| 521 | sc_signal<size_t> r_dcache_cc_send_way; // DCACHE cc_send way |
---|
| 522 | sc_signal<size_t> r_dcache_cc_send_updt_tab_idx; // DCACHE cc_send update table index |
---|
[477] | 523 | |
---|
| 524 | // special registers for ODCCP/RWT |
---|
| 525 | sc_signal<bool> r_dcache_cc_cleanup_updt_data; // Register for cleanup with data (wb updt) |
---|
| 526 | sc_signal<bool> r_dcache_cc_cleanup_line_ncc; // Register for cleanup with data (wb updt) |
---|
| 527 | sc_signal<bool> r_dcache_miss_victim_no_coherence; // Register for victim in no coherence mode |
---|
| 528 | sc_signal<bool> r_dcache_line_no_coherence; // Register for line current in no coherence mode |
---|
| 529 | sc_signal<bool> r_dcache_dirty_save; |
---|
| 530 | sc_signal<uint32_t> r_cc_send_cpt_word; |
---|
| 531 | sc_signal<uint32_t> r_dcache_miss_data_cpt; |
---|
| 532 | sc_signal<paddr_t> r_dcache_miss_data_addr; |
---|
| 533 | sc_signal<uint32_t> r_dcache_xtn_flush_data_cpt; |
---|
| 534 | sc_signal<paddr_t> r_dcache_xtn_flush_addr_data; |
---|
| 535 | sc_signal<int> r_dcache_xtn_state; |
---|
| 536 | sc_signal<paddr_t> r_dcache_xtn_data_addr; |
---|
| 537 | sc_signal<uint32_t> r_dcache_xtn_data_cpt; |
---|
[331] | 538 | // dcache directory extension |
---|
[477] | 539 | ///////////////////////////MODIFIED/////////////////////////////////////////////////// |
---|
| 540 | //bool *r_dcache_in_tlb; // copy exist in dtlb or itlb |
---|
| 541 | //bool *r_dcache_contains_ptd; // cache line contains a PTD |
---|
| 542 | int *r_dcache_content_state; // content state of one cache line |
---|
| 543 | int *r_dcache_dirty_word; // content state of one cache line |
---|
| 544 | ////////////////////////////////////////////////////////////////////////////////////// |
---|
[331] | 545 | |
---|
[477] | 546 | //RWT |
---|
| 547 | sc_signal<bool> r_dcache_read_state; |
---|
| 548 | |
---|
| 549 | /////////////////////////////////// |
---|
[394] | 550 | // Physical address extension for data access |
---|
| 551 | sc_signal<uint32_t> r_dcache_paddr_ext; // CP2 register (if vci_address > 32) |
---|
| 552 | |
---|
[331] | 553 | /////////////////////////////////// |
---|
| 554 | // VCI_CMD FSM REGISTERS |
---|
| 555 | /////////////////////////////////// |
---|
| 556 | sc_signal<int> r_vci_cmd_fsm; |
---|
[394] | 557 | sc_signal<size_t> r_vci_cmd_min; // used for write bursts |
---|
| 558 | sc_signal<size_t> r_vci_cmd_max; // used for write bursts |
---|
| 559 | sc_signal<size_t> r_vci_cmd_cpt; // used for write bursts |
---|
| 560 | sc_signal<bool> r_vci_cmd_imiss_prio; // round-robin between imiss & dmiss |
---|
[331] | 561 | |
---|
| 562 | /////////////////////////////////// |
---|
| 563 | // VCI_RSP FSM REGISTERS |
---|
| 564 | /////////////////////////////////// |
---|
| 565 | sc_signal<int> r_vci_rsp_fsm; |
---|
| 566 | sc_signal<size_t> r_vci_rsp_cpt; |
---|
| 567 | sc_signal<bool> r_vci_rsp_ins_error; |
---|
| 568 | sc_signal<bool> r_vci_rsp_data_error; |
---|
[394] | 569 | GenericFifo<uint32_t> r_vci_rsp_fifo_icache; // response FIFO to ICACHE FSM |
---|
| 570 | GenericFifo<uint32_t> r_vci_rsp_fifo_dcache; // response FIFO to DCACHE FSM |
---|
[477] | 571 | |
---|
[331] | 572 | |
---|
[477] | 573 | //RWT |
---|
| 574 | GenericFifo<bool> r_vci_rsp_fifo_rpktid; |
---|
| 575 | |
---|
| 576 | GenericFifo<uint32_t> r_cc_send_data_fifo; |
---|
| 577 | |
---|
[331] | 578 | /////////////////////////////////// |
---|
| 579 | // CC_SEND FSM REGISTER |
---|
| 580 | /////////////////////////////////// |
---|
[394] | 581 | sc_signal<int> r_cc_send_fsm; // state register |
---|
| 582 | sc_signal<bool> r_cc_send_last_client; // 0 dcache / 1 icache |
---|
[331] | 583 | |
---|
| 584 | /////////////////////////////////// |
---|
| 585 | // CC_RECEIVE FSM REGISTER |
---|
| 586 | /////////////////////////////////// |
---|
[394] | 587 | sc_signal<int> r_cc_receive_fsm; // state register |
---|
| 588 | sc_signal<bool> r_cc_receive_data_ins; // request to : 0 dcache / 1 icache |
---|
[331] | 589 | |
---|
[394] | 590 | // communication between CC_RECEIVE FSM and ICACHE/DCACHE FSM |
---|
| 591 | sc_signal<size_t> r_cc_receive_word_idx; // word index |
---|
[331] | 592 | GenericFifo<uint32_t> r_cc_receive_updt_fifo_be; |
---|
| 593 | GenericFifo<uint32_t> r_cc_receive_updt_fifo_data; |
---|
| 594 | GenericFifo<bool> r_cc_receive_updt_fifo_eop; |
---|
| 595 | |
---|
| 596 | // communication between CC_RECEIVE FSM and ICACHE FSM |
---|
[394] | 597 | sc_signal<bool> r_cc_receive_icache_req; // cc_receive to icache request |
---|
[477] | 598 | sc_signal<int> r_cc_receive_icache_type; // cc_receive type of request |
---|
[394] | 599 | sc_signal<size_t> r_cc_receive_icache_way; // cc_receive to icache way |
---|
| 600 | sc_signal<size_t> r_cc_receive_icache_set; // cc_receive to icache set |
---|
[331] | 601 | sc_signal<size_t> r_cc_receive_icache_updt_tab_idx; // cc_receive update table index |
---|
[394] | 602 | sc_signal<paddr_t> r_cc_receive_icache_nline; // cache line physical address |
---|
[331] | 603 | |
---|
| 604 | // communication between CC_RECEIVE FSM and DCACHE FSM |
---|
[394] | 605 | sc_signal<bool> r_cc_receive_dcache_req; // cc_receive to dcache request |
---|
[477] | 606 | sc_signal<int> r_cc_receive_dcache_type; // cc_receive type of request |
---|
[394] | 607 | sc_signal<size_t> r_cc_receive_dcache_way; // cc_receive to dcache way |
---|
| 608 | sc_signal<size_t> r_cc_receive_dcache_set; // cc_receive to dcache set |
---|
[331] | 609 | sc_signal<size_t> r_cc_receive_dcache_updt_tab_idx; // cc_receive update table index |
---|
[394] | 610 | sc_signal<paddr_t> r_cc_receive_dcache_nline; // cache line physical address |
---|
[331] | 611 | |
---|
[468] | 612 | /////////////////////////////////// |
---|
| 613 | // DSPIN CLACK INTERFACE REGISTER |
---|
| 614 | /////////////////////////////////// |
---|
| 615 | sc_signal<bool> r_dspin_clack_req; |
---|
| 616 | sc_signal<uint64_t> r_dspin_clack_flit; |
---|
| 617 | |
---|
[331] | 618 | ////////////////////////////////////////////////////////////////// |
---|
| 619 | // processor, write buffer, caches , TLBs |
---|
| 620 | ////////////////////////////////////////////////////////////////// |
---|
| 621 | |
---|
| 622 | iss_t r_iss; |
---|
| 623 | MultiWriteBuffer<paddr_t> r_wbuf; |
---|
| 624 | GenericCache<paddr_t> r_icache; |
---|
| 625 | GenericCache<paddr_t> r_dcache; |
---|
| 626 | GenericTlb<paddr_t> r_itlb; |
---|
| 627 | GenericTlb<paddr_t> r_dtlb; |
---|
| 628 | |
---|
| 629 | ////////////////////////////////////////////////////////////////// |
---|
| 630 | // llsc registration buffer |
---|
| 631 | ////////////////////////////////////////////////////////////////// |
---|
| 632 | |
---|
| 633 | sc_signal<paddr_t> r_dcache_llsc_paddr; |
---|
| 634 | sc_signal<uint32_t> r_dcache_llsc_key; |
---|
| 635 | sc_signal<uint32_t> r_dcache_llsc_count; |
---|
| 636 | sc_signal<bool> r_dcache_llsc_valid; |
---|
| 637 | |
---|
| 638 | //////////////////////////////// |
---|
| 639 | // Activity counters |
---|
| 640 | //////////////////////////////// |
---|
| 641 | uint32_t m_cpt_dcache_data_read; // DCACHE DATA READ |
---|
| 642 | uint32_t m_cpt_dcache_data_write; // DCACHE DATA WRITE |
---|
| 643 | uint32_t m_cpt_dcache_dir_read; // DCACHE DIR READ |
---|
| 644 | uint32_t m_cpt_dcache_dir_write; // DCACHE DIR WRITE |
---|
| 645 | |
---|
| 646 | uint32_t m_cpt_icache_data_read; // ICACHE DATA READ |
---|
| 647 | uint32_t m_cpt_icache_data_write; // ICACHE DATA WRITE |
---|
| 648 | uint32_t m_cpt_icache_dir_read; // ICACHE DIR READ |
---|
| 649 | uint32_t m_cpt_icache_dir_write; // ICACHE DIR WRITE |
---|
| 650 | |
---|
| 651 | uint32_t m_cpt_frz_cycles; // number of cycles where the cpu is frozen |
---|
| 652 | uint32_t m_cpt_total_cycles; // total number of cycles |
---|
| 653 | |
---|
| 654 | // Cache activity counters |
---|
| 655 | uint32_t m_cpt_data_read; // total number of read data |
---|
| 656 | uint32_t m_cpt_data_write; // total number of write data |
---|
[477] | 657 | uint32_t m_cpt_data_write_back; |
---|
| 658 | uint32_t m_cpt_data_cleanup; |
---|
| 659 | uint32_t m_cpt_data_sc; |
---|
[331] | 660 | uint32_t m_cpt_data_miss; // number of read miss |
---|
| 661 | uint32_t m_cpt_ins_miss; // number of instruction miss |
---|
| 662 | uint32_t m_cpt_unc_read; // number of read uncached |
---|
| 663 | uint32_t m_cpt_write_cached; // number of cached write |
---|
| 664 | uint32_t m_cpt_ins_read; // number of instruction read |
---|
| 665 | uint32_t m_cpt_ins_spc_miss; // number of speculative instruction miss |
---|
| 666 | |
---|
| 667 | uint32_t m_cost_write_frz; // number of frozen cycles related to write buffer |
---|
| 668 | uint32_t m_cost_data_miss_frz; // number of frozen cycles related to data miss |
---|
| 669 | uint32_t m_cost_unc_read_frz; // number of frozen cycles related to uncached read |
---|
| 670 | uint32_t m_cost_ins_miss_frz; // number of frozen cycles related to ins miss |
---|
| 671 | |
---|
| 672 | uint32_t m_cpt_imiss_transaction; // number of VCI instruction miss transactions |
---|
| 673 | uint32_t m_cpt_dmiss_transaction; // number of VCI data miss transactions |
---|
| 674 | uint32_t m_cpt_unc_transaction; // number of VCI uncached read transactions |
---|
[477] | 675 | uint32_t m_cpt_dunc_transaction; // number of VCI uncached read transactions |
---|
| 676 | uint32_t m_cpt_ll_transaction; // number of VCI uncached read transactions |
---|
[331] | 677 | uint32_t m_cpt_write_transaction; // number of VCI write transactions |
---|
| 678 | uint32_t m_cpt_icache_unc_transaction; |
---|
| 679 | |
---|
| 680 | uint32_t m_cost_imiss_transaction; // cumulated duration for VCI IMISS transactions |
---|
| 681 | uint32_t m_cost_dmiss_transaction; // cumulated duration for VCI DMISS transactions |
---|
| 682 | uint32_t m_cost_unc_transaction; // cumulated duration for VCI UNC transactions |
---|
| 683 | uint32_t m_cost_write_transaction; // cumulated duration for VCI WRITE transactions |
---|
| 684 | uint32_t m_cost_icache_unc_transaction; // cumulated duration for VCI IUNC transactions |
---|
| 685 | uint32_t m_length_write_transaction; // cumulated length for VCI WRITE transactions |
---|
| 686 | |
---|
| 687 | // TLB activity counters |
---|
| 688 | uint32_t m_cpt_ins_tlb_read; // number of instruction tlb read |
---|
| 689 | uint32_t m_cpt_ins_tlb_miss; // number of instruction tlb miss |
---|
| 690 | uint32_t m_cpt_ins_tlb_update_acc; // number of instruction tlb update |
---|
| 691 | uint32_t m_cpt_ins_tlb_occup_cache; // number of instruction tlb occupy data cache line |
---|
| 692 | uint32_t m_cpt_ins_tlb_hit_dcache; // number of instruction tlb hit in data cache |
---|
| 693 | |
---|
| 694 | uint32_t m_cpt_data_tlb_read; // number of data tlb read |
---|
| 695 | uint32_t m_cpt_data_tlb_miss; // number of data tlb miss |
---|
| 696 | uint32_t m_cpt_data_tlb_update_acc; // number of data tlb update |
---|
| 697 | uint32_t m_cpt_data_tlb_update_dirty; // number of data tlb update dirty |
---|
| 698 | uint32_t m_cpt_data_tlb_hit_dcache; // number of data tlb hit in data cache |
---|
| 699 | uint32_t m_cpt_data_tlb_occup_cache; // number of data tlb occupy data cache line |
---|
| 700 | uint32_t m_cpt_tlb_occup_dcache; |
---|
| 701 | |
---|
| 702 | uint32_t m_cost_ins_tlb_miss_frz; // number of frozen cycles related to instruction tlb miss |
---|
| 703 | uint32_t m_cost_data_tlb_miss_frz; // number of frozen cycles related to data tlb miss |
---|
| 704 | uint32_t m_cost_ins_tlb_update_acc_frz; // number of frozen cycles related to instruction tlb update acc |
---|
| 705 | uint32_t m_cost_data_tlb_update_acc_frz; // number of frozen cycles related to data tlb update acc |
---|
| 706 | uint32_t m_cost_data_tlb_update_dirty_frz; // number of frozen cycles related to data tlb update dirty |
---|
| 707 | uint32_t m_cost_ins_tlb_occup_cache_frz; // number of frozen cycles related to instruction tlb miss operate in dcache |
---|
| 708 | uint32_t m_cost_data_tlb_occup_cache_frz; // number of frozen cycles related to data tlb miss operate in dcache |
---|
| 709 | |
---|
| 710 | uint32_t m_cpt_itlbmiss_transaction; // number of itlb miss transactions |
---|
| 711 | uint32_t m_cpt_itlb_ll_transaction; // number of itlb ll acc transactions |
---|
| 712 | uint32_t m_cpt_itlb_sc_transaction; // number of itlb sc acc transactions |
---|
| 713 | uint32_t m_cpt_dtlbmiss_transaction; // number of dtlb miss transactions |
---|
| 714 | uint32_t m_cpt_dtlb_ll_transaction; // number of dtlb ll acc transactions |
---|
| 715 | uint32_t m_cpt_dtlb_sc_transaction; // number of dtlb sc acc transactions |
---|
| 716 | uint32_t m_cpt_dtlb_ll_dirty_transaction; // number of dtlb ll dirty transactions |
---|
| 717 | uint32_t m_cpt_dtlb_sc_dirty_transaction; // number of dtlb sc dirty transactions |
---|
| 718 | |
---|
| 719 | uint32_t m_cost_itlbmiss_transaction; // cumulated duration for VCI instruction TLB miss transactions |
---|
| 720 | uint32_t m_cost_itlb_ll_transaction; // cumulated duration for VCI instruction TLB ll acc transactions |
---|
| 721 | uint32_t m_cost_itlb_sc_transaction; // cumulated duration for VCI instruction TLB sc acc transactions |
---|
| 722 | uint32_t m_cost_dtlbmiss_transaction; // cumulated duration for VCI data TLB miss transactions |
---|
| 723 | uint32_t m_cost_dtlb_ll_transaction; // cumulated duration for VCI data TLB ll acc transactions |
---|
| 724 | uint32_t m_cost_dtlb_sc_transaction; // cumulated duration for VCI data TLB sc acc transactions |
---|
| 725 | uint32_t m_cost_dtlb_ll_dirty_transaction; // cumulated duration for VCI data TLB ll dirty transactions |
---|
| 726 | uint32_t m_cost_dtlb_sc_dirty_transaction; // cumulated duration for VCI data TLB sc dirty transactions |
---|
| 727 | |
---|
| 728 | // coherence activity counters |
---|
| 729 | uint32_t m_cpt_cc_update_icache; // number of coherence update instruction commands |
---|
| 730 | uint32_t m_cpt_cc_update_dcache; // number of coherence update data commands |
---|
| 731 | uint32_t m_cpt_cc_inval_icache; // number of coherence inval instruction commands |
---|
| 732 | uint32_t m_cpt_cc_inval_dcache; // number of coherence inval data commands |
---|
| 733 | uint32_t m_cpt_cc_broadcast; // number of coherence broadcast commands |
---|
| 734 | |
---|
| 735 | uint32_t m_cost_updt_data_frz; // number of frozen cycles related to coherence update data packets |
---|
| 736 | uint32_t m_cost_inval_ins_frz; // number of frozen cycles related to coherence inval instruction packets |
---|
| 737 | uint32_t m_cost_inval_data_frz; // number of frozen cycles related to coherence inval data packets |
---|
| 738 | uint32_t m_cost_broadcast_frz; // number of frozen cycles related to coherence broadcast packets |
---|
| 739 | |
---|
| 740 | uint32_t m_cpt_cc_cleanup_ins; // number of coherence cleanup packets |
---|
| 741 | uint32_t m_cpt_cc_cleanup_data; // number of coherence cleanup packets |
---|
[477] | 742 | uint32_t m_cpt_cleanup_data_not_dirty; |
---|
| 743 | uint32_t m_cpt_cleanup_data_dirty_word; |
---|
[331] | 744 | |
---|
| 745 | uint32_t m_cpt_icleanup_transaction; // number of instruction cleanup transactions |
---|
| 746 | uint32_t m_cpt_dcleanup_transaction; // number of instructinumber of data cleanup transactions |
---|
| 747 | uint32_t m_cost_icleanup_transaction; // cumulated duration for VCI instruction cleanup transactions |
---|
| 748 | uint32_t m_cost_dcleanup_transaction; // cumulated duration for VCI data cleanup transactions |
---|
| 749 | |
---|
| 750 | uint32_t m_cost_ins_tlb_inval_frz; // number of frozen cycles related to checking ins tlb invalidate |
---|
| 751 | uint32_t m_cpt_ins_tlb_inval; // number of ins tlb invalidate |
---|
| 752 | |
---|
| 753 | uint32_t m_cost_data_tlb_inval_frz; // number of frozen cycles related to checking data tlb invalidate |
---|
| 754 | uint32_t m_cpt_data_tlb_inval; // number of data tlb invalidate |
---|
| 755 | |
---|
| 756 | // FSM activity counters |
---|
| 757 | uint32_t m_cpt_fsm_icache [64]; |
---|
| 758 | uint32_t m_cpt_fsm_dcache [64]; |
---|
| 759 | uint32_t m_cpt_fsm_cmd [64]; |
---|
| 760 | uint32_t m_cpt_fsm_rsp [64]; |
---|
| 761 | uint32_t m_cpt_fsm_cc_receive [64]; |
---|
| 762 | uint32_t m_cpt_fsm_cc_send [64]; |
---|
| 763 | |
---|
| 764 | uint32_t m_cpt_stop_simulation; // used to stop simulation if frozen |
---|
[432] | 765 | bool m_monitor_ok; // used to debug cache output |
---|
| 766 | uint32_t m_monitor_base; |
---|
| 767 | uint32_t m_monitor_length; |
---|
[331] | 768 | |
---|
| 769 | protected: |
---|
| 770 | SC_HAS_PROCESS(VciCcVCacheWrapper); |
---|
| 771 | |
---|
| 772 | public: |
---|
| 773 | VciCcVCacheWrapper( |
---|
[346] | 774 | sc_module_name name, |
---|
| 775 | const int proc_id, |
---|
| 776 | const soclib::common::MappingTable &mtd, |
---|
| 777 | const soclib::common::IntTab &srcid, |
---|
| 778 | const size_t cc_global_id, |
---|
| 779 | const size_t itlb_ways, |
---|
| 780 | const size_t itlb_sets, |
---|
| 781 | const size_t dtlb_ways, |
---|
| 782 | const size_t dtlb_sets, |
---|
| 783 | const size_t icache_ways, |
---|
| 784 | const size_t icache_sets, |
---|
| 785 | const size_t icache_words, |
---|
| 786 | const size_t dcache_ways, |
---|
| 787 | const size_t dcache_sets, |
---|
| 788 | const size_t dcache_words, |
---|
| 789 | const size_t wbuf_nlines, |
---|
| 790 | const size_t wbuf_nwords, |
---|
| 791 | const size_t x_width, |
---|
| 792 | const size_t y_width, |
---|
| 793 | const uint32_t max_frozen_cycles, |
---|
| 794 | const uint32_t debug_start_cycle, |
---|
| 795 | const bool debug_ok ); |
---|
[331] | 796 | |
---|
| 797 | ~VciCcVCacheWrapper(); |
---|
| 798 | |
---|
| 799 | void print_cpi(); |
---|
| 800 | void print_stats(); |
---|
| 801 | void clear_stats(); |
---|
| 802 | void print_trace(size_t mode = 0); |
---|
| 803 | void cache_monitor(paddr_t addr); |
---|
[423] | 804 | void start_monitor(paddr_t,paddr_t); |
---|
| 805 | void stop_monitor(); |
---|
[394] | 806 | inline void iss_set_debug_mask(uint v) |
---|
| 807 | { |
---|
| 808 | r_iss.set_debug_mask(v); |
---|
[331] | 809 | } |
---|
| 810 | |
---|
| 811 | private: |
---|
| 812 | void transition(); |
---|
| 813 | void genMoore(); |
---|
| 814 | |
---|
| 815 | soclib_static_assert((int)iss_t::SC_ATOMIC == (int)vci_param::STORE_COND_ATOMIC); |
---|
| 816 | soclib_static_assert((int)iss_t::SC_NOT_ATOMIC == (int)vci_param::STORE_COND_NOT_ATOMIC); |
---|
| 817 | }; |
---|
| 818 | |
---|
| 819 | }} |
---|
| 820 | |
---|
| 821 | #endif /* SOCLIB_CABA_VCI_CC_VCACHE_WRAPPER_H */ |
---|
| 822 | |
---|
| 823 | // Local Variables: |
---|
| 824 | // tab-width: 4 |
---|
| 825 | // c-basic-offset: 4 |
---|
| 826 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 827 | // indent-tabs-mode: nil |
---|
| 828 | // End: |
---|
| 829 | |
---|
| 830 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|