- Timestamp:
- Jul 12, 2013, 12:16:30 PM (11 years ago)
- Location:
- trunk/modules
- Files:
-
- 6 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp
r423 r434 5276 5276 break; 5277 5277 } 5278 ///////////////// ///5278 ///////////////// 5279 5279 case RSP_DATA_LL: 5280 5280 { … … 5285 5285 r_vci_rsp_data_error = true; 5286 5286 r_vci_rsp_fsm = RSP_IDLE; 5287 break; 5287 5288 } 5288 5289 if (r_vci_rsp_cpt.read() == 0) //first flit -
trunk/modules/vci_io_bridge/caba/metadata/vci_io_bridge.sd
r240 r434 6 6 Module('caba:vci_io_bridge', 7 7 classname = 'soclib::caba::VciIoBridge', 8 tmpl_parameters = [ 9 parameter.Module('vci_param_d', default = 'caba:vci_param', 10 cell_size = parameter.Reference("cell_size_d"), 11 plen_size = parameter.Reference("plen_size_d"), 12 addr_size = parameter.Reference("addr_size_d"), 13 rerror_size = parameter.Reference("rerror_size_d"), 14 clen_size = parameter.Reference("clen_size_d"), 15 rflag_size = parameter.Reference("rflag_size_d"), 16 srcid_size = parameter.Reference("srcid_size_d"), 17 pktid_size = parameter.Reference("pktid_size_d"), 18 trdid_size = parameter.Reference("trdid_size_d"), 19 wrplen_size = parameter.Reference("wrplen_size_d")), 20 parameter.Module('vci_param_x', default = 'caba:vci_param', 21 cell_size = parameter.Reference("cell_size_x"), 22 plen_size = parameter.Reference("plen_size_x"), 23 addr_size = parameter.Reference("addr_size_x"), 24 rerror_size = parameter.Reference("rerror_size_x"), 25 clen_size = parameter.Reference("clen_size_x"), 26 rflag_size = parameter.Reference("rflag_size_x"), 27 srcid_size = parameter.Reference("srcid_size_x"), 28 pktid_size = parameter.Reference("pktid_size_x"), 29 trdid_size = parameter.Reference("trdid_size_x"), 30 wrplen_size = parameter.Reference("wrplen_size_x")), 31 parameter.Module('vci_param_io', default = 'caba:vci_param', 32 cell_size = parameter.Reference("cell_size_io"), 33 plen_size = parameter.Reference("plen_size_io"), 34 addr_size = parameter.Reference("addr_size_io"), 35 rerror_size = parameter.Reference("rerror_size_io"), 36 clen_size = parameter.Reference("clen_size_io"), 37 rflag_size = parameter.Reference("rflag_size_io"), 38 srcid_size = parameter.Reference("srcid_size_io"), 39 pktid_size = parameter.Reference("pktid_size_io"), 40 trdid_size = parameter.Reference("trdid_size_io"), 41 wrplen_size = parameter.Reference("wrplen_size_io")), 8 9 tmpl_parameters = [ 10 parameter.Module('vci_param_int', 11 default = 'caba:vci_param', 12 cell_size = parameter.Reference('iob_cell_size_int')), 13 parameter.Module('vci_param_ext', 14 default = 'caba:vci_param', 15 cell_size = parameter.Reference('iob_cell_size_ext')), 42 16 ], 43 header_files = [ '../source/include/vci_io_bridge.h', 44 '../source/include/transaction_tab_io.h'], 17 18 header_files = [ 19 '../source/include/vci_io_bridge.h', 20 '../source/include/transaction_tab_io.h' 21 ], 22 45 23 implementation_files = [ '../source/src/vci_io_bridge.cpp' ], 24 46 25 uses = [ Uses('caba:base_module'), 47 Uses('common:mapping_table'), 48 Uses('caba:generic_fifo'), 49 Uses('caba:generic_tlb', 50 addr_t = parameter.StringExt('sc_dt::sc_uint<%d> ', 51 parameter.Reference('addr_size'))), 52 Uses('common:address_decoding_table', 53 input_t = 'unsigned long', 54 output_t = 'bool'), 55 Uses('common:address_decoding_table', 56 input_t = 'unsigned long', 57 output_t = 'int'), 58 # Uses('common:address_masking_table', 59 # data_t = parameter.StringExt('sc_dt::sc_uint<%d> ', 60 # parameter.Reference('addr_size'))), 61 ], 62 ports = [ Port('caba:vci_initiator', 'p_vci_ini_dma'), 63 Port('caba:vci_target', 'p_vci_tgt_dma'), 64 Port('caba:vci_initiator', 'p_vci_ini_config'), 65 Port('caba:vci_target', 'p_vci_tgt_config'), 66 Port('caba:vci_initiator', 'p_vci_ini_miss'), 67 Port('caba:bit_in','p_irq', parameter.Reference('nb_periph')), 26 Uses('common:mapping_table'), 27 Uses('caba:generic_fifo'), 28 Uses('caba:generic_tlb', 29 addr_t = parameter.StringExt('sc_dt::sc_uint<%d> ', 30 parameter.Reference('addr_size'))), 31 Uses('common:address_decoding_table', 32 input_t = 'unsigned long', 33 output_t = 'bool'), 34 Uses('common:address_decoding_table', 35 input_t = 'unsigned long', 36 output_t = 'int'), 37 ], 38 39 ports = [ 40 Port('caba:vci_initiator', 'p_vci_ini_ram'), 41 Port('caba:vci_target', 'p_vci_tgt_iox'), 42 Port('caba:vci_initiator', 'p_vci_ini_iox'), 43 Port('caba:vci_target', 'p_vci_tgt_int'), 44 Port('caba:vci_initiator', 'p_vci_ini_int'), 45 Port('caba:bit_in','p_irq', 32), 68 46 Port('caba:bit_in', 'p_resetn', auto = 'resetn'), 69 Port('caba:clock_in', 'p_clk', auto = 'clock'), ], 70 instance_parameters = [ parameter.Int('nd_periph'), 71 parameter.Module('mtx', 'common:mapping_table'), 72 parameter.Module('mtd', 'common:mapping_table'), 73 parameter.Module('mtio', 'common:mapping_table'), 74 parameter.Module('seg_config_iob', 'common:segment'), 75 parameter.IntTab('tgt_index_iocluster'), 76 # parameter.IntTab('tgt_index_config'), 77 parameter.IntTab('init_index_direct'), 78 parameter.IntTab('tgt_index_iospace'), 79 parameter.IntTab('init_index_iospace'), 80 parameter.IntTab('init_index_dma'), 81 parameter.Int('dcache_words'), 82 parameter.Int('iotlb_ways'), 83 parameter.Int('iotlb_sets'), 84 parameter.Int('max_frozen_cycles'), ], 85 extensions = [ 'dsx:get_ident=' 86 'tgt_index_config:p_vci_tgt_config:mtd,' 87 'init_index_direct:p_vci_init_miss:mtd,' 88 'tgt_index_iospace:p_vci_tgt_dma:mtio,' 89 'init_index_iospace:p_vci_init_config:mtio,' 90 'init_index_dma:p_vci_ini_dma:mtx,' 91 'dsx:cpu=wrapper:iss_t', 92 'dsx:addressable=tgt_index_config,tgt_index_iospace', 93 # 'dsx:on_segment=mc:add_index:initiator_rw_index', 94 ], 47 Port('caba:clock_in', 'p_clk', auto = 'clock'), 48 ], 95 49 96 # debug = True, 50 instance_parameters = [ 51 parameter.Module('mt_ext', 'common:mapping_table'), 52 parameter.Module('mt_int', 'common:mapping_table'), 53 parameter.Module('mt_iox', 'common:mapping_table'), 54 parameter.IntTab('int_tgtid'), 55 parameter.IntTab('int_srcid'), 56 parameter.IntTab('iox_tgtid'), 57 parameter.IntTab('iox_srcid'), 58 parameter.IntTab('ext_srcid'), 59 parameter.Int('dcache_words'), 60 parameter.Int('iotlb_ways'), 61 parameter.Int('iotlb_sets'), 62 parameter.Int('debug_start_cycle'), 63 parameter.Bool('debug_ok'), 64 ], 97 65 ) 98 66 -
trunk/modules/vci_io_bridge/caba/source/include/vci_io_bridge.h
r405 r434 3 3 * Copyright (c) UPMC, Lip6, SoC 4 4 * Date : 16/04/2012 5 * Authors: Cassio Fraga, Alain Greiner 5 6 * 6 7 * SOCLIB_LGPL_HEADER_BEGIN … … 24 25 * SOCLIB_LGPL_HEADER_END 25 26 */ 26 27 //////Utilisation Considerations//////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////////////// 28 // This TSAR component is a bridge to access external peripherals 29 // connected to an external I/O bus (such as Hypertransport or PCIe). 30 // AT the moment, the external I/O bus is modeled by a VCI VGMN component. 31 // It connects three VCI networks: 32 // - INT network : to receive both configuration requests from processors 33 // or software driven data access to peripherals. 34 // - RAM network : to send DMA transactions initiated by peripherals 35 // directly to the RAM (or L3 caches). 36 // - IOX network : to receive DMA transactions from peripherals, or to send 37 // configuration or data transactions to peripherals. 28 38 // 29 // - IOMMU PTPR pointer must fit in 32 bits (with a classical 2 level 4K page 30 // table in a 32 bit virtual space, it means a maximum of 45 bits in physical 31 // address) 39 // Regarding DMA transactions initiated by external peripherals, it provides 40 // an - optional - IOMMU service : the 32 bits virtual address is translated 41 // to a (up to) 40 bits physical address by a standard SoCLib generic TLB. 42 // In case of TLB MISS, the DMA is stalled until the TLB is updated. 43 // In case of page fault (illegal access), a VCI error is returned to the 44 // faulty peripheral. 45 ///////////////////////////////////////////////////////////////////////////////// 46 // General Constraints: 32 47 // 33 // - Physical address must fit in two 32 bit words 34 // 35 // - Maximal number of flits in a write transaction cannot be bigger than (n° of 36 // words in a chache line)/2 37 // 38 // - Page Tables must have the format used in TSAR (compatible with component 39 // generic_tlb) 40 // 41 // - IO's segment size must be the same in both networks 42 // 48 // - All VCI fields have the same widths on the EXT and IOX networks. 49 // - Only the VCI DATA field can differ between INT and EXT networks, 50 // and the width must be 32 or 64 bits. 51 // - The common VCI ADDRESS width cannot be larger than 64 bits. 52 // - All VCI transactions must be included in a single cache line. 53 // - Page Tables must have the format required by the SoCLib generic_tlb. 54 // - IO's segments must be the same in INT and IOX networks 43 55 // - Write operations on IOMMU configuration registers (PTPR, ACTIVE) can only 44 56 // be done when DMA_TLB FSM is IDLE. It should, preferably, be done before 45 57 // starting any transfers. Pseudo register INVAL may be modified any time. 46 //47 // - Similarly, write operations on the interruptions registers can only be done48 // when the dedicated FSM is IDLE.49 58 //////////////////////////////////////////////////////////////////////////////// 50 59 51 60 52 61 ///////TODO List/////////////////////////////////////////////////////////////// 53 // 54 // Tableau de correspondance d'adresses physique - IO (pour CONFIG_CMD) 55 // 56 // Conversion 32 (entree) à 64 (sortie) bits (champ data). Dans les deux senses (CMD et RSP) 57 // 58 // Ne pas garder tous les champs WRITE CMD dans les FIFO a chaque flit 59 // (seulement 'data' et 'be') 62 // - Ne pas garder tous les champs WRITE CMD dans les FIFO a chaque flit 63 // (seulement 'data' et 'be') 64 // - Traiter complêtement les codes d'erreur en réponse à une transaction 65 // WTI write 60 66 /////////////////////////////////////////////////////////////////////////////// 61 67 … … 71 77 #include "address_decoding_table.h" 72 78 #include "static_assert.h" 73 #include "transaction_tab_io.h"74 79 #include "vci_initiator.h" 75 80 #include "vci_target.h" 81 #include "../../../include/soclib/io_bridge.h" 76 82 77 83 namespace soclib { … … 80 86 using namespace soclib::common; 81 87 82 //////////////////////////////////////////// 83 template<typename vci_param_d,typename vci_param_x, typename vci_param_io > 88 /////////////////////////////////////////////////////////////////////////////////// 89 template<typename vci_param_int, 90 typename vci_param_ext> 84 91 class VciIoBridge 85 //////////////////////////////////////////// 92 /////////////////////////////////////////////////////////////////////////////////// 86 93 : public soclib::caba::BaseModule 87 94 { 88 typedef uint32_t tag_t; 89 typedef uint32_t type_t; 90 91 // Address field may change between direct, extenal and IO network 92 typedef typename vci_param_d::addr_t paddr_t; 93 typedef typename vci_param_x::addr_t paddr_t_x; // Just the cache line, for example 94 typedef typename vci_param_io::addr_t vaddr_t; 95 96 // Data field may change for external network 97 typedef typename vci_param_x::data_t vci_data_t_x; 98 typedef typename vci_param_x::be_t vci_be_t_x; 99 // Srcid field may change for external network 100 typedef typename vci_param_x::srcid_t vci_srcid_t_x; 101 102 // Other fields must coincide 103 typedef typename vci_param_d::srcid_t vci_srcid_t; 104 typedef typename vci_param_d::data_t vci_data_t; 105 typedef typename vci_param_d::be_t vci_be_t; 106 typedef typename vci_param_d::trdid_t vci_trdid_t; 107 typedef typename vci_param_d::pktid_t vci_pktid_t; 108 typedef typename vci_param_d::plen_t vci_plen_t; 109 typedef typename vci_param_d::cmd_t vci_cmd_t; 110 typedef typename vci_param_d::contig_t vci_contig_t; 111 typedef typename vci_param_d::eop_t vci_eop_t; 112 typedef typename vci_param_d::const_t vci_cons_t; 113 typedef typename vci_param_d::wrap_t vci_wrap_t; 114 typedef typename vci_param_d::clen_t vci_clen_t; 115 typedef typename vci_param_d::cfixed_t vci_cfixed_t; 116 117 typedef typename vci_param_d::rerror_t vci_rerror_t; 118 119 enum { 120 CACHE_LINE_MASK = 0xFFFFFFFFC0, 121 PPN1_MASK = 0x0007FFFF, 122 PPN2_MASK = 0x0FFFFFFF, 95 // Data field can have different widths on INT and EXT networks 96 typedef typename vci_param_ext::fast_data_t ext_data_t; 97 typedef typename vci_param_int::fast_data_t int_data_t; 98 99 // Other fields must be equal 100 typedef typename vci_param_int::fast_addr_t vci_addr_t; 101 typedef typename vci_param_int::srcid_t vci_srcid_t; 102 typedef typename vci_param_int::be_t vci_be_t; 103 typedef typename vci_param_int::trdid_t vci_trdid_t; 104 typedef typename vci_param_int::pktid_t vci_pktid_t; 105 typedef typename vci_param_int::plen_t vci_plen_t; 106 typedef typename vci_param_int::cmd_t vci_cmd_t; 107 typedef typename vci_param_int::contig_t vci_contig_t; 108 typedef typename vci_param_int::eop_t vci_eop_t; 109 typedef typename vci_param_int::const_t vci_cons_t; 110 typedef typename vci_param_int::wrap_t vci_wrap_t; 111 typedef typename vci_param_int::clen_t vci_clen_t; 112 typedef typename vci_param_int::cfixed_t vci_cfixed_t; 113 typedef typename vci_param_int::rerror_t vci_rerror_t; 114 115 enum 116 { 117 CACHE_LINE_MASK = 0xFFFFFFFFC0LL, 118 PPN1_MASK = 0x0007FFFF, 119 PPN2_MASK = 0x0FFFFFFF, 123 120 K_PAGE_OFFSET_MASK = 0x00000FFF, 124 121 M_PAGE_OFFSET_MASK = 0x001FFFFF, … … 127 124 }; 128 125 129 //DMA (from Peripherals to XRAM) 130 enum dma_cmd_fsm_state { 126 // States for DMA_CMD FSM (from IOX to RAM) 127 enum dma_cmd_fsm_state 128 { 131 129 DMA_CMD_IDLE, 132 DMA_CMD_TRT_LOCK, 133 DMA_CMD_TRT_WAIT, 134 DMA_CMD_TRT_SET, 135 DMA_CMD_FIFO_PUT, 136 DMA_CMD_FIFO_MISS_PUT, 137 DMA_CMD_TLB_MISS_WAIT, 138 DMA_CMD_TLB_MISS_STORE, 139 DMA_CMD_ERROR, 130 DMA_CMD_FIFO_PUT_CMD, 131 DMA_CMD_FIFO_PUT_RSP, 132 DMA_CMD_MISS_WAIT, 133 DMA_CMD_WAIT_EOP, 140 134 }; 141 135 142 enum dma_rsp_fsm_state { 136 // States for DMA_RSP FSM (from RAM to IOX) 137 enum dma_rsp_fsm_state 138 { 143 139 DMA_RSP_IDLE, 144 DMA_RSP_TRT_LOCK,145 140 DMA_RSP_FIFO_PUT, 146 DMA_RSP_FIFO_ERROR_PUT,147 141 }; 148 142 149 // Allocates the transaction_tab_dma 150 enum alloc_trt_dma_fsm_state { 151 ALLOC_TRT_DMA_CMD, 152 ALLOC_TRT_DMA_RSP 143 // States for TLB_MISS FSM 144 enum dma_tlb_fsm_state 145 { 146 TLB_IDLE, 147 TLB_MISS, 148 TLB_PTE1_GET, 149 TLB_PTE1_SELECT, 150 TLB_PTE1_UPDT, 151 TLB_PTE2_GET, 152 TLB_PTE2_SELECT, 153 TLB_PTE2_UPDT, 154 TLB_WAIT, 155 TLB_RETURN, 156 TLB_INVAL_CHECK, 157 }; 158 159 // States for CONFIG_CMD FSM (from INT to IOX) 160 enum config_cmd_fsm_state 161 { 162 CONFIG_CMD_IDLE, 163 CONFIG_CMD_FIFO_PUT_CMD, 164 CONFIG_CMD_FIFO_PUT_RSP, 165 }; 166 167 // states for CONFIG_RSP FSM (from IOX to INT) 168 enum config_rsp_fsm_state 169 { 170 CONFIG_RSP_IDLE, 171 CONFIG_RSP_FIFO_PUT, 153 172 }; 154 155 156 enum dma_tlb_fsm_state { 157 DMA_TLB_IDLE, 158 DMA_TLB_MISS, 159 DMA_TLB_PTE1_GET, 160 DMA_TLB_PTE1_SELECT, 161 DMA_TLB_PTE1_UPDT, 162 DMA_TLB_PTE2_GET, 163 DMA_TLB_PTE2_SELECT, 164 DMA_TLB_PTE2_UPDT, 165 DMA_TLB_WAIT_TRANSACTION, 166 DMA_TLB_RETURN, 167 // Treatment of CONFIG FSM request 168 DMA_TLB_INVAL_CHECK, 169 DMA_TLB_INVAL_SCAN 173 174 // States for MISS_WTI_CMD FSM (to INT network) 175 enum miss_wti_cmd_state 176 { 177 MISS_WTI_CMD_IDLE, 178 MISS_WTI_CMD_WTI, 179 MISS_WTI_CMD_MISS, 170 180 }; 171 181 172 //CONFIG (from Direct Network to Peripherals) 173 enum config_cmd_fsm_state { 174 CONFIG_CMD_IDLE, 175 CONFIG_CMD_TRT_LOCK, 176 CONFIG_CMD_TRT_WAIT, 177 CONFIG_CMD_TRT_SET, 178 CONFIG_CMD_FIFO_PUT, 179 180 // IOB private configuration segment 181 CONFIG_CMD_PTPR_WRITE, 182 CONFIG_CMD_PTPR_READ, 183 CONFIG_CMD_ACTIVE_WRITE, 184 CONFIG_CMD_ACTIVE_READ, 185 CONFIG_CMD_BVAR_READ, 186 CONFIG_CMD_ETR_READ, 187 CONFIG_CMD_BAD_ID_READ, 188 CONFIG_CMD_INVAL_REQ, 189 CONFIG_CMD_INVAL, 190 CONFIG_CMD_IT_ADDR_IOMMU_WRITE_1, 191 CONFIG_CMD_IT_ADDR_IOMMU_WRITE_2, 192 CONFIG_CMD_IT_ADDR_IOMMU_READ_1, 193 CONFIG_CMD_IT_ADDR_IOMMU_READ_2, 194 CONFIG_CMD_IT_ADDR_WRITE_1, 195 CONFIG_CMD_IT_ADDR_WRITE_2, 196 CONFIG_CMD_IT_ADDR_READ_1, 197 CONFIG_CMD_IT_ADDR_READ_2, 198 CONFIG_CMD_ERROR_WAIT, 199 CONFIG_CMD_ERROR_RSP 182 // States for MISS_WTI_RSP FSM (from INT network) 183 enum miss_wti_rsp_state 184 { 185 MISS_WTI_RSP_IDLE, 186 MISS_WTI_RSP_WTI, 187 MISS_WTI_RSP_MISS, 200 188 }; 201 202 enum config_rsp_fsm_state { 203 CONFIG_RSP_IDLE, 204 CONFIG_RSP_TRT_LOCK, 205 CONFIG_RSP_FIFO_PUT 189 190 // PKTID values for TLB MISS and WTI transactions 191 enum pktid_values_e 192 { 193 PKTID_READ = 0x0, // TSAR code for read data uncached 194 PKTID_WRITE = 0x4, // TSAR code for write 206 195 }; 207 208 // Allocates the transaction_tab_dma 209 enum alloc_trt_config_fsm_state { 210 ALLOC_TRT_CONFIG_CMD, 211 ALLOC_TRT_CONFIG_RSP 212 }; 213 214 //MISS TRANSACTIONS (to Direct Network) 215 enum miss_init_fsm_state { 216 MISS_INIT_IDLE_MISS, 217 MISS_INIT_IDLE_IRQ, 218 MISS_INIT_IRQ_CMD, 219 MISS_INIT_IRQ_RSP, 220 MISS_INIT_TLB_MISS_CMD, 221 MISS_INIT_TLB_MISS_RSP 222 }; 223 224 ///////////////////////////////////////////////////////////////// 225 226 // Configuration Error Type 227 enum config_error_type { 228 READ_OK = 0, 229 READ_ERROR = 1, 230 WRITE_OK = 2, 231 WRITE_ERROR = 3 232 }; 233 196 234 197 // Miss types for iotlb 235 198 enum tlb_miss_type_e 236 199 { 237 200 PTE1_MISS, 238 PTE2_MISS 201 PTE2_MISS, 239 202 }; 240 203 241 // IOB Configuration registers242 // Required segment size = (8 + 2*nb_periph) words243 enum {244 IOB_IOMMU_PTPR = 0, // R/W : Page Table Pointer Register245 IOB_IOMMU_ACTIVE = 1, // R/W : IOMMU activated if not 0246 IOB_IOMMU_BVAR = 2, // R : Bad Virtual Address247 IOB_IOMMU_ETR = 3, // R : Error type248 IOB_IOMMU_BAD_ID = 4, // R : Faulty peripheral Index249 IOB_INVAL_PTE = 5, // W : Invalidate PTE. Virtual Address250 IOB_IT_ADDR_IOMMU_LO = 6, // R/W251 IOB_IT_ADDR_IOMMU_HI = 7, // R/W252 IOB_IT_ADDR_BEGIN = 8 // R/W : One register by IO253 // Addressed by two 32-bit words each254 };255 256 257 // Error Type258 enum mmu_error_type_e259 {260 MMU_NONE = 0x0000, // None261 MMU_WRITE_ACCES_VIOLATION = 0x0008, // Write access of write access to a non writable page (bit W in flags)262 MMU_WRITE_PT1_ILLEGAL_ACCESS = 0x0040, // Write access of Bus Error accessing Table 1263 MMU_READ_PT1_UNMAPPED = 0x1001, // Read access of Page fault on Page Table 1264 MMU_READ_PT2_UNMAPPED = 0x1002, // Read access of Page fault on Page Table 2265 MMU_READ_PT1_ILLEGAL_ACCESS = 0x1040, // Read access of Bus Error in Table1 access266 MMU_READ_PT2_ILLEGAL_ACCESS = 0x1080, // Read access of Bus Error in Table2 access267 MMU_READ_DATA_ILLEGAL_ACCESS = 0x1100, // Read access of Bus Error in cache access268 };269 270 271 204 public: 272 sc_in<bool> p_clk;273 sc_in<bool> p_resetn;274 sc_in<bool> *p_irq_in;275 276 soclib::caba::VciInitiator<vci_param_ x> p_vci_ini_dma; // XRAM Noc277 soclib::caba::VciTarget<vci_param_io> p_vci_tgt_dma; 278 279 soclib::caba::VciInitiator<vci_param_ io> p_vci_ini_config;280 soclib::caba::VciTarget<vci_param_d> p_vci_tgt_config; 281 282 soclib::caba::VciInitiator<vci_param_ d> p_vci_ini_miss;205 sc_in<bool> p_clk; 206 sc_in<bool> p_resetn; 207 sc_in<bool>* p_irq[32]; // not always constructed 208 209 soclib::caba::VciInitiator<vci_param_ext> p_vci_ini_ram; 210 211 soclib::caba::VciTarget<vci_param_ext> p_vci_tgt_iox; 212 soclib::caba::VciInitiator<vci_param_ext> p_vci_ini_iox; 213 214 soclib::caba::VciTarget<vci_param_int> p_vci_tgt_int; 215 soclib::caba::VciInitiator<vci_param_int> p_vci_ini_int; 283 216 284 217 private: 285 const size_t m_words; 286 const size_t m_nb_periph; 287 288 // STRUCTURAL PARAMETERS 289 // soclib::common::AddressDecodingTable<unsigned long, bool> m_locality_table_config; 290 // soclib::common::AddressDecodingTable<unsigned long, int> m_routing_table_config; 291 //const soclib::common::MappingTable& m_mtio; 292 293 uint32_t m_transaction_tab_dma_lines; 294 TransactionTabIO m_transaction_tab_dma; // dma transaction table 295 296 uint32_t m_transaction_tab_config_lines; 297 TransactionTabIO m_transaction_tab_config; // config transaction table 298 299 // Direct Network 300 const soclib::common::Segment m_segment_config; 301 const vci_srcid_t m_srcid_miss; 302 // XRAM Network 303 const vci_srcid_t_x m_srcid_dma; 304 // IO Network 305 const soclib::common::Segment m_segment_io; 306 const vci_srcid_t m_srcid_config; 307 308 const size_t m_iotlb_ways; 309 const size_t m_iotlb_sets; 310 const size_t m_paddr_nbits; 311 312 313 ///////////////////////////////////////////// 314 // debug variables (for each FSM) 315 ///////////////////////////////////////////// 316 uint32_t m_debug_start_cycle; 317 bool m_debug_ok; 318 319 bool m_debug_dma_cmd_fsm; 320 bool m_debug_dma_rsp_fsm; 321 bool m_debug_dma_tlb_fsm; 322 bool m_debug_config_cmd_fsm; 323 bool m_debug_config_rsp_fsm; 324 bool m_debug_miss_init_fsm; 218 const size_t m_words; 219 const bool m_has_irqs; 220 221 // INT & IOX Networks 222 std::list<soclib::common::Segment> m_int_seglist; 223 const vci_srcid_t m_int_srcid; // local SRCID on INT network 224 std::list<soclib::common::Segment> m_iox_seglist; 225 226 // TLB parameters 227 const size_t m_iotlb_ways; 228 const size_t m_iotlb_sets; 229 230 // debug variables 231 uint32_t m_debug_start_cycle; 232 bool m_debug_ok; 233 bool m_debug_activated; 325 234 326 235 /////////////////////////////// 327 236 // MEMORY MAPPED REGISTERS 328 237 /////////////////////////////// 329 sc_signal<uint32_t> r_iommu_ptpr;// page table pointer register330 sc_signal<bool> r_iommu_active; // iotlb mode331 sc_signal<uint32_t> r_iommu_bvar; // iommu badaddress332 sc_signal<uint32_t> r_iommu_etr;// iommu error type333 sc_signal<uint32_t> r_iommu_bad_id; // ID of the peripheral that tried bad operation334 335 sc_signal< paddr_t> r_it_addr_iommu; // iommu error type336 paddr_t *r_it_addr; // iommu error type238 sc_signal<uint32_t> r_iommu_ptpr; // page table pointer register 239 sc_signal<bool> r_iommu_active; // iotlb mode 240 sc_signal<uint32_t> r_iommu_bvar; // iommu bad virtual address 241 sc_signal<uint32_t> r_iommu_etr; // iommu error type 242 sc_signal<uint32_t> r_iommu_bad_id; // SRCID of faulty peripheral 243 sc_signal<uint32_t> r_iommu_wti_enable; // enable WTI transactions when true 244 sc_signal<vci_addr_t> r_iommu_wti_paddr; // address of IOMMU WTI 245 sc_signal<vci_addr_t>* r_iommu_peri_wti; // array[32] WTI for peripherals 337 246 338 247 /////////////////////////////////// 339 248 // DMA_CMD FSM REGISTERS 340 249 /////////////////////////////////// 341 sc_signal<int> r_dma_cmd_fsm; // state register 342 sc_signal<int> r_dma_cmd_fsm_save; //saves current state when miss interruption happens 343 sc_signal<bool> r_miss_interrupt; 344 345 sc_signal<int> r_dma_cmd_count; 346 sc_signal<vci_trdid_t> r_dma_cmd_trt_index; 347 sc_signal<paddr_t> r_dma_paddr; 348 349 GenericFifo<paddr_t> m_dma_cmd_addr_fifo; 350 //GenericFifo<size_t> m_dma_cmd_length_fifo; 250 sc_signal<int> r_dma_cmd_fsm; 251 sc_signal<uint32_t> r_dma_cmd_vaddr; // input virtual address 252 sc_signal<vci_addr_t> r_dma_cmd_paddr; // output physical address 253 254 /////////////////////////////////// 255 // DMA_RSP FSM REGISTERS 256 /////////////////////////////////// 257 sc_signal<int> r_dma_rsp_fsm; 258 259 /////////////////////////////////// 260 // CONFIG_CMD FSM REGISTERS 261 /////////////////////////////////// 262 sc_signal<int> r_config_cmd_fsm; 263 sc_signal<uint32_t> r_config_cmd_rdata; 264 sc_signal<bool> r_config_cmd_error; 265 sc_signal<uint32_t> r_config_cmd_inval_vaddr; 266 267 /////////////////////////////////// 268 // CONFIG_RSP FSM REGISTERS 269 /////////////////////////////////// 270 sc_signal<int> r_config_rsp_fsm; 271 272 /////////////////////////////////// 273 // TLB FSM REGISTERS 274 /////////////////////////////////// 275 sc_signal<int> r_tlb_fsm; // state register 276 sc_signal<bool> r_waiting_transaction; // Flag for returning from 277 sc_signal<int> r_tlb_miss_type; 278 sc_signal<bool> r_tlb_miss_error; 279 280 sc_signal<vci_addr_t> r_tlb_paddr; // physical address of pte 281 sc_signal<uint32_t> r_tlb_pte_flags; // pte1 or first word of pte2 282 sc_signal<uint32_t> r_tlb_pte_ppn; // second word of pte2 283 sc_signal<size_t> r_tlb_way; // selected way in tlb 284 sc_signal<size_t> r_tlb_set; // selected set in tlb 285 286 uint32_t* r_tlb_buf_data; // prefetch buffer for PTEs 287 sc_signal<bool> r_tlb_buf_valid; // one valit flag for all PTEs 288 sc_signal<vci_addr_t> r_tlb_buf_tag; // cache line number 289 sc_signal<vci_addr_t> r_tlb_buf_vaddr; // virtual address first PTE 290 sc_signal<bool> r_tlb_buf_big_page; // ??? 291 292 /////////////////////////////////// 293 // MISS_WTI_CMD FSM REGISTERS 294 /////////////////////////////////// 295 sc_signal<int> r_miss_wti_cmd_fsm; 296 sc_signal<size_t> r_miss_wti_cmd_index; 297 298 /////////////////////////////////// 299 // MISS_WTI_RSP FSM REGISTERS 300 /////////////////////////////////// 301 sc_signal<int> r_miss_wti_rsp_fsm; 302 sc_signal<bool> r_miss_wti_rsp_error; 303 sc_signal<size_t> r_miss_wti_rsp_count; 304 305 ///////////////////////////////////////////////////// 306 // ALLOCATORS for CONFIG_RSP fifo & DMA_RSP fifo 307 ///////////////////////////////////////////////////// 308 sc_signal<bool> r_alloc_fifo_config_rsp_local; 309 sc_signal<bool> r_alloc_fifo_dma_rsp_local; 310 311 ////////////////////////////////// 312 // IRQ FSM registers 313 ////////////////////////////////// 314 sc_signal<bool>* r_irq_pending; // array[32] 315 sc_signal<bool>* r_irq_request; // array[32] 316 317 ////////////////////////////////////////////////////////////////// 318 // IOTLB 319 ////////////////////////////////////////////////////////////////// 320 GenericTlb<vci_addr_t> r_iotlb; 321 322 ////////////////////////////////////////////////////////////////// 323 // Inter-FSM communications 324 ////////////////////////////////////////////////////////////////// 325 326 // between DMA_CMD and TLB FSM 327 sc_signal<bool> r_dma_tlb_req; 328 329 // between CONFIG_CMD FSM and TLB FSM 330 sc_signal<bool> r_config_tlb_req; 331 332 // between TLB FSM and MISS_WTI FSM 333 sc_signal<bool> r_tlb_miss_req; 334 335 ///////////////////////// 336 // FIFOs 337 ///////////////////////// 338 339 // ouput FIFO to VCI INI port on RAM network (VCI command) 340 GenericFifo<vci_addr_t> m_dma_cmd_addr_fifo; 351 341 GenericFifo<vci_srcid_t> m_dma_cmd_srcid_fifo; 352 342 GenericFifo<vci_trdid_t> m_dma_cmd_trdid_fifo; … … 355 345 GenericFifo<vci_cmd_t> m_dma_cmd_cmd_fifo; 356 346 GenericFifo<vci_contig_t> m_dma_cmd_contig_fifo; 357 GenericFifo< vci_data_t> m_dma_cmd_data_fifo;347 GenericFifo<ext_data_t> m_dma_cmd_data_fifo; 358 348 GenericFifo<vci_eop_t> m_dma_cmd_eop_fifo; 359 349 GenericFifo<vci_cons_t> m_dma_cmd_cons_fifo; … … 363 353 GenericFifo<vci_clen_t> m_dma_cmd_clen_fifo; 364 354 365 // Command storage registers (in case of miss tlb) 366 sc_signal<paddr_t> r_miss_paddr; 367 sc_signal<vci_cmd_t> r_miss_cmd ; 368 sc_signal<vci_contig_t> r_miss_contig; 369 sc_signal<vci_cons_t> r_miss_cons ; 370 sc_signal<vci_plen_t> r_miss_plen ; 371 sc_signal<vci_wrap_t> r_miss_wrap ; 372 sc_signal<vci_cfixed_t> r_miss_cfixed; 373 sc_signal<vci_clen_t> r_miss_clen ; 374 sc_signal<vci_srcid_t> r_miss_srcid ; 375 sc_signal<vci_trdid_t> r_miss_trdid ; 376 sc_signal<vci_pktid_t> r_miss_pktid ; 377 vci_data_t_x *r_miss_data ; 378 vci_be_t *r_miss_be; 379 380 // Error registers 381 sc_signal<int> r_dma_error_type; 382 sc_signal<vci_trdid_t> r_dma_error_trdid; 383 sc_signal<vci_pktid_t> r_dma_error_pktid; 384 385 /////////////////////////////////// 386 // DMA_TLB FSM REGISTERS 387 /////////////////////////////////// 388 sc_signal<int> r_dma_tlb_fsm; // state register 389 sc_signal<bool> r_waiting_transaction; // Flag for returning from 390 // invalidation interruptions 391 sc_signal<int> r_tlb_miss_type; 392 393 sc_signal<vaddr_t> r_iotlb_vaddr; // virtual address for a tlb miss 394 sc_signal<paddr_t> r_iotlb_paddr; // physical address of pte 395 sc_signal<uint32_t> r_iotlb_pte_flags; // pte1 or first word of pte2 396 sc_signal<uint32_t> r_iotlb_pte_ppn; // second word of pte2 397 sc_signal<size_t> r_iotlb_way; // selected way in tlb 398 sc_signal<size_t> r_iotlb_set; // selected set in tlb 399 400 ////////////////////////////////////////////////////////////////// 401 // IOTLB 402 ////////////////////////////////////////////////////////////////// 403 GenericTlb<paddr_t> r_iotlb; 404 405 /////////////////////////////////// 406 // DMA_RSP FSM REGISTERS 407 /////////////////////////////////// 408 sc_signal<int> r_dma_rsp_fsm; 409 410 sc_signal<vci_trdid_t> r_dma_rtrdid; 411 sc_signal<vci_srcid_t> r_dma_rsrcid; 412 413 GenericFifo<vci_data_t> m_dma_rsp_data_fifo; 355 // output FIFO to VCI TGT port on IOX network (VCI response) 356 GenericFifo<ext_data_t> m_dma_rsp_data_fifo; 414 357 GenericFifo<vci_srcid_t> m_dma_rsp_rsrcid_fifo; 415 358 GenericFifo<vci_trdid_t> m_dma_rsp_rtrdid_fifo; … … 418 361 GenericFifo<vci_rerror_t> m_dma_rsp_rerror_fifo; 419 362 420 //Communication between DMA_CMD and DMA_RSP 421 sc_signal<bool> r_dma_cmd_rsp_erase_req; 422 sc_signal<bool> r_dma_cmd_error_req; 423 //Communication between DMA_CMD and TLB 424 sc_signal<bool> r_dma_tlb_req; 425 sc_signal<bool> r_tlb_dma_untreated; 426 sc_signal<bool> r_dma_tlb_error_req; 427 sc_signal<int> r_tlb_error_type; 428 //Communication betweeen TLB and CONFIG_CMD 429 sc_signal<bool> r_config_tlb_req; 430 sc_signal<vaddr_t> r_config_tlb_inval_vaddr; 431 432 /////////////////////////////////// 433 // ALLOC_TRT_DMA FSM REGISTERS 434 /////////////////////////////////// 435 sc_signal<int> r_alloc_trt_dma_fsm; // state register 436 437 438 /////////////////////////////////// 439 // CONFIG_CMD FSM REGISTERS 440 /////////////////////////////////// 441 sc_signal<int> r_config_cmd_fsm; // state register 442 443 sc_signal<vci_trdid_t> r_config_cmd_trt_index; 444 445 GenericFifo<paddr_t> m_config_cmd_addr_fifo; 446 //GenericFifo<size_t> m_config_cmd_length_fifo; 363 // output FIFO to VCI INI port on IOX network (VCI command) 364 GenericFifo<vci_addr_t> m_config_cmd_addr_fifo; 447 365 GenericFifo<vci_srcid_t> m_config_cmd_srcid_fifo; 448 366 GenericFifo<vci_trdid_t> m_config_cmd_trdid_fifo; … … 451 369 GenericFifo<vci_cmd_t> m_config_cmd_cmd_fifo; 452 370 GenericFifo<vci_contig_t> m_config_cmd_contig_fifo; 453 GenericFifo< vci_data_t> m_config_cmd_data_fifo;371 GenericFifo<ext_data_t> m_config_cmd_data_fifo; 454 372 GenericFifo<vci_eop_t> m_config_cmd_eop_fifo; 455 373 GenericFifo<vci_cons_t> m_config_cmd_cons_fifo; … … 459 377 GenericFifo<vci_clen_t> m_config_cmd_clen_fifo; 460 378 461 462 // Private configuration registers 463 sc_signal<int> r_config_error_type; // rerror field 464 sc_signal<vci_data_t> r_config_first_word; 465 sc_signal<int> r_it_index; 466 467 GenericFifo<vci_data_t> m_config_local_data_fifo; 468 GenericFifo<vci_srcid_t> m_config_local_rsrcid_fifo; 469 GenericFifo<vci_trdid_t> m_config_local_rtrdid_fifo; 470 GenericFifo<vci_pktid_t> m_config_local_rpktid_fifo; 471 GenericFifo<vci_eop_t> m_config_local_reop_fifo; 472 GenericFifo<vci_rerror_t> m_config_local_rerror_fifo; 473 sc_signal<vaddr_t> r_config_vaddr; 474 475 476 /////////////////////////////////// 477 // CONFIG_RSP FSM REGISTERS 478 /////////////////////////////////// 479 sc_signal<int> r_config_rsp_fsm; 480 481 sc_signal<vci_trdid_t> r_config_rtrdid; 482 sc_signal<vci_srcid_t> r_config_rsrcid; 483 484 GenericFifo<vci_data_t> m_config_rsp_data_fifo; 485 GenericFifo<vci_srcid_t> m_config_rsp_rsrcid_fifo; 486 GenericFifo<vci_trdid_t> m_config_rsp_rtrdid_fifo; 487 GenericFifo<vci_pktid_t> m_config_rsp_rpktid_fifo; 488 GenericFifo<vci_eop_t> m_config_rsp_reop_fifo; 489 GenericFifo<vci_rerror_t> m_config_rsp_rerror_fifo; 379 // output FIFO to VCI TGT port on INT network (VCI response) 380 GenericFifo<int_data_t> m_config_rsp_data_fifo; 381 GenericFifo<vci_srcid_t> m_config_rsp_rsrcid_fifo; 382 GenericFifo<vci_trdid_t> m_config_rsp_rtrdid_fifo; 383 GenericFifo<vci_pktid_t> m_config_rsp_rpktid_fifo; 384 GenericFifo<vci_eop_t> m_config_rsp_reop_fifo; 385 GenericFifo<vci_rerror_t> m_config_rsp_rerror_fifo; 490 386 491 // Defines priority between the two response FIFOs (local and remote) 492 sc_signal<bool> r_config_rsp_fifo_local_priority; 493 494 //Communication between CONFIG_CMD and CONFIG_RSP 495 sc_signal<bool> r_config_cmd_rsp_erase_req; // used to signal an erasing on TRT table 496 497 /////////////////////////////////// 498 // ALLOC_TRT_CONFIG FSM REGISTERS 499 /////////////////////////////////// 500 sc_signal<int> r_alloc_trt_config_fsm; // state register 501 502 /////////////////////////////////// 503 // MISS_INIT FSM REGISTERS 504 /////////////////////////////////// 505 sc_signal<int> r_miss_init_fsm; 506 507 sc_signal<vci_data_t> r_miss_rdata; 508 sc_signal<vci_pktid_t> r_miss_rpktid; 509 sc_signal<vci_trdid_t> r_miss_rtrdid; 510 sc_signal<vci_rerror_t> r_miss_rerror; 511 sc_signal<vci_eop_t> r_miss_reop; 512 //sc_signal<vci_data_t> r_miss_rsrcid; 513 514 sc_signal<size_t> r_miss_rsp_cpt; 515 516 //IRQ 517 sc_signal<uint32_t> r_irq_pending; 518 sc_signal<uint32_t> r_irq_mask; 519 sc_signal<uint32_t> r_irq_chosen; 520 521 522 //Communication between TLB and MISS_INIT 523 sc_signal<bool> r_tlb_miss_init_req; 524 sc_signal<bool> r_miss_init_error; 525 526 //////////////////////////////////// 527 // MISS PREFETCH BUFFER 528 /////////////////////////////////// 529 //DMA_TLB FSM is its owner. 530 //CONFIG FSM must set a request in order to access the resource (invalidation) 531 532 // Proposition : Buffer with some lines (4, for example). It could be 533 // indexed from the bit 20. 534 535 vci_data_t *r_miss_buf_data; // cache line data buffer 536 bool r_miss_buf_valid; // For individual invalidation, 537 // we could rather use the Valid bit at each PTE 538 sc_signal<paddr_t> r_miss_buf_tag; // chache line number 539 sc_signal<paddr_t> r_miss_buf_vaddr_begin; // Virtual address of the first PTE on the line 540 541 bool r_miss_buf_first_level; // useful only if using both types of pages 542 387 543 388 //////////////////////////////// 544 389 // Activity counters … … 550 395 uint32_t m_cpt_iotlb_read; // number of iotlb read 551 396 uint32_t m_cpt_iotlb_miss; // number of iotlb miss 552 uint32_t m_cost_iotlb_miss; // number of blocking cycles (not the treatment cyclesitself)553 uint32_t m_cpt_iotlbmiss_transaction; // number of iotlb miss transactions to Mem Cache554 uint32_t m_cost_iotlbmiss_transaction; // cumulated duration for iotlb miss transactions397 uint32_t m_cost_iotlb_miss; // number of wait cycles (not treatment itself) 398 uint32_t m_cpt_iotlbmiss_transaction; // number of tlb miss transactions 399 uint32_t m_cost_iotlbmiss_transaction; // cumulated duration tlb miss transactions 555 400 556 401 //Transaction Tabs (TRTs) activity counters … … 564 409 uint32_t m_cpt_fsm_dma_cmd [32]; 565 410 uint32_t m_cpt_fsm_dma_rsp [32]; 566 uint32_t m_cpt_fsm_dma_tlb [32]; 567 uint32_t m_cpt_fsm_alloc_trt_dma [32]; 411 uint32_t m_cpt_fsm_tlb [32]; 568 412 uint32_t m_cpt_fsm_config_cmd [32]; 569 413 uint32_t m_cpt_fsm_config_rsp [32]; 570 uint32_t m_cpt_fsm_ alloc_trt_config[32];571 uint32_t m_cpt_fsm_miss_ init[32];414 uint32_t m_cpt_fsm_miss_wti_cmd [32]; 415 uint32_t m_cpt_fsm_miss_wti_rsp [32]; 572 416 573 417 protected: … … 577 421 VciIoBridge( 578 422 sc_module_name insname, 579 size_t nb_periph, // maximun is 32 580 const soclib::common::MappingTable &mtx, //external network 581 const soclib::common::MappingTable &mtd, //direct network 582 const soclib::common::MappingTable &mtio, //io network 583 const soclib::common::Segment &seg_config_iob, 584 const soclib::common::IntTab &tgt_index_iocluster, 585 // const soclib::common::IntTab &tgt_index_config, // Direct Noc 586 const soclib::common::IntTab &init_index_direct, // Direct Noc 587 const soclib::common::IntTab &tgt_index_iospace, // IO Noc 588 const soclib::common::IntTab &init_index_iospace, // IO Noc 589 const soclib::common::IntTab &init_index_dma, // XRAM Noc 590 size_t dcache_words, 591 size_t iotlb_ways, 592 size_t iotlb_sets, 593 uint32_t debug_start_cycle, 594 bool debug_ok); 423 const soclib::common::MappingTable &mt_ext, // external network 424 const soclib::common::MappingTable &mt_int, // internal network 425 const soclib::common::MappingTable &mt_iox, // iox network 426 const soclib::common::IntTab &int_tgtid, // INT network TGTID 427 const soclib::common::IntTab &int_srcid, // INT network SRCID 428 const soclib::common::IntTab &iox_tgtid, // IOX network TGTID 429 const bool has_irqs, // component has irq ports 430 const size_t dcache_words, 431 const size_t iotlb_ways, 432 const size_t iotlb_sets, 433 const uint32_t debug_start_cycle, 434 const bool debug_ok ); 595 435 596 436 ~VciIoBridge(); -
trunk/modules/vci_io_bridge/caba/source/src/vci_io_bridge.cpp
r405 r434 1 /* i*- c++ -*-C1 /* -*- c++ -*- 2 2 * File : vci_io_bridge.cpp 3 3 * Copyright (c) UPMC, Lip6, SoC 4 * Authors: Cassio Fraga, Alain Greiner 4 5 * 5 6 * SOCLIB_LGPL_HEADER_BEGIN … … 29 30 #include "../include/vci_io_bridge.h" 30 31 32 31 33 ////// debug services /////////////////////////////////////////////////////// 32 34 // All debug messages are conditionned by two variables: 33 35 // - compile time : DEBUG_*** : defined below 34 36 // - execution time : m_debug_*** : defined by constructor arguments 35 // m_debug_ *= (m_debug_ok) and (m_cpt_cycle > m_debug_start_cycle)37 // m_debug_activated = (m_debug_ok) and (m_cpt_cycle > m_debug_start_cycle) 36 38 ///////////////////////////////////////////////////////////////////////////////// 37 39 38 40 #define DEBUG_DMA_CMD 1 39 41 #define DEBUG_DMA_RSP 1 40 #define DEBUG_ DMA_TLB142 #define DEBUG_TLB_MISS 1 41 43 #define DEBUG_CONFIG_CMD 1 42 44 #define DEBUG_CONFIG_RSP 1 43 #define DEBUG_MISS_INIT 1 44 45 #define NEW_XRAM_VCI 0 46 47 #define IOMMU_ID 4097 45 #define DEBUG_MISS_WTI 1 48 46 49 47 namespace soclib { … … 52 50 namespace { 53 51 54 //DMA55 const char *dma_cmd_fsm_state_str[] ={52 const char *dma_cmd_fsm_state_str[] = 53 { 56 54 "DMA_CMD_IDLE", 57 "DMA_CMD_TRT_LOCK", 58 "DMA_CMD_TRT_WAIT", 59 "DMA_CMD_TRT_SET", 60 "DMA_CMD_FIFO_PUT", 61 "DMA_CMD_FIFO_MISS_PUT", 62 "DMA_CMD_TLB_MISS_WAIT", 63 "DMA_CMD_TLB_MISS_STORE", 64 "DMA_CMD_ERROR", 55 "DMA_CMD_FIFO_PUT_CMD", 56 "DMA_CMD_FIFO_PUT_RSP", 57 "DMA_CMD_MISS_WAIT", 58 "DMA_CMD_WAIT_EOP", 65 59 }; 66 60 67 const char *dma_rsp_fsm_state_str[] = { 61 const char *dma_rsp_fsm_state_str[] = 62 { 68 63 "DMA_RSP_IDLE", 69 "DMA_RSP_TRT_LOCK",70 64 "DMA_RSP_FIFO_PUT", 71 "DMA_RSP_FIFO_ERROR_PUT",72 };73 74 const char *alloc_trt_dma_fsm_state_str[] = {75 "ALLOC_TRT_DMA_CMD",76 "ALLOC_TRT_DMA_RSP",77 65 }; 78 66 79 const char * dma_tlb_fsm_state_str[] = {80 "DMA_TLB_IDLE",81 " DMA_TLB_MISS",82 " DMA_TLB_PTE1_GET",83 " DMA_TLB_PTE1_SELECT",84 " DMA_TLB_PTE1_UPDT",85 " DMA_TLB_PTE2_GET",86 " DMA_TLB_PTE2_SELECT",87 " DMA_TLB_PTE2_UPDT",88 " DMA_TLB_WAIT_TRANSACTION",89 " DMA_TLB_RETURN",90 " DMA_TLB_INVAL_CHECK",91 " DMA_TLB_INVAL_SCAN",67 const char *tlb_fsm_state_str[] = 68 { 69 "TLB_IDLE", 70 "TLB_MISS", 71 "TLB_PTE1_GET", 72 "TLB_PTE1_SELECT", 73 "TLB_PTE1_UPDT", 74 "TLB_PTE2_GET", 75 "TLB_PTE2_SELECT", 76 "TLB_PTE2_UPDT", 77 "TLB_WAIT", 78 "TLB_RETURN", 79 "TLB_INVAL_CHECK", 92 80 }; 93 81 94 //CONFIG95 const char *config_cmd_fsm_state_str[] ={82 const char *config_cmd_fsm_state_str[] = 83 { 96 84 "CONFIG_CMD_IDLE", 97 "CONFIG_CMD_TRT_LOCK", 98 "CONFIG_CMD_TRT_WAIT", 99 "CONFIG_CMD_TRT_SET", 100 "CONFIG_CMD_FIFO_PUT", 101 102 // IOB private configuration segment 103 "CONFIG_CMD_PTPR_WRITE", 104 "CONFIG_CMD_PTPR_READ", 105 "CONFIG_CMD_ACTIVE_WRITE", 106 "CONFIG_CMD_ACTIVE_READ", 107 "CONFIG_CMD_BVAR_READ", 108 "CONFIG_CMD_ETR_READ", 109 "CONFIG_CMD_BAD_ID_READ", 110 "CONFIG_CMD_INVAL_REQ", 111 "CONFIG_CMD_INVAL", 112 "CONFIG_CMD_IT_ADDR_IOMMU_WRITE_1", 113 "CONFIG_CMD_IT_ADDR_IOMMU_WRITE_2", 114 "CONFIG_CMD_IT_ADDR_IOMMU_READ_1", 115 "CONFIG_CMD_IT_ADDR_IOMMU_READ_2", 116 "CONFIG_CMD_IT_ADDR_WRITE_1", 117 "CONFIG_CMD_IT_ADDR_WRITE_2", 118 "CONFIG_CMD_IT_ADDR_READ_1", 119 "CONFIG_CMD_IT_ADDR_READ_2", 120 "CONFIG_CMD_ERROR_WAIT", 121 "CONFIG_CMD_ERROR_RSP", 85 "CONFIG_CMD_FIFO_PUT_CMD", 86 "CONFIG_CMD_FIFO_PUT_RSP", 122 87 }; 123 88 124 const char *config_rsp_fsm_state_str[] = { 89 const char *config_rsp_fsm_state_str[] = 90 { 125 91 "CONFIG_RSP_IDLE", 126 "CONFIG_RSP_TRT_LOCK",127 92 "CONFIG_RSP_FIFO_PUT", 128 93 }; 129 94 130 const char *alloc_trt_config_fsm_state_str[] = { 131 "ALLOC_TRT_CONFIG_CMD", 132 "ALLOC_TRT_CONFIG_RSP", 133 }; 134 135 //MISS TRANSACTIONS (to Direct Network) 136 const char *miss_init_fsm_state_str[] = { 137 "MISS_INIT_IDLE_MISS", 138 "MISS_INIT_IDLE_IRQ", 139 "MISS_INIT_IRQ_CMD", 140 "MISS_INIT_IRQ_RSP", 141 "MISS_INIT_TLB_MISS_CMD", 142 "MISS_INIT_TLB_MISS_RSP", 95 const char *miss_wti_fsm_state_str[] = { 96 "MISS_WTI_IDLE_MISS", 97 "MISS_WTI_IDLE_WTI", 98 "MISS_WTI_CMD_WTI", 99 "MISS_WTI_RSP_WTI", 100 "MISS_WTI_CMD_MISS", 101 "MISS_WTI_RSP_MISS", 143 102 }; 144 103 } 145 104 146 #define tmpl(...) template<typename vci_param_ d,typename vci_param_x, typename vci_param_io> __VA_ARGS__ VciIoBridge<vci_param_d,vci_param_x,vci_param_io>147 148 //////////////////////// /////////105 #define tmpl(...) template<typename vci_param_int,typename vci_param_ext> __VA_ARGS__ VciIoBridge<vci_param_int,vci_param_ext> 106 107 //////////////////////// 149 108 tmpl(/**/)::VciIoBridge( 150 109 sc_module_name name, 151 size_t nb_periph, 152 const soclib::common::MappingTable &mtx, 153 const soclib::common::MappingTable &mtd, 154 const soclib::common::MappingTable &mtio, 155 const soclib::common::Segment &seg_config_iob, 156 const soclib::common::IntTab &tgt_index_iocluster, 157 // const soclib::common::IntTab &tgt_index_config, 158 const soclib::common::IntTab &init_index_direct, 159 const soclib::common::IntTab &tgt_index_iospace, 160 const soclib::common::IntTab &init_index_iospace, 161 const soclib::common::IntTab &init_index_dma, 162 size_t dcache_words, 163 size_t iotlb_ways, 164 size_t iotlb_sets, 165 uint32_t debug_start_cycle, 166 bool debug_ok) 110 const soclib::common::MappingTable &mt_ext, 111 const soclib::common::MappingTable &mt_int, 112 const soclib::common::MappingTable &mt_iox, 113 const soclib::common::IntTab &int_tgtid, // INT network TGTID 114 const soclib::common::IntTab &int_srcid, // INT network SRCID 115 const soclib::common::IntTab &iox_tgtid, // IOX network TGTID 116 const bool has_irqs, 117 const size_t dcache_words, 118 const size_t iotlb_ways, 119 const size_t iotlb_sets, 120 const uint32_t debug_start_cycle, 121 const bool debug_ok) 167 122 : soclib::caba::BaseModule(name), 168 123 169 p_clk("clk"), 170 p_resetn("resetn"), 171 p_irq_in(soclib::common::alloc_elems<sc_core::sc_in<bool> >("irq_in", nb_periph)), 172 p_vci_ini_dma("vci_ini_dma"), 173 p_vci_tgt_dma("vci_tgt_dma"), 174 p_vci_ini_config("vci_ini_config"), 175 p_vci_tgt_config("vci_tgt_config"), 176 p_vci_ini_miss("vci_ini_miss"), 177 178 m_words(dcache_words), 179 m_nb_periph(nb_periph), 180 181 // m_locality_table_config(mtd.getLocalityTable<unsigned long>(tgt_index_iocluster)), 182 // These structures simulate what in hardware will be a correspondence table 183 // Between segments' base address on the direct space and on the IO space 184 // m_routing_table_config(mtd.getRoutingTable<unsigned long>(tgt_index_iocluster)), 185 //m_mtio(mtio), 186 187 m_transaction_tab_dma(2), 188 m_transaction_tab_config(1), 189 //Direct Network 190 // m_segment_config(mtd.getSegment(tgt_index_config)), 191 m_segment_config(seg_config_iob), 192 m_srcid_miss(mtx.indexForId(init_index_direct)), 193 //XRAM Network 194 m_srcid_dma(mtx.indexForId(init_index_dma)), 195 //IO Network 196 m_segment_io(mtio.getSegment(tgt_index_iospace)), 197 m_srcid_config(mtio.indexForId(init_index_iospace)), 124 p_clk("p_clk"), 125 p_resetn("p_resetn"), 126 p_vci_ini_ram("p_vci_ini_ram"), 127 p_vci_tgt_iox("p_vci_tgt_iox"), 128 p_vci_ini_iox("p_vci_ini_iox"), 129 p_vci_tgt_int("p_vci_tgt_int"), 130 p_vci_ini_int("p_vci_ini_int"), 131 132 m_words( dcache_words ), 133 m_has_irqs( has_irqs ), 134 135 // INT & IOX Network 136 m_int_seglist( mt_int.getSegmentList( int_tgtid )), 137 m_int_srcid( mt_int.indexForId( int_srcid )), 138 m_iox_seglist( mt_iox.getSegmentList( iox_tgtid )), 198 139 199 140 m_iotlb_ways(iotlb_ways), 200 141 m_iotlb_sets(iotlb_sets), 201 m_paddr_nbits(vci_param_d::N),202 142 203 143 m_debug_start_cycle(debug_start_cycle), 204 144 m_debug_ok(debug_ok), 205 145 146 // addressable registers 206 147 r_iommu_ptpr("r_iommu_ptpr"), 207 148 r_iommu_active("r_iommu_active"), … … 209 150 r_iommu_etr("r_iommu_etr"), 210 151 r_iommu_bad_id("r_iommu_bad_id"), 211 r_it_addr_iommu("r_it_addr_iommu"), 212 213 // DMA_CMD 152 r_iommu_wti_paddr("r_iommu_wti_paddr"), 153 r_iommu_peri_wti(alloc_elems<sc_signal<vci_addr_t> >("r_peri_wti_paddr", 32)), 154 155 // DMA_CMD FSM registers 214 156 r_dma_cmd_fsm("r_dma_cmd_fsm"), 215 r_dma_cmd_fsm_save("r_dma_cmd_fsm_save"), 216 r_miss_interrupt("r_miss_interrupt"), 217 r_dma_cmd_count("r_dma_cmd_count"), 218 r_dma_cmd_trt_index("r_dma_cmd_trt_index"), 219 r_dma_paddr("r_dma_paddr"), 220 // FIFOs 221 m_dma_cmd_addr_fifo("m_dma_cmd_addr_fifo",4), 222 //m_dma_cmd_length_fifo("m_dma_cmd_length_fifo",4), 223 m_dma_cmd_srcid_fifo("m_dma_cmd_srcid_fifo",4), 224 m_dma_cmd_trdid_fifo("m_dma_cmd_trdid_fifo",4), 225 m_dma_cmd_pktid_fifo("m_dma_cmd_pktid_fifo",4), 226 m_dma_cmd_be_fifo("m_dma_cmd_be_fifo",4), 227 m_dma_cmd_cmd_fifo("m_dma_cmd_cmd_fifo",4), 228 m_dma_cmd_contig_fifo("m_dma_cmd_contig_fifo",4), 229 m_dma_cmd_data_fifo("m_dma_cmd_data_fifo",4), 230 m_dma_cmd_eop_fifo("m_dma_cmd_eop_fifo",4), 231 m_dma_cmd_cons_fifo("m_dma_cmd_cons_fifo",4), 232 m_dma_cmd_plen_fifo("m_dma_cmd_plen_fifo",4), 233 m_dma_cmd_wrap_fifo("m_dma_cmd_wrap_fifo",4), 234 m_dma_cmd_cfixed_fifo("m_dma_cmd_cfixed_fifo",4), 235 m_dma_cmd_clen_fifo("m_dma_cmd_clen_fifo",4), 236 237 r_miss_paddr ("r_miss_paddr"), 238 r_miss_cmd ("r_miss_cmd"), 239 r_miss_contig ("r_miss_contig"), 240 r_miss_cons ("r_miss_cons"), 241 r_miss_plen ("r_miss_plen"), 242 r_miss_wrap ("r_miss_wrap"), 243 r_miss_cfixed ("r_miss_cfixed"), 244 r_miss_clen ("r_miss_clen"), 245 r_miss_srcid ("r_miss_srcid"), 246 r_miss_trdid ("r_miss_trdid"), 247 r_miss_pktid ("r_miss_pktid"), 248 249 r_dma_error_type("r_dma_error_type"), 250 r_dma_error_trdid("r_dma_error_trdid"), 251 r_dma_error_pktid("r_dma_error_pktid"), 252 253 254 r_dma_tlb_fsm("r_dma_tlb_fsm"), 157 r_dma_cmd_vaddr("r_dma_cmd_vaddr"), 158 r_dma_cmd_paddr("r_dma_cmd_paddr"), 159 160 //DMA_RSP FSM registers 161 r_dma_rsp_fsm("r_dma_rsp_fsm"), 162 163 // CONFIG_CMD FSM registers 164 r_config_cmd_fsm("r_config_cmd_fsm"), 165 r_config_cmd_rdata("r_config_cmd_rdata"), 166 r_config_cmd_error("r_config_cmd_error"), 167 r_config_cmd_inval_vaddr("r_config_cmd_inval_vaddr"), 168 169 // CONFIG_RSP FSM registers 170 r_config_rsp_fsm("r_config_rsp_fsm"), 171 172 // TLB FSM registers 173 r_tlb_fsm("r_tlb_fsm"), 255 174 r_waiting_transaction("r_waiting_transaction"), 256 175 r_tlb_miss_type("r_tlb_miss_type"), 257 258 259 r_iotlb_vaddr("r_iotlb_vaddr"), // virtual address for a tlb miss 260 r_iotlb_paddr("r_iotlb_paddr"), // physical address of pte 261 r_iotlb_pte_flags("r_iotlb_pte_flags"),// pte1 or first word of pte2 262 r_iotlb_pte_ppn("r_iotlb_pte_ppn"), // second word of pte2 263 r_iotlb_way("r_iotlb_way"), // selected way in tlb 264 r_iotlb_set("r_iotlb_set"), // selected set in tlb 265 266 r_iotlb("iotlb", IOMMU_ID, iotlb_ways,iotlb_sets,vci_param_d::N), 176 r_tlb_miss_error("r_tlb_miss_error"), 177 r_tlb_paddr("r_tlb_paddr"), 178 r_tlb_pte_flags("r_tlb_pte_flags"), 179 r_tlb_pte_ppn("r_tlb_pte_ppn"), 180 r_tlb_way("r_tlb_way"), 181 r_tlb_set("r_tlb_set"), 182 r_tlb_buf_valid("r_tlb_buf_valid"), 183 r_tlb_buf_tag("r_tlb_buf_tag"), 184 r_tlb_buf_vaddr("r_tlb_buf_vaddr"), 185 r_tlb_buf_big_page("r_tlb_buf_big_page"), 186 187 // MISS_WTI_CMD FSM registers 188 r_miss_wti_cmd_fsm("r_miss_wti_cmd_fsm"), 189 r_miss_wti_cmd_index("r_miss_wti_cmd_index"), 190 191 // MISS_WTI_CMD FSM registers 192 r_miss_wti_rsp_fsm("r_miss_wti_rsp_fsm"), 193 r_miss_wti_rsp_error("r_miss_wti_rsp_error"), 194 195 // allocator for CONFIG_RSP & DMA_RSP fifos 196 r_alloc_fifo_config_rsp_local("r_alloc_fifo_config_rsp_local"), 197 r_alloc_fifo_dma_rsp_local("r_alloc_fifo_dma_rsp_local"), 198 199 // IRQs registers 200 r_irq_pending(alloc_elems<sc_signal<bool> >("r_irq_pending", 32)), 201 r_irq_request(alloc_elems<sc_signal<bool> >("r_irq_request", 32)), 267 202 268 //DMA_RSP 269 r_dma_rsp_fsm("r_dma_rsp_fsm"), 270 r_dma_rtrdid("r_dma_rtrdid"), 271 r_dma_rsrcid("r_dma_rsrcid"), 272 //Fifo's 273 m_dma_rsp_data_fifo("m_dma_rsp_data_fifo",4), 274 m_dma_rsp_rsrcid_fifo("m_dma_rsp_rsrcid_fifo",4), 275 m_dma_rsp_rtrdid_fifo("m_dma_rsp_rtrdid_fifo",4), 276 m_dma_rsp_rpktid_fifo("m_dma_rsp_rpktid_fifo",4), 277 m_dma_rsp_reop_fifo("m_dma_rsp_reop_fifo",4), 278 m_dma_rsp_rerror_fifo("m_dma_rsp_rerror_fifo",4), 203 // TLB for IOMMU 204 r_iotlb("iotlb", 0, iotlb_ways, iotlb_sets, vci_param_int::N), 205 206 // Inter-FSM communications 207 r_dma_tlb_req("r_dma_tlb_req"), 208 r_config_tlb_req("r_config_tlb_req"), 209 r_tlb_miss_req("r_tlb_miss_req"), 279 210 280 r_dma_cmd_rsp_erase_req("r_dma_cmd_rsp_erase_req"), 281 r_dma_cmd_error_req("r_dma_cmd_error_req"), 282 r_dma_tlb_req("r_dma_tlb_req"), 283 r_tlb_dma_untreated("r_tlb_dma_untreated"), 284 r_dma_tlb_error_req("r_dma_tlb_error_req"), 285 r_config_tlb_req("r_config_tlb_req"), 286 r_config_tlb_inval_vaddr("r_config_tlb_inval_vaddr"), 287 288 // ALLOC TRT DMA 289 r_alloc_trt_dma_fsm("r_alloc_trt_dma_fsm"), 290 291 // CONFIG CMD 292 r_config_cmd_fsm("r_config_cmd_fsm"), 293 r_config_cmd_trt_index("r_config_cmd_trt_index"), 294 295 m_config_cmd_addr_fifo("m_config_cmd_addr_fifo",4), 296 //m_config_cmd_length_fifo("m_config_cmd_length_fifo",4), 297 m_config_cmd_srcid_fifo("m_config_cmd_srcid_fifo",4), 298 m_config_cmd_trdid_fifo("m_config_cmd_trdid_fifo",4), 299 m_config_cmd_pktid_fifo("m_config_cmd_pktid_fifo",4), 300 m_config_cmd_be_fifo("m_config_cmd_be_fifo",4), 301 m_config_cmd_cmd_fifo("m_config_cmd_cmd_fifo",4), 302 m_config_cmd_contig_fifo("m_config_cmd_contig_fifo",4), 303 m_config_cmd_data_fifo("m_config_cmd_data_fifo",4), 304 m_config_cmd_eop_fifo("m_config_cmd_eop_fifo",4), 305 m_config_cmd_cons_fifo("m_config_cmd_cons_fifo",4), 306 m_config_cmd_plen_fifo("m_config_cmd_plen_fifo",4), 307 m_config_cmd_wrap_fifo("m_config_cmd_wrap_fifo",4), 308 m_config_cmd_cfixed_fifo("m_config_cmd_cfixed_fifo",4), 309 m_config_cmd_clen_fifo("m_config_cmd_clen_fifo",4), 310 // Private configuration registers 311 r_config_error_type("r_config_error_type"), 312 r_config_first_word("r_config_first_word"), 313 r_it_index("r_it_index"), 314 //Fifo's 315 m_config_local_data_fifo("m_config_local_data_fifo",4), 316 m_config_local_rsrcid_fifo("m_config_local_rsrcid_fifo",4), 317 m_config_local_rtrdid_fifo("m_config_local_rtrdid_fifo",4), 318 m_config_local_rpktid_fifo("m_config_local_rpktid_fifo",4), 319 m_config_local_reop_fifo("m_config_local_reop_fifo",4), 320 m_config_local_rerror_fifo("m_config_local_rerror_fifo",4), 321 r_config_vaddr("r_config_vaddr"), 211 // DMA_CMD FIFOs 212 m_dma_cmd_addr_fifo("m_dma_cmd_addr_fifo",2), 213 m_dma_cmd_srcid_fifo("m_dma_cmd_srcid_fifo",2), 214 m_dma_cmd_trdid_fifo("m_dma_cmd_trdid_fifo",2), 215 m_dma_cmd_pktid_fifo("m_dma_cmd_pktid_fifo",2), 216 m_dma_cmd_be_fifo("m_dma_cmd_be_fifo",2), 217 m_dma_cmd_cmd_fifo("m_dma_cmd_cmd_fifo",2), 218 m_dma_cmd_contig_fifo("m_dma_cmd_contig_fifo",2), 219 m_dma_cmd_data_fifo("m_dma_cmd_data_fifo",2), 220 m_dma_cmd_eop_fifo("m_dma_cmd_eop_fifo",2), 221 m_dma_cmd_cons_fifo("m_dma_cmd_cons_fifo",2), 222 m_dma_cmd_plen_fifo("m_dma_cmd_plen_fifo",2), 223 m_dma_cmd_wrap_fifo("m_dma_cmd_wrap_fifo",2), 224 m_dma_cmd_cfixed_fifo("m_dma_cmd_cfixed_fifo",2), 225 m_dma_cmd_clen_fifo("m_dma_cmd_clen_fifo",2), 226 227 // DMA_RSP FIFOs 228 m_dma_rsp_data_fifo("m_dma_rsp_data_fifo",2), 229 m_dma_rsp_rsrcid_fifo("m_dma_rsp_rsrcid_fifo",2), 230 m_dma_rsp_rtrdid_fifo("m_dma_rsp_rtrdid_fifo",2), 231 m_dma_rsp_rpktid_fifo("m_dma_rsp_rpktid_fifo",2), 232 m_dma_rsp_reop_fifo("m_dma_rsp_reop_fifo",2), 233 m_dma_rsp_rerror_fifo("m_dma_rsp_rerror_fifo",2), 234 235 // CONFIG_CMD FIFOs 236 m_config_cmd_addr_fifo("m_config_cmd_addr_fifo",2), 237 m_config_cmd_srcid_fifo("m_config_cmd_srcid_fifo",2), 238 m_config_cmd_trdid_fifo("m_config_cmd_trdid_fifo",2), 239 m_config_cmd_pktid_fifo("m_config_cmd_pktid_fifo",2), 240 m_config_cmd_be_fifo("m_config_cmd_be_fifo",2), 241 m_config_cmd_cmd_fifo("m_config_cmd_cmd_fifo",2), 242 m_config_cmd_contig_fifo("m_config_cmd_contig_fifo",2), 243 m_config_cmd_data_fifo("m_config_cmd_data_fifo",2), 244 m_config_cmd_eop_fifo("m_config_cmd_eop_fifo",2), 245 m_config_cmd_cons_fifo("m_config_cmd_cons_fifo",2), 246 m_config_cmd_plen_fifo("m_config_cmd_plen_fifo",2), 247 m_config_cmd_wrap_fifo("m_config_cmd_wrap_fifo",2), 248 m_config_cmd_cfixed_fifo("m_config_cmd_cfixed_fifo",2), 249 m_config_cmd_clen_fifo("m_config_cmd_clen_fifo",2), 250 251 // CONFIG_RSP FIFOs 252 m_config_rsp_data_fifo("m_config_rsp_data_fifo",2), 253 m_config_rsp_rsrcid_fifo("m_config_rsp_rsrcid_fifo",2), 254 m_config_rsp_rtrdid_fifo("m_config_rsp_rtrdid_fifo",2), 255 m_config_rsp_rpktid_fifo("m_config_rsp_rpktid_fifo",2), 256 m_config_rsp_reop_fifo("m_config_rsp_reop_fifo",2), 257 m_config_rsp_rerror_fifo("m_config_rsp_rerror_fifo",2) 258 { 259 std::cout << " - Building VciIoBridge : " << name << std::endl; 260 261 // checking segments on INT network 262 assert ( ( not m_int_seglist.empty() ) and 263 "VCI_IO_BRIDGE ERROR : no segment allocated on INT network"); 264 265 std::list<soclib::common::Segment>::iterator int_seg; 266 for ( int_seg = m_int_seglist.begin() ; int_seg != m_int_seglist.end() ; int_seg++ ) 267 { 268 std::cout << " => segment " << int_seg->name() 269 << " / base = " << std::hex << int_seg->baseAddress() 270 << " / size = " << int_seg->size() << std::endl; 271 } 272 273 // checking segments on IOX network 274 assert ( ( not m_iox_seglist.empty() ) and 275 "VCI_IO_BRIDGE ERROR : no segment allocated on IOX network"); 276 277 std::list<soclib::common::Segment>::iterator iox_seg; 278 for ( iox_seg = m_iox_seglist.begin() ; iox_seg != m_iox_seglist.end() ; iox_seg++ ) 279 { 280 std::cout << " => segment " << iox_seg->name() 281 << " / base = " << std::hex << iox_seg->baseAddress() 282 << " / size = " << iox_seg->size() << std::endl; 283 } 284 285 assert( (vci_param_int::N == vci_param_ext::N) and 286 "VCI_IO_BRIDGE ERROR: VCI ADDRESS widths must be equal on the 3 networks"); 287 288 assert( (vci_param_int::N <= 64) and 289 "VCI_IO_BRIDGE ERROR: VCI ADDRESS width cannot be bigger than 64 bits"); 290 291 assert( ((vci_param_int::B == 4) or (vci_param_int::B == 8)) and 292 "VCI_IO_BRIDGE ERROR: VCI DATA width must be 32 or 64 bits on internal network"); 293 294 assert( ((vci_param_ext::B == 4) or (vci_param_ext::B == 8)) and 295 "VCI_IO_BRIDGE ERROR: VCI DATA width must be 32 or 64 bits on external network"); 296 297 assert( (vci_param_int::S == vci_param_ext::S) and 298 "VCI_IO_BRIDGE ERROR: SRCID widths must be equal on the 3 networks"); 299 300 // contruct 32 IRQ ports if required 301 if ( has_irqs ) 302 { 303 for ( size_t n=0 ; n<32 ; n++ ) p_irq[n] = new sc_core::sc_in<bool>; 304 } 322 305 323 // CONFIG RSP 324 r_config_rsp_fsm("r_config_rsp_fsm"), 325 r_config_rtrdid("r_config_rtrdid"), 326 r_config_rsrcid("r_config_rsrcid"), 327 //Fifo's 328 m_config_rsp_data_fifo("m_config_rsp_data_fifo",4), 329 m_config_rsp_rsrcid_fifo("m_config_rsp_rsrcid_fifo",4), 330 m_config_rsp_rtrdid_fifo("m_config_rsp_rtrdid_fifo",4), 331 m_config_rsp_rpktid_fifo("m_config_rsp_rpktid_fifo",4), 332 m_config_rsp_reop_fifo("m_config_rsp_reop_fifo",4), 333 m_config_rsp_rerror_fifo("m_config_rsp_rerror_fifo",4), 334 335 // Communication between CONFIG CMD and CONFIG RSP 336 r_config_cmd_rsp_erase_req("r_config_cmd_rsp_erase_req"), 337 338 // ALLOC TRT CONFIG 339 r_alloc_trt_config_fsm("r_alloc_trt_config_fsm"), 340 // MISS INIT 341 r_miss_init_fsm("r_miss_init_fsm"), 342 r_miss_rdata("r_miss_rdata"), 343 r_miss_rpktid("r_miss_rpktid"), 344 r_miss_rtrdid("r_miss_rtrdid"), 345 r_miss_rerror("r_miss_rerror"), 346 r_miss_reop("r_miss_reop"), 347 //r_miss_rsrcid("r_miss_rsrcid"), 348 r_miss_rsp_cpt("r_miss_rsp_cpt"), 349 //IRQ 350 r_irq_pending("r_irq_pending"), 351 r_irq_mask("r_irq_mask"), 352 r_irq_chosen("r_irq_chosen"), 353 354 r_tlb_miss_init_req("r_tlb_miss_init_req"), 355 r_miss_init_error("r_miss_init_error"), 356 357 r_miss_buf_valid("r_miss_buf_valid"), 358 r_miss_buf_tag("r_miss_buf_tag") 359 { 360 assert( (vci_param_d::N <= 64) and 361 "ADDRESS cannot be bigger than 64 bits"); 362 assert( (vci_param_x::B)*8 == 64 and (vci_param_io::B)*8 == 64 and 363 "DATA field must be 64 bits in Extern and IO Network"); 364 assert ( (vci_param_d::B)*8 == 32 365 and "Error: data field in Direct Noc must be 32 bits" ); 366 367 368 // Interruption Address vector, one entry for each IO 369 r_it_addr = new paddr_t[nb_periph]; 370 // One cache line buffer 371 r_miss_buf_data = new vci_data_t[dcache_words]; 372 // Command storage in case of miss TLB 373 // (dcache_words/2) => Maximal size of a write command 374 r_miss_data = new vci_data_t[dcache_words]; 375 r_miss_be = new vci_be_t[dcache_words]; 376 306 // Cache line buffer 307 r_tlb_buf_data = new uint32_t[dcache_words]; 308 377 309 SC_METHOD(transition); 378 310 dont_initialize(); … … 389 321 ///////////////////////////////////// 390 322 { 391 delete [] r_i t_addr;392 delete [] r_ miss_buf_data;393 delete [] r_miss_data;394 delete [] r_miss_be;395 soclib::common::dealloc_elems( p_irq_in, m_nb_periph);323 delete [] r_iommu_peri_wti; 324 delete [] r_tlb_buf_data; 325 soclib::common::dealloc_elems(p_irq, 32); 326 soclib::common::dealloc_elems(r_irq_request, 32); 327 soclib::common::dealloc_elems(r_irq_pending, 32); 396 328 } 397 329 … … 404 336 std::cout << std::dec << "IO_BRIDGE " << name() << std::endl; 405 337 406 std::cout << " " << dma_cmd_fsm_state_str[r_dma_cmd_fsm.read()]338 std::cout << " " << dma_cmd_fsm_state_str[r_dma_cmd_fsm.read()] 407 339 << " | " << dma_rsp_fsm_state_str[r_dma_rsp_fsm.read()] 408 << " | " << dma_tlb_fsm_state_str[r_dma_tlb_fsm.read()] 409 << " | " << alloc_trt_dma_fsm_state_str[r_alloc_trt_dma_fsm.read()] 340 << " | " << tlb_fsm_state_str[r_tlb_fsm.read()] 410 341 << " | " << config_cmd_fsm_state_str[r_config_cmd_fsm.read()] 411 342 << " | " << config_rsp_fsm_state_str[r_config_rsp_fsm.read()] 412 << " | " << alloc_trt_config_fsm_state_str[r_alloc_trt_config_fsm.read()] 413 << " | " << miss_init_fsm_state_str[r_miss_init_fsm.read()]; 414 std::cout << std::endl; 343 << " | " << miss_wti_fsm_state_str[r_miss_wti_cmd_fsm.read()] 344 << std::endl; 415 345 416 346 if(mode & 0x01) … … 424 354 } 425 355 } 426 427 428 356 429 357 //////////////////////// … … 447 375 m_cpt_iotlbmiss_transaction = 0; 448 376 m_cost_iotlbmiss_transaction = 0; 449 450 m_cpt_trt_dma_full = 0;451 m_cpt_trt_dma_full_cost = 0;452 m_cpt_trt_config_full = 0;453 m_cpt_trt_config_full_cost = 0;454 377 } 455 378 … … 460 383 if ( not p_resetn.read() ) 461 384 { 462 463 r_dma_cmd_fsm = DMA_CMD_IDLE; 464 r_dma_rsp_fsm = DMA_RSP_IDLE; 465 r_alloc_trt_dma_fsm = ALLOC_TRT_DMA_CMD; 466 r_dma_tlb_fsm = DMA_TLB_IDLE; 467 r_config_cmd_fsm = CONFIG_CMD_IDLE; 468 r_config_rsp_fsm = CONFIG_RSP_IDLE; 469 r_alloc_trt_config_fsm = ALLOC_TRT_CONFIG_CMD; 470 r_miss_init_fsm = MISS_INIT_IDLE_MISS; 471 472 //miss buffer invalidation 473 r_miss_buf_valid = false; 474 475 r_iommu_active = false; 476 477 r_dma_cmd_count = 0; 385 r_dma_cmd_fsm = DMA_CMD_IDLE; 386 r_dma_rsp_fsm = DMA_RSP_IDLE; 387 r_tlb_fsm = TLB_IDLE; 388 r_config_cmd_fsm = CONFIG_CMD_IDLE; 389 r_config_rsp_fsm = CONFIG_RSP_IDLE; 390 r_miss_wti_cmd_fsm = MISS_WTI_CMD_IDLE; 391 r_miss_wti_rsp_fsm = MISS_WTI_RSP_IDLE; 392 393 r_alloc_fifo_config_rsp_local = true; 394 r_alloc_fifo_dma_rsp_local = true; 395 396 r_tlb_buf_valid = false; 397 r_iommu_active = false; 398 r_iommu_wti_enable = false; 478 399 479 400 // initializing FIFOs … … 522 443 m_config_rsp_reop_fifo.init(); 523 444 524 m_config_local_rsrcid_fifo.init(); 525 m_config_local_rtrdid_fifo.init(); 526 m_config_local_rpktid_fifo.init(); 527 m_config_local_data_fifo.init(); 528 m_config_local_rerror_fifo.init(); 529 m_config_local_reop_fifo.init(); 530 531 //Communication between DMA_CMD and DMA_RSP 532 r_dma_cmd_rsp_erase_req =false; 533 r_dma_cmd_error_req =false; 534 //Communication between DMA_CMD and TLB 535 r_dma_tlb_req =false; 536 r_tlb_dma_untreated =false; 537 //Communication betweeen TLB and CONFIG_CMD 538 r_config_tlb_req =false; 539 r_config_tlb_inval_vaddr =false; 540 r_dma_tlb_error_req =false; 541 r_tlb_error_type =false; 542 //Communication between CONFIG_CMD and CONFIG_RSP 543 r_config_cmd_rsp_erase_req =false; 544 //Communication between TLB_MISS and MISS_INIT 545 r_tlb_miss_init_req =false; 546 r_miss_init_error =false; 547 // Debug variables 548 m_debug_dma_rsp_fsm = false; 549 m_debug_dma_cmd_fsm = false; 550 m_debug_dma_tlb_fsm = false; 551 m_debug_config_cmd_fsm = false; 552 m_debug_config_rsp_fsm = false; 553 m_debug_miss_init_fsm = false; 445 // SET/RESET Communication flip-flops 446 r_dma_tlb_req = false; 447 r_config_tlb_req = false; 448 r_tlb_miss_req = false; 449 450 // Debug variable 451 m_debug_activated = false; 554 452 555 r_irq_mask = 0xFFFFFFFF; 556 r_irq_chosen = 0; 453 for ( size_t n=0 ; n<32 ; n++ ) 454 { 455 r_irq_pending[n] = false; 456 r_irq_request[n] = false; 457 } 557 458 558 459 // activity counters 559 m_cpt_total_cycles = 0;560 m_cpt_iotlb_read = 0;561 m_cpt_iotlb_miss = 0;562 m_cpt_iotlbmiss_transaction 563 m_cost_iotlbmiss_transaction 460 m_cpt_total_cycles = 0; 461 m_cpt_iotlb_read = 0; 462 m_cpt_iotlb_miss = 0; 463 m_cpt_iotlbmiss_transaction = 0; 464 m_cost_iotlbmiss_transaction = 0; 564 465 565 m_cpt_trt_dma_full = 0;566 m_cpt_trt_dma_full_cost = 0;567 m_cpt_trt_config_full 568 m_cpt_trt_config_full_cost 466 m_cpt_trt_dma_full = 0; 467 m_cpt_trt_dma_full_cost = 0; 468 m_cpt_trt_config_full = 0; 469 m_cpt_trt_config_full_cost = 0; 569 470 570 471 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_dma_cmd [i] = 0; 571 472 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_dma_rsp [i] = 0; 572 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_dma_tlb [i] = 0; 573 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_alloc_trt_dma [i] = 0; 473 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_tlb [i] = 0; 574 474 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_config_cmd [i] = 0; 575 475 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_config_rsp [i] = 0; 576 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_alloc_trt_config [i] = 0; 577 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_miss_init [i] = 0; 476 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_miss_wti_cmd [i] = 0; 477 for (uint32_t i=0; i<32 ; ++i) m_cpt_fsm_miss_wti_rsp [i] = 0; 478 578 479 return; 579 480 } 580 481 482 // default values for FIFOs 483 bool dma_cmd_fifo_put = false; 484 bool dma_cmd_fifo_get = false; 485 486 bool dma_rsp_fifo_put = false; 487 bool dma_rsp_fifo_get = false; 581 488 582 //bool miss_unposted = false; 583 bool dma_cmd_fifo_put = false; 584 bool dma_cmd_fifo_get = false; 585 bool dma_rsp_fifo_put = false; 586 bool dma_rsp_fifo_get = false; 587 588 bool config_cmd_fifo_put = false; 589 bool config_cmd_fifo_get = false; 590 bool config_rsp_fifo_put = false; 591 bool config_rsp_fifo_get = false; 592 bool config_local_fifo_put = false; 593 bool config_local_fifo_get = false; 489 bool config_cmd_fifo_put = false; 490 bool config_cmd_fifo_get = false; 491 492 bool config_rsp_fifo_put = false; 493 bool config_rsp_fifo_get = false; 594 494 595 495 #ifdef INSTRUMENTATION 596 496 m_cpt_fsm_dma_cmd [r_dma_cmd_fsm.read()] ++; 597 497 m_cpt_fsm_dma_rsp [r_dma_rsp_fsm.read() ] ++; 598 m_cpt_fsm_dma_tlb [r_dma_tlb_fsm.read() ] ++; 599 m_cpt_fsm_alloc_trt_dma [r_alloc_trt_dma_fsm.read() ] ++; 498 m_cpt_fsm_tlb [r_tlb_fsm.read() ] ++; 600 499 m_cpt_fsm_config_cmd [r_config_cmd_fsm.read() ] ++; 601 500 m_cpt_fsm_config_rsp [r_config_rsp_fsm.read() ] ++; 602 m_cpt_fsm_ alloc_trt_config [r_alloc_trt_config_fsm.read() ] ++;603 m_cpt_fsm_miss_ init [r_miss_init_fsm.read() ] ++;501 m_cpt_fsm_miss_wti_cmd [r_miss_wti_cmd_fsm.read() ] ++; 502 m_cpt_fsm_miss_wti_rsp [r_miss_wti_rsp_fsm.read() ] ++; 604 503 #endif 605 504 606 505 m_cpt_total_cycles++; 607 506 608 m_debug_dma_cmd_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 609 m_debug_dma_rsp_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 610 m_debug_dma_tlb_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 611 m_debug_config_cmd_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 612 m_debug_config_rsp_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 613 m_debug_miss_init_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 614 615 ///////////////////////////////////////////////////////////////////// 616 // The DMA_CMD_FSM controls the following ressources: 617 // - r_dma_cmd_fsm 618 // - r_dma_srcid 619 // - r_dma_tlb_req (set) 620 // - r_tlb_dma_untreated (reset) 621 // - r_dma_cmd_rsp_erase_req (set) 507 m_debug_activated = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 508 509 ////////////////////////////////////////////////////////////////////////////// 510 // The DMA_CMD_FSM handles DMA transactions requested by peripherals 511 // It makes the address translation if IOMMU is activated. 622 512 /////////////////////////////////////////////////////////////////////////////// 623 513 624 514 switch( r_dma_cmd_fsm.read() ) 625 515 { 626 ////////////// 627 case DMA_CMD_IDLE: 628 { 629 // Treats an eventual request from TLB_MISS fsm 630 // to send a command whose miss treatment is now finished 631 if ( r_tlb_dma_untreated.read() ) 632 { 633 r_dma_cmd_fsm = DMA_CMD_TRT_LOCK;//before posting we must update TRT 634 r_dma_cmd_fsm_save = DMA_CMD_IDLE; 635 r_miss_interrupt = true; 636 break; 637 } 638 // Error during miss treatment 639 else if (r_dma_tlb_error_req.read()) 640 { 641 r_iommu_etr = r_tlb_error_type.read(); 642 r_iommu_bvar = r_iotlb_vaddr.read(); 643 r_iommu_bad_id = r_miss_srcid.read(); 644 // For DMA_RSP FSM 645 if(r_miss_cmd.read() == vci_param_io::CMD_WRITE) r_dma_error_type = WRITE_ERROR; 646 else r_dma_error_type = READ_ERROR; 647 r_dma_error_trdid = r_miss_trdid.read(); 648 r_dma_error_pktid = r_miss_pktid.read(); 649 650 r_dma_tlb_error_req = false; 651 r_dma_cmd_fsm = DMA_CMD_ERROR; 652 } 653 654 if ( p_vci_tgt_dma.cmdval.read() ) 516 ////////////////// 517 case DMA_CMD_IDLE: // waiting DMA VCI transaction 518 { 519 if ( p_vci_tgt_iox.cmdval.read() ) // compute physical address 655 520 { 656 if ( not r_iommu_active.read() ) // iotlb not activated521 if ( not r_iommu_active.read() ) // tlb not activated 657 522 { 658 // physical address 659 r_dma_paddr = (paddr_t)p_vci_tgt_dma.address.read(); 660 r_dma_cmd_fsm = DMA_CMD_TRT_LOCK; 523 #if DEBUG_DMA_CMD 524 if( m_debug_activated ) 525 std::cout << " <IOB DMA_CMD_IDLE> IOMMU not activated" << std::endl; 526 #endif 527 // put DMA transaction into DMA_CMD fifo 528 r_dma_cmd_paddr = p_vci_tgt_iox.address.read(); 529 r_dma_cmd_fsm = DMA_CMD_FIFO_PUT_CMD; 661 530 } 662 else if (r_ dma_tlb_fsm.read() == DMA_TLB_IDLE ||663 r_ dma_tlb_fsm.read() == DMA_TLB_WAIT_TRANSACTION ) // iotlb activated531 else if (r_tlb_fsm.read() == TLB_IDLE || 532 r_tlb_fsm.read() == TLB_WAIT ) // tlb access possible 664 533 { 665 paddr_t paddr; 666 667 668 // We compute physical address and check access rights : 669 // - If MMU not activated :the physical address is equal to the virtual 670 //address (identity mapping) and there is no access rights checking 671 // - If MMU activated : cacheability is defined by the C bit in the PTE, 672 // the physical address is obtained from the TLB, and the access rights are 673 // defined by the W bit in the PTE. 674 675 paddr_t iotlb_paddr; 534 vci_addr_t iotlb_paddr; 676 535 pte_info_t iotlb_flags; 677 536 size_t iotlb_way; 678 537 size_t iotlb_set; 679 paddr_t iotlb_nline; 680 bool iotlb_hit = false;; 681 538 vci_addr_t iotlb_nline; 539 bool iotlb_hit; 682 540 683 541 #ifdef INSTRUMENTATION 684 542 m_cpt_iotlb_read++; 685 543 #endif 686 687 iotlb_hit = r_iotlb.translate(p_vci_tgt_dma.address.read(), 688 &iotlb_paddr, 689 &iotlb_flags, 690 &iotlb_nline,// unused 691 &iotlb_way, // unused 692 &iotlb_set );// unused 544 iotlb_hit = r_iotlb.translate(p_vci_tgt_iox.address.read(), 545 &iotlb_paddr, 546 &iotlb_flags, 547 &iotlb_nline, // unused 548 &iotlb_way, // unused 549 &iotlb_set ); // unused 693 550 694 695 if ( iotlb_hit ) // tlb hit 551 if ( iotlb_hit ) // tlb hit 696 552 { 697 paddr = iotlb_paddr; 698 699 // access rights checking 700 if ( not iotlb_flags.w and 701 (p_vci_tgt_dma.cmd.read() == vci_param_io::CMD_WRITE) ) 553 if ( not iotlb_flags.w and // access right violation 554 (p_vci_tgt_iox.cmd.read() == vci_param_ext::CMD_WRITE) ) 702 555 { 703 r_iommu_etr = MMU_WRITE_ACCES_VIOLATION; 704 r_iommu_bvar = p_vci_tgt_dma.address.read(); 705 r_iommu_bad_id = p_vci_tgt_dma.srcid.read(); 706 r_dma_cmd_fsm = DMA_CMD_ERROR; 707 // For DMA_RSP 708 r_dma_error_type = WRITE_ERROR; 709 r_dma_error_trdid = p_vci_tgt_dma.trdid.read(); 710 r_dma_error_pktid = p_vci_tgt_dma.pktid.read(); 556 // put DMA response error into DMA_RSP fifo 557 r_iommu_etr = MMU_WRITE_ACCES_VIOLATION; 558 r_iommu_bvar = p_vci_tgt_iox.address.read(); 559 r_iommu_bad_id = p_vci_tgt_iox.srcid.read(); 560 r_dma_cmd_fsm = DMA_CMD_FIFO_PUT_RSP; 711 561 #if DEBUG_DMA_CMD 712 if( m_debug_dma_cmd_fsm ) 713 { 714 std::cout << " <IOB.DMA_CMD_IDLE> HIT in iotlb, but writable violation" << std::endl; 715 } 716 #endif 717 break; 562 if( m_debug_activated ) 563 std::cout << " <IOB DMA_CMD_IDLE> TLB HIT but writable violation" << std::endl; 564 #endif 718 565 } 719 720 // Physical address registration 721 r_dma_paddr = paddr; 722 r_dma_cmd_fsm = DMA_CMD_TRT_LOCK; 723 } 724 // TLB miss: we enter TLB_MISS treatment sub-fsm 725 else 566 else // no access rights violation 567 { 568 #if DEBUG_DMA_CMD 569 if( m_debug_activated ) 570 std::cout << " <IOB DMA_CMD_IDLE> TLB HIT" << std::endl; 571 #endif 572 // put DMA transaction into DMA_CMD fifo 573 r_dma_cmd_paddr = iotlb_paddr; 574 r_dma_cmd_fsm = DMA_CMD_FIFO_PUT_CMD; 575 } 576 } 577 else // TLB miss 726 578 { 727 579 … … 729 581 m_cpt_iotlb_miss++; 730 582 #endif 731 if( r_dma_tlb_req.read() || r_tlb_dma_untreated.read() || r_dma_tlb_error_req.read() ) 732 { 733 // There's already a ongoing request 734 // or a completed request but not yet put on FIFO. 735 // We stay blocked 736 r_dma_cmd_fsm = DMA_CMD_TLB_MISS_WAIT; 583 // register virtual address, and send request to TLB FSM 584 r_dma_cmd_vaddr = p_vci_tgt_iox.address.read(); 585 r_dma_tlb_req = true; 586 r_dma_cmd_fsm = DMA_CMD_MISS_WAIT; 737 587 #if DEBUG_DMA_CMD 738 if( m_debug_dma_cmd_fsm ) 739 { 740 std::cout << " <IOB.DMA_CMD_IDLE> MISS in iotlb. There is a pending request." << std::endl; 741 } 742 #endif 743 } 744 else 745 { 746 // We register request virtual address, to be used by DMA_TLB_MISS FSM 747 r_iotlb_vaddr = p_vci_tgt_dma.address.read(); 748 assert((r_dma_cmd_count.read() == 0) 749 and "ERROR: TRT counter should be 0"); 750 r_dma_tlb_req = true; 751 r_dma_cmd_fsm = DMA_CMD_TLB_MISS_STORE; 752 #if DEBUG_DMA_CMD 753 if( m_debug_dma_cmd_fsm ) 754 { 755 std::cout << " <IOB.DMA_CMD_IDLE> MISS in iotlb. No pending request." << std::endl; 756 } 757 #endif 758 } 588 if( m_debug_activated ) 589 std::cout << " <IOB DMA_CMD_IDLE> TLB MISS" << std::endl; 590 #endif 759 591 } // end !hit 760 592 } // end if tlb_activated … … 762 594 break; 763 595 } 764 ///////////////////////// 765 case DMA_CMD_TRT_LOCK: // Waiting for the lock to modify Transaction Table 766 { 767 if ( r_alloc_trt_dma_fsm.read() == ALLOC_TRT_DMA_CMD ) 768 { 769 770 #if DEBUG_DMA_CMD 771 if( m_debug_dma_cmd_fsm ) 772 { 773 std::cout << " <IOB.DMA_CMD_TRT_LOCK> Check the TRT" << std::endl; 774 } 775 #endif 776 size_t wok_index = 0; 777 bool wok = !m_transaction_tab_dma.full(wok_index); 778 779 if ( wok ) // TRT isn't full. Write the new transaction. 780 { 781 r_dma_cmd_trt_index = (vci_trdid_t)wok_index; 782 r_dma_cmd_fsm = DMA_CMD_TRT_SET; 783 } 784 else // wait an empty entry in TRT 785 { 786 r_dma_cmd_rsp_erase_req = true; 787 r_dma_cmd_fsm = DMA_CMD_TRT_WAIT; 788 #if DEBUG_DMA_CMD 789 if( m_debug_dma_cmd_fsm ) 790 { 791 std::cout << " <IOB.DMA_CMD_TRT_LOCK> TRT is full. Going to TRT_WAIT state" << std::endl; 792 } 793 #endif 596 ////////////////////////// 597 case DMA_CMD_FIFO_PUT_CMD: // put a DMA transaction in DMA_CMD fifo 598 // if contig, VCI address must be incremented 599 { 600 if ( p_vci_tgt_iox.cmdval && m_dma_cmd_addr_fifo.wok() ) 601 { 602 dma_cmd_fifo_put = true; 794 603 795 #ifdef INSTRUMENTATION 796 m_cpt_trt_dma_full++; 797 #endif 798 } 799 } 800 break; 801 } 802 //////////////// 803 case DMA_CMD_TRT_WAIT: // release the lock protecting the transaction tab 804 // waits that RSP erases an entry 805 { 806 #ifdef INSTRUMENTATION 807 m_cpt_trt_dma_full_cost++; 808 #endif 809 // DMA_RSP will notify an erase action by reseting this register 810 if(!r_dma_cmd_rsp_erase_req.read()) 811 { 812 r_dma_cmd_fsm = DMA_CMD_TRT_LOCK; // take the lock again 813 } 814 break; 815 } 816 //////////////////////// 817 case DMA_CMD_TRT_SET: // register a new transaction in TRT 818 { 819 if ( r_alloc_trt_dma_fsm.read() == ALLOC_TRT_DMA_CMD ) 820 { 821 if(r_miss_interrupt.read()) 822 { 823 m_transaction_tab_dma.set(r_dma_cmd_trt_index.read(), 824 r_miss_srcid.read(), 825 r_miss_trdid.read() ); 826 r_dma_cmd_fsm = DMA_CMD_FIFO_MISS_PUT; 827 } 828 else 829 { 830 m_transaction_tab_dma.set(r_dma_cmd_trt_index.read(), 831 p_vci_tgt_dma.srcid.read(), 832 p_vci_tgt_dma.trdid.read() ); 833 r_dma_cmd_fsm = DMA_CMD_FIFO_PUT; 834 } 835 #if DEBUG_DMA_CMD 836 if( m_debug_dma_cmd_fsm ) 837 { 838 std::cout << " <IOB.DMA_CMD_TRT_SET> Set a new entry in TRT" << std::endl; 839 if(r_miss_interrupt.read()) std::cout << " From the Network " << std::endl; 840 else std::cout << " From miss interruption" << std::endl; 841 } 842 #endif 843 } 844 break; 845 } 846 /////////////////////// 847 case DMA_CMD_FIFO_PUT: 848 { 849 if ( p_vci_tgt_dma.cmdval && m_dma_cmd_addr_fifo.wok() ) 850 { 851 dma_cmd_fifo_put = true; 852 //miss_unposted = false; 853 if( p_vci_tgt_dma.contig ) r_dma_paddr = r_dma_paddr.read() + 4; 854 if( p_vci_tgt_dma.eop ) r_dma_cmd_fsm = DMA_CMD_IDLE; 604 if ( p_vci_tgt_iox.contig.read() ) r_dma_cmd_paddr = r_dma_cmd_paddr.read() + 605 vci_param_ext::B; 606 607 if ( p_vci_tgt_iox.eop.read() ) r_dma_cmd_fsm = DMA_CMD_IDLE; 855 608 856 609 #if DEBUG_DMA_CMD 857 if( m_debug_dma_cmd_fsm ) 858 { 859 std::cout << " <IOB.DMA_CMD_FIFO_PUT> Push into cmd_fifo:" 860 << " address = " << std::hex << r_dma_paddr.read() 861 << " srcid = " << std::dec << m_srcid_dma 862 << " trdid = " << r_dma_cmd_trt_index.read() 863 << " wdata = " << std::hex << p_vci_tgt_dma.wdata.read() 864 << " be = " << p_vci_tgt_dma.be.read() 865 << " contig = " << p_vci_tgt_dma.contig.read() 866 << " eop = " << std::dec << p_vci_tgt_dma.eop.read() 867 << " plen = " << std::dec << p_vci_tgt_dma.plen.read() << std::endl; 868 } 869 #endif 610 if( m_debug_activated ) 611 std::cout << " <IOB DMA_CMD_FIFO_PUT_CMD> Push into DMA_CMD fifo:" 612 << " address = " << std::hex << r_dma_cmd_paddr.read() 613 << " srcid = " << p_vci_tgt_iox.srcid.read() 614 << " trdid = " << p_vci_tgt_iox.trdid.read() 615 << " wdata = " << p_vci_tgt_iox.wdata.read() 616 << " be = " << p_vci_tgt_iox.be.read() 617 << " contig = " << p_vci_tgt_iox.contig.read() 618 << " eop = " << std::dec << p_vci_tgt_iox.eop.read() 619 << " plen = " << std::dec << p_vci_tgt_iox.plen.read() << std::endl; 620 #endif 621 } 622 break; 623 } 624 ////////////////////// 625 case DMA_CMD_WAIT_EOP: // An error has been detected on the VCI DMA command 626 // consume the VCI packet before sending the error response 627 { 628 if ( p_vci_tgt_iox.eop.read() ) r_dma_cmd_fsm = DMA_CMD_FIFO_PUT_RSP; 629 break; 630 } 631 ////////////////////////// 632 case DMA_CMD_FIFO_PUT_RSP: // try to put a response error in DMA_RSP fifo 633 // The FIFO is shared with DMA_RSP FSM 634 // and we must we wait for allocation... 635 { 636 if ( r_alloc_fifo_dma_rsp_local.read() ) 637 { 638 dma_rsp_fifo_put = true; 639 640 if( m_dma_rsp_data_fifo.wok() ) 641 { 642 643 #if DEBUG_DMA_CMD 644 if( m_debug_activated ) 645 std::cout << " <IOB DMA_CMD_FIFO_PUT_RSP> Put a response error to a DMA transaction." 646 << std::endl; 647 #endif 648 r_dma_cmd_fsm = DMA_CMD_IDLE; 649 } 870 650 } 871 651 break; 872 652 } 873 653 /////////////////////// 874 case DMA_CMD_FIFO_MISS_PUT: 875 { 876 if ( m_dma_cmd_addr_fifo.wok() ) 877 { 878 dma_cmd_fifo_put = true; 879 //miss_unposted = true; 880 if( r_miss_contig.read() ) r_miss_paddr = r_miss_paddr.read() + 4; 881 882 if( r_dma_cmd_count.read() == 1 ) 654 case DMA_CMD_MISS_WAIT: // waiting completion of a TLB miss 655 // we must test a possible page fault error... 656 { 657 if ( not r_dma_tlb_req.read() ) // TLB miss completed 658 { 659 if ( r_tlb_miss_error.read() ) // Error reported by TLB FSM 883 660 { 884 r_tlb_dma_untreated = false; 885 r_miss_interrupt = false; 886 r_dma_cmd_fsm = r_dma_cmd_fsm_save.read(); 661 r_iommu_etr = MMU_READ_PT2_UNMAPPED; 662 r_iommu_bvar = r_dma_cmd_vaddr.read(); 663 r_iommu_bad_id = p_vci_tgt_iox.srcid.read(); 664 r_dma_cmd_fsm = DMA_CMD_FIFO_PUT_RSP; 887 665 } 888 r_dma_cmd_count = r_dma_cmd_count.read() - 1; 889 890 #if DEBUG_DMA_CMD 891 if( m_debug_dma_cmd_fsm ) 892 { 893 std::cout << " <IOB.DMA_CMD_FIFO_MISS_PUT> Push into cmd_fifo:" 894 << " counter = " << std::hex << r_dma_cmd_count.read() 895 << " address = " << std::hex << r_miss_paddr.read() 896 << " srcid = " << std::dec << r_miss_srcid.read() 897 << " trdid = " << r_miss_trdid.read() 898 << " wdata = " << std::hex << r_miss_data 899 << " be = " << r_miss_be 900 << " plen = " << std::dec << r_miss_plen.read() << std::endl; 901 } 902 #endif 903 } 904 break; 905 } 906 /////////////////// 907 case DMA_CMD_TLB_MISS_WAIT: // to store the miss request there must be 908 // neither an ongoing request, nor a unposted finished request 909 { 910 // Treats an eventual request from TLB_MISS fsm 911 // to send a command whose miss treatment is now finished 912 if ( r_tlb_dma_untreated.read() ) 913 { 914 r_dma_cmd_fsm = DMA_CMD_TRT_LOCK; //before posting we must update TRT 915 r_dma_cmd_fsm_save = DMA_CMD_TLB_MISS_WAIT; 916 r_miss_interrupt = true; 917 break; 918 } 919 // Error during miss treatment 920 else if (r_dma_tlb_error_req.read()) 921 { 922 r_iommu_etr = r_tlb_error_type.read(); 923 r_iommu_bvar = r_iotlb_vaddr.read(); 924 r_iommu_bad_id = r_miss_srcid.read(); 925 // For DMA_RSP FSM 926 if(r_miss_cmd.read() == vci_param_io::CMD_WRITE) r_dma_error_type = WRITE_ERROR; 927 else r_dma_error_type = READ_ERROR; 928 r_dma_error_trdid = r_miss_trdid.read(); 929 r_dma_error_pktid = r_miss_pktid.read(); 930 931 r_dma_tlb_error_req = false; 932 r_dma_cmd_fsm = DMA_CMD_ERROR; 933 } 934 935 #ifdef INSTRUMENTATION 936 m_cost_iotlb_miss++; // Now it represents misses' total blocking cost (not the treatment cost itself) 937 #endif 938 else if (not r_dma_tlb_req.read()) 939 { 940 r_dma_cmd_fsm = DMA_CMD_TLB_MISS_STORE; 941 assert((r_dma_cmd_count.read() == 0) and "ERROR: TRT counter should be 0"); 942 } 943 break; 944 } 945 /////////////////// 946 case DMA_CMD_TLB_MISS_STORE: 947 { 948 if ( p_vci_tgt_dma.cmdval.read()) 949 { 950 if(r_dma_cmd_count.read() == 0) 666 else // No error 951 667 { 952 r_miss_cmd = p_vci_tgt_dma.cmd.read(); 953 r_miss_contig = p_vci_tgt_dma.contig.read(); 954 r_miss_cons = p_vci_tgt_dma.cons.read(); 955 r_miss_plen = p_vci_tgt_dma.plen.read(); 956 r_miss_wrap = p_vci_tgt_dma.wrap.read(); 957 r_miss_cfixed = p_vci_tgt_dma.cfixed.read(); 958 r_miss_clen = p_vci_tgt_dma.clen.read(); 959 r_miss_srcid = p_vci_tgt_dma.srcid.read(); 960 r_miss_trdid = p_vci_tgt_dma.trdid.read(); 961 r_miss_pktid = p_vci_tgt_dma.pktid.read(); 962 963 // r_dma_tlb_req = true; 668 r_dma_cmd_fsm = DMA_CMD_IDLE; 964 669 } 965 966 r_miss_data[r_dma_cmd_count.read()] = p_vci_tgt_dma.wdata.read(); 967 r_miss_be[r_dma_cmd_count.read()] = p_vci_tgt_dma.be.read(); 968 969 r_dma_cmd_count = r_dma_cmd_count.read() + 1; 970 971 if( p_vci_tgt_dma.eop ) r_dma_cmd_fsm = DMA_CMD_IDLE; 972 973 #if DEBUG_DMA_CMD 974 if( m_debug_dma_cmd_fsm ) 975 { 976 std::cout << " <IOB.DMA_CMD_TLB_MISS_STORE> Storing VCI fields of command that originate the Miss:" 977 << " counter = " << std::hex << r_dma_cmd_count.read() 978 << " address = " << std::hex << p_vci_tgt_dma.address.read() 979 << " srcid = " << std::dec << p_vci_tgt_dma.srcid.read() 980 << " trdid = " << p_vci_tgt_dma.trdid.read() 981 << " wdata = " << std::hex << p_vci_tgt_dma.wdata.read() 982 << " be = " << p_vci_tgt_dma.be.read() 983 << " plen = " << std::dec << p_vci_tgt_dma.plen.read() << std::endl; 984 } 985 #endif 986 } 987 break; 988 } 989 /////////////////// 990 case DMA_CMD_ERROR: 991 { 992 // Wait in case of pending request 993 // it isn't the case, generally 994 if(!r_dma_cmd_error_req.read()) 995 { 996 r_dma_cmd_error_req = true; 997 r_dma_cmd_fsm = DMA_CMD_IDLE; 998 } 999 break; 1000 } 1001 } // end switch DMA_CMD_FSM 1002 1003 ///////////////////////////////////////////////////////////////////// 1004 // The DMA_RSP_FSM controls the following ressources: 1005 // - r_dma_rsp_fsm 1006 // - r_dma_cmd_rsp_erase_req (reset) 1007 // - r_fma_error_req (reset) 1008 // - 670 } 671 break; 672 } 673 } // end switch DMA_CMD FSM 674 1009 675 ////////////////////////////////////////////////////////////////////////////// 676 // The DMA_RSP_FSM handles the RAM responses to peripherals DMA transactions. 677 ////////////////////////////////////////////////////////////////////////////// 678 1010 679 switch( r_dma_rsp_fsm.read() ) 1011 680 { 1012 ////////////////// ///1013 case DMA_RSP_IDLE: 681 ////////////////// 682 case DMA_RSP_IDLE: // waiting a response from RAM betwork 1014 683 { 1015 // Interruption from DMA_CMD following an error 1016 if(r_dma_cmd_error_req.read()) r_dma_rsp_fsm = DMA_RSP_FIFO_ERROR_PUT; 1017 1018 if(p_vci_ini_dma.rspval.read()) 684 if ( p_vci_ini_ram.rspval.read() ) 1019 685 { 1020 r_dma_rsp_fsm = DMA_RSP_ TRT_LOCK;686 r_dma_rsp_fsm = DMA_RSP_FIFO_PUT; 1021 687 } 1022 688 break; 1023 689 } 1024 ///////////////////// 1025 case DMA_RSP_TRT_LOCK: 1026 { 1027 if ( r_alloc_trt_dma_fsm.read() == ALLOC_TRT_DMA_RSP ) 1028 { 1029 1030 #if DEBUG_DMA_RSP 1031 if( m_debug_dma_rsp_fsm ) 1032 { 1033 std::cout << " <IOB.DMA_RSP_TRT_LOCK> Erase entry" << std::endl; 1034 } 1035 #endif 1036 uint32_t trdid_xram = p_vci_ini_dma.rtrdid.read(); 1037 1038 r_dma_rsrcid = (vci_srcid_t)m_transaction_tab_dma.readSrcid(trdid_xram); 1039 r_dma_rtrdid = (vci_trdid_t)m_transaction_tab_dma.readTrdid(trdid_xram); 1040 m_transaction_tab_dma.erase(trdid_xram); 1041 if (r_dma_cmd_rsp_erase_req.read()) r_dma_cmd_rsp_erase_req = false; 1042 r_dma_rsp_fsm = DMA_RSP_FIFO_PUT; 1043 } 1044 break; 1045 } 1046 ////////////////// 690 ////////////////////// 1047 691 case DMA_RSP_FIFO_PUT: 1048 692 { 1049 if(p_vci_ini_ dma.rspval.read() && m_dma_rsp_data_fifo.wok())693 if(p_vci_ini_ram.rspval.read() and not r_alloc_fifo_dma_rsp_local.read() ) 1050 694 { 1051 695 dma_rsp_fifo_put = true; 1052 if(p_vci_ini_dma.reop.read()) r_dma_rsp_fsm = DMA_RSP_IDLE; 696 697 if(p_vci_ini_ram.reop.read()) r_dma_rsp_fsm = DMA_RSP_IDLE; 1053 698 1054 699 #if DEBUG_DMA_RSP 1055 if( m_debug_dma_rsp_fsm ) 1056 { 1057 std::cout << " <IOB.DMA_RSP_FIFO_PUT> Push into rsp_fifo:" 1058 << " rsrcid = " << std::dec << r_dma_rsrcid.read() 1059 << " rtrdid = " << r_dma_rtrdid.read() 1060 << " rdata = " << std::hex << p_vci_ini_dma.rdata.read() 1061 << std::endl; 1062 } 1063 #endif 1064 700 if( m_debug_activated ) 701 std::cout << " <IOB DMA_RSP_FIFO_PUT> Push response into DMA_RSP fifo:" 702 << " / rsrcid = " << std::hex << p_vci_ini_ram.rsrcid.read() 703 << " / rtrdid = " << p_vci_ini_ram.rtrdid.read() 704 << " / rdata = " << std::hex << p_vci_ini_ram.rdata.read() 705 << " / rerror = " << p_vci_ini_ram.rerror.read() 706 << " / reop = " << p_vci_ini_ram.reop.read() << std::endl; 707 #endif 1065 708 } 1066 709 break; 1067 710 } 1068 //////////////////1069 case DMA_RSP_FIFO_ERROR_PUT:1070 {1071 if(m_dma_rsp_data_fifo.wok())1072 {1073 dma_rsp_fifo_put = true;1074 r_dma_rsp_fsm = DMA_RSP_IDLE;1075 1076 #if DEBUG_DMA_RSP1077 if( m_debug_dma_rsp_fsm )1078 {1079 std::cout << " <IOB.DMA_RSP_FIFO_ERROR_PUT> Push into rsp_fifo:"1080 << " rsrcid = " << std::dec << r_iommu_bad_id.read()1081 << " rtrdid = " << r_dma_error_trdid.read()1082 << " rerror = " << r_dma_error_type.read()1083 << " rdata = " << std::hex << 01084 << std::endl;1085 }1086 #endif1087 1088 }1089 break;1090 }1091 711 } // end switch DMA_RSP_FSM 1092 712 1093 //////////////////////////////////////////////////////////////////////////// 1094 // The ALLOC_TRT_DMA fsm allocates the access to the Transaction Table (m_transaction_tab_dma) 1095 // with a round robin priority between 2 user FSMs : 1096 // - DMA_CMD : to set a new entry 1097 // - DMA_RSP : to read and erase an entry 1098 // The ressource is always allocated. 1099 //////////////////////////////////////////////////////////////////////////// 1100 1101 switch ( r_alloc_trt_dma_fsm.read() ) 1102 { 1103 /////////////////// 1104 case ALLOC_TRT_DMA_CMD: 1105 { 1106 if ( r_dma_cmd_fsm.read() != DMA_CMD_TRT_LOCK ) 1107 { 1108 if (r_dma_rsp_fsm.read() == DMA_RSP_TRT_LOCK) r_alloc_trt_dma_fsm = ALLOC_TRT_DMA_RSP; 1109 } 1110 break; 1111 } 1112 /////////////////// 1113 case ALLOC_TRT_DMA_RSP: 1114 { 1115 if (r_dma_rsp_fsm.read() != DMA_RSP_TRT_LOCK) 1116 { 1117 if (r_dma_cmd_fsm.read() == DMA_CMD_TRT_LOCK) r_alloc_trt_dma_fsm = ALLOC_TRT_DMA_CMD; 1118 } 1119 break; 1120 } 1121 } // end switch r_alloc_trt_dma_fsm 1122 1123 1124 //////////////////////////////////////////////////////////////////////////// 1125 // The DMA_TLB_MISS FSM handles an IOTLB miss. It blocks the TGT_FSM. 1126 // Input argument is: 1127 // - r_iotlb_vaddr 1128 // - r_dma_tlb_req (reset) 1129 // - r_tlb_miss_init_req (set) 1130 // - r_config_tlb_req (reset) 1131 // - r_tlb_dma_untreated (set) 1132 // 1133 // This fsm searchs the requested PTE on the prefetch buffer. 1134 // In case of miss, it accesses the XRAM to find the missing TLB entry, 713 ////////////////////////////////////////////////////////////////////////////////// 714 // The TLB FSM handles TLB miss request (from DMA_CMD FSM), 715 // and the PTE inval request (from CONFIG_CMD FSM). 716 // PTE inval request have highest priority. In case of TLB miss, 717 // this fsm searchs the requested PTE on the prefetch buffer. 718 // In case of buffer miss, it request the MISS_WTI FSM to access the memory. 1135 719 // It bypass the first level page table access if possible. 1136 // It directly updates the iotlb, and writes into the1137 // r_mmu_ins_* or r_mmu_data* error reporting registers.720 // It reset the r_dma_tlb_req flip-flop to signal TLB miss completion. 721 // An unexpected, but possible page fault is signaled in r_tlb_miss_error flip_flop. 1138 722 //////////////////////////////////////////////////////////////////////////////////// 1139 switch (r_dma_tlb_fsm.read()) 1140 { 1141 case DMA_TLB_IDLE: 1142 { 1143 if(r_config_tlb_req) 1144 { 1145 r_config_tlb_req = false; 723 724 switch (r_tlb_fsm.read()) 725 { 726 ////////////// 727 case TLB_IDLE: // In case of TLB miss request, chek the prefetch buffer first 728 // PTE inval request are handled as unmaskable interrupts 729 { 730 if ( r_config_tlb_req ) // Request from CONFIG FSM for a PTE invalidation 731 { 732 r_config_tlb_req = false; 1146 733 r_waiting_transaction = false; 1147 r_dma_tlb_fsm = DMA_TLB_INVAL_CHECK; 1148 // Request from CONFIG FSM following an PTE invalidation signal by OS 1149 } 1150 // Miss in IOTLB 1151 else if(r_dma_tlb_req.read()) 1152 { 1153 // Checking prefetch buffer, by the virtual address 1154 if(!r_miss_buf_first_level) 1155 { 1156 if( r_miss_buf_valid && 1157 (r_miss_buf_vaddr_begin.read() == 1158 (r_iotlb_vaddr.read()& ~PTE2_LINE_OFFSET & ~K_PAGE_OFFSET_MASK))) 734 r_tlb_fsm = TLB_INVAL_CHECK; 735 } 736 737 else if ( r_dma_tlb_req.read() ) // request from DMA_CMD for a TLB Miss 738 { 739 // Checking prefetch buffer 740 if( not r_tlb_buf_big_page ) // small page => PTE2 1159 741 { 1160 // Hit 1161 size_t pte_offset = (r_iotlb_vaddr.read()& PTE2_LINE_OFFSET)>>12; 1162 1163 1164 uint32_t pte_flags = r_miss_buf_data[2*pte_offset]; 1165 uint32_t pte_ppn = r_miss_buf_data[2*pte_offset+1]; //because PTE2 is 2 words long 742 if( r_tlb_buf_valid && // Hit on prefetch buffer 743 (r_tlb_buf_vaddr.read() == 744 (r_dma_cmd_vaddr.read()& ~PTE2_LINE_OFFSET & ~K_PAGE_OFFSET_MASK))) 745 { 746 size_t pte_offset = (r_dma_cmd_vaddr.read()& PTE2_LINE_OFFSET)>>12; 747 uint32_t pte_flags = r_tlb_buf_data[2*pte_offset]; 748 uint32_t pte_ppn = r_tlb_buf_data[2*pte_offset+1]; 1166 749 1167 // Bit valid checking 1168 if ( not ( pte_flags & PTE_V_MASK) ) // unmapped 1169 { 1170 //must not occur! 1171 std::cout << "IOMMU ERROR : " << name() << " DMA_TLB_IDLE state" << std::endl 1172 << "The Page Table entry ins't valid (unmapped)" << std::endl; 750 // Bit valid checking 751 if ( not ( pte_flags & PTE_V_MASK) ) // unmapped 752 { 753 std::cout << "VCI_IO_BRIDGE ERROR : " << name() 754 << " Page Table entry unmapped" << std::endl; 1173 755 1174 r_tlb_error_type = MMU_READ_PT2_UNMAPPED; 1175 r_dma_tlb_error_req = true; 1176 r_dma_tlb_req = false; 1177 1178 #if DEBUG_DMA_TLB 1179 if ( m_debug_dma_tlb_fsm ) 1180 { 1181 std::cout << " <IOB.DMA_TLB_IDLE> PTE2 Unmapped" 1182 << std::hex << " / paddr = " << r_iotlb_paddr.read() 1183 << std::hex << " / PTE (first word) = " << pte_flags << std::endl; 1184 } 1185 #endif 1186 break; 1187 } 1188 1189 r_iotlb_pte_flags = pte_flags; 1190 r_iotlb_pte_ppn = pte_ppn; 1191 r_dma_tlb_fsm = DMA_TLB_PTE2_SELECT; 1192 1193 #if DEBUG_DMA_TLB 1194 if ( m_debug_dma_tlb_fsm ) 1195 { 1196 std::cout << " <IOB.DMA_TLB_IDLE> Hit on the prefetch buffer for PTE2:" 1197 << " PTE_FLAGS = " << std::hex << pte_flags 1198 << " PTE_PPN = " << std::hex << pte_ppn << std::endl; 1199 } 1200 #endif 1201 break; 756 r_tlb_miss_error = true; 757 r_dma_tlb_req = false; 758 #if DEBUG_TLB_MISS 759 if ( m_debug_activated ) 760 std::cout << " <IOB TLB_IDLE> PTE2 Unmapped" << std::hex 761 << " / paddr = " << r_tlb_paddr.read() 762 << " / PTE_FLAGS = " << pte_flags 763 << " / PTE_PPN = " << pte_ppn << std::endl; 764 #endif 765 break; 766 } 767 768 // valid PTE2 : we must update the TLB 769 r_tlb_pte_flags = pte_flags; 770 r_tlb_pte_ppn = pte_ppn; 771 r_tlb_fsm = TLB_PTE2_SELECT; 772 #if DEBUG_TLB_MISS 773 if ( m_debug_activated ) 774 std::cout << " <IOB TLB_IDLE> Hit on prefetch buffer: PTE2" << std::hex 775 << " / PTE_FLAGS = " << pte_flags 776 << " / PTE_PPN = " << pte_ppn << std::endl; 777 #endif 778 break; 779 } 1202 780 } 1203 } 1204 else // First level entries on buffer. Unused if only small pages 1205 { 1206 if( r_miss_buf_valid && 1207 (r_miss_buf_vaddr_begin.read() == 1208 (r_iotlb_vaddr.read()& ~PTE1_LINE_OFFSET & ~M_PAGE_OFFSET_MASK ))) 1209 // The virtual address corresponds to one entry on the buffer line 781 else // big page => PTE1 1210 782 { 1211 // Hit 1212 size_t pte_offset = (r_iotlb_vaddr.read()& PTE1_LINE_OFFSET)>>21; 1213 1214 uint32_t pte_flags = r_miss_buf_data[pte_offset]; 783 if( r_tlb_buf_valid && // Hit on prefetch buffer 784 (r_tlb_buf_vaddr.read() == 785 (r_dma_cmd_vaddr.read()& ~PTE1_LINE_OFFSET & ~M_PAGE_OFFSET_MASK ))) 786 { 787 size_t pte_offset = (r_dma_cmd_vaddr.read()& PTE1_LINE_OFFSET)>>21; 788 uint32_t pte_flags = r_tlb_buf_data[pte_offset]; 1215 789 1216 // Bit valid checking 1217 if ( not ( pte_flags & PTE_V_MASK) ) // unmapped 1218 { 1219 //must not occur! 1220 std::cout << "IOMMU ERROR " << name() << "DMA_TLB_IDLE state" << std::endl 1221 << "The Page Table entry ins't valid (unmapped)" << std::endl; 790 // Bit valid checking 791 if ( not ( pte_flags & PTE_V_MASK) ) // unmapped 792 { 793 std::cout << "VCI_IO_BRIDGE ERROR : " << name() 794 << " Page Table entry unmapped" << std::endl; 1222 795 1223 r_tlb_error_type = MMU_READ_PT1_UNMAPPED; 1224 r_dma_tlb_error_req = true; 1225 r_dma_tlb_req = false; 1226 1227 #if DEBUG_DMA_TLB 1228 if ( m_debug_dma_tlb_fsm ) 1229 { 1230 std::cout << " <IOB.DMA_TLB_IDLE> First level entry Unmapped" 1231 << std::hex << " / paddr = " << r_iotlb_paddr.read() 1232 << std::hex << " / PTE = " << pte_flags << std::endl; 1233 } 1234 #endif 1235 break; 1236 } 1237 1238 if( pte_flags & PTE_T_MASK ) // PTD : me must access PT2 1239 { 1240 // register bypass 1241 r_iotlb.set_bypass( r_iotlb_vaddr.read(), 1242 pte_flags & ((1 << (m_paddr_nbits-PAGE_K_NBITS)) - 1), 1243 0); //nline, unused 1244 1245 //&PTE2 = PTBA + IX2 * 8 1246 // ps: PAGE_K_NBITS corresponds also to the size of a second level page table 1247 r_iotlb_paddr = (paddr_t)(pte_flags & ((1<<(m_paddr_nbits-PAGE_K_NBITS))-1)) << PAGE_K_NBITS | 1248 (paddr_t)(((r_iotlb_vaddr.read() & PTD_ID2_MASK) >> PAGE_K_NBITS) << 3); 1249 r_tlb_miss_init_req = true; 1250 r_tlb_miss_type = PTE2_MISS; 1251 r_dma_tlb_fsm = DMA_TLB_WAIT_TRANSACTION; 796 r_tlb_miss_error = true; 797 r_dma_tlb_req = false; 798 #if DEBUG_TLB_MISS 799 if ( m_debug_activated ) 800 std::cout << " <IOB TLB_IDLE> PTE1 Unmapped" << std::hex 801 << " / paddr = " << r_tlb_paddr.read() 802 << " / PTE = " << pte_flags << std::endl; 803 #endif 804 break; 805 } 806 807 // valid PTE1 : we must update the TLB 808 r_tlb_pte_flags = pte_flags; 809 r_tlb_fsm = TLB_PTE1_SELECT; 810 #if DEBUG_TLB_MISS 811 if ( m_debug_activated ) 812 std::cout << " <IOB TLB_PTE1_GET> Hit on prefetch buffer: PTE1" << std::hex 813 << " / paddr = " << r_tlb_paddr.read() 814 << std::hex << " / PTE1 = " << pte_flags << std::endl; 815 #endif 816 break; 817 } 818 } 819 820 // prefetch buffer miss 821 r_tlb_fsm = TLB_MISS; 822 823 #if DEBUG_TLB_MISS 824 if ( m_debug_activated ) 825 std::cout << " <IOB TLB_IDLE> Miss on prefetch buffer" 826 << std::hex << " / vaddr = " << r_dma_cmd_vaddr.read() << std::endl; 827 #endif 828 } 829 break; 830 } 831 ////////////// 832 case TLB_MISS: // handling tlb miss 833 { 834 uint32_t ptba = 0; 835 bool bypass; 836 vci_addr_t pte_paddr; 837 1252 838 #ifdef INSTRUMENTATION 1253 839 m_cpt_iotlbmiss_transaction++; 1254 840 #endif 1255 1256 #if DEBUG_DMA_TLB1257 if ( m_debug_dma_tlb_fsm )1258 {1259 std::cout << " <IOB.DMA_TLB_IDLE> Hit on prefetch, but it is a PTD.Search PTE2"1260 << std::hex << " / paddr = " << r_iotlb_paddr.read()1261 << std::hex << " / PTD = " << pte_flags << std::endl;1262 }1263 #endif1264 }1265 else // PTE1 : we must update the TLB1266 // Should not occur if working only with small pages1267 {1268 r_iotlb_pte_flags = pte_flags;1269 r_dma_tlb_fsm = DMA_TLB_PTE1_SELECT;1270 1271 #if DEBUG_DMA_TLB1272 if ( m_debug_dma_tlb_fsm )1273 {1274 std::cout << " <IOB.DMA_TLB_PTE1_GET> Success. Big page"1275 << std::hex << " / paddr = " << r_iotlb_paddr.read()1276 << std::hex << " / PTE1 = " << pte_flags << std::endl;1277 }1278 #endif1279 }1280 break;1281 }1282 }1283 1284 r_dma_tlb_fsm = DMA_TLB_MISS;1285 1286 #if DEBUG_DMA_TLB1287 if ( m_debug_dma_tlb_fsm )1288 {1289 std::cout << " <IOB.DMA_TLB_IDLE> Miss on prefetch."1290 << std::hex << " / vaddr = " << r_iotlb_vaddr.read() << std::endl;1291 }1292 #endif1293 }1294 break;1295 }1296 /////////////////////1297 case DMA_TLB_MISS: // handling all tlb miss1298 {1299 uint32_t ptba = 0; //28 bits en TSAR1300 bool bypass;1301 paddr_t pte_paddr;1302 1303 841 // evaluate bypass in order to skip first level page table access 1304 bypass = r_iotlb.get_bypass(r_ iotlb_vaddr.read(), &ptba);842 bypass = r_iotlb.get_bypass(r_dma_cmd_vaddr.read(), &ptba); 1305 843 1306 // Request to MISS_INIT_FSM to start transaction on Direct Network844 // Request MISS_WTI_FSM a transaction on INT Network 1307 845 if ( not bypass ) // Read PTE1/PTD1 in XRAM 1308 846 { 1309 // VOIR CONVENTION >> 13 1310 pte_paddr = (paddr_t)((r_iommu_ptpr.read()) << (INDEX1_NBITS+2)) | 1311 (paddr_t)((r_iotlb_vaddr.read() >> PAGE_M_NBITS) << 2); 1312 r_iotlb_paddr = pte_paddr; 847 848 #if DEBUG_TLB_MISS 849 if ( m_debug_activated ) 850 std::cout << " <IOB TLB_MISS> Read PTE1/PTD1 in memory" << std::endl; 851 #endif 852 pte_paddr = (vci_addr_t)((r_iommu_ptpr.read()) << (INDEX1_NBITS+2)) | 853 (vci_addr_t)((r_dma_cmd_vaddr.read() >> PAGE_M_NBITS) << 2); 854 r_tlb_paddr = pte_paddr; 1313 855 1314 r_tlb_miss_init_req = true; 1315 r_tlb_miss_type = PTE1_MISS; 1316 r_dma_tlb_fsm = DMA_TLB_WAIT_TRANSACTION; 1317 #ifdef INSTRUMENTATION 1318 m_cpt_iotlbmiss_transaction++; 1319 #endif 856 r_tlb_miss_req = true; 857 r_tlb_miss_type = PTE1_MISS; 858 r_tlb_fsm = TLB_WAIT; 1320 859 } 1321 860 else // Read PTE2 in XRAM 1322 861 { 862 863 #if DEBUG_TLB_MISS 864 if ( m_debug_activated ) 865 std::cout << " <IOB TLB_MISS> Read PTE2 in memory" << std::endl; 866 #endif 1323 867 //&PTE2 = PTBA + IX2 * 8 1324 pte_paddr = ( paddr_t)ptba << PAGE_K_NBITS |1325 ( paddr_t)(r_iotlb_vaddr.read()&PTD_ID2_MASK)>>(PAGE_K_NBITS-3);868 pte_paddr = (vci_addr_t)ptba << PAGE_K_NBITS | 869 (vci_addr_t)(r_dma_cmd_vaddr.read()&PTD_ID2_MASK)>>(PAGE_K_NBITS-3); 1326 870 1327 r_ iotlb_paddr = pte_paddr;871 r_tlb_paddr = pte_paddr; 1328 872 1329 r_tlb_miss_init_req = true; 1330 r_tlb_miss_type = PTE2_MISS; 1331 r_dma_tlb_fsm = DMA_TLB_WAIT_TRANSACTION; 1332 #ifdef INSTRUMENTATION 1333 m_cpt_iotlbmiss_transaction++; 1334 #endif 1335 } 1336 1337 #if DEBUG_DMA_TLB 1338 if ( m_debug_dma_tlb_fsm ) 1339 { 1340 std::cout << " <IOB.DMA_TLB_MISS> IOTLB miss"; 1341 std::cout << " / VADDR = " << std::hex << r_iotlb_vaddr.read() 1342 << " / BYPASS = " << bypass 1343 << " / PTE_ADR = " << pte_paddr << std::endl; 1344 } 1345 #endif 1346 1347 break; 1348 } 1349 ///////////////////////// 1350 case DMA_TLB_PTE1_GET: // Try to read a PT1 entry in the miss buffer 873 r_tlb_miss_req = true; 874 r_tlb_miss_type = PTE2_MISS; 875 r_tlb_fsm = TLB_WAIT; 876 } 877 878 break; 879 } 880 ////////////////// 881 case TLB_PTE1_GET: // Try to read a PT1 entry in the miss buffer 1351 882 { 1352 883 1353 884 uint32_t entry; 1354 885 1355 paddr_t line_number = (paddr_t)((r_iotlb_paddr.read())&(CACHE_LINE_MASK));1356 size_t word_position = (size_t)( ((r_ iotlb_paddr.read())&(~CACHE_LINE_MASK))>>2 );886 vci_addr_t line_number = (vci_addr_t)((r_tlb_paddr.read())&(CACHE_LINE_MASK)); 887 size_t word_position = (size_t)( ((r_tlb_paddr.read())&(~CACHE_LINE_MASK))>>2 ); 1357 888 1358 889 // Hit test. Just to verify. 1359 890 // Hit must happen, since we've just finished its' miss transaction 1360 bool hit = (r_ miss_buf_valid && (r_miss_buf_tag.read()== line_number) );891 bool hit = (r_tlb_buf_valid && (r_tlb_buf_tag.read()== line_number) ); 1361 892 assert(hit and "Error: No hit on prefetch buffer after Miss Transaction"); 1362 893 1363 entry = r_ miss_buf_data[word_position];894 entry = r_tlb_buf_data[word_position]; 1364 895 1365 896 // Bit valid checking … … 1367 898 { 1368 899 //must not occur! 1369 std::cout << "IOMMU ERROR " << name() << " DMA_TLB_IDLE state" << std::endl900 std::cout << "IOMMU ERROR " << name() << "TLB_IDLE state" << std::endl 1370 901 << "The Page Table entry ins't valid (unmapped)" << std::endl; 1371 902 1372 r_tlb_ error_type = MMU_READ_PT1_UNMAPPED;1373 r_dma_tlb_ error_req = true;1374 r_ dma_tlb_req = false;1375 r_dma_tlb_fsm = DMA_TLB_IDLE; 1376 #if DEBUG_ DMA_TLB1377 if ( m_debug_ dma_tlb_fsm)903 r_tlb_miss_error = true; 904 r_dma_tlb_req = false; 905 r_tlb_fsm = TLB_IDLE; 906 907 #if DEBUG_TLB_MISS 908 if ( m_debug_activated ) 1378 909 { 1379 std::cout << " <IOB .DMA_PTE1_GET> First level entry Unmapped"1380 << std::hex << " / paddr = " << r_ iotlb_paddr.read()910 std::cout << " <IOB DMA_PTE1_GET> First level entry Unmapped" 911 << std::hex << " / paddr = " << r_tlb_paddr.read() 1381 912 << std::hex << " / PTE = " << entry << std::endl; 1382 913 } … … 1388 919 { 1389 920 // register bypass 1390 r_iotlb.set_bypass( r_ iotlb_vaddr.read(),1391 entry & ((1 << ( m_paddr_nbits-PAGE_K_NBITS)) - 1),921 r_iotlb.set_bypass( r_dma_cmd_vaddr.read(), 922 entry & ((1 << (vci_param_int::N-PAGE_K_NBITS)) - 1), 1392 923 0); //nline, unused 1393 924 1394 925 //&PTE2 = PTBA + IX2 * 8 1395 926 // ps: PAGE_K_NBITS corresponds also to the size of a second level page table 1396 r_iotlb_paddr = (paddr_t)(entry & ((1<<(m_paddr_nbits-PAGE_K_NBITS))-1)) << PAGE_K_NBITS | 1397 (paddr_t)(((r_iotlb_vaddr.read() & PTD_ID2_MASK) >> PAGE_K_NBITS) << 3); 1398 r_tlb_miss_init_req = true; 1399 r_tlb_miss_type = PTE2_MISS; 1400 r_dma_tlb_fsm = DMA_TLB_WAIT_TRANSACTION; 927 r_tlb_paddr = (vci_addr_t)(entry & ((1<<(vci_param_int::N-PAGE_K_NBITS))-1)) << PAGE_K_NBITS | 928 (vci_addr_t)(((r_dma_cmd_vaddr.read() & PTD_ID2_MASK) >> PAGE_K_NBITS) << 3); 929 r_tlb_miss_req = true; 930 r_tlb_miss_type = PTE2_MISS; 931 r_tlb_fsm = TLB_WAIT; 932 1401 933 #ifdef INSTRUMENTATION 1402 934 m_cpt_iotlbmiss_transaction++; 1403 935 #endif 1404 936 1405 #if DEBUG_DMA_TLB 1406 if ( m_debug_dma_tlb_fsm ) 1407 { 1408 std::cout << " <IOB.DMA_TLB_PTE1_GET> Success. Search PTE2" 1409 << std::hex << " / paddr = " << r_iotlb_paddr.read() 1410 << std::hex << " / PTD = " << entry << std::endl; 1411 } 937 #if DEBUG_TLB_MISS 938 if ( m_debug_activated ) 939 std::cout << " <IOB TLB_PTE1_GET> Success. Search PTE2" << std::hex 940 << " / PADDR = " << r_tlb_paddr.read() 941 << " / PTD = " << entry << std::endl; 1412 942 #endif 1413 943 } … … 1415 945 // Should not occur if working only with small pages 1416 946 { 1417 r_iotlb_pte_flags = entry; 1418 r_dma_tlb_fsm = DMA_TLB_PTE1_SELECT; 1419 1420 #if DEBUG_DMA_TLB 1421 if ( m_debug_dma_tlb_fsm ) 1422 { 1423 std::cout << " <IOB.DMA_TLB_PTE1_GET> Success. Big page" 1424 << std::hex << " / paddr = " << r_iotlb_paddr.read() 1425 << std::hex << " / PTE1 = " << entry << std::endl; 1426 } 1427 #endif 1428 } 1429 1430 break; 1431 } 1432 //////////////////////////// 1433 case DMA_TLB_PTE1_SELECT: // select a slot for PTE1 947 r_tlb_pte_flags = entry; 948 r_tlb_fsm = TLB_PTE1_SELECT; 949 950 #if DEBUG_TLB_MISS 951 if ( m_debug_activated ) 952 std::cout << " <IOB TLB_PTE1_GET> Success. Big page" 953 << std::hex << " / paddr = " << r_tlb_paddr.read() 954 << std::hex << " / PTE1 = " << entry << std::endl; 955 #endif 956 } 957 break; 958 } 959 ///////////////////// 960 case TLB_PTE1_SELECT: // select a slot for PTE1 1434 961 { 1435 962 size_t way; 1436 963 size_t set; 1437 964 1438 r_iotlb.select( r_ iotlb_vaddr.read(),965 r_iotlb.select( r_dma_cmd_vaddr.read(), 1439 966 true, // PTE1 1440 967 &way, … … 1444 971 #endif 1445 972 1446 #if DEBUG_DMA_TLB 1447 if ( m_debug_dma_tlb_fsm ) 1448 { 1449 std::cout << " <IOB.DMA_TLB_PTE1_SELECT> Select a slot in IOTLB:"; 1450 std::cout << " way = " << std::dec << way 1451 << " / set = " << set << std::endl; 1452 } 1453 #endif 1454 r_iotlb_way = way; 1455 r_iotlb_set = set; 1456 r_dma_tlb_fsm = DMA_TLB_PTE1_UPDT; 1457 break; 1458 } 1459 ////////////////////////// 1460 case DMA_TLB_PTE1_UPDT: // write a new PTE1 in tlb 1461 // not necessary to treat the L/R bit 1462 { 1463 //(OLD) paddr_t nline = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2); 1464 uint32_t pte = r_iotlb_pte_flags.read(); 973 #if DEBUG_TLB_MISS 974 if ( m_debug_activated ) 975 std::cout << " <IOB TLB_PTE1_SELECT> Select a slot in TLB" 976 << " / way = " << std::dec << way 977 << " / set = " << set << std::endl; 978 #endif 979 r_tlb_way = way; 980 r_tlb_set = set; 981 r_tlb_fsm = TLB_PTE1_UPDT; 982 break; 983 } 984 /////////////////// 985 case TLB_PTE1_UPDT: // write a new PTE1 in tlb 986 // not necessary to treat the L/R bit 987 { 988 uint32_t pte = r_tlb_pte_flags.read(); 1465 989 1466 r_ miss_paddr = (paddr_t)( ((r_iotlb_pte_flags.read() & PPN1_MASK) << 21)1467 | (r_ iotlb_vaddr.read()& M_PAGE_OFFSET_MASK) );990 r_tlb_paddr = (vci_addr_t)( ((r_tlb_pte_flags.read() & PPN1_MASK) << 21) 991 | (r_dma_cmd_vaddr.read()& M_PAGE_OFFSET_MASK) ); 1468 992 1469 993 // update TLB … … 1471 995 pte, 1472 996 0, // argument unused for a PTE1 1473 r_ iotlb_vaddr.read(),1474 r_ iotlb_way.read(),1475 r_ iotlb_set.read(),997 r_dma_cmd_vaddr.read(), 998 r_tlb_way.read(), 999 r_tlb_set.read(), 1476 1000 0 ); //we set nline = 0 1477 1001 #ifdef INSTRUMENTATION … … 1479 1003 #endif 1480 1004 1481 #if DEBUG_ DMA_TLB1482 if ( m_debug_ dma_tlb_fsm)1005 #if DEBUG_TLB_MISS 1006 if ( m_debug_activated ) 1483 1007 { 1484 std::cout << " <IOB.DMA_TLB_PTE1_UPDT> write PTE1 in IOTLB"; 1485 std::cout << " / set = " << std::dec << r_iotlb_set.read()1486 << " / way = " << r_iotlb_way.read() << std::endl;1487 1008 std::cout << " <IOB TLB_PTE1_UPDT> write PTE1 in TLB" 1009 << " / set = " << std::dec << r_tlb_set.read() 1010 << " / way = " << r_tlb_way.read() << std::endl; 1011 r_iotlb.printTrace(); 1488 1012 } 1489 1013 #endif 1490 1014 // next state 1491 r_ dma_tlb_fsm = DMA_TLB_RETURN; // exit sub-fsm1492 break; 1493 } 1494 ////////////////// ///////1495 case DMA_TLB_PTE2_GET: // Try to read a PTE2 (64 bits) in the miss buffer1015 r_tlb_fsm = TLB_RETURN; // exit sub-fsm 1016 break; 1017 } 1018 ////////////////// 1019 case TLB_PTE2_GET: // Try to read a PTE2 (64 bits) in the miss buffer 1496 1020 { 1497 1021 uint32_t pte_flags; 1498 1022 uint32_t pte_ppn; 1499 1023 1500 paddr_t line_number = (paddr_t)((r_iotlb_paddr.read())&(CACHE_LINE_MASK));1501 size_t word_position = (size_t)( ((r_ iotlb_paddr.read())&(~CACHE_LINE_MASK))>>2 );1024 vci_addr_t line_number = (vci_addr_t)((r_tlb_paddr.read())&(CACHE_LINE_MASK)); 1025 size_t word_position = (size_t)( ((r_tlb_paddr.read())&(~CACHE_LINE_MASK))>>2 ); 1502 1026 1503 1027 1504 1028 // Hit test. Just to verify. 1505 bool hit = (r_ miss_buf_valid && (r_miss_buf_tag.read()== line_number) );1029 bool hit = (r_tlb_buf_valid && (r_tlb_buf_tag.read()== line_number) ); 1506 1030 assert(hit and "Error: No hit on prefetch buffer after Miss Transaction"); 1507 pte_flags= r_ miss_buf_data[word_position];1508 pte_ppn= r_ miss_buf_data[word_position+1]; //because PTE2 is 2 words long1031 pte_flags= r_tlb_buf_data[word_position]; 1032 pte_ppn= r_tlb_buf_data[word_position+1]; //because PTE2 is 2 words long 1509 1033 // Bit valid checking 1510 1034 if ( not ( pte_flags & PTE_V_MASK) ) // unmapped 1511 1035 { 1512 1036 //must not occur! 1513 std::cout << "IOMMU ERROR " << name() << " DMA_TLB_IDLE state" << std::endl1037 std::cout << "IOMMU ERROR " << name() << "TLB_IDLE state" << std::endl 1514 1038 << "The Page Table entry ins't valid (unmapped)" << std::endl; 1515 1039 1516 r_tlb_error_type = MMU_READ_PT2_UNMAPPED; 1517 r_dma_tlb_error_req = true; 1518 r_dma_tlb_req = false; 1519 r_dma_tlb_fsm = DMA_TLB_IDLE; 1520 #if DEBUG_DMA_TLB 1521 if ( m_debug_dma_tlb_fsm ) 1522 { 1523 std::cout << " <IOB.DMA_TLB_PTE2_GET> PTE2 Unmapped" 1524 << std::hex << " / paddr = " << r_iotlb_paddr.read() 1525 << std::hex << " / PTE = " << pte_flags << std::endl; 1526 } 1527 #endif 1528 break; 1040 r_tlb_miss_error = true; 1041 r_dma_tlb_req = false; 1042 r_tlb_fsm = TLB_IDLE; 1043 1044 #if DEBUG_TLB_MISS 1045 if ( m_debug_activated ) 1046 std::cout << " <IOB TLB_PTE2_GET> PTE2 Unmapped" << std::hex 1047 << " / PADDR = " << r_tlb_paddr.read() 1048 << " / PTE = " << pte_flags << std::endl; 1049 #endif 1050 break; 1529 1051 } 1530 1052 1531 r_ iotlb_pte_flags = pte_flags;1532 r_ iotlb_pte_ppn = pte_ppn;1533 r_ dma_tlb_fsm = DMA_TLB_PTE2_SELECT;1053 r_tlb_pte_flags = pte_flags; 1054 r_tlb_pte_ppn = pte_ppn; 1055 r_tlb_fsm = TLB_PTE2_SELECT; 1534 1056 1535 #if DEBUG_DMA_TLB 1536 if ( m_debug_dma_tlb_fsm ) 1537 { 1538 std::cout << " <IOB.DMA_TLB_PTE2_GET> Mapped:" 1539 << " PTE_FLAGS = " << std::hex << pte_flags 1540 << " PTE_PPN = " << std::hex << pte_ppn << std::endl; 1541 } 1057 #if DEBUG_TLB_MISS 1058 if ( m_debug_activated ) 1059 std::cout << " <IOB TLB_PTE2_GET> Mapped" << std::hex 1060 << " / PTE_FLAGS = " << pte_flags 1061 << " / PTE_PPN = " << pte_ppn << std::endl; 1542 1062 #endif 1543 1063 break; 1544 1064 } 1545 1065 //////////////////////////// 1546 case DMA_TLB_PTE2_SELECT: // select a slot for PTE21066 case TLB_PTE2_SELECT: // select a slot for PTE2 1547 1067 { 1548 1068 size_t way; 1549 1069 size_t set; 1550 1070 1551 r_iotlb.select( r_ iotlb_vaddr.read(),1071 r_iotlb.select( r_dma_cmd_vaddr.read(), 1552 1072 false, // PTE2 1553 1073 &way, … … 1557 1077 #endif 1558 1078 1559 #if DEBUG_ DMA_TLB1560 if ( m_debug_ dma_tlb_fsm)1079 #if DEBUG_TLB_MISS 1080 if ( m_debug_activated ) 1561 1081 { 1562 std::cout << " <IOB .DMA_TLB_PTE2_SELECT> Select a slot in IOTLB:";1082 std::cout << " <IOB TLB_PTE2_SELECT> Select a slot in IOTLB:"; 1563 1083 std::cout << " way = " << std::dec << way 1564 1084 << " / set = " << set << std::endl; 1565 1085 } 1566 1086 #endif 1567 r_iotlb_way = way; 1568 r_iotlb_set = set; 1569 r_dma_tlb_fsm = DMA_TLB_PTE2_UPDT; 1570 break; 1571 } 1572 ////////////////////////// 1573 case DMA_TLB_PTE2_UPDT: // write a new PTE2 in tlb 1574 // not necessary to treat the L/R bit 1575 { 1576 //(OLD) paddr_t nline = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2); 1577 uint32_t pte_flags = r_iotlb_pte_flags.read(); 1578 uint32_t pte_ppn = r_iotlb_pte_ppn.read(); 1087 r_tlb_way = way; 1088 r_tlb_set = set; 1089 r_tlb_fsm = TLB_PTE2_UPDT; 1090 break; 1091 } 1092 /////////////////// 1093 case TLB_PTE2_UPDT: // write a new PTE2 in tlb 1094 // not necessary to treat the L/R bit 1095 { 1096 uint32_t pte_flags = r_tlb_pte_flags.read(); 1097 uint32_t pte_ppn = r_tlb_pte_ppn.read(); 1579 1098 1580 r_ miss_paddr = (paddr_t)( ((r_iotlb_pte_ppn.read() & PPN2_MASK) << 12)1581 | (r_ iotlb_vaddr.read()& K_PAGE_OFFSET_MASK) );1099 r_tlb_paddr = (vci_addr_t)( ((r_tlb_pte_ppn.read() & PPN2_MASK) << 12) 1100 | (r_dma_cmd_vaddr.read()& K_PAGE_OFFSET_MASK) ); 1582 1101 1583 1102 // update TLB for a PTE2 … … 1585 1104 pte_flags, 1586 1105 pte_ppn, 1587 r_ iotlb_vaddr.read(),1588 r_ iotlb_way.read(),1589 r_ iotlb_set.read(),1106 r_dma_cmd_vaddr.read(), 1107 r_tlb_way.read(), 1108 r_tlb_set.read(), 1590 1109 0 ); // nline = 0 1591 1110 #ifdef INSTRUMENTATION … … 1593 1112 #endif 1594 1113 1595 #if DEBUG_ DMA_TLB1596 if ( m_debug_ dma_tlb_fsm)1114 #if DEBUG_TLB_MISS 1115 if ( m_debug_activated ) 1597 1116 { 1598 std::cout << " <IOB .DMA_TLB_PTE2_UPDT> write PTE2 in IOTLB";1599 std::cout << " / set = " << std::dec << r_ iotlb_set.read()1600 << " / way = " << r_ iotlb_way.read() << std::endl;1117 std::cout << " <IOB TLB_PTE2_UPDT> write PTE2 in IOTLB"; 1118 std::cout << " / set = " << std::dec << r_tlb_set.read() 1119 << " / way = " << r_tlb_way.read() << std::endl; 1601 1120 r_iotlb.printTrace(); 1602 1121 } 1603 1122 #endif 1604 1123 // next state 1605 r_ dma_tlb_fsm = DMA_TLB_RETURN; // exit sub-fsm1606 break; 1607 } 1608 ////////////// /////////1609 case DMA_TLB_WAIT_TRANSACTION:1610 {1611 // CONFIG FSM request following a invalidation signal sent by OS.1612 if (r_config_tlb_req)1124 r_tlb_fsm = TLB_RETURN; 1125 break; 1126 } 1127 ////////////// 1128 case TLB_WAIT: // waiting completion of a miss transaction from MISS_WTI FSM 1129 // PTE inval request are handled as unmaskable interrupts 1130 { 1131 if ( r_config_tlb_req ) // Request from CONFIG FSM for a PTE invalidation 1613 1132 { 1614 1133 r_config_tlb_req = false; 1615 1134 r_waiting_transaction = true; 1616 r_ dma_tlb_fsm = DMA_TLB_INVAL_CHECK;1135 r_tlb_fsm = TLB_INVAL_CHECK; 1617 1136 } 1618 1137 … … 1620 1139 m_cost_iotlbmiss_transaction++; 1621 1140 #endif 1622 if ( not r_tlb_miss_ init_req ) // Miss transaction is done1141 if ( not r_tlb_miss_req ) // Miss transaction is done 1623 1142 { 1624 if ( r_miss_ init_error.read() ) // bus error1143 if ( r_miss_wti_rsp_error.read() ) // bus error 1625 1144 { 1626 r_miss_init_error = false; 1627 r_tlb_error_type = MMU_READ_DATA_ILLEGAL_ACCESS; 1628 r_dma_tlb_error_req = true; 1629 r_dma_tlb_req = false; 1630 r_dma_tlb_fsm = DMA_TLB_IDLE; 1145 r_miss_wti_rsp_error = false; 1146 r_tlb_miss_error = true; 1147 r_dma_tlb_req = false; 1148 r_tlb_fsm = TLB_IDLE; 1631 1149 } 1632 1150 else if(r_tlb_miss_type == PTE1_MISS) 1633 1151 { 1634 r_dma_tlb_fsm = DMA_TLB_PTE1_GET; 1635 1152 r_tlb_fsm = TLB_PTE1_GET; 1636 1153 } 1637 1154 else 1638 1155 { 1639 r_ dma_tlb_fsm = DMA_TLB_PTE2_GET;1156 r_tlb_fsm = TLB_PTE2_GET; 1640 1157 } 1641 1158 } 1642 1159 break; 1643 1160 } 1644 /////////////////////// 1645 case DMA_TLB_RETURN: // return to caller depending on tlb miss type 1646 { 1647 #if DEBUG_DMA_TLB 1648 if ( m_debug_dma_tlb_fsm ) 1649 { 1650 std::cout << " <IOB.DMA_TLB_RETURN> IOTLB MISS completed" << std::endl; 1651 } 1652 #endif 1653 r_dma_tlb_req = false; 1654 r_tlb_dma_untreated = true; 1655 r_dma_tlb_fsm = DMA_TLB_IDLE; 1656 break; 1657 } 1658 ////////////////////// 1659 case DMA_TLB_INVAL_CHECK: // request from CONFIG FSM to invalidate all PTE on a given line 1660 // This state checks the necessity to invalidate prefetch buffer 1161 //////////////// 1162 case TLB_RETURN: // reset r_dma_tlb_req flip-flop to signal TLB miss completion 1163 // possible errors are signaled through r_tlb_miss_error 1164 { 1165 #if DEBUG_TLB_MISS 1166 if ( m_debug_activated ) 1167 std::cout << " <IOB TLB_RETURN> IOTLB MISS completed" << std::endl; 1168 #endif 1169 r_dma_tlb_req = false; 1170 r_tlb_fsm = TLB_IDLE; 1171 break; 1172 } 1173 ///////////////////// 1174 case TLB_INVAL_CHECK: // request from CONFIG_FSM to invalidate all PTE in a given line 1175 // checks the necessity to invalidate prefetch buffer 1661 1176 { 1662 1177 // If a transaction is pending, no need to invalidate the prefetch 1663 1178 // We can ignore it, since we'll replace the line. 1664 1179 // The new line is necessarily up-to-date 1665 if(!r_waiting_transaction.read() && r_ miss_buf_valid)1666 { 1667 if(!r_ miss_buf_first_level)1180 if(!r_waiting_transaction.read() && r_tlb_buf_valid) 1181 { 1182 if(!r_tlb_buf_big_page) 1668 1183 { 1669 if( r_ miss_buf_vaddr_begin.read() ==1670 (r_config_ tlb_inval_vaddr.read()& ~PTE2_LINE_OFFSET) )1184 if( r_tlb_buf_vaddr.read() == 1185 (r_config_cmd_inval_vaddr.read()& ~PTE2_LINE_OFFSET) ) 1671 1186 // The virtual address corresponds to one entry on the buffer line 1672 1187 { 1673 r_ miss_buf_valid = false; //change here for individual invalidation1188 r_tlb_buf_valid = false; //change here for individual invalidation 1674 1189 } 1675 1190 } 1676 1191 else // First level entries on buffer. Unused if only small pages 1677 1192 { 1678 if( r_ miss_buf_vaddr_begin.read() ==1679 (r_config_ tlb_inval_vaddr.read()& ~PTE1_LINE_OFFSET) )1193 if( r_tlb_buf_vaddr.read() == 1194 (r_config_cmd_inval_vaddr.read()& ~PTE1_LINE_OFFSET) ) 1680 1195 // The virtual address corresponds to one entry on the buffer line 1681 1196 { 1682 r_ miss_buf_valid = false; //change here for individual invalidation1197 r_tlb_buf_valid = false; //change here for individual invalidation 1683 1198 } 1684 1199 } … … 1687 1202 // Invalidation on IOTLB 1688 1203 bool ok; 1689 ok = r_iotlb.inval(r_config_ tlb_inval_vaddr.read());1204 ok = r_iotlb.inval(r_config_cmd_inval_vaddr.read()); 1690 1205 1691 if(r_waiting_transaction.read()) r_ dma_tlb_fsm =DMA_TLB_WAIT_TRANSACTION;1692 else r_ dma_tlb_fsm = DMA_TLB_IDLE;1206 if(r_waiting_transaction.read()) r_tlb_fsm =TLB_WAIT; 1207 else r_tlb_fsm = TLB_IDLE; 1693 1208 break; 1694 1209 } 1695 } //end switch r_ dma_tlb_fsm1210 } //end switch r_tlb_fsm 1696 1211 1697 1698 ///////////////////////////////////////////////////////////////////// 1699 // The CONFIG_CMD_FSM is similar to the DMA_CMD_FSM, but without miss TLB treatment. 1700 // It controls the following ressources: 1701 // - r_config_cmd_fsm 1702 // 1703 // - r_config_cmd_rsp_erase_req (set) 1704 // - r_config_tlb_req (set) 1705 ///////////////////////////////////////////////////////////////////// 1212 //////////////////////////////////////////////////////////////////////////////// 1213 // The CONFIG_CMD_FSM handles the VCI commands from the INT network. 1214 // This FSM is mainly intended to handle single flit config transactions, 1215 // but it can also handle software driven, multi-flits data transactions. 1216 // - The configuration requests can be local (IO_BRIDGE config registers) 1217 // or remote (config registers of peripherals on IOX network). 1218 // - The data requests are always remote. 1219 // In case of local config, this FSM put a VCI response in CONFIG_RSP fifo. 1220 // In case of remote transaction, it put the VCI command in CONFIG_CMD fifo. 1221 /////////////////////////////////////////////////////////////////////////////// 1706 1222 1707 1223 switch( r_config_cmd_fsm.read() ) 1708 1224 { 1709 ////////////// 1710 case CONFIG_CMD_IDLE: 1711 { 1712 if ( p_vci_tgt_config.cmdval.read() ) 1713 { 1225 ///////////////////// 1226 case CONFIG_CMD_IDLE: // waiting VCI command 1227 { 1228 if ( p_vci_tgt_int.cmdval.read() ) 1229 { 1230 1714 1231 #if DEBUG_CONFIG_CMD 1715 if( m_debug_config_cmd_fsm ) 1716 { 1717 std::cout << " <IOB.CONFIG_CMD_IDLE> Configuration command received!" <<std::endl; 1718 std::cout << " address = " << std::hex << p_vci_tgt_config.address.read() 1719 << " srcid = " << std::dec << p_vci_tgt_config.srcid.read() 1720 << " trdid = " << p_vci_tgt_config.trdid.read() 1721 << " wdata = " << std::hex << p_vci_tgt_config.wdata.read() 1722 << " be = " << p_vci_tgt_config.be.read() 1723 << " plen = " << std::dec << p_vci_tgt_config.plen.read() << std::endl; 1724 } 1725 #endif 1726 paddr_t config_paddr = p_vci_tgt_config.address.read(); 1727 1728 // // Just to verify 1729 // if(! m_locality_table_config[config_paddr] ) //cannot receive remote packets 1730 // { 1731 // std::cout << "IOB ERROR " << name() << " CONFIG_CMD_IDLE state" << std::endl 1732 // << "Received a remote packet" << std::endl; 1733 // exit(0); 1734 // } 1735 1736 bool read = (p_vci_tgt_config.cmd.read() == vci_param_d::CMD_READ); 1737 1738 uint32_t cell = (uint32_t)((config_paddr & 0x1FF)>>2); 1739 1740 // Treatement of received command 1741 // Verifies error, tests if the the command is for IOB itself 1232 if( m_debug_activated ) 1233 std::cout << " <IOB CONFIG_CMD_IDLE> Command received" 1234 << " / address = " << std::hex << p_vci_tgt_int.address.read() 1235 << " / srcid = " << std::dec << p_vci_tgt_int.srcid.read() 1236 << " / trdid = " << p_vci_tgt_int.trdid.read() 1237 << " / wdata = " << std::hex << p_vci_tgt_int.wdata.read() 1238 << " / be = " << p_vci_tgt_int.be.read() 1239 << " / plen = " << std::dec << p_vci_tgt_int.plen.read() 1240 << " / eop = " << p_vci_tgt_int.eop.read() << std::endl; 1241 #endif 1242 vci_addr_t paddr = p_vci_tgt_int.address.read(); 1243 bool read = (p_vci_tgt_int.cmd.read() == vci_param_int::CMD_READ); 1244 uint32_t cell = (uint32_t)((paddr & 0x1FF)>>2); 1742 1245 1743 // To IOB itself 1744 if(m_segment_config.contains(config_paddr)) 1246 // The "local" segment must be the first in the seglist 1247 soclib::common::Segment seg = m_int_seglist.front(); 1248 1249 if ( seg.contains(paddr) ) // IO_BRIDGE itself 1745 1250 { 1746 if(!read && (cell == IOB_IOMMU_PTPR)) 1747 r_config_cmd_fsm = CONFIG_CMD_PTPR_WRITE; 1748 else if(read && (cell == IOB_IOMMU_PTPR)) 1749 r_config_cmd_fsm = CONFIG_CMD_PTPR_READ; 1750 else if(!read && (cell == IOB_IOMMU_ACTIVE)) 1751 r_config_cmd_fsm = CONFIG_CMD_ACTIVE_WRITE; 1752 else if(read && (cell == IOB_IOMMU_ACTIVE)) 1753 r_config_cmd_fsm = CONFIG_CMD_ACTIVE_READ; 1754 else if(read && (cell == IOB_IOMMU_BVAR)) 1755 r_config_cmd_fsm = CONFIG_CMD_BVAR_READ; 1756 else if(read && (cell == IOB_IOMMU_ETR)) 1757 r_config_cmd_fsm = CONFIG_CMD_ETR_READ; 1758 else if(read && (cell == IOB_IOMMU_BAD_ID)) 1759 r_config_cmd_fsm = CONFIG_CMD_BAD_ID_READ; 1760 // PTE invalidation signaled by the OS 1761 else if(!read && (cell == IOB_INVAL_PTE)) 1762 r_config_cmd_fsm = CONFIG_CMD_INVAL_REQ; 1763 else if(!read && (cell == IOB_IT_ADDR_IOMMU_LO)) 1764 r_config_cmd_fsm = CONFIG_CMD_IT_ADDR_IOMMU_WRITE_1; 1765 else if(read && (cell == IOB_IT_ADDR_IOMMU_LO)) 1766 r_config_cmd_fsm = CONFIG_CMD_IT_ADDR_IOMMU_READ_1; 1767 else if( !read && ((cell >= IOB_IT_ADDR_BEGIN)&& 1768 ( cell< (IOB_IT_ADDR_BEGIN +2*m_nb_periph-1) ) ) ) 1769 { 1770 // a factor two shows up because the registres come in couples 1771 r_it_index = (cell - IOB_IT_ADDR_BEGIN)/2; 1772 r_config_cmd_fsm = CONFIG_CMD_IT_ADDR_WRITE_1; 1251 uint32_t rdata = 0; 1252 bool rerror = false; 1253 1254 if ( not read && (cell == IOB_IOMMU_PTPR) ) // WRITE PTPR 1255 { 1256 r_iommu_ptpr = (uint32_t)p_vci_tgt_int.wdata.read(); 1257 } 1258 else if ( read && (cell == IOB_IOMMU_PTPR) ) // READ PTPR 1259 { 1260 rdata = r_iommu_ptpr.read(); 1261 } 1262 else if( not read && (cell == IOB_WTI_ENABLE)) // WRITE WTI_ENABLE 1263 { 1264 r_iommu_wti_enable = p_vci_tgt_int.wdata.read(); 1265 } 1266 else if( read && (cell == IOB_WTI_ENABLE)) // READ WTI ENABLE 1267 { 1268 rdata = r_iommu_wti_enable.read(); 1269 } 1270 else if( read && (cell == IOB_IOMMU_BVAR)) // READ BVAR 1271 { 1272 rdata = r_iommu_bvar.read(); 1273 } 1274 else if( read && (cell == IOB_IOMMU_ETR)) // READ ETR 1275 { 1276 rdata = r_iommu_etr.read(); 1277 } 1278 else if( read && (cell == IOB_IOMMU_BAD_ID)) // READ BAD_ID 1279 { 1280 rdata = r_iommu_bad_id.read(); 1281 } 1282 else if( not read && (cell == IOB_INVAL_PTE)) // WRITE INVAL_PTE 1283 { 1284 r_config_tlb_req = true; 1285 r_config_cmd_inval_vaddr = (uint32_t)p_vci_tgt_int.wdata.read(); 1286 } 1287 else if( not read && (cell == IOB_WTI_ADDR_LO)) // WRITE WTI_PADDR_LO 1288 { 1289 r_iommu_wti_paddr = (vci_addr_t)p_vci_tgt_int.wdata.read(); 1290 } 1291 else if( read && (cell == IOB_WTI_ADDR_LO)) // READ WTI_PADDR_LO 1292 { 1293 rdata = (uint32_t)r_iommu_wti_paddr.read(); 1294 } 1295 else if( not read && (cell == IOB_WTI_ADDR_HI)) // WRITE WTI_PADDR_HI 1296 { 1297 r_iommu_wti_paddr = (r_iommu_wti_paddr.read() & 0x00000000FFFFFFFFLL) | 1298 ((vci_addr_t)p_vci_tgt_int.wdata.read())<<32; 1299 } 1300 else if( read && (cell == IOB_WTI_ADDR_HI)) // READ WTI_PADDR_HI 1301 { 1302 rdata = (uint32_t)(r_iommu_wti_paddr.read()>>32); 1303 } 1304 else if( not read && ((cell >= IOB_PERI_WTI_BEGIN) // WRITE PERI WTI 1305 && (cell< (IOB_PERI_WTI_BEGIN + 64))) ) 1306 { 1307 size_t index = (cell - IOB_PERI_WTI_BEGIN)/2; 1308 bool high = (cell - IOB_PERI_WTI_BEGIN)%2; 1309 if ( high ) r_iommu_peri_wti[index] = // set 32 MSB bits 1310 (r_iommu_peri_wti[index].read() & 0x00000000FFFFFFFFLL) | 1311 ((vci_addr_t)p_vci_tgt_int.wdata.read())<<32; 1312 else r_iommu_peri_wti[index] = // set 32 LSB bits 1313 (vci_addr_t)p_vci_tgt_int.wdata.read(); 1773 1314 } 1774 else if( read && ((cell >= IOB_IT_ADDR_BEGIN)&& 1775 (cell< (IOB_IT_ADDR_BEGIN +2*m_nb_periph-1))) ) 1776 { 1777 r_it_index = (cell - IOB_IT_ADDR_BEGIN)/2; 1778 r_config_cmd_fsm = CONFIG_CMD_IT_ADDR_READ_1; 1779 } 1780 else 1781 //Error. Wrong address, or invalid operation. 1782 { 1783 if(read) r_config_error_type = READ_ERROR; 1784 else r_config_error_type = WRITE_ERROR; 1785 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 1786 } 1315 else if( read && ((cell >= IOB_PERI_WTI_BEGIN) // READ PERI WTI 1316 && (cell< (IOB_PERI_WTI_BEGIN + 64))) ) 1317 { 1318 size_t index = (cell - IOB_PERI_WTI_BEGIN)/2; 1319 bool high = (cell - IOB_PERI_WTI_BEGIN)%2; 1320 if ( high ) rdata = (uint32_t)(r_iommu_peri_wti[index].read()>>32); 1321 else rdata = (uint32_t)(r_iommu_peri_wti[index].read()); 1322 } 1323 else // Error: Wrong address, or invalid operation. 1324 { 1325 rerror = true; 1326 } 1327 r_config_cmd_rdata = rdata; 1328 r_config_cmd_error = rerror; 1329 r_config_cmd_fsm = CONFIG_CMD_FIFO_PUT_RSP; 1787 1330 } 1788 // Must route the command to the correct IO 1789 else 1331 else // remote peripheral 1790 1332 { 1791 if(!p_vci_tgt_config.eop.read()) 1792 { 1793 //Error 1794 if(read) r_config_error_type = READ_ERROR; 1795 else r_config_error_type = WRITE_ERROR; 1796 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 1797 } 1798 1799 // Find the corresponding address on IO Space 1800 // int tgt_index = m_routing_table_config[config_paddr]; 1801 //#if DEBUG_CONFIG_CMD 1802 //if( m_debug_config_cmd_fsm ) 1803 //{ 1804 // std::cout << " <IOB.CONFIG_CMD_IDLE> Routing a configuration packet" <<std::endl 1805 // << "Target Index on Direct NoC: " << tgt_index << std::endl; 1806 //} 1807 //#endif 1808 // soclib::common::Segment io_segment = m_mtio.getSegment(IntTab(tgt_index)); 1809 // #define L2 soclib::common::uint32_log2 1810 // paddr_t offset_mask = ( (1 << L2(io_segment.size())) - 1); 1811 // #undef L2 1812 // r_config_vaddr = (vaddr_t)( io_segment.baseAddress() | 1813 // (vaddr_t)(config_paddr & offset_mask) ); 1814 1815 // TODO So far, it is in identity mapping 1816 r_config_vaddr = (vaddr_t) config_paddr ; 1817 r_config_cmd_fsm = CONFIG_CMD_TRT_LOCK; 1818 1333 r_config_cmd_fsm = CONFIG_CMD_FIFO_PUT_CMD; 1819 1334 } 1820 1821 1822 1335 } // end if cmdval 1823 1336 break; 1824 1337 } 1825 ///////////////////////// 1826 case CONFIG_CMD_TRT_LOCK: // Waiting for the lock to modify Transaction Table 1827 { 1828 if ( r_alloc_trt_config_fsm.read() == ALLOC_TRT_CONFIG_CMD ) 1338 ///////////////////////////// 1339 case CONFIG_CMD_FIFO_PUT_CMD: // transmit VCI command from the INT network 1340 // to the CONFIG_CMD fifo to IOX network 1341 { 1342 config_cmd_fifo_put = true; 1343 1344 if ( p_vci_tgt_int.cmdval.read() and m_config_cmd_addr_fifo.wok() ) 1829 1345 { 1830 1346 1831 1347 #if DEBUG_CONFIG_CMD 1832 if( m_debug_config_cmd_fsm ) 1833 { 1834 std::cout << " <IOB.CONFIG_CMD_TRT_LOCK> Check the TRT" << std::endl; 1835 } 1836 #endif 1837 size_t wok_index = 0; 1838 bool wok = !m_transaction_tab_config.full(wok_index); 1839 1840 if ( wok ) // TRT isn't full. Write the new transaction. 1348 if( m_debug_activated ) 1349 std::cout << " <IOB CONFIG_CMD_FIFO_PUT_CMD> Transmit VCI command to IOX network" 1350 << " : address = " << std::hex << p_vci_tgt_int.address.read() 1351 << " / srcid = " << p_vci_tgt_int.srcid.read() 1352 << std::endl; 1353 #endif 1354 if( p_vci_tgt_int.eop.read() ) r_config_cmd_fsm = CONFIG_CMD_IDLE; 1355 } 1356 break; 1357 } 1358 ///////////////////////////// 1359 case CONFIG_CMD_FIFO_PUT_RSP: // Try to put a response in CONFIG_RSP fifo, 1360 // for a local configuration transaction. 1361 // The FIFO is shared with CONFIG_RSP FSM 1362 // and must we wait for allocation... 1363 { 1364 if ( p_vci_tgt_int.cmdval.read() and r_alloc_fifo_config_rsp_local.read() ) 1365 { 1366 config_rsp_fifo_put = true; 1367 1368 if ( m_config_rsp_data_fifo.wok() ) 1841 1369 { 1842 r_config_cmd_trt_index = (vci_trdid_t)wok_index; 1843 r_config_cmd_fsm = CONFIG_CMD_TRT_SET; 1844 } 1845 else // wait an empty entry in TRT 1846 { 1847 r_config_cmd_fsm = CONFIG_CMD_TRT_WAIT; 1848 r_config_cmd_rsp_erase_req = true; 1370 1849 1371 #if DEBUG_CONFIG_CMD 1850 if( m_debug_config_cmd_fsm ) 1851 { 1852 std::cout << " <IOB.CONFIG_CMD_TRT_LOCK> TRT is full. Going to TRT_WAIT state" << std::endl; 1853 } 1854 #endif 1855 1856 #ifdef INSTRUMENTATION 1857 m_cpt_trt_config_full++; 1858 #endif 1372 if( m_debug_activated ) 1373 std::cout << " <IOB CONFIG_CMD_FIFO_PUT_RSP> Response to a local configuration request" 1374 << std::endl; 1375 #endif 1376 if( p_vci_tgt_int.eop.read() ) r_config_cmd_fsm = CONFIG_CMD_IDLE; 1859 1377 } 1860 1378 } 1861 1379 break; 1862 1380 } 1863 //////////////// 1864 case CONFIG_CMD_TRT_WAIT: // release the lock protecting the transaction tab 1865 // waits that RSP erases an entry 1866 { 1867 #ifdef INSTRUMENTATION 1868 m_cpt_trt_config_full_cost++; 1869 #endif 1870 // CONFIG_RSP will notify an erase action by reseting this register 1871 if(!r_config_cmd_rsp_erase_req.read()) 1872 { 1873 r_config_cmd_fsm = CONFIG_CMD_TRT_LOCK; // take the lock again 1874 } 1875 break; 1876 } 1877 //////////////////////// 1878 case CONFIG_CMD_TRT_SET: // register a new transaction in TRT 1879 { 1880 if ( r_alloc_trt_config_fsm.read() == ALLOC_TRT_CONFIG_CMD ) 1881 { 1882 m_transaction_tab_config.set( r_config_cmd_trt_index.read(), 1883 p_vci_tgt_config.srcid.read(), 1884 p_vci_tgt_config.trdid.read() ); 1885 1886 r_config_cmd_fsm = CONFIG_CMD_FIFO_PUT; 1887 #if DEBUG_CONFIG_CMD 1888 if( m_debug_config_cmd_fsm ) 1889 { 1890 std::cout << " <IOB.CONFIG_CMD_TRT_SET> Set a new entry in TRT" << std::endl; 1891 } 1892 #endif 1893 } 1894 break; 1895 } 1896 /////////////////////// 1897 case CONFIG_CMD_FIFO_PUT: 1898 { 1899 if ( p_vci_tgt_config.cmdval && m_config_cmd_addr_fifo.wok() ) 1900 { 1901 config_cmd_fifo_put = true; 1902 if( p_vci_tgt_config.eop ) r_config_cmd_fsm = CONFIG_CMD_IDLE; 1903 1904 #if DEBUG_CONFIG_CMD 1905 if( m_debug_config_cmd_fsm ) 1906 { 1907 std::cout << " <IOB.CONFIG_CMD_FIFO_PUT> Push into config_cmd_fifo:" 1908 << " address = " << std::hex << r_config_vaddr.read() 1909 << " srcid = " << std::dec << m_srcid_config 1910 << " trdid = " << r_config_cmd_trt_index.read() 1911 << " wdata = " << std::hex << p_vci_tgt_config.wdata.read() 1912 << " be = " << p_vci_tgt_config.be.read() 1913 << " plen = " << std::dec << p_vci_tgt_config.plen.read() << std::endl; 1914 } 1915 #endif 1916 } 1917 break; 1918 } 1919 1920 /////////////////////////////// 1921 // Private Configuration States 1922 /////////////////////////////// 1923 1924 ////////////////// 1925 case CONFIG_CMD_PTPR_WRITE: // Convention- The word received is in the format: 1926 // 00000 BASE_ADDRESS[39:13] 1927 // Same pattern as in iommu_ptpr register 1928 { 1929 if ( p_vci_tgt_config.cmdval.read() && m_config_local_data_fifo.wok() 1930 && r_dma_tlb_fsm == DMA_TLB_IDLE ) 1931 { 1932 // This verification could have been done on IDLE state 1933 // It would save us one cycle 1934 if ( !p_vci_tgt_config.eop.read() ) 1935 { 1936 std::cout << "CONFIG_CMD ERROR " << name() << " CONFIG_CMD_PTPR_WRITE state" << std::endl; 1937 std::cout << " PTPR write command must contain one single flit" << std::endl; 1938 r_config_error_type = WRITE_ERROR; 1939 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 1940 break; 1941 } 1942 1943 // Depends on the convention 1944 r_iommu_ptpr = (uint32_t)(p_vci_tgt_config.wdata.read()); 1945 1946 config_local_fifo_put = true; 1947 r_config_cmd_fsm = CONFIG_CMD_IDLE; 1948 1949 #if DEBUG_CONFIG_CMD 1950 if( m_debug_config_cmd_fsm ) 1951 { 1952 std::cout << " <IOB.CONFIG_CMD_PTPR_WRITE> PTPR received:" 1953 << "r_iommu_ptpr = " << std::hex << (p_vci_tgt_config.wdata.read()) 1954 <<std::endl; 1955 } 1956 #endif 1957 } 1958 break; 1959 } 1381 } // end switch CONFIG_CMD FSM 1382 1383 ////////////////////////////////////////////////////////////////////////////// 1384 // The CONFIG_RSP_FSM handles the VCI responses from the periherals 1385 // on the IOX network and writes the responses in the CONFIG_RSP fifo. 1386 // The VCI response flit is only consumed in the FIFO_PUT state. 1387 // This FSM is mainly intended to handle single flit config transactions, 1388 // but it can also handle software driven, multi-flits data transactions. 1389 ////////////////////////////////////////////////////////////////////////////// 1390 1391 switch( r_config_rsp_fsm.read() ) 1392 { 1960 1393 ///////////////////// 1961 case CONFIG_CMD_ACTIVE_WRITE: 1962 { 1963 if ( p_vci_tgt_config.cmdval.read() && m_config_local_data_fifo.wok() 1964 && r_dma_tlb_fsm == DMA_TLB_IDLE ) 1965 { 1966 // This verification could have been done on IDLE state 1967 // It would save us one cycle 1968 if ( !p_vci_tgt_config.eop.read() ) 1969 { 1970 std::cout << "CONFIG_CMD ERROR " << name() << " CONFIG_CMD_ACTIVE_WRITE state" << std::endl; 1971 std::cout << " ACTIVE write command must contain one single flit" << std::endl; 1972 r_config_error_type = WRITE_ERROR; 1973 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 1974 break; 1975 } 1976 1977 r_iommu_active = (p_vci_tgt_config.wdata.read() != 0); 1978 1979 config_local_fifo_put = true; 1980 r_config_cmd_fsm = CONFIG_CMD_IDLE; 1981 } 1982 break; 1983 } 1984 /////////////////// 1985 case CONFIG_CMD_INVAL_REQ: // Blocks in case of untreated request 1986 { 1987 if ( !r_config_tlb_req.read() ) 1988 { 1989 r_config_tlb_req = true; 1990 r_config_cmd_fsm = CONFIG_CMD_INVAL; 1991 } 1992 break; 1993 } 1994 /////////////////// 1995 case CONFIG_CMD_INVAL: // Consuming the 32bit Virtual Address of the invalidated page 1996 { 1997 if ( p_vci_tgt_config.cmdval.read() && 1998 m_config_local_data_fifo.wok() ) 1999 { 2000 2001 if ( !p_vci_tgt_config.eop.read() ) 2002 { 2003 std::cout << "CONFIG_CMD ERROR " << name() << " CONFIG_CMD_INVAL state" << std::endl; 2004 std::cout << " PTE invalidation commands must contain one single flit" << std::endl; 2005 r_config_error_type = WRITE_ERROR; 2006 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 2007 break; 2008 } 2009 2010 assert( (p_vci_tgt_config.wdata.read()& K_PAGE_OFFSET_MASK) == 0 2011 and " Error : Invalid format for Page Virtual Address. At least the 12 LSB bits must be zero"); 2012 2013 r_config_tlb_inval_vaddr = (vaddr_t)(p_vci_tgt_config.wdata.read()); 2014 2015 config_local_fifo_put = true; 2016 r_config_cmd_fsm = CONFIG_CMD_IDLE; 2017 } 2018 break; 2019 } 2020 ////////////////// 2021 case CONFIG_CMD_IT_ADDR_IOMMU_WRITE_1: 2022 { 2023 if ( p_vci_tgt_config.cmdval.read() && m_config_local_data_fifo.wok()) 2024 { 2025 if(vci_param_d::N <= 32) 2026 { 2027 // address holds in one single flit 2028 if (!p_vci_tgt_config.eop.read() ) 2029 { 2030 2031 std::cout << "CONFIG_CMD ERROR " << name() << " CONFIG_CMD_IT_ADDR_IOMMU_WRITE_1 state" << std::endl; 2032 std::cout << " PTE invalidation command should contain just one flit" << std::endl; 2033 r_config_error_type = WRITE_ERROR; 2034 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 2035 } 2036 else 2037 { 2038 // If physical address holds on a single word 2039 r_it_addr[r_it_index.read()] = (paddr_t)(p_vci_tgt_config.wdata.read()); 2040 2041 config_local_fifo_put = true; 2042 r_config_cmd_fsm = CONFIG_CMD_IDLE; 2043 } 2044 2045 } 2046 else 2047 { 2048 // two flits are required to send address 2049 if ( p_vci_tgt_config.eop.read() ) 2050 { 2051 2052 std::cout << "CONFIG_CMD ERROR " << name() << " CONFIG_CMD_IT_ADDR_IOMMU_WRITE_1 state" << std::endl; 2053 std::cout << " PTE invalidation commands should contain two flits" << std::endl; 2054 r_config_error_type = WRITE_ERROR; 2055 r_config_cmd_fsm = CONFIG_CMD_ERROR_RSP; 2056 } 2057 else 2058 { 2059 r_config_first_word = p_vci_tgt_config.wdata.read(); 2060 r_config_cmd_fsm = CONFIG_CMD_IT_ADDR_IOMMU_WRITE_2; 2061 } 2062 } 2063 } 2064 break; 2065 } 2066 ///////////////// 2067 case CONFIG_CMD_IT_ADDR_IOMMU_WRITE_2: 2068 { 2069 if ( p_vci_tgt_config.cmdval.read() && m_config_local_data_fifo.wok() ) 2070 { 2071 if ( !p_vci_tgt_config.eop.read() ) 2072 { 2073 std::cout << "CONFIG_CMD ERROR " << name() << " CONFIG_CMD_IT_IOMMU_WRITE_2 state" << std::endl; 2074 std::cout << " PTE invalidation commands must contain two flits" << std::endl; 2075 r_config_error_type = WRITE_ERROR; 2076 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 2077 break; 2078 } 2079 2080 // Depends on the convention 2081 size_t mask_msb = (1 << (vci_param_d::N - 32)) - 1 ; 2082 r_it_addr_iommu = (paddr_t)(r_config_first_word.read() | 2083 ((p_vci_tgt_config.wdata.read()& mask_msb)<<32)); 2084 2085 config_local_fifo_put = true; 2086 r_config_cmd_fsm = CONFIG_CMD_IDLE; 2087 } 2088 } 2089 ////////////////// 2090 case CONFIG_CMD_IT_ADDR_WRITE_1: 2091 { 2092 if ( p_vci_tgt_config.cmdval.read() && m_config_local_data_fifo.wok()) 2093 { 2094 if(vci_param_d::N <= 32) 2095 { 2096 // address holds in one single flit 2097 if (!p_vci_tgt_config.eop.read() ) 2098 { 2099 2100 std::cout << "CONFIG_CMD ERROR " << name() << " CONFIG_CMD_IT_ADDR_WRITE_1 state" << std::endl; 2101 std::cout << " PTE invalidation command should contain just one flit" << std::endl; 2102 r_config_error_type = WRITE_ERROR; 2103 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 2104 2105 2106 } 2107 else 2108 { 2109 // If physical address holds on a single word 2110 r_it_addr[r_it_index.read()] = (paddr_t)(p_vci_tgt_config.wdata.read()); 2111 2112 config_local_fifo_put = true; 2113 r_config_cmd_fsm = CONFIG_CMD_IDLE; 2114 } 2115 2116 } 2117 else 2118 { 2119 // two flits are required to send address 2120 if ( p_vci_tgt_config.eop.read() ) 2121 { 2122 2123 std::cout << "CONFIG_CMD ERROR " << name() << " CONFIG_CMD_IT_ADDR_WRITE_1 state" << std::endl; 2124 std::cout << " PTE invalidation commands should contain two flits" << std::endl; 2125 r_config_error_type = WRITE_ERROR; 2126 r_config_cmd_fsm = CONFIG_CMD_ERROR_RSP; 2127 } 2128 else 2129 { 2130 r_config_first_word = p_vci_tgt_config.wdata.read(); 2131 r_config_cmd_fsm = CONFIG_CMD_IT_ADDR_WRITE_2; 2132 } 2133 } 2134 } 2135 break; 2136 } 2137 ///////////////// 2138 case CONFIG_CMD_IT_ADDR_WRITE_2: 2139 { 2140 if ( p_vci_tgt_config.cmdval.read() && m_config_local_data_fifo.wok() ) 2141 { 2142 if ( !p_vci_tgt_config.eop.read() ) 2143 { 2144 std::cout << "CONFIG_CMD ERROR " << name() << " CONFIG_CMD_IT_ADDR_WRITE_2 state" << std::endl; 2145 std::cout << " PTE invalidation commands must contain two flits" << std::endl; 2146 r_config_error_type = WRITE_ERROR; 2147 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 2148 break; 2149 } 2150 2151 // Depends on the convention 2152 size_t mask_msb = (1 << (vci_param_d::N - 32)) - 1 ; 2153 r_it_addr[r_it_index.read()] = (paddr_t)(r_config_first_word.read() | 2154 ((p_vci_tgt_config.wdata.read()& mask_msb)<<32)); 2155 2156 config_local_fifo_put = true; 2157 r_config_cmd_fsm = CONFIG_CMD_IDLE; 2158 } 2159 } 2160 ////////////////// 2161 case CONFIG_CMD_PTPR_READ: 2162 case CONFIG_CMD_ACTIVE_READ: 2163 case CONFIG_CMD_BVAR_READ: 2164 case CONFIG_CMD_ETR_READ: 2165 case CONFIG_CMD_BAD_ID_READ: 2166 case CONFIG_CMD_IT_ADDR_IOMMU_READ_1: 2167 case CONFIG_CMD_IT_ADDR_READ_1: 2168 { 2169 if ( p_vci_tgt_config.cmdval.read() && m_config_local_data_fifo.wok() ) 2170 { 2171 // This verification could have been done on IDLE state 2172 // It would save us one cycle 2173 if ( !p_vci_tgt_config.eop.read() ) 2174 { 2175 std::cout << "CONFIG_CMD ERROR " << name() << config_cmd_fsm_state_str[r_config_cmd_fsm.read()] << std::endl; 2176 std::cout << " Read commands must contain one single flit" << std::endl; 2177 r_config_error_type = READ_ERROR; 2178 r_config_cmd_fsm = CONFIG_CMD_ERROR_WAIT; 2179 break; 2180 } 2181 2182 // fifo data receives the content of the corresponding register 2183 // (depending on the current state) 2184 config_local_fifo_put = true; 2185 if(r_config_cmd_fsm.read()== CONFIG_CMD_IT_ADDR_READ_1) 2186 r_config_cmd_fsm = CONFIG_CMD_IT_ADDR_READ_2; 2187 else if(r_config_cmd_fsm.read()== CONFIG_CMD_IT_ADDR_IOMMU_READ_1) 2188 r_config_cmd_fsm = CONFIG_CMD_IT_ADDR_IOMMU_READ_2; 2189 else 2190 r_config_cmd_fsm = CONFIG_CMD_IDLE; 2191 } 2192 break; 2193 } 2194 ////////////////// 2195 case CONFIG_CMD_IT_ADDR_READ_2: 2196 case CONFIG_CMD_IT_ADDR_IOMMU_READ_2: 2197 { 2198 if ( p_vci_tgt_config.cmdval.read() && m_config_local_data_fifo.wok() ) 2199 { 2200 config_local_fifo_put = true; 2201 r_config_cmd_fsm = CONFIG_CMD_IDLE; 2202 } 2203 } 2204 ////////////////// 2205 case CONFIG_CMD_ERROR_WAIT: //receives the other flits of the same transaction 2206 { 2207 if ( p_vci_tgt_config.cmdval.read() && p_vci_tgt_config.eop.read() ) 2208 r_config_cmd_fsm = CONFIG_CMD_ERROR_RSP; 2209 } 2210 /////////////////// 2211 case CONFIG_CMD_ERROR_RSP: 2212 { 2213 if ( m_config_local_data_fifo.wok() ) 2214 { 2215 config_local_fifo_put = true; 2216 r_config_cmd_fsm = CONFIG_CMD_IDLE; 2217 } 2218 break; 2219 } 2220 2221 } // end switch CONFIG_CMD FSM 2222 2223 ///////////////////////////////////////////////////////////////////// 2224 // The CONFIG_RSP_FSM controls the following ressources: 2225 // - r_config_rsp_fsm 2226 // - r_config_cmd_rsp_erase_req (reset) 2227 // - 2228 // - 2229 ////////////////////////////////////////////////////////////////////////////// 2230 switch( r_config_rsp_fsm.read() ) 2231 { 2232 ///////////////////// 2233 case CONFIG_RSP_IDLE: 1394 case CONFIG_RSP_IDLE: // waiting a VCI response from IOX network 2234 1395 { 2235 if (p_vci_ini_config.rspval.read())1396 if ( p_vci_ini_iox.rspval.read() ) 2236 1397 { 2237 r_config_rsp_fsm = CONFIG_RSP_ TRT_LOCK;1398 r_config_rsp_fsm = CONFIG_RSP_FIFO_PUT; 2238 1399 } 2239 1400 break; 2240 1401 } 2241 ///////////////////// 2242 case CONFIG_RSP_TRT_LOCK: 2243 { 2244 if ( r_alloc_trt_config_fsm.read() == ALLOC_TRT_CONFIG_RSP ) 2245 { 2246 2247 #if DEBUG_CONFIG_RSP 2248 if( m_debug_config_rsp_fsm ) 2249 { 2250 std::cout << " <IOB.CONFIG_RSP_TRT_LOCK> Read and erase entry" << std::endl; 2251 } 2252 #endif 2253 uint32_t trdid_iospace = p_vci_ini_config.rtrdid.read(); 2254 2255 r_config_rsrcid = (vci_srcid_t)m_transaction_tab_config.readSrcid(trdid_iospace); 2256 r_config_rtrdid = (vci_trdid_t)m_transaction_tab_config.readTrdid(trdid_iospace); 2257 m_transaction_tab_config.erase(trdid_iospace); 2258 if (r_config_cmd_rsp_erase_req.read()) r_config_cmd_rsp_erase_req = false; 2259 r_config_rsp_fsm = CONFIG_RSP_FIFO_PUT; 2260 } 2261 break; 2262 } 2263 ////////////////// 2264 case CONFIG_RSP_FIFO_PUT: 2265 { 2266 if(p_vci_ini_config.rspval.read() && m_config_rsp_data_fifo.wok()) 1402 ///////////////////////// 1403 case CONFIG_RSP_FIFO_PUT: // try to write into CONFIG_RSP fifo 1404 // as soon as it is allocated 1405 { 1406 if ( p_vci_ini_iox.rspval.read() and not r_alloc_fifo_config_rsp_local.read() ) 2267 1407 { 2268 1408 config_rsp_fifo_put = true; 2269 if(p_vci_ini_config.reop.read()) r_config_rsp_fsm = CONFIG_RSP_IDLE; 1409 1410 if ( m_config_rsp_data_fifo.wok() ) 1411 { 1412 if ( p_vci_ini_iox.reop.read() ) r_config_rsp_fsm = CONFIG_RSP_IDLE; 2270 1413 2271 1414 #if DEBUG_CONFIG_RSP 2272 if( m_debug_ config_rsp_fsm)2273 { 2274 std::cout << " <IOB.CONFIG_RSP_FIFO_PUT> Push into rsp_fifo:"2275 << " rsrcid = " << std::dec << r_config_rsrcid.read()2276 << " rtrdid = " << r_config_rtrdid.read()2277 << " rdata = " << std::hex << p_vci_ini_config.rdata.read()2278 << std::endl;2279 } 2280 #endif 1415 if( m_debug_activated ) 1416 std::cout << " <IOB CONFIG_RSP_FIFO_PUT> Push response into CONFIG_RSP fifo:" 1417 << " / rsrcid = " << std::hex << p_vci_ini_iox.rsrcid.read() 1418 << " / rtrdid = " << p_vci_ini_iox.rtrdid.read() 1419 << " / rdata = " << p_vci_ini_iox.rdata.read() 1420 << " / reop = " << p_vci_ini_iox.reop.read() 1421 << " / rerror = " << p_vci_ini_iox.rerror.read() << std::endl; 1422 #endif 1423 } 2281 1424 2282 1425 } … … 2285 1428 } // end switch CONFIG_RSP FSM 2286 1429 2287 2288 //////////////////////////////////////////////////////////////////////////// 2289 // The ALLOC_TRT_CONFIG fsm allocates the access to the Transaction Table (m_transaction_tab_config) 2290 // with a round robin priority between 2 user FSMs : 2291 // - CONFIG_CMD : to set a new entry 2292 // - CONFIG_RSP : to read and erase an entry 2293 // The ressource is always allocated. 1430 ///////////////////////////////////////////////////////////////////////////////// 1431 // If the IOB component has IRQ ports, the IRQ FSM detects all changes 1432 // on the 32 p_irq[i] ports and request a VCI write transaction to the 1433 // MISS_INIT FSM, using the 64 r_irq_request[i] and r_irq_pending[i] flip-flops. 1434 ///////////////////////////////////////////////////////////////////////////////// 1435 1436 if ( m_has_irqs ) 1437 { 1438 for ( size_t i = 0; i<32; ++i ) 1439 { 1440 r_irq_request[i] = ( p_irq[i]->read() == not r_irq_pending[i].read() ); 1441 r_irq_pending[i] = p_irq[i]->read(); 1442 } 1443 } 1444 1445 /////////////////////////////////////////////////////////////////////////////////// 1446 // The MISS_WTI_CMD FSM send VCI commands on the Internal Network. 1447 // It handles PTE MISS requests from TLB_MISS FSM and software IRQs. 1448 // It supports several simultaneous VCI transactions. 2294 1449 //////////////////////////////////////////////////////////////////////////////////// 2295 2296 switch ( r_alloc_trt_config_fsm.read() )2297 {2298 ///////////////////2299 case ALLOC_TRT_CONFIG_CMD:2300 {2301 if ( r_config_cmd_fsm.read() != CONFIG_CMD_TRT_LOCK )2302 {2303 if (r_config_rsp_fsm.read() == CONFIG_RSP_TRT_LOCK) r_alloc_trt_config_fsm = ALLOC_TRT_CONFIG_RSP;2304 }2305 }2306 ///////////////////2307 case ALLOC_TRT_CONFIG_RSP:2308 {2309 if (r_config_rsp_fsm.read() != CONFIG_RSP_TRT_LOCK)2310 {2311 if (r_config_cmd_fsm.read() == CONFIG_CMD_TRT_LOCK) r_alloc_trt_config_fsm = ALLOC_TRT_CONFIG_CMD;2312 }2313 }2314 } // end switch r_alloc_trt_config_fsm2315 2316 ////////////////////////////////////////////////////////////////////////////2317 // The MISS_INIT FSM sends a page table entry miss request into Direct Noc2318 // It controls the following ressources:2319 // - r_miss_init_fsm2320 // - r_tlb_miss_init_req (reset)2321 // - r_miss_buf_data2322 // - r_miss_buf_valid2323 // - r_miss_buf_tag2324 ////////////////////////////////////////////////////////////////////////////////////2325 2326 // Building the interruption vector (systematically)2327 uint32_t irq_demands = 0;2328 for ( size_t i = 0; i<m_nb_periph; ++i )2329 irq_demands |= (p_irq_in[i].read() ? 1 : 0) << i;2330 2331 // For next cycle:2332 // Afectation of the new pending vector.2333 // Not useful, unless Irq choice is postponed to next cycle2334 r_irq_pending = irq_demands & r_irq_mask.read();2335 // Updating Mask2336 r_irq_mask = r_irq_mask.read()| ~irq_demands;2337 2338 1450 2339 switch ( r_miss_ init_fsm.read() )2340 { 2341 ////////////// 2342 case MISS_ INIT_IDLE_MISS:2343 { 2344 if (r_tlb_miss_init_req.read())1451 switch ( r_miss_wti_cmd_fsm.read() ) 1452 { 1453 /////////////////////// 1454 case MISS_WTI_CMD_IDLE: // TLB MISS have highest priority 1455 { 1456 if ( r_tlb_miss_req.read() ) 2345 1457 { 2346 r_miss_ init_fsm = MISS_INIT_TLB_MISS_CMD;1458 r_miss_wti_cmd_fsm = MISS_WTI_CMD_MISS; 2347 1459 } 2348 else if (irq_demands & r_irq_mask.read()){ 2349 // Choosing one interruption to send 2350 // Find the first bit 1 2351 // starting by the bit just after the last chosen 2352 size_t i = (r_irq_chosen.read() + 1)% m_nb_periph; 1460 else if ( r_iommu_wti_enable.read() ) 1461 { 1462 // checking if there is a new pending interrupt 2353 1463 bool found = false; 2354 do 2355 { 2356 if(irq_demands & r_irq_mask.read() & (1<<i)) 2357 { 2358 r_irq_chosen = i; 2359 found = true; 2360 } 2361 i = (i+1) % m_nb_periph; 2362 } 2363 while(i != r_irq_chosen.read()+1 && !found); 2364 2365 r_miss_init_fsm = MISS_INIT_IRQ_CMD; 1464 size_t n; 1465 for ( n = 0 ; (n < 32) and not found ; n++ ) 1466 { 1467 if ( r_irq_request[n] ) found = true; 1468 } 1469 if ( found ) 1470 { 1471 r_miss_wti_cmd_index = n; 1472 r_miss_wti_cmd_fsm = MISS_WTI_CMD_WTI; 1473 } 2366 1474 } 2367 1475 break; 2368 1476 } 2369 ////////////// 2370 case MISS_INIT_IDLE_IRQ: 2371 { 2372 if (irq_demands & r_irq_mask.read()){ 2373 // Choosing one interruption to send 2374 // Find the first bit 1 2375 // starting by the bit just after the last chosen 2376 size_t i = (r_irq_chosen.read() + 1)% m_nb_periph; 2377 bool found = false; 2378 do 2379 { 2380 if(irq_demands & r_irq_mask.read() & (1<<i)) 2381 { 2382 r_irq_chosen = i; 2383 found = true; 2384 } 2385 i = (i+1) % m_nb_periph; 2386 } 2387 while(i != r_irq_chosen.read()+1 && !found); 2388 2389 r_miss_init_fsm = MISS_INIT_IRQ_CMD; 2390 } 2391 else if(r_tlb_miss_init_req.read()) 1477 ////////////////////// 1478 case MISS_WTI_CMD_WTI: // send a single flit IRQ WRITE on INT Network 1479 // address is defined by IRQ_VECTOR[r_miss_wti_index] 1480 // data is defined by r_irq_pending[r_miss_wti_index] 1481 { 1482 if ( p_vci_ini_int.cmdack ) 2392 1483 { 2393 r_miss_init_fsm = MISS_INIT_TLB_MISS_CMD; 2394 } 2395 break; 2396 } 2397 ///////////////////////// // send a read request to Direct Network 2398 case MISS_INIT_IRQ_CMD: 2399 { 2400 if ( p_vci_ini_miss.cmdack ) 2401 { 2402 // Masking chosen interruption, until it is resolved 2403 r_irq_mask = r_irq_mask.read() & ~(1<<r_irq_chosen.read()); 2404 r_miss_init_fsm = MISS_INIT_IRQ_RSP; 2405 2406 #if DEBUG_MISS_INIT 2407 if( m_debug_miss_init_fsm ) 2408 { 2409 std::cout << " <IOB.MISS_INIT_IRQ_CMD> Send write (irq) command to XICU" 2410 << " irq ID = " << std::dec << r_irq_chosen.read() 2411 << " new mask = " << std::hex << (r_irq_mask.read() & ~(1<<r_irq_chosen.read())) 2412 << std::endl; 2413 } 2414 #endif 2415 } 2416 break; 2417 } 2418 ////////////////// 2419 case MISS_INIT_IRQ_RSP: 2420 { 2421 if ( p_vci_ini_miss.rspval.read() ) 2422 { 2423 // It is a WRITE command, response in one single flit long 2424 assert( p_vci_ini_miss.reop.read() and "Write answer should have one single flit" ); 2425 bool error; 2426 2427 if ( (p_vci_ini_miss.rerror.read()&0x1) != 0 ) // error reported 2428 { 2429 // TODO traiter error 2430 error = true; 2431 } 2432 r_miss_init_fsm = MISS_INIT_IDLE_MISS; 1484 // reset the request 1485 r_irq_request[r_miss_wti_cmd_index.read()] = false; 1486 r_miss_wti_cmd_fsm = MISS_WTI_RSP_WTI; 1487 1488 #if DEBUG_MISS_WTI 1489 if( m_debug_activated ) 1490 std::cout << " <IOB MISS_WTI_CMD_WTI> Send WTI write command on Internal Network" 1491 << " / IRQID = " << std::dec << r_miss_wti_cmd_index.read() << std::endl; 1492 #endif 2433 1493 } 2434 1494 break; 2435 1495 } 2436 ///////////////////////// // send a read request to Direct Network 2437 case MISS_INIT_TLB_MISS_CMD: 2438 { 2439 if ( p_vci_ini_miss.cmdack ) 2440 { 2441 r_miss_rsp_cpt = 0; //counter for the response flits 2442 r_miss_buf_tag = ( (r_iotlb_paddr.read()) & CACHE_LINE_MASK ); 2443 r_miss_buf_valid = true; 1496 /////////////////////// 1497 case MISS_WTI_CMD_MISS: // send a TLB MISS request on INT Network 1498 { 1499 if ( p_vci_ini_int.cmdack ) 1500 { 1501 r_tlb_buf_tag = ( (r_tlb_paddr.read()) & CACHE_LINE_MASK ); 1502 r_tlb_buf_valid = true; 2444 1503 2445 if(r_tlb_miss_type.read()== PTE1_MISS) 2446 r_miss_buf_vaddr_begin =(r_iotlb_vaddr.read() & ~M_PAGE_OFFSET_MASK & ~PTE1_LINE_OFFSET); 2447 else 2448 r_miss_buf_vaddr_begin =(r_iotlb_vaddr.read() & ~K_PAGE_OFFSET_MASK & ~PTE2_LINE_OFFSET); 1504 if( r_tlb_miss_type.read() == PTE1_MISS ) 1505 r_tlb_buf_vaddr = (r_dma_cmd_vaddr.read() & 1506 ~M_PAGE_OFFSET_MASK & ~PTE1_LINE_OFFSET); 1507 else 1508 r_tlb_buf_vaddr = (r_dma_cmd_vaddr.read() & 1509 ~K_PAGE_OFFSET_MASK & ~PTE2_LINE_OFFSET); 2449 1510 2450 r_miss_init_fsm = MISS_INIT_TLB_MISS_RSP; 2451 2452 #if DEBUG_MISS_INIT 2453 if( m_debug_miss_init_fsm ) 2454 { 2455 std::cout << " <IOB.MISS_INIT_TLB_MISS_CMD> Send read (tlb entry) request to MEM CACHE: " 2456 << " | address : "<< std::hex <<(paddr_t)((r_iotlb_paddr.read())& CACHE_LINE_MASK) 2457 << std::endl; 2458 } 2459 #endif 2460 } 1511 r_miss_wti_cmd_fsm = MISS_WTI_RSP_MISS; 1512 1513 #if DEBUG_MISS_WTI 1514 if( m_debug_activated ) 1515 std::cout << " <IOB MISS_WTI_CMD_MISS> Send TLB MISS command on Internal Network" << std::hex 1516 << " / address = " <<(vci_addr_t)((r_tlb_paddr.read())& CACHE_LINE_MASK) << std::endl; 1517 #endif 1518 } 2461 1519 break; 2462 1520 } 2463 ////////////////// 2464 case MISS_INIT_TLB_MISS_RSP: 2465 { 2466 if ( p_vci_ini_miss.rspval.read() ) 1521 } // end switch r_miss_wti_cmd_fsm 1522 1523 /////////////////////////////////////////////////////////////////////////////////// 1524 // The MISS_WTI_RSP FSM handles VCI responses on the Internal Network. 1525 // it can be response to TLB MISS (read transaction) or WTI (write transaction). 1526 // It supports several simultaneous VCI transactions. 1527 //////////////////////////////////////////////////////////////////////////////////// 1528 1529 switch ( r_miss_wti_rsp_fsm.read() ) 1530 { 1531 case MISS_WTI_RSP_IDLE: // waiting a VCI response 1532 { 1533 if ( p_vci_ini_int.rspval.read() ) 2467 1534 { 2468 if ( (p_vci_ini_miss.rerror.read()&0x1) != 0 ) // error reported 2469 { 2470 r_miss_init_error = true; 2471 if ( p_vci_ini_miss.reop.read() ) 1535 if ( p_vci_ini_int.rpktid.read() == PKTID_READ ) // it's a TLB MISS response 1536 { 1537 r_miss_wti_rsp_fsm = MISS_WTI_RSP_MISS; 1538 r_miss_wti_rsp_count = 0; 1539 } 1540 else // it's a WTI WRITE response 1541 { 1542 r_miss_wti_rsp_fsm = MISS_WTI_RSP_WTI; 1543 1544 } 1545 } 1546 break; 1547 } 1548 ////////////////////// 1549 case MISS_WTI_RSP_WTI: // Handling response to a WTI transaction 1550 { 1551 assert( p_vci_ini_int.reop.read() and 1552 "VCI_IO_BRIDGE ERROR: IRQ Write response should have one single flit" ); 1553 1554 assert( ( (p_vci_ini_int.rerror.read()&0x1) == 0 ) and 1555 "VCI_IO_BRIDGE ERROR: IRQ Write response error !!!" ); 1556 // TODO traiter error using the IOMMU IRQ 1557 1558 #if DEBUG_MISS_WTI 1559 if( m_debug_activated ) 1560 std::cout << " <IOB MISS_WTI_RSP_WTI> Response to WTI write" << std::endl; 1561 #endif 1562 r_miss_wti_rsp_fsm = MISS_WTI_RSP_IDLE; 1563 break; 1564 } 1565 /////////////////////// 1566 case MISS_WTI_RSP_MISS: // Handling response to a TLB MISS transaction 1567 { 1568 if ( p_vci_ini_int.rspval.read() ) 1569 { 1570 if ( (p_vci_ini_int.rerror.read()&0x1) != 0 ) // error reported 1571 { 1572 r_miss_wti_rsp_error = true; 1573 if ( p_vci_ini_int.reop.read() ) 2472 1574 { 2473 r_miss_ init_fsm = MISS_INIT_IDLE_IRQ;2474 r_tlb_miss_ init_req = false;1575 r_miss_wti_cmd_fsm = MISS_WTI_RSP_IDLE; 1576 r_tlb_miss_req = false; 2475 1577 } 2476 #if DEBUG_MISS_INIT 2477 if( m_debug_miss_init_fsm ) 2478 { 2479 std::cout << " <IOB.MISS_INIT_TLB_MISS_RSP> ERROR " << std::endl; 2480 } 2481 #endif 2482 } 2483 else 1578 #if DEBUG_MISS_WTI 1579 if( m_debug_activated ) 1580 std::cout << " <IOB MISS_WTI_RSP_MISS> ERROR " << std::endl; 1581 #endif 1582 } 1583 else // no error 2484 1584 { 2485 bool eop = p_vci_ini_miss.reop.read(); 2486 2487 2488 #if DEBUG_MISS_INIT 2489 if( m_debug_miss_init_fsm ) 2490 { 2491 std::cout << " <IOB.MISS_INIT_TLB_MISS_RSP> Response from Mem Cache to a read (tlb entry) transaction. Count = " << r_miss_rsp_cpt.read() 2492 <<" | Data = " << std::hex << p_vci_ini_miss.rdata.read() << std::endl; 2493 } 2494 #endif 2495 2496 assert(((eop == (r_miss_rsp_cpt.read() == (m_words-1))) ) 2497 and "Error : invalid length for a response from MEM CACHE"); 2498 r_miss_buf_data[r_miss_rsp_cpt] = (uint32_t)p_vci_ini_miss.rdata.read(); 2499 2500 r_miss_rsp_cpt = r_miss_rsp_cpt.read() + 1; 1585 bool eop = p_vci_ini_int.reop.read(); 1586 1587 #if DEBUG_MISS_WTI 1588 if( m_debug_activated ) 1589 std::cout << " <IOB MISS_WTI_RSP_MISS> Response to a tlb miss transaction" 1590 << " / Count = " << r_miss_wti_rsp_count.read() 1591 << " / Data = " << std::hex << p_vci_ini_int.rdata.read() << std::endl; 1592 #endif 1593 assert(((eop == (r_miss_wti_rsp_count.read() == (m_words-1)))) and 1594 "VCI_IO_BRIDGE ERROR: invalid length for a TLB MISS response"); 1595 1596 r_tlb_buf_data[r_miss_wti_rsp_count.read()] = p_vci_ini_int.rdata.read(); 1597 r_miss_wti_rsp_count = r_miss_wti_rsp_count.read() + 1; 2501 1598 2502 1599 if ( eop ) 2503 1600 { 2504 r_tlb_miss_ init_req = false; //reset the request flip-flop2505 r_miss_ init_fsm = MISS_INIT_IDLE_IRQ;1601 r_tlb_miss_req = false; //reset the request flip-flop 1602 r_miss_wti_cmd_fsm = MISS_WTI_RSP_IDLE; 2506 1603 } 2507 2508 1604 } 2509 1605 } 2510 1606 break; 2511 1607 } 2512 2513 } // end switch r_miss_init_fsm 1608 } // end switch r_miss_wti_rsp_fsm 1609 1610 ///////////////////////////////////////////////////////////////////////// 1611 // This flip-flop allocates the access to the CONFIG_RSP fifo 1612 // with a round robin priority between 2 clients FSMs : 1613 // - CONFIG_CMD : to put a response to a local config command. 1614 // - CONFIG_RSP : to put a response to a peripheral config command. 1615 // The ressource is always allocated. 1616 // A new allocation occurs when the owner FSM is not using it, 1617 // and the other FSM is requiring it. 1618 ///////////////////////////////////////////////////////////////////////// 2514 1619 2515 ////////////////////////////////// 2516 // Fifo consumption arbitration // 2517 ////////////////////////////////// 1620 if ( r_alloc_fifo_config_rsp_local.read() ) 1621 { 1622 if ( (r_config_rsp_fsm.read() == CONFIG_RSP_FIFO_PUT) and 1623 (r_config_cmd_fsm.read() != CONFIG_CMD_FIFO_PUT_RSP) ) 1624 r_alloc_fifo_config_rsp_local = false; 1625 } 1626 else 1627 { 1628 if ( (r_config_cmd_fsm.read() == CONFIG_CMD_FIFO_PUT_RSP) and 1629 (r_config_rsp_fsm.read() != CONFIG_RSP_FIFO_PUT) ) 1630 r_alloc_fifo_config_rsp_local = true; 1631 } 1632 1633 ///////////////////////////////////////////////////////////////////////// 1634 // This flip-flop allocates the access to the DMA_RSP fifo 1635 // with a round robin priority between 2 clients FSMs : 1636 // - DMA_CMD : to put a error response in case of bad address translation 1637 // - DMA_RSP : to put a normal response to a DMA transaction. 1638 // The ressource is always allocated. 1639 // A new allocation occurs when the owner FSM is not using it, 1640 // and the other FSM is requiring it. 1641 ///////////////////////////////////////////////////////////////////////// 2518 1642 2519 // Round Robin priority for CONFIG_RSP FIFO consumption 2520 r_config_rsp_fifo_local_priority = ! r_config_rsp_fifo_local_priority.read(); 2521 2522 //DMA CMD 2523 dma_cmd_fifo_get = (p_vci_ini_dma.cmdack.read() && m_dma_cmd_addr_fifo.rok()); 2524 // DMA RSP 2525 dma_rsp_fifo_get = (p_vci_tgt_dma.rspack.read() && m_dma_rsp_data_fifo.rok()); 2526 // CONFIG CMD 2527 config_cmd_fifo_get = (p_vci_ini_config.cmdack.read() && m_config_cmd_addr_fifo.rok() ); 2528 // CONFIG RSP, detemines wich fifo to consume 2529 if(r_config_rsp_fifo_local_priority) 2530 { 2531 if(m_config_local_data_fifo.rok()) config_local_fifo_get = p_vci_tgt_config.rspack.read(); 2532 else if (m_config_rsp_data_fifo.rok()) config_rsp_fifo_get = p_vci_tgt_config.rspack.read(); 2533 2534 } 2535 else 2536 { 2537 if (m_config_rsp_data_fifo.rok()) config_rsp_fifo_get = p_vci_tgt_config.rspack.read(); 2538 else if(m_config_local_data_fifo.rok()) config_local_fifo_get = p_vci_tgt_config.rspack.read(); 2539 } 2540 /////////////// 2541 //DMA_CMD Fifo 2542 /////////////// 2543 if(r_miss_interrupt) 2544 { 2545 m_dma_cmd_addr_fifo.update( dma_cmd_fifo_get, 2546 dma_cmd_fifo_put, 2547 r_miss_paddr.read() ); 2548 m_dma_cmd_cmd_fifo.update( dma_cmd_fifo_get, 2549 dma_cmd_fifo_put, 2550 r_miss_cmd.read() ); 2551 m_dma_cmd_contig_fifo.update( dma_cmd_fifo_get, 2552 dma_cmd_fifo_put, 2553 r_miss_contig.read() ); 2554 m_dma_cmd_cons_fifo.update( dma_cmd_fifo_get, 2555 dma_cmd_fifo_put, 2556 r_miss_cons.read() ); 2557 m_dma_cmd_plen_fifo.update( dma_cmd_fifo_get, 2558 dma_cmd_fifo_put, 2559 r_miss_plen.read() ); 2560 m_dma_cmd_wrap_fifo.update( dma_cmd_fifo_get, 2561 dma_cmd_fifo_put, 2562 r_miss_wrap.read() ); 2563 m_dma_cmd_cfixed_fifo.update( dma_cmd_fifo_get, 2564 dma_cmd_fifo_put, 2565 r_miss_cfixed.read() ); 2566 m_dma_cmd_clen_fifo.update( dma_cmd_fifo_get, 2567 dma_cmd_fifo_put, 2568 r_miss_clen.read() ); 2569 m_dma_cmd_srcid_fifo.update( dma_cmd_fifo_get, 2570 dma_cmd_fifo_put, 2571 m_srcid_dma ); //r_miss_srcid.read() 2572 m_dma_cmd_trdid_fifo.update( dma_cmd_fifo_get, 2573 dma_cmd_fifo_put, 2574 r_miss_trdid.read() ); 2575 m_dma_cmd_pktid_fifo.update( dma_cmd_fifo_get, 2576 dma_cmd_fifo_put, 2577 r_miss_pktid.read() ); 2578 m_dma_cmd_data_fifo.update( dma_cmd_fifo_get, 2579 dma_cmd_fifo_put, 2580 r_miss_data[r_dma_cmd_count.read()-1] ); 2581 m_dma_cmd_be_fifo.update( dma_cmd_fifo_get, 2582 dma_cmd_fifo_put, 2583 r_miss_be[r_dma_cmd_count.read()-1] ); 2584 m_dma_cmd_eop_fifo.update( dma_cmd_fifo_get, 2585 dma_cmd_fifo_put, 2586 (r_dma_cmd_count.read() == 1) ); 1643 if ( r_alloc_fifo_dma_rsp_local.read() ) 1644 { 1645 if ( (r_dma_rsp_fsm.read() == DMA_RSP_FIFO_PUT) and 1646 (r_dma_cmd_fsm.read() != DMA_CMD_FIFO_PUT_RSP) ) 1647 r_alloc_fifo_dma_rsp_local = false; 2587 1648 } 2588 1649 else 2589 1650 { 2590 m_dma_cmd_addr_fifo.update( dma_cmd_fifo_get, 2591 dma_cmd_fifo_put, 2592 r_dma_paddr.read() ); 2593 m_dma_cmd_cmd_fifo.update( dma_cmd_fifo_get, 2594 dma_cmd_fifo_put, 2595 p_vci_tgt_dma.cmd.read() ); 2596 m_dma_cmd_contig_fifo.update( dma_cmd_fifo_get, 2597 dma_cmd_fifo_put, 2598 p_vci_tgt_dma.contig.read() ); 2599 m_dma_cmd_cons_fifo.update( dma_cmd_fifo_get, 2600 dma_cmd_fifo_put, 2601 p_vci_tgt_dma.cons.read() ); 2602 m_dma_cmd_plen_fifo.update( dma_cmd_fifo_get, 2603 dma_cmd_fifo_put, 2604 p_vci_tgt_dma.plen.read() ); 2605 m_dma_cmd_wrap_fifo.update( dma_cmd_fifo_get, 2606 dma_cmd_fifo_put, 2607 p_vci_tgt_dma.wrap.read() ); 2608 m_dma_cmd_cfixed_fifo.update( dma_cmd_fifo_get, 2609 dma_cmd_fifo_put, 2610 p_vci_tgt_dma.cfixed.read() ); 2611 m_dma_cmd_clen_fifo.update( dma_cmd_fifo_get, 2612 dma_cmd_fifo_put, 2613 p_vci_tgt_dma.clen.read() ); 2614 m_dma_cmd_srcid_fifo.update( dma_cmd_fifo_get, 2615 dma_cmd_fifo_put, 2616 m_srcid_dma ); 2617 m_dma_cmd_trdid_fifo.update( dma_cmd_fifo_get, 2618 dma_cmd_fifo_put, 2619 r_dma_cmd_trt_index.read() ); 2620 m_dma_cmd_pktid_fifo.update( dma_cmd_fifo_get, 2621 dma_cmd_fifo_put, 2622 p_vci_tgt_dma.pktid.read() ); 2623 m_dma_cmd_data_fifo.update( dma_cmd_fifo_get, 2624 dma_cmd_fifo_put, 2625 p_vci_tgt_dma.wdata.read() ); // TODO change 2626 // For 64bits XRAM 2627 m_dma_cmd_be_fifo.update( dma_cmd_fifo_get, 2628 dma_cmd_fifo_put, 2629 p_vci_tgt_dma.be.read() ); 2630 m_dma_cmd_eop_fifo.update( dma_cmd_fifo_get, 2631 dma_cmd_fifo_put, 2632 p_vci_tgt_dma.eop.read() ); 2633 } 2634 2635 /////////////// 2636 //DMA_RSP Fifo 2637 /////////////// 2638 if(r_dma_rsp_fsm.read() == DMA_RSP_FIFO_ERROR_PUT) 2639 { 2640 m_dma_rsp_data_fifo.update( dma_rsp_fifo_get, 2641 dma_rsp_fifo_put, 2642 0 ); 1651 if ( (r_dma_cmd_fsm.read() == DMA_CMD_FIFO_PUT_RSP) and 1652 (r_dma_rsp_fsm.read() != DMA_RSP_FIFO_PUT) ) 1653 r_alloc_fifo_dma_rsp_local = true; 1654 } 1655 1656 // Define GET signals for all output FIFOs 1657 dma_cmd_fifo_get = p_vci_ini_ram.cmdack.read(); 1658 dma_rsp_fifo_get = p_vci_tgt_iox.rspack.read(); 1659 config_cmd_fifo_get = p_vci_ini_iox.cmdack.read(); 1660 config_rsp_fifo_get = p_vci_tgt_int.rspack.read(); 1661 1662 /////////////////////////////////////////////////////////// 1663 // DMA_CMD fifo update 1664 // One writer : DMA_CMD FSM 1665 /////////////////////////////////////////////////////////// 1666 1667 m_dma_cmd_addr_fifo.update( dma_cmd_fifo_get, 1668 dma_cmd_fifo_put, 1669 r_dma_cmd_paddr.read() ); // address translation 1670 m_dma_cmd_cmd_fifo.update( dma_cmd_fifo_get, 1671 dma_cmd_fifo_put, 1672 p_vci_tgt_iox.cmd.read() ); 1673 m_dma_cmd_contig_fifo.update( dma_cmd_fifo_get, 1674 dma_cmd_fifo_put, 1675 p_vci_tgt_iox.contig.read() ); 1676 m_dma_cmd_cons_fifo.update( dma_cmd_fifo_get, 1677 dma_cmd_fifo_put, 1678 p_vci_tgt_iox.cons.read() ); 1679 m_dma_cmd_plen_fifo.update( dma_cmd_fifo_get, 1680 dma_cmd_fifo_put, 1681 p_vci_tgt_iox.plen.read() ); 1682 m_dma_cmd_wrap_fifo.update( dma_cmd_fifo_get, 1683 dma_cmd_fifo_put, 1684 p_vci_tgt_iox.wrap.read() ); 1685 m_dma_cmd_cfixed_fifo.update( dma_cmd_fifo_get, 1686 dma_cmd_fifo_put, 1687 p_vci_tgt_iox.cfixed.read() ); 1688 m_dma_cmd_clen_fifo.update( dma_cmd_fifo_get, 1689 dma_cmd_fifo_put, 1690 p_vci_tgt_iox.clen.read() ); 1691 m_dma_cmd_srcid_fifo.update( dma_cmd_fifo_get, 1692 dma_cmd_fifo_put, 1693 p_vci_tgt_iox.srcid.read() ); 1694 m_dma_cmd_trdid_fifo.update( dma_cmd_fifo_get, 1695 dma_cmd_fifo_put, 1696 p_vci_tgt_iox.trdid.read() ); 1697 m_dma_cmd_pktid_fifo.update( dma_cmd_fifo_get, 1698 dma_cmd_fifo_put, 1699 p_vci_tgt_iox.pktid.read() ); 1700 m_dma_cmd_data_fifo.update( dma_cmd_fifo_get, 1701 dma_cmd_fifo_put, 1702 p_vci_tgt_iox.wdata.read() ); 1703 m_dma_cmd_be_fifo.update( dma_cmd_fifo_get, 1704 dma_cmd_fifo_put, 1705 p_vci_tgt_iox.be.read() ); 1706 m_dma_cmd_eop_fifo.update( dma_cmd_fifo_get, 1707 dma_cmd_fifo_put, 1708 p_vci_tgt_iox.eop.read() ); 1709 1710 ////////////////////////////////////////////////////////////// 1711 // DMA_RSP fifo update 1712 // Two writers : DMA_CMD FSM & DMA_RSP FSM 1713 ////////////////////////////////////////////////////////////// 1714 1715 if (r_alloc_fifo_dma_rsp_local.read() ) // owner is DMA_CMD FSM 1716 // local response for a translation error 1717 { 1718 m_dma_rsp_data_fifo.update( dma_rsp_fifo_get, 1719 dma_rsp_fifo_put, 1720 0 ); // no data if error 2643 1721 m_dma_rsp_rsrcid_fifo.update( dma_rsp_fifo_get, 2644 dma_rsp_fifo_put,2645 r_iommu_bad_id.read() );1722 dma_rsp_fifo_put, 1723 p_vci_tgt_iox.rsrcid.read() ); 2646 1724 m_dma_rsp_rtrdid_fifo.update( dma_rsp_fifo_get, 2647 dma_rsp_fifo_put,2648 r_dma_error_trdid.read() );1725 dma_rsp_fifo_put, 1726 p_vci_tgt_iox.rtrdid.read() ); 2649 1727 m_dma_rsp_rpktid_fifo.update( dma_rsp_fifo_get, 2650 dma_rsp_fifo_put,2651 r_dma_error_pktid.read() );2652 m_dma_rsp_reop_fifo.update( dma_rsp_fifo_get,2653 dma_rsp_fifo_put,2654 true );1728 dma_rsp_fifo_put, 1729 p_vci_tgt_iox.rpktid.read() ); 1730 m_dma_rsp_reop_fifo.update( dma_rsp_fifo_get, 1731 dma_rsp_fifo_put, 1732 true ); // single flit response 2655 1733 m_dma_rsp_rerror_fifo.update( dma_rsp_fifo_get, 2656 1734 dma_rsp_fifo_put, 2657 r_dma_error_type.read() ); 2658 } 2659 else 2660 { 2661 m_dma_rsp_data_fifo.update( dma_rsp_fifo_get, 2662 dma_rsp_fifo_put, 2663 p_vci_ini_dma.rdata.read() ); 1735 1 ); // error 1736 } 1737 else // owner is DMA_RSP FSM 1738 // normal response to a DMA transaction 1739 { 1740 m_dma_rsp_data_fifo.update( dma_rsp_fifo_get, 1741 dma_rsp_fifo_put, 1742 p_vci_ini_ram.rdata.read() ); 2664 1743 m_dma_rsp_rsrcid_fifo.update( dma_rsp_fifo_get, 2665 dma_rsp_fifo_put,2666 r_dma_rsrcid.read() );1744 dma_rsp_fifo_put, 1745 p_vci_ini_ram.rsrcid.read() ); 2667 1746 m_dma_rsp_rtrdid_fifo.update( dma_rsp_fifo_get, 2668 dma_rsp_fifo_put,2669 r_dma_rtrdid.read() );1747 dma_rsp_fifo_put, 1748 p_vci_ini_ram.rtrdid.read() ); 2670 1749 m_dma_rsp_rpktid_fifo.update( dma_rsp_fifo_get, 2671 dma_rsp_fifo_put,2672 p_vci_ini_dma.rpktid.read() );2673 m_dma_rsp_reop_fifo.update( dma_rsp_fifo_get,2674 dma_rsp_fifo_put,2675 p_vci_ini_dma.reop.read() );1750 dma_rsp_fifo_put, 1751 p_vci_ini_ram.rpktid.read() ); 1752 m_dma_rsp_reop_fifo.update( dma_rsp_fifo_get, 1753 dma_rsp_fifo_put, 1754 p_vci_ini_ram.reop.read() ); 2676 1755 m_dma_rsp_rerror_fifo.update( dma_rsp_fifo_get, 2677 1756 dma_rsp_fifo_put, 2678 p_vci_ini_dma.rerror.read() ); 2679 } 2680 2681 ////////////////// 2682 //CONFIG_CMD Fifo 2683 ////////////////// 2684 m_config_cmd_addr_fifo.update( config_cmd_fifo_get, 2685 config_cmd_fifo_put, 2686 r_config_vaddr.read() ); 2687 m_config_cmd_cmd_fifo.update( config_cmd_fifo_get, 2688 config_cmd_fifo_put, 2689 p_vci_tgt_config.cmd.read() ); 1757 p_vci_ini_ram.rerror.read() ); 1758 } 1759 1760 //////////////////////////////////////////////////////////////// 1761 // CONFIG_CMD fifo update 1762 // One writer : CONFIG_CMD FSM 1763 //////////////////////////////////////////////////////////////// 1764 1765 m_config_cmd_addr_fifo.update( config_cmd_fifo_get, 1766 config_cmd_fifo_put, 1767 p_vci_tgt_int.address.read() ); 1768 m_config_cmd_cmd_fifo.update( config_cmd_fifo_get, 1769 config_cmd_fifo_put, 1770 p_vci_tgt_int.cmd.read() ); 2690 1771 m_config_cmd_contig_fifo.update( config_cmd_fifo_get, 2691 config_cmd_fifo_put,2692 p_vci_tgt_config.contig.read() );2693 m_config_cmd_cons_fifo.update( config_cmd_fifo_get,2694 config_cmd_fifo_put,2695 p_vci_tgt_config.cons.read() );2696 m_config_cmd_plen_fifo.update( config_cmd_fifo_get,2697 config_cmd_fifo_put,2698 p_vci_tgt_config.plen.read() );2699 m_config_cmd_wrap_fifo.update( config_cmd_fifo_get,2700 config_cmd_fifo_put,2701 p_vci_tgt_config.wrap.read() );1772 config_cmd_fifo_put, 1773 p_vci_tgt_int.contig.read() ); 1774 m_config_cmd_cons_fifo.update( config_cmd_fifo_get, 1775 config_cmd_fifo_put, 1776 p_vci_tgt_int.cons.read() ); 1777 m_config_cmd_plen_fifo.update( config_cmd_fifo_get, 1778 config_cmd_fifo_put, 1779 p_vci_tgt_int.plen.read() ); 1780 m_config_cmd_wrap_fifo.update( config_cmd_fifo_get, 1781 config_cmd_fifo_put, 1782 p_vci_tgt_int.wrap.read() ); 2702 1783 m_config_cmd_cfixed_fifo.update( config_cmd_fifo_get, 2703 config_cmd_fifo_put,2704 p_vci_tgt_config.cfixed.read() );2705 m_config_cmd_clen_fifo.update( config_cmd_fifo_get,2706 config_cmd_fifo_put,2707 p_vci_tgt_config.clen.read() );2708 m_config_cmd_srcid_fifo.update( config_cmd_fifo_get,2709 config_cmd_fifo_put,2710 m_srcid_config);2711 m_config_cmd_trdid_fifo.update( config_cmd_fifo_get,2712 config_cmd_fifo_put,2713 r_config_cmd_trt_index.read() );2714 m_config_cmd_pktid_fifo.update( config_cmd_fifo_get,2715 config_cmd_fifo_put,2716 p_vci_tgt_config.pktid.read() );2717 m_config_cmd_data_fifo.update( config_cmd_fifo_get,2718 config_cmd_fifo_put,2719 p_vci_tgt_config.wdata.read() );2720 m_config_cmd_be_fifo.update( config_cmd_fifo_get,2721 config_cmd_fifo_put,2722 p_vci_tgt_config.be.read() );2723 m_config_cmd_eop_fifo.update( config_cmd_fifo_get,2724 config_cmd_fifo_put,2725 p_vci_tgt_ config.eop.read() );1784 config_cmd_fifo_put, 1785 p_vci_tgt_int.cfixed.read() ); 1786 m_config_cmd_clen_fifo.update( config_cmd_fifo_get, 1787 config_cmd_fifo_put, 1788 p_vci_tgt_int.clen.read() ); 1789 m_config_cmd_srcid_fifo.update( config_cmd_fifo_get, 1790 config_cmd_fifo_put, 1791 p_vci_tgt_int.srcid.read() ); 1792 m_config_cmd_trdid_fifo.update( config_cmd_fifo_get, 1793 config_cmd_fifo_put, 1794 p_vci_tgt_int.trdid.read() ); 1795 m_config_cmd_pktid_fifo.update( config_cmd_fifo_get, 1796 config_cmd_fifo_put, 1797 p_vci_tgt_int.pktid.read() ); 1798 m_config_cmd_data_fifo.update( config_cmd_fifo_get, 1799 config_cmd_fifo_put, 1800 (ext_data_t)p_vci_tgt_int.wdata.read() ); 1801 m_config_cmd_be_fifo.update( config_cmd_fifo_get, 1802 config_cmd_fifo_put, 1803 p_vci_tgt_int.be.read() ); 1804 m_config_cmd_eop_fifo.update( config_cmd_fifo_get, 1805 config_cmd_fifo_put, 1806 p_vci_tgt_int.eop.read() ); 2726 1807 2727 ////////////////// 2728 //CONFIG_RSP Fifo 2729 ////////////////// 2730 m_config_rsp_data_fifo.update( config_rsp_fifo_get, 2731 config_rsp_fifo_put, 2732 p_vci_ini_config.rdata.read() ); 2733 m_config_rsp_rsrcid_fifo.update( config_rsp_fifo_get, 2734 config_rsp_fifo_put, 2735 r_config_rsrcid.read() ); 2736 m_config_rsp_rtrdid_fifo.update( config_rsp_fifo_get, 2737 config_rsp_fifo_put, 2738 r_config_rtrdid.read() ); 2739 m_config_rsp_rpktid_fifo.update( config_rsp_fifo_get, 2740 config_rsp_fifo_put, 2741 p_vci_ini_config.rpktid.read() ); 2742 m_config_rsp_reop_fifo.update( config_rsp_fifo_get, 2743 config_rsp_fifo_put, 2744 p_vci_ini_config.reop.read() ); 2745 m_config_rsp_rerror_fifo.update( config_rsp_fifo_get, 2746 config_rsp_fifo_put, 2747 p_vci_ini_config.rerror.read() ); 1808 ////////////////////////////////////////////////////////////////////////// 1809 // CONFIG_RSP fifo update 1810 // There is two writers : CONFIG_CMD FSM & CONFIG_RSP FSM 1811 ////////////////////////////////////////////////////////////////////////// 1812 1813 if ( r_alloc_fifo_config_rsp_local.read() ) // owner is CONFIG_CMD FSM 1814 // response for a local config transaction 1815 { 1816 m_config_rsp_data_fifo.update( config_rsp_fifo_get, 1817 config_rsp_fifo_put, 1818 (int_data_t)r_config_cmd_rdata.read() ); 1819 m_config_rsp_rsrcid_fifo.update( config_rsp_fifo_get, 1820 config_rsp_fifo_put, 1821 p_vci_tgt_int.srcid.read() ); 1822 m_config_rsp_rtrdid_fifo.update( config_rsp_fifo_get, 1823 config_rsp_fifo_put, 1824 p_vci_tgt_int.trdid.read() ); 1825 m_config_rsp_rpktid_fifo.update( config_rsp_fifo_get, 1826 config_rsp_fifo_put, 1827 p_vci_tgt_int.pktid.read() ); 1828 m_config_rsp_reop_fifo.update( config_rsp_fifo_get, 1829 config_rsp_fifo_put, 1830 true ); // local config are one flit 1831 m_config_rsp_rerror_fifo.update( config_rsp_fifo_get, 1832 config_rsp_fifo_put, 1833 r_config_cmd_error.read() ); 1834 } 1835 else // owner is CONFIG_RSP FSM 1836 // response for a remote transaction 1837 { 1838 m_config_rsp_data_fifo.update( config_rsp_fifo_get, 1839 config_rsp_fifo_put, 1840 (int_data_t)p_vci_ini_iox.rdata.read() ); 1841 m_config_rsp_rsrcid_fifo.update( config_rsp_fifo_get, 1842 config_rsp_fifo_put, 1843 p_vci_ini_iox.rsrcid.read() ); 1844 m_config_rsp_rtrdid_fifo.update( config_rsp_fifo_get, 1845 config_rsp_fifo_put, 1846 p_vci_ini_iox.rtrdid.read() ); 1847 m_config_rsp_rpktid_fifo.update( config_rsp_fifo_get, 1848 config_rsp_fifo_put, 1849 p_vci_ini_iox.rpktid.read() ); 1850 m_config_rsp_reop_fifo.update( config_rsp_fifo_get, 1851 config_rsp_fifo_put, 1852 p_vci_ini_iox.reop.read() ); 1853 m_config_rsp_rerror_fifo.update( config_rsp_fifo_get, 1854 config_rsp_fifo_put, 1855 p_vci_ini_iox.rerror.read() ); 1856 } 2748 1857 2749 ///////////////////////2750 //CONFIG Local RSP Fifo2751 ///////////////////////2752 m_config_local_rsrcid_fifo.update( config_local_fifo_get,2753 config_local_fifo_put,2754 p_vci_tgt_config.srcid.read() );2755 m_config_local_rtrdid_fifo.update( config_local_fifo_get,2756 config_local_fifo_put,2757 p_vci_tgt_config.trdid.read() );2758 m_config_local_rpktid_fifo.update( config_local_fifo_get,2759 config_local_fifo_put,2760 p_vci_tgt_config.pktid.read() );2761 2762 switch( r_config_cmd_fsm.read() )2763 {2764 case CONFIG_CMD_PTPR_WRITE:2765 case CONFIG_CMD_ACTIVE_WRITE:2766 case CONFIG_CMD_IT_ADDR_IOMMU_WRITE_2:2767 case CONFIG_CMD_IT_ADDR_WRITE_2:2768 case CONFIG_CMD_INVAL:2769 m_config_local_data_fifo.update( config_local_fifo_get,2770 config_local_fifo_put,2771 0);2772 m_config_local_rerror_fifo.update( config_local_fifo_get,2773 config_local_fifo_put,2774 WRITE_OK );2775 m_config_local_reop_fifo.update( config_local_fifo_get,2776 config_local_fifo_put,2777 true );2778 break;2779 case CONFIG_CMD_PTPR_READ:2780 m_config_local_data_fifo.update( config_local_fifo_get,2781 config_local_fifo_put,2782 r_iommu_ptpr.read());2783 m_config_local_rerror_fifo.update( config_local_fifo_get,2784 config_local_fifo_put,2785 READ_OK );2786 m_config_local_reop_fifo.update( config_local_fifo_get,2787 config_local_fifo_put,2788 true );2789 break;2790 case CONFIG_CMD_ACTIVE_READ:2791 m_config_local_data_fifo.update( config_local_fifo_get,2792 config_local_fifo_put,2793 r_iommu_active.read());2794 m_config_local_rerror_fifo.update( config_local_fifo_get,2795 config_local_fifo_put,2796 READ_OK );2797 m_config_local_reop_fifo.update( config_local_fifo_get,2798 config_local_fifo_put,2799 true );2800 break;2801 case CONFIG_CMD_BVAR_READ:2802 m_config_local_data_fifo.update( config_local_fifo_get,2803 config_local_fifo_put,2804 r_iommu_bvar.read());2805 m_config_local_rerror_fifo.update( config_local_fifo_get,2806 config_local_fifo_put,2807 READ_OK );2808 m_config_local_reop_fifo.update( config_local_fifo_get,2809 config_local_fifo_put,2810 true );2811 break;2812 case CONFIG_CMD_ETR_READ:2813 m_config_local_data_fifo.update( config_local_fifo_get,2814 config_local_fifo_put,2815 r_iommu_etr.read());2816 m_config_local_rerror_fifo.update( config_local_fifo_get,2817 config_local_fifo_put,2818 READ_OK );2819 m_config_local_reop_fifo.update( config_local_fifo_get,2820 config_local_fifo_put,2821 true );2822 break;2823 case CONFIG_CMD_BAD_ID_READ:2824 m_config_local_data_fifo.update( config_local_fifo_get,2825 config_local_fifo_put,2826 r_iommu_bad_id.read());2827 m_config_local_rerror_fifo.update( config_local_fifo_get,2828 config_local_fifo_put,2829 READ_OK );2830 m_config_local_reop_fifo.update( config_local_fifo_get,2831 config_local_fifo_put,2832 true );2833 break;2834 case CONFIG_CMD_IT_ADDR_IOMMU_READ_1:2835 m_config_local_data_fifo.update( config_local_fifo_get,2836 config_local_fifo_put,2837 (uint32_t)(r_it_addr_iommu.read() & 0xFFFFFFFF) );2838 m_config_local_rerror_fifo.update( config_local_fifo_get,2839 config_local_fifo_put,2840 READ_OK );2841 m_config_local_reop_fifo.update( config_local_fifo_get,2842 config_local_fifo_put,2843 false );2844 break;2845 case CONFIG_CMD_IT_ADDR_IOMMU_READ_2:2846 m_config_local_data_fifo.update( config_local_fifo_get,2847 config_local_fifo_put,2848 (uint32_t)((r_it_addr_iommu.read()>>32)&0xFF) );2849 m_config_local_rerror_fifo.update( config_local_fifo_get,2850 config_local_fifo_put,2851 READ_OK );2852 m_config_local_reop_fifo.update( config_local_fifo_get,2853 config_local_fifo_put,2854 true );2855 break;2856 case CONFIG_CMD_IT_ADDR_READ_1:2857 m_config_local_data_fifo.update( config_local_fifo_get,2858 config_local_fifo_put,2859 (uint32_t)(r_it_addr[r_it_index.read()] & 0xFFFFFFFF) );2860 m_config_local_rerror_fifo.update( config_local_fifo_get,2861 config_local_fifo_put,2862 READ_OK );2863 m_config_local_reop_fifo.update( config_local_fifo_get,2864 config_local_fifo_put,2865 false );2866 break;2867 case CONFIG_CMD_IT_ADDR_READ_2:2868 m_config_local_data_fifo.update( config_local_fifo_get,2869 config_local_fifo_put,2870 (uint32_t)((r_it_addr[r_it_index.read()]>>32)&0xFF) );2871 m_config_local_rerror_fifo.update( config_local_fifo_get,2872 config_local_fifo_put,2873 READ_OK );2874 m_config_local_reop_fifo.update( config_local_fifo_get,2875 config_local_fifo_put,2876 true );2877 break;2878 case CONFIG_CMD_ERROR_RSP:2879 m_config_local_data_fifo.update( config_local_fifo_get,2880 config_local_fifo_put,2881 0);2882 m_config_local_rerror_fifo.update( config_local_fifo_get,2883 config_local_fifo_put,2884 r_config_error_type.read() );2885 m_config_local_reop_fifo.update( config_local_fifo_get,2886 config_local_fifo_put,2887 true );2888 break;2889 default:2890 m_config_local_data_fifo.update( config_local_fifo_get,2891 config_local_fifo_put,2892 0);2893 m_config_local_rerror_fifo.update( config_local_fifo_get,2894 config_local_fifo_put,2895 0 );2896 m_config_local_reop_fifo.update( config_local_fifo_get,2897 config_local_fifo_put,2898 false );2899 break;2900 }2901 2902 1858 } // end transition() 2903 1859 … … 2906 1862 /////////////////////// 2907 1863 { 2908 ////////////////// 2909 // DMA Commands // 2910 ////////////////// 1864 // VCI initiator command on RAM network 1865 // directly the content of the dma_cmd FIFO 1866 1867 p_vci_ini_ram.cmdval = m_dma_cmd_addr_fifo.rok(); 1868 p_vci_ini_ram.address = m_dma_cmd_addr_fifo.read(); 1869 p_vci_ini_ram.be = m_dma_cmd_be_fifo.read(); 1870 p_vci_ini_ram.cmd = m_dma_cmd_cmd_fifo.read(); 1871 p_vci_ini_ram.contig = m_dma_cmd_contig_fifo.read(); 1872 p_vci_ini_ram.wdata = m_dma_cmd_data_fifo.read(); 1873 p_vci_ini_ram.eop = m_dma_cmd_eop_fifo.read(); 1874 p_vci_ini_ram.cons = m_dma_cmd_cons_fifo.read(); 1875 p_vci_ini_ram.plen = m_dma_cmd_plen_fifo.read(); 1876 p_vci_ini_ram.wrap = m_dma_cmd_wrap_fifo.read(); 1877 p_vci_ini_ram.cfixed = m_dma_cmd_cfixed_fifo.read(); 1878 p_vci_ini_ram.clen = m_dma_cmd_clen_fifo.read(); 1879 p_vci_ini_ram.trdid = m_dma_cmd_trdid_fifo.read(); 1880 p_vci_ini_ram.pktid = m_dma_cmd_pktid_fifo.read(); 1881 p_vci_ini_ram.srcid = m_dma_cmd_srcid_fifo.read(); 2911 1882 2912 // VCI initiator command on the xram network 2913 if(m_dma_cmd_addr_fifo.rok()) 2914 //&& p_vci_ini_dma.cmdack.read()) 2915 { 2916 p_vci_ini_dma.cmdval = true; 2917 #if NEW_XRAM_VCI 2918 p_vci_ini_dma.address = (paddr_t_x)(m_dma_cmd_addr_fifo.read() >> 6 ) 2919 #else 2920 p_vci_ini_dma.address = m_dma_cmd_addr_fifo.read(); 2921 #endif 2922 2923 p_vci_ini_dma.be = m_dma_cmd_be_fifo.read(); 2924 p_vci_ini_dma.cmd = m_dma_cmd_cmd_fifo.read(); 2925 p_vci_ini_dma.contig = m_dma_cmd_contig_fifo.read(); 2926 #if NEW_XRAM_VCI 2927 //TODO for 64 bits field 2928 #else 2929 p_vci_ini_dma.wdata = m_dma_cmd_data_fifo.read(); // The first is in param_x 2930 // the second in param_io 2931 #endif 2932 p_vci_ini_dma.eop = m_dma_cmd_eop_fifo.read(); 2933 p_vci_ini_dma.cons = m_dma_cmd_cons_fifo.read(); 2934 p_vci_ini_dma.plen = m_dma_cmd_plen_fifo.read(); 2935 p_vci_ini_dma.wrap = m_dma_cmd_wrap_fifo.read(); 2936 p_vci_ini_dma.cfixed = m_dma_cmd_cfixed_fifo.read(); 2937 p_vci_ini_dma.clen = m_dma_cmd_clen_fifo.read(); 2938 p_vci_ini_dma.trdid = m_dma_cmd_trdid_fifo.read(); 2939 p_vci_ini_dma.pktid = m_dma_cmd_pktid_fifo.read(); 2940 p_vci_ini_dma.srcid = m_dma_cmd_srcid_fifo.read(); 2941 } 2942 else 2943 { 2944 p_vci_ini_dma.cmdval = false; 2945 p_vci_ini_dma.address = 0; 2946 p_vci_ini_dma.be = 0; 2947 p_vci_ini_dma.cmd = vci_param_x::CMD_NOP; 2948 p_vci_ini_dma.contig = false; 2949 p_vci_ini_dma.wdata = 0; 2950 p_vci_ini_dma.eop = false; 2951 p_vci_ini_dma.cons = true; 2952 p_vci_ini_dma.plen = 0; 2953 p_vci_ini_dma.wrap = false; 2954 p_vci_ini_dma.cfixed = false; 2955 p_vci_ini_dma.clen = 0; 2956 p_vci_ini_dma.trdid = 0; 2957 p_vci_ini_dma.pktid = 0; 2958 } 2959 2960 // VCI target command on the IO network 2961 // it depends on the DMA_CMD FSM state 1883 // VCI target command ack on IOX network 1884 // depends on the DMA_CMD FSM state 2962 1885 2963 1886 switch ( r_dma_cmd_fsm.read() ) 2964 1887 { 2965 1888 case DMA_CMD_IDLE: 2966 case DMA_CMD_TRT_LOCK: 2967 case DMA_CMD_TRT_WAIT: 2968 case DMA_CMD_TRT_SET: 2969 p_vci_tgt_dma.cmdack = false; 2970 break; 2971 case DMA_CMD_FIFO_PUT: 2972 case DMA_CMD_FIFO_MISS_PUT: 2973 p_vci_tgt_dma.cmdack = m_dma_cmd_addr_fifo.wok(); 2974 break; 2975 case DMA_CMD_TLB_MISS_WAIT: 2976 p_vci_tgt_dma.cmdack = false; 2977 break; 2978 case DMA_CMD_TLB_MISS_STORE: 2979 p_vci_tgt_dma.cmdack = true; 2980 break; 2981 case DMA_CMD_ERROR: 2982 p_vci_tgt_dma.cmdack = !r_dma_cmd_error_req.read(); 1889 case DMA_CMD_MISS_WAIT: 1890 p_vci_tgt_iox.cmdack = false; 1891 break; 1892 case DMA_CMD_WAIT_EOP: 1893 p_vci_tgt_iox.cmdack = true; 1894 break; 1895 case DMA_CMD_FIFO_PUT_CMD: 1896 p_vci_tgt_iox.cmdack = m_dma_cmd_addr_fifo.wok(); 1897 break; 1898 case DMA_CMD_FIFO_PUT_RSP: 1899 p_vci_tgt_iox.cmdack = m_dma_rsp_data_fifo.wok(); 2983 1900 break; 2984 1901 }// end switch r_dma_cmd_fsm 2985 1902 2986 ////////////////// 2987 // DMA Responses// 2988 ////////////////// 1903 // VCI target response on IOX network 1904 // directly the content of the DMA_RSP FIFO 1905 1906 p_vci_tgt_iox.rspval = m_dma_rsp_data_fifo.rok(); 1907 p_vci_tgt_iox.rsrcid = m_dma_rsp_rsrcid_fifo.read(); 1908 p_vci_tgt_iox.rtrdid = m_dma_rsp_rtrdid_fifo.read(); 1909 p_vci_tgt_iox.rpktid = m_dma_rsp_rpktid_fifo.read(); 1910 p_vci_tgt_iox.rdata = m_dma_rsp_data_fifo.read(); 1911 p_vci_tgt_iox.rerror = m_dma_rsp_rerror_fifo.read(); 1912 p_vci_tgt_iox.reop = m_dma_rsp_reop_fifo.read(); 1913 1914 // VCI initiator response on the RAM Network 1915 // depends on the DMA_RSP FSM state 1916 1917 p_vci_ini_ram.rspack = m_dma_rsp_data_fifo.wok() and 1918 (r_dma_rsp_fsm.read() == DMA_RSP_FIFO_PUT) and 1919 not r_alloc_fifo_dma_rsp_local.read(); 1920 1921 // VCI initiator command on IOX network 1922 // directly the content of the CONFIG_CMD FIFO 1923 1924 p_vci_ini_iox.cmdval = m_config_cmd_addr_fifo.rok(); 1925 p_vci_ini_iox.address = m_config_cmd_addr_fifo.read(); 1926 p_vci_ini_iox.be = m_config_cmd_be_fifo.read(); 1927 p_vci_ini_iox.cmd = m_config_cmd_cmd_fifo.read(); 1928 p_vci_ini_iox.contig = m_config_cmd_contig_fifo.read(); 1929 p_vci_ini_iox.wdata = (ext_data_t)m_config_cmd_data_fifo.read(); 1930 p_vci_ini_iox.eop = m_config_cmd_eop_fifo.read(); 1931 p_vci_ini_iox.cons = m_config_cmd_cons_fifo.read(); 1932 p_vci_ini_iox.plen = m_config_cmd_plen_fifo.read(); 1933 p_vci_ini_iox.wrap = m_config_cmd_wrap_fifo.read(); 1934 p_vci_ini_iox.cfixed = m_config_cmd_cfixed_fifo.read(); 1935 p_vci_ini_iox.clen = m_config_cmd_clen_fifo.read(); 1936 p_vci_ini_iox.trdid = m_config_cmd_trdid_fifo.read(); 1937 p_vci_ini_iox.pktid = m_config_cmd_pktid_fifo.read(); 1938 p_vci_ini_iox.srcid = m_config_cmd_srcid_fifo.read(); 2989 1939 2990 // VCI target response on the IO network 2991 if(m_dma_rsp_data_fifo.rok()) 2992 { 2993 p_vci_tgt_dma.rspval = true; 2994 p_vci_tgt_dma.rsrcid = m_dma_rsp_rsrcid_fifo.read(); 2995 p_vci_tgt_dma.rtrdid = m_dma_rsp_rtrdid_fifo.read(); 2996 2997 p_vci_tgt_dma.rpktid = m_dma_rsp_rpktid_fifo.read(); 1940 // VCI target command ack on INT network 1941 // it depends on the CONFIG_CMD FSM state 1942 1943 switch ( r_config_cmd_fsm.read() ) 1944 { 1945 case CONFIG_CMD_IDLE: 1946 p_vci_tgt_int.cmdack = false; 1947 break; 1948 case CONFIG_CMD_FIFO_PUT_CMD: 1949 p_vci_tgt_int.cmdack = m_config_cmd_addr_fifo.wok(); 1950 break; 1951 case CONFIG_CMD_FIFO_PUT_RSP: 1952 p_vci_tgt_int.cmdack = m_config_rsp_data_fifo.wok() and 1953 r_alloc_fifo_config_rsp_local.read(); 1954 break; 1955 }// end switch r_config_cmd_fsm 1956 1957 // VCI target response on INT network 1958 // directly the content of the CONFIG_RSP FIFO 1959 1960 p_vci_tgt_int.rspval = m_config_rsp_data_fifo.rok(); 1961 p_vci_tgt_int.rsrcid = m_config_rsp_rsrcid_fifo.read(); 1962 p_vci_tgt_int.rtrdid = m_config_rsp_rtrdid_fifo.read(); 1963 p_vci_tgt_int.rpktid = m_config_rsp_rpktid_fifo.read(); 1964 p_vci_tgt_int.rdata = m_config_rsp_data_fifo.read(); 1965 p_vci_tgt_int.rerror = m_config_rsp_rerror_fifo.read(); 1966 p_vci_tgt_int.reop = m_config_rsp_reop_fifo.read(); 2998 1967 2999 #if NEW_XRAM_VCI 3000 //TODO for 64 bit data field 3001 #else 3002 p_vci_tgt_dma.rdata = m_dma_rsp_data_fifo.read(); // The first is in param_io 3003 // the second in param_x 3004 #endif 3005 3006 p_vci_tgt_dma.rerror = m_dma_rsp_rerror_fifo.read(); 3007 p_vci_tgt_dma.reop = m_dma_rsp_reop_fifo.read(); 3008 } 3009 else 3010 { 3011 p_vci_tgt_dma.rspval = false; 3012 3013 p_vci_tgt_dma.rsrcid = 0; 3014 p_vci_tgt_dma.rdata = 0; 3015 p_vci_tgt_dma.rpktid = 0; 3016 p_vci_tgt_dma.rtrdid = 0; 3017 p_vci_tgt_dma.rerror = 0; 3018 p_vci_tgt_dma.reop = false; 3019 3020 } 3021 3022 // VCI initiator response on the Xram Network 3023 // it depends on the DMA_RSP FSM state 3024 switch ( r_dma_rsp_fsm.read() ) 3025 { 3026 case DMA_RSP_IDLE: 3027 case DMA_RSP_TRT_LOCK: 3028 case DMA_RSP_FIFO_ERROR_PUT: 3029 { 3030 p_vci_ini_dma.rspack = false; 3031 break; 3032 } 3033 case DMA_RSP_FIFO_PUT: 3034 { 3035 p_vci_ini_dma.rspack = m_dma_rsp_data_fifo.wok(); 3036 break; 3037 } 3038 }// end switch r_dma_rsp_fsm 3039 3040 ///////////////////// 3041 // CONFIG Commands // 3042 ///////////////////// 3043 3044 // VCI initiator command on the IO network 3045 if(m_config_cmd_addr_fifo.rok()) 3046 { 3047 p_vci_ini_config.cmdval = true; 3048 #if NEW_XRAM_VCI 3049 p_vci_ini_config.address = (paddr_t_x)(m_config_cmd_addr_fifo.read() >> 6 ) 3050 #else 3051 p_vci_ini_config.address = m_config_cmd_addr_fifo.read(); 3052 #endif 3053 3054 p_vci_ini_config.be = (vci_be_t_x)m_config_cmd_be_fifo.read(); 3055 p_vci_ini_config.cmd = m_config_cmd_cmd_fifo.read(); 3056 p_vci_ini_config.contig = m_config_cmd_contig_fifo.read(); 3057 #if NEW_XRAM_VCI 3058 //TODO 3059 #else 3060 p_vci_ini_config.wdata = (vci_data_t_x)m_config_cmd_data_fifo.read(); // The first is in param_io 3061 // the second in param_d 3062 #endif 3063 p_vci_ini_config.eop = m_config_cmd_eop_fifo.read(); 3064 p_vci_ini_config.cons = m_config_cmd_cons_fifo.read(); 3065 p_vci_ini_config.plen = m_config_cmd_plen_fifo.read(); 3066 p_vci_ini_config.wrap = m_config_cmd_wrap_fifo.read(); 3067 p_vci_ini_config.cfixed = m_config_cmd_cfixed_fifo.read(); 3068 p_vci_ini_config.clen = m_config_cmd_clen_fifo.read(); 3069 p_vci_ini_config.trdid = m_config_cmd_trdid_fifo.read(); 3070 p_vci_ini_config.pktid = m_config_cmd_pktid_fifo.read(); 3071 } 3072 else 3073 { 3074 p_vci_ini_config.cmdval = false; 3075 p_vci_ini_config.address = 0; 3076 p_vci_ini_config.be = 0; 3077 p_vci_ini_config.cmd = vci_param_io::CMD_NOP; 3078 p_vci_ini_config.contig = false; 3079 p_vci_ini_config.wdata = 0; 3080 p_vci_ini_config.eop = false; 3081 p_vci_ini_config.cons = true; 3082 p_vci_ini_config.plen = 0; 3083 p_vci_ini_config.wrap = false; 3084 p_vci_ini_config.cfixed = false; 3085 p_vci_ini_config.clen = 0; 3086 p_vci_ini_config.trdid = 0; 3087 p_vci_ini_config.pktid = 0; 3088 } 1968 // VCI initiator response on IOX Network 1969 // it depends on the CONFIG_RSP FSM state 1970 1971 p_vci_ini_iox.rspack = m_config_rsp_data_fifo.wok() and 1972 (r_config_rsp_fsm.read() == CONFIG_RSP_FIFO_PUT) and 1973 not r_alloc_fifo_config_rsp_local.read(); 1974 1975 // VCI initiator command on INT network 1976 // it depends on the MISS_WTI_CMD FSM state 1977 1978 // default values 1979 p_vci_ini_int.srcid = m_int_srcid; 1980 p_vci_ini_int.trdid = 0; 1981 p_vci_ini_int.cfixed = false; 1982 p_vci_ini_int.eop = true; 1983 p_vci_ini_int.wrap = false; 1984 p_vci_ini_int.clen = 0; 1985 p_vci_ini_int.contig = false; 1986 p_vci_ini_int.cons = true; 1987 p_vci_ini_int.be = 0xFF; 3089 1988 3090 // VCI target command on the Direct network 3091 // it depends on the CONFIG_CMD FSM state 3092 3093 switch ( r_config_cmd_fsm.read() ) 3094 { 3095 case CONFIG_CMD_IDLE: 3096 case CONFIG_CMD_TRT_LOCK: 3097 case CONFIG_CMD_TRT_WAIT: 3098 case CONFIG_CMD_TRT_SET: 3099 case CONFIG_CMD_IT_ADDR_IOMMU_READ_1: 3100 case CONFIG_CMD_IT_ADDR_READ_1: 3101 case CONFIG_CMD_ERROR_RSP: 3102 case CONFIG_CMD_INVAL_REQ: 3103 p_vci_tgt_config.cmdack = false; 3104 break; 3105 case CONFIG_CMD_FIFO_PUT: 3106 case CONFIG_CMD_PTPR_WRITE: 3107 case CONFIG_CMD_PTPR_READ: 3108 case CONFIG_CMD_ACTIVE_WRITE: 3109 case CONFIG_CMD_ACTIVE_READ: 3110 case CONFIG_CMD_BVAR_READ: 3111 case CONFIG_CMD_ETR_READ: 3112 case CONFIG_CMD_BAD_ID_READ: 3113 case CONFIG_CMD_IT_ADDR_IOMMU_WRITE_2: 3114 case CONFIG_CMD_IT_ADDR_IOMMU_READ_2: 3115 case CONFIG_CMD_IT_ADDR_WRITE_2: 3116 case CONFIG_CMD_IT_ADDR_READ_2: 3117 case CONFIG_CMD_INVAL: 3118 p_vci_tgt_config.cmdack = m_config_cmd_addr_fifo.wok(); 3119 break; 3120 case CONFIG_CMD_IT_ADDR_IOMMU_WRITE_1: 3121 case CONFIG_CMD_IT_ADDR_WRITE_1: 3122 case CONFIG_CMD_ERROR_WAIT: 3123 p_vci_tgt_config.cmdack = true; 3124 break; 3125 default: 3126 p_vci_tgt_config.cmdack = false; 3127 break; 3128 }// end switch r_config_cmd_fsm 3129 3130 ///////////////////// 3131 // CONFIG Responses// 3132 ///////////////////// 1989 switch ( r_miss_wti_cmd_fsm.read() ) 1990 { 1991 case MISS_WTI_CMD_IDLE: 1992 p_vci_ini_int.cmdval = false; 1993 p_vci_ini_int.address = 0; 1994 p_vci_ini_int.cmd = vci_param_int::CMD_NOP; 1995 p_vci_ini_int.pktid = PKTID_READ; 1996 p_vci_ini_int.wdata = 0; 1997 p_vci_ini_int.plen = 0; 1998 break; 3133 1999 3134 // VCI target response on the Direct network 3135 if(r_config_rsp_fifo_local_priority) 3136 { 3137 if( m_config_local_data_fifo.rok() ) 3138 { 3139 p_vci_tgt_config.rspval = true; 3140 p_vci_tgt_config.rsrcid = m_config_local_rsrcid_fifo.read(); 3141 p_vci_tgt_config.rtrdid = m_config_local_rtrdid_fifo.read(); 3142 p_vci_tgt_config.rpktid = m_config_local_rpktid_fifo.read(); 3143 p_vci_tgt_config.rdata = (vci_data_t)m_config_local_data_fifo.read(); 3144 p_vci_tgt_config.rerror = m_config_local_rerror_fifo.read(); 3145 p_vci_tgt_config.reop = m_config_local_reop_fifo.read(); 3146 } 3147 else if(m_config_rsp_data_fifo.rok() ) 3148 { 3149 p_vci_tgt_config.rspval = true; 3150 p_vci_tgt_config.rsrcid = m_config_rsp_rsrcid_fifo.read(); 3151 p_vci_tgt_config.rtrdid = m_config_rsp_rtrdid_fifo.read(); 3152 3153 p_vci_tgt_config.rpktid = m_config_rsp_rpktid_fifo.read(); 2000 case MISS_WTI_CMD_WTI: 2001 p_vci_ini_int.cmdval = true; 2002 p_vci_ini_int.address = r_iommu_peri_wti[r_miss_wti_cmd_index.read()].read(); 2003 p_vci_ini_int.cmd = vci_param_int::CMD_WRITE; 2004 p_vci_ini_int.pktid = PKTID_WRITE; 2005 p_vci_ini_int.wdata = (int_data_t)r_irq_pending[r_miss_wti_cmd_index.read()].read(); 2006 p_vci_ini_int.plen = vci_param_int::B; 2007 break; 3154 2008 3155 p_vci_tgt_config.rdata = (vci_data_t)m_config_rsp_data_fifo.read(); // The first is in param_d 3156 // the second in param_io 3157 p_vci_tgt_config.rerror = m_config_rsp_rerror_fifo.read(); 3158 p_vci_tgt_config.reop = m_config_rsp_reop_fifo.read(); 3159 } 3160 else 3161 { 3162 p_vci_tgt_config.rspval = false; 3163 3164 p_vci_tgt_config.rsrcid = 0; 3165 p_vci_tgt_config.rdata = 0; 3166 p_vci_tgt_config.rpktid = 0; 3167 p_vci_tgt_config.rtrdid = 0; 3168 p_vci_tgt_config.rerror = 0; 3169 p_vci_tgt_config.reop = false; 3170 3171 } 3172 } 3173 else 3174 { 3175 if(m_config_rsp_data_fifo.rok() ) 3176 { 3177 p_vci_tgt_config.rspval = true; 3178 p_vci_tgt_config.rsrcid = m_config_rsp_rsrcid_fifo.read(); 3179 p_vci_tgt_config.rtrdid = m_config_rsp_rtrdid_fifo.read(); 3180 3181 p_vci_tgt_config.rpktid = m_config_rsp_rpktid_fifo.read(); 3182 3183 p_vci_tgt_config.rdata = (vci_data_t)m_config_rsp_data_fifo.read(); // The first is in param_d 3184 // the second in param_io 3185 p_vci_tgt_config.rerror = m_config_rsp_rerror_fifo.read(); 3186 p_vci_tgt_config.reop = m_config_rsp_reop_fifo.read(); 3187 } 3188 else if( m_config_local_data_fifo.rok() ) 3189 { 3190 p_vci_tgt_config.rspval = true; 3191 p_vci_tgt_config.rsrcid = m_config_local_rsrcid_fifo.read(); 3192 p_vci_tgt_config.rtrdid = m_config_local_rtrdid_fifo.read(); 3193 p_vci_tgt_config.rpktid = m_config_local_rpktid_fifo.read(); 3194 p_vci_tgt_config.rdata = (vci_data_t)m_config_local_data_fifo.read(); 3195 p_vci_tgt_config.rerror = m_config_local_rerror_fifo.read(); 3196 p_vci_tgt_config.reop = m_config_local_reop_fifo.read(); 3197 } 3198 else 3199 { 3200 p_vci_tgt_config.rspval = false; 3201 3202 p_vci_tgt_config.rsrcid = 0; 3203 p_vci_tgt_config.rdata = 0; 3204 p_vci_tgt_config.rpktid = 0; 3205 p_vci_tgt_config.rtrdid = 0; 3206 p_vci_tgt_config.rerror = 0; 3207 p_vci_tgt_config.reop = false; 3208 3209 } 3210 } 3211 3212 // VCI initiator response on the IO Network 3213 // it depends on the CONFIG_RSP FSM state 3214 switch ( r_config_rsp_fsm.read() ) 3215 { 3216 case CONFIG_RSP_IDLE: 3217 case CONFIG_RSP_TRT_LOCK: 3218 p_vci_ini_config.rspack = false; 3219 break; 3220 case CONFIG_RSP_FIFO_PUT: 3221 p_vci_ini_config.rspack = m_config_rsp_data_fifo.wok(); 3222 break; 3223 }// end switch r_config_rsp_fsm 3224 3225 //////////////////////////////////////////////////////////////// 3226 // VCI initiator command and response on from the Direct network 3227 // for Miss Transactions 3228 p_vci_ini_miss.srcid = m_srcid_miss; 3229 3230 switch ( r_miss_init_fsm.read() ) 3231 { 3232 case MISS_INIT_IDLE_MISS: 3233 case MISS_INIT_IDLE_IRQ: 3234 p_vci_ini_miss.cmdval = false; 3235 p_vci_ini_miss.address = 0; 3236 p_vci_ini_miss.be = 0; 3237 p_vci_ini_miss.cmd = vci_param_d::CMD_NOP; 3238 p_vci_ini_miss.contig = false; 3239 p_vci_ini_miss.wdata = 0; 3240 p_vci_ini_miss.eop = false; 3241 p_vci_ini_miss.cons = true; 3242 p_vci_ini_miss.plen = 0; 3243 p_vci_ini_miss.wrap = false; 3244 p_vci_ini_miss.cfixed = false; 3245 p_vci_ini_miss.clen = 0; 3246 p_vci_ini_miss.trdid = 0; 3247 p_vci_ini_miss.pktid = 0; 3248 3249 p_vci_ini_miss.rspack = false; 3250 break; 3251 3252 case MISS_INIT_IRQ_CMD: 3253 p_vci_ini_miss.cmdval = true; 3254 p_vci_ini_miss.address = (paddr_t)r_it_addr[r_irq_chosen.read()]; 3255 p_vci_ini_miss.wdata = 0; 3256 p_vci_ini_miss.plen = vci_param_d::B; 3257 p_vci_ini_miss.trdid = 0; 3258 p_vci_ini_miss.cmd = vci_param_d::CMD_READ; 3259 p_vci_ini_miss.eop = true; 3260 3261 p_vci_ini_miss.be = 0xF; 3262 p_vci_ini_miss.pktid = 0; 3263 p_vci_ini_miss.cons = false; 3264 p_vci_ini_miss.wrap = false; 3265 p_vci_ini_miss.contig = true; 3266 p_vci_ini_miss.clen = 0; 3267 p_vci_ini_miss.cfixed = false; 3268 break; 3269 3270 case MISS_INIT_IRQ_RSP: 3271 case MISS_INIT_TLB_MISS_RSP: 3272 p_vci_ini_miss.cmdval = false; 3273 p_vci_ini_miss.address = 0; 3274 p_vci_ini_miss.be = 0; 3275 p_vci_ini_miss.cmd = vci_param_d::CMD_NOP; 3276 p_vci_ini_miss.contig = false; 3277 p_vci_ini_miss.wdata = 0; 3278 p_vci_ini_miss.eop = false; 3279 p_vci_ini_miss.cons = true; 3280 p_vci_ini_miss.plen = 0; 3281 p_vci_ini_miss.wrap = false; 3282 p_vci_ini_miss.cfixed = false; 3283 p_vci_ini_miss.clen = 0; 3284 p_vci_ini_miss.trdid = 0; 3285 p_vci_ini_miss.pktid = 0; 3286 3287 p_vci_ini_miss.rspack = true; 3288 3289 break; 3290 3291 case MISS_INIT_TLB_MISS_CMD: 3292 p_vci_ini_miss.cmdval = true; 3293 p_vci_ini_miss.address = (paddr_t)((r_iotlb_paddr.read())& CACHE_LINE_MASK); 3294 p_vci_ini_miss.wdata = 0x00000000; 3295 p_vci_ini_miss.plen = m_words*(vci_param_d::B); 3296 p_vci_ini_miss.trdid = 0; //could be used as the index on a miss transaction table 3297 p_vci_ini_miss.cmd = vci_param_d::CMD_READ; 3298 p_vci_ini_miss.eop = true; 3299 3300 p_vci_ini_miss.be = 0xF; 3301 p_vci_ini_miss.pktid = 0; 3302 p_vci_ini_miss.cons = false; 3303 p_vci_ini_miss.wrap = false; 3304 p_vci_ini_miss.contig = true; 3305 p_vci_ini_miss.clen = 0; 3306 p_vci_ini_miss.cfixed = false; 3307 break; 3308 3309 } // end switch r_miss_init_fsm 2009 case MISS_WTI_CMD_MISS: 2010 p_vci_ini_int.cmdval = true; 2011 p_vci_ini_int.address = r_tlb_paddr.read() & CACHE_LINE_MASK; 2012 p_vci_ini_int.cmd = vci_param_int::CMD_READ; 2013 p_vci_ini_int.pktid = PKTID_READ; 2014 p_vci_ini_int.wdata = 0; 2015 p_vci_ini_int.plen = m_words*(vci_param_int::B); 2016 break; 2017 } 2018 2019 // VCI initiator response on INT network 2020 // It depends on the MISS_WTI_RSP FSM state 2021 2022 if ( r_miss_wti_rsp_fsm.read() == MISS_WTI_RSP_IDLE ) p_vci_ini_int.rspack = false; 2023 else p_vci_ini_int.rspack = true; 2024 3310 2025 } // end genMoore 3311 2026 -
trunk/modules/vci_mem_cache/caba/metadata/vci_mem_cache.sd
r426 r434 24 24 '../source/include/mem_cache_directory.h', 25 25 '../source/include/update_tab.h' 26 ], 27 28 interface_files = [ 29 '../../include/soclib/mem_cache.h', 26 30 ], 27 31 -
trunk/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h
r385 r434 274 274 275 275 ///////////////////////////////////////////////////////////////////// 276 // The inval function invalidate an entry defined by the set and 277 // way arguments. 278 ///////////////////////////////////////////////////////////////////// 279 void inval( const size_t &set, const size_t &way ) 280 { 281 m_dir_tab[set][way].init(); 282 } 283 284 ///////////////////////////////////////////////////////////////////// 276 285 // The read_neutral() function reads a directory entry, without 277 286 // changing the LRU … … 320 329 // update LRU bits 321 330 bool all_recent = true; 322 for ( size_t i=0 ; i<m_ways ; i++ ) { 323 if ( i != way ) all_recent = m_lru_tab[set][i].recent && all_recent; 324 } 325 if ( all_recent ) { 326 for( size_t i=0 ; i<m_ways ; i++ ) m_lru_tab[set][i].recent = false; 327 } else { 328 m_lru_tab[set][way].recent = true; 331 for ( size_t i=0 ; i<m_ways ; i++ ) 332 { 333 if ( i != way ) all_recent = m_lru_tab[set][i].recent && all_recent; 334 } 335 if ( all_recent ) 336 { 337 for( size_t i=0 ; i<m_ways ; i++ ) m_lru_tab[set][i].recent = false; 338 } 339 else 340 { 341 m_lru_tab[set][way].recent = true; 329 342 } 330 343 } // end write() -
trunk/modules/vci_mem_cache/caba/source/include/update_tab.h
r385 r434 11 11 //////////////////////////////////////////////////////////////////////// 12 12 class UpdateTabEntry { 13 13 14 typedef uint32_t size_t; 14 15 typedef sc_dt::sc_uint<40> addr_t; 15 16 16 17 public: 18 17 19 bool valid; // It is a valid pending transaction 18 20 bool update; // It is an update transaction 19 21 bool brdcast; // It is a broadcast invalidate 20 bool rsp; // It needs a response to the initiator 22 bool rsp; // Response to the initiator required 23 bool ack; // Acknowledge to the CONFIG FSM required 21 24 size_t srcid; // The srcid of the initiator which wrote the data 22 25 size_t trdid; // The trdid of the initiator which wrote the data … … 25 28 size_t count; // The number of acknowledge responses to receive 26 29 27 UpdateTabEntry(){ 30 UpdateTabEntry() 31 { 28 32 valid = false; 29 33 update = false; 30 34 brdcast = false; 31 35 rsp = false; 36 ack = false; 32 37 srcid = 0; 33 38 trdid = 0; … … 38 43 39 44 UpdateTabEntry(bool i_valid, 40 bool i_update, 41 bool i_brdcast, 42 bool i_rsp, 43 size_t i_srcid, 44 size_t i_trdid, 45 size_t i_pktid, 46 addr_t i_nline, 47 size_t i_count) 45 bool i_update, 46 bool i_brdcast, 47 bool i_rsp, 48 bool i_ack, 49 size_t i_srcid, 50 size_t i_trdid, 51 size_t i_pktid, 52 addr_t i_nline, 53 size_t i_count) 48 54 { 49 55 valid = i_valid; … … 51 57 brdcast = i_brdcast; 52 58 rsp = i_rsp; 59 ack = i_ack; 53 60 srcid = i_srcid; 54 61 trdid = i_trdid; … … 64 71 brdcast = source.brdcast; 65 72 rsp = source.rsp; 73 ack = source.ack; 66 74 srcid = source.srcid; 67 75 trdid = source.trdid; … … 80 88 brdcast= false; 81 89 rsp = false; 90 ack = false; 82 91 srcid = 0; 83 92 trdid = 0; … … 98 107 brdcast= source.brdcast; 99 108 rsp = source.rsp; 109 ack = source.ack ; 100 110 srcid = source.srcid; 101 111 trdid = source.trdid; … … 108 118 // The print() function prints the entry 109 119 //////////////////////////////////////////////////////////////////// 110 void print(){ 111 std::cout << std::dec << "valid = " << valid << std::endl; 112 std::cout << "update = " << update << std::endl; 113 std::cout << "brdcast= " << brdcast<< std::endl; 114 std::cout << "rsp = " << rsp << std::endl; 115 std::cout << "srcid = " << srcid << std::endl; 116 std::cout << "trdid = " << trdid << std::endl; 117 std::cout << "pktid = " << pktid << std::endl; 118 std::cout << std::hex << "nline = " << nline << std::endl; 119 std::cout << std::dec << "count = " << count << std::endl; 120 void print() 121 { 122 std::cout << " val = " << std::dec << valid 123 << " / updt = " << update 124 << " / bc = " << brdcast 125 << " / rsp = " << rsp 126 << " / ack = " << ack 127 << " / count = " << count 128 << " / srcid = " << std::hex << srcid 129 << " / trdid = " << trdid 130 << " / pktid = " << pktid 131 << " / nline = " << nline << std::endl; 120 132 } 121 133 }; … … 126 138 class UpdateTab{ 127 139 128 typedef sc_dt::sc_uint<40>addr_t;140 typedef uint64_t addr_t; 129 141 130 142 private: 131 size_t size_tab;143 size_t size_tab; 132 144 std::vector<UpdateTabEntry> tab; 133 145 … … 149 161 // The size() function returns the size of the tab 150 162 //////////////////////////////////////////////////////////////////// 151 const size_t size(){ 163 const size_t size() 164 { 152 165 return size_tab; 153 166 } 154 167 155 156 168 //////////////////////////////////////////////////////////////////// 157 169 // The print() function diplays the tab content 158 170 //////////////////////////////////////////////////////////////////// 159 void print(){ 160 for(size_t i=0; i<size_tab; i++) { 161 std::cout << "UPDATE TAB ENTRY " << std::dec << i << "--------" << std::endl; 171 void print() 172 { 173 std::cout << "UPDATE TABLE Content" << std::endl; 174 for(size_t i=0; i<size_tab; i++) 175 { 176 std::cout << "[" << std::dec << i << "] "; 162 177 tab[i].print(); 163 178 } … … 165 180 } 166 181 167 168 182 ///////////////////////////////////////////////////////////////////// 169 183 // The init() function initializes the tab 170 184 ///////////////////////////////////////////////////////////////////// 171 void init(){ 172 for ( size_t i=0; i<size_tab; i++) { 173 tab[i].init(); 174 } 175 } 176 185 void init() 186 { 187 for ( size_t i=0; i<size_tab; i++) tab[i].init(); 188 } 177 189 178 190 ///////////////////////////////////////////////////////////////////// … … 200 212 /////////////////////////////////////////////////////////////////////////// 201 213 bool set(const bool update, 202 const bool brdcast, 203 const bool rsp, 204 const size_t srcid, 205 const size_t trdid, 206 const size_t pktid, 207 const addr_t nline, 208 const size_t count, 209 size_t &index) 210 { 211 for ( size_t i=0 ; i<size_tab ; i++ ) { 212 if( !tab[i].valid ) { 214 const bool brdcast, 215 const bool rsp, 216 const bool ack, 217 const size_t srcid, 218 const size_t trdid, 219 const size_t pktid, 220 const addr_t nline, 221 const size_t count, 222 size_t &index) 223 { 224 for ( size_t i=0 ; i<size_tab ; i++ ) 225 { 226 if( !tab[i].valid ) 227 { 213 228 tab[i].valid = true; 214 229 tab[i].update = update; 215 230 tab[i].brdcast = brdcast; 216 231 tab[i].rsp = rsp; 232 tab[i].ack = ack; 217 233 tab[i].srcid = (size_t) srcid; 218 234 tab[i].trdid = (size_t) trdid; … … 235 251 ///////////////////////////////////////////////////////////////////// 236 252 bool decrement( const size_t index, 237 size_t &counter )253 size_t &counter ) 238 254 { 239 255 assert((index<size_tab) && "Bad Update Tab Entry"); 240 if ( tab[index].valid ) { 256 if ( tab[index].valid ) 257 { 241 258 tab[index].count--; 242 259 counter = tab[index].count; 243 260 return true; 244 } else { 261 } 262 else 263 { 245 264 return false; 246 265 } … … 252 271 bool is_full() 253 272 { 254 for(size_t i = 0 ; i < size_tab ; i++){ 255 if(!tab[i].valid){ 256 return false; 257 } 273 for(size_t i = 0 ; i < size_tab ; i++) 274 { 275 if(!tab[i].valid) return false; 258 276 } 259 277 return true; … … 265 283 bool is_not_empty() 266 284 { 267 for(size_t i = 0 ; i < size_tab ; i++){ 268 if(tab[i].valid){ 285 for(size_t i = 0 ; i < size_tab ; i++) 286 { 287 if(tab[i].valid) return true; 288 } 289 return false; 290 } 291 292 ///////////////////////////////////////////////////////////////////// 293 // The need_rsp() function returns the need of a response 294 // Arguments : 295 // - index : the index of the entry 296 ///////////////////////////////////////////////////////////////////// 297 bool need_rsp(const size_t index) 298 { 299 assert(index<size_tab && "Bad Update Tab Entry"); 300 return tab[index].rsp; 301 } 302 303 ///////////////////////////////////////////////////////////////////// 304 // The need_ack() function returns the need of an acknowledge 305 // Arguments : 306 // - index : the index of the entry 307 ///////////////////////////////////////////////////////////////////// 308 bool need_ack(const size_t index) 309 { 310 assert(index<size_tab && "Bad Update Tab Entry"); 311 return tab[index].ack; 312 } 313 314 ///////////////////////////////////////////////////////////////////// 315 // The is_brdcast() function returns the transaction type 316 // Arguments : 317 // - index : the index of the entry 318 ///////////////////////////////////////////////////////////////////// 319 bool is_brdcast(const size_t index) 320 { 321 assert(index<size_tab && "Bad Update Tab Entry"); 322 return tab[index].brdcast; 323 } 324 325 ///////////////////////////////////////////////////////////////////// 326 // The is_update() function returns the transaction type 327 // Arguments : 328 // - index : the index of the entry 329 ///////////////////////////////////////////////////////////////////// 330 bool is_update(const size_t index) 331 { 332 assert(index<size_tab && "Bad Update Tab Entry"); 333 return tab[index].update; 334 } 335 336 ///////////////////////////////////////////////////////////////////// 337 // The srcid() function returns the srcid value 338 // Arguments : 339 // - index : the index of the entry 340 ///////////////////////////////////////////////////////////////////// 341 size_t srcid(const size_t index) 342 { 343 assert(index<size_tab && "Bad Update Tab Entry"); 344 return tab[index].srcid; 345 } 346 347 ///////////////////////////////////////////////////////////////////// 348 // The trdid() function returns the trdid value 349 // Arguments : 350 // - index : the index of the entry 351 ///////////////////////////////////////////////////////////////////// 352 size_t trdid(const size_t index) 353 { 354 assert(index<size_tab && "Bad Update Tab Entry"); 355 return tab[index].trdid; 356 } 357 358 ///////////////////////////////////////////////////////////////////// 359 // The pktid() function returns the pktid value 360 // Arguments : 361 // - index : the index of the entry 362 ///////////////////////////////////////////////////////////////////// 363 size_t pktid(const size_t index) 364 { 365 assert(index<size_tab && "Bad Update Tab Entry"); 366 return tab[index].pktid; 367 } 368 369 ///////////////////////////////////////////////////////////////////// 370 // The nline() function returns the nline value 371 // Arguments : 372 // - index : the index of the entry 373 ///////////////////////////////////////////////////////////////////// 374 addr_t nline(const size_t index) 375 { 376 assert(index<size_tab && "Bad Update Tab Entry"); 377 return tab[index].nline; 378 } 379 380 ///////////////////////////////////////////////////////////////////// 381 // The search_inval() function returns the index of the entry in UPT 382 // Arguments : 383 // - nline : the line number of the entry in the directory 384 ///////////////////////////////////////////////////////////////////// 385 bool search_inval(const addr_t nline,size_t &index) 386 { 387 size_t i ; 388 389 for (i = 0 ; i < size_tab ; i++) 390 { 391 if ( (tab[i].nline == nline) and tab[i].valid and not tab[i].update ) 392 { 393 index = i ; 269 394 return true; 270 395 } … … 274 399 275 400 ///////////////////////////////////////////////////////////////////// 276 // The need_rsp() function returns the need of a response 277 // Arguments : 278 // - index : the index of the entry 279 ///////////////////////////////////////////////////////////////////// 280 bool need_rsp(const size_t index) 281 { 282 assert(index<size_tab && "Bad Update Tab Entry"); 283 return tab[index].rsp; 284 } 285 286 ///////////////////////////////////////////////////////////////////// 287 // The is_update() function returns the transaction type 288 // Arguments : 289 // - index : the index of the entry 290 ///////////////////////////////////////////////////////////////////// 291 bool is_brdcast(const size_t index) 292 { 293 assert(index<size_tab && "Bad Update Tab Entry"); 294 return tab[index].brdcast; 295 } 296 297 ///////////////////////////////////////////////////////////////////// 298 // The is_update() function returns the transaction type 299 // Arguments : 300 // - index : the index of the entry 301 ///////////////////////////////////////////////////////////////////// 302 bool is_update(const size_t index) 303 { 304 assert(index<size_tab && "Bad Update Tab Entry"); 305 return tab[index].update; 306 } 307 308 ///////////////////////////////////////////////////////////////////// 309 // The srcid() function returns the srcid value 310 // Arguments : 311 // - index : the index of the entry 312 ///////////////////////////////////////////////////////////////////// 313 size_t srcid(const size_t index) 314 { 315 assert(index<size_tab && "Bad Update Tab Entry"); 316 return tab[index].srcid; 317 } 318 319 ///////////////////////////////////////////////////////////////////// 320 // The trdid() function returns the trdid value 321 // Arguments : 322 // - index : the index of the entry 323 ///////////////////////////////////////////////////////////////////// 324 size_t trdid(const size_t index) 325 { 326 assert(index<size_tab && "Bad Update Tab Entry"); 327 return tab[index].trdid; 328 } 329 330 ///////////////////////////////////////////////////////////////////// 331 // The pktid() function returns the pktid value 332 // Arguments : 333 // - index : the index of the entry 334 ///////////////////////////////////////////////////////////////////// 335 size_t pktid(const size_t index) 336 { 337 assert(index<size_tab && "Bad Update Tab Entry"); 338 return tab[index].pktid; 339 } 340 341 ///////////////////////////////////////////////////////////////////// 342 // The nline() function returns the nline value 343 // Arguments : 344 // - index : the index of the entry 345 ///////////////////////////////////////////////////////////////////// 346 addr_t nline(const size_t index) 347 { 348 assert(index<size_tab && "Bad Update Tab Entry"); 349 return tab[index].nline; 350 } 351 352 ///////////////////////////////////////////////////////////////////// 353 // The search_inval() function returns the index of the entry in UPT 401 // The read_nline() function returns the index of the entry in UPT 354 402 // Arguments : 355 403 // - nline : the line number of the entry in the directory 356 404 ///////////////////////////////////////////////////////////////////// 357 bool search_inval(const addr_t nline,size_t &index)405 bool read_nline(const addr_t nline,size_t &index) 358 406 { 359 407 size_t i ; 360 408 361 for (i = 0 ; i < size_tab ; i++){ 362 if((tab[i].nline == nline) && tab[i].valid){ 363 if(!tab[i].update){ 364 index = i ; 365 return true; 366 } 367 } 368 } 369 return false; 370 } 371 372 ///////////////////////////////////////////////////////////////////// 373 // The read_nline() function returns the index of the entry in UPT 374 // Arguments : 375 // - nline : the line number of the entry in the directory 376 ///////////////////////////////////////////////////////////////////// 377 bool read_nline(const addr_t nline,size_t &index) 378 { 379 size_t i ; 380 381 for (i = 0 ; i < size_tab ; i++){ 382 if((tab[i].nline == nline) && tab[i].valid){ 409 for (i = 0 ; i < size_tab ; i++) 410 { 411 if ( (tab[i].nline == nline) and tab[i].valid ) 412 { 383 413 index = i ; 384 414 return true; -
trunk/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h
r430 r434 77 77 78 78 /* States of the TGT_CMD fsm */ 79 enum tgt_cmd_fsm_state_e{ 79 enum tgt_cmd_fsm_state_e 80 { 80 81 TGT_CMD_IDLE, 81 82 TGT_CMD_ERROR, 82 83 TGT_CMD_READ, 83 84 TGT_CMD_WRITE, 84 TGT_CMD_CAS 85 TGT_CMD_CAS, 86 TGT_CMD_CONFIG 85 87 }; 86 88 … … 144 146 MULTI_ACK_UPT_LOCK, 145 147 MULTI_ACK_UPT_CLEAR, 146 MULTI_ACK_WRITE_RSP 148 MULTI_ACK_WRITE_RSP, 149 MULTI_ACK_CONFIG_ACK 150 }; 151 152 /* States of the CONFIG fsm */ 153 enum config_fsm_state_e 154 { 155 CONFIG_IDLE, 156 CONFIG_LOOP, 157 CONFIG_RSP, 158 CONFIG_DIR_REQ, 159 CONFIG_DIR_ACCESS, 160 CONFIG_DIR_INVAL, 161 CONFIG_BC_UPT_LOCK, 162 CONFIG_BC_SEND, 163 CONFIG_BC_WAIT, 164 165 CONFIG_UPT_WAIT, 166 167 CONFIG_UPT_LOCK, 168 169 CONFIG_HEAP_REQ 147 170 }; 148 171 … … 277 300 CLEANUP_UPT_CLEAR, 278 301 CLEANUP_WRITE_RSP, 279 CLEANUP_SEND_ACK 302 CLEANUP_CONFIG_ACK, 303 CLEANUP_SEND_CLACK 280 304 }; 281 305 … … 284 308 { 285 309 ALLOC_DIR_RESET, 310 ALLOC_DIR_CONFIG, 286 311 ALLOC_DIR_READ, 287 312 ALLOC_DIR_WRITE, … … 304 329 enum alloc_upt_fsm_state_e 305 330 { 331 ALLOC_UPT_CONFIG, 306 332 ALLOC_UPT_WRITE, 307 333 ALLOC_UPT_XRAM_RSP, … … 350 376 }; 351 377 378 /* Configuration commands */ 379 enum cmd_config_type_e 380 { 381 CMD_CONFIG_INVAL = 0, 382 CMD_CONFIG_SYNC = 1 383 }; 384 352 385 // debug variables (for each FSM) 353 bool m_debug_global; 354 bool m_debug_tgt_cmd_fsm; 355 bool m_debug_tgt_rsp_fsm; 356 bool m_debug_cc_send_fsm; 357 bool m_debug_cc_receive_fsm; 358 bool m_debug_multi_ack_fsm; 359 bool m_debug_read_fsm; 360 bool m_debug_write_fsm; 361 bool m_debug_cas_fsm; 362 bool m_debug_cleanup_fsm; 363 bool m_debug_ixr_cmd_fsm; 364 bool m_debug_ixr_rsp_fsm; 365 bool m_debug_xram_rsp_fsm; 386 bool m_debug; 366 387 bool m_debug_previous_hit; 367 388 size_t m_debug_previous_count; … … 373 394 // instrumentation counters 374 395 uint32_t m_cpt_cycles; // Counter of cycles 396 375 397 uint32_t m_cpt_read; // Number of READ transactions 398 uint32_t m_cpt_read_remote; // number of remote READ transactions 399 uint32_t m_cpt_read_flits; // number of flits for READs 400 uint32_t m_cpt_read_cost; // Number of (flits * distance) for READs 401 376 402 uint32_t m_cpt_read_miss; // Number of MISS READ 403 377 404 uint32_t m_cpt_write; // Number of WRITE transactions 405 uint32_t m_cpt_write_remote; // number of remote WRITE transactions 406 uint32_t m_cpt_write_flits; // number of flits for WRITEs 407 uint32_t m_cpt_write_cost; // Number of (flits * distance) for WRITEs 408 378 409 uint32_t m_cpt_write_miss; // Number of MISS WRITE 379 410 uint32_t m_cpt_write_cells; // Cumulated length for WRITE transactions … … 391 422 uint32_t m_cpt_cas; // Number of CAS transactions 392 423 424 uint32_t m_cpt_cleanup_cost; // Number of (flits * distance) for CLEANUPs 425 426 uint32_t m_cpt_update_flits; // Number of flits for UPDATEs 427 uint32_t m_cpt_update_cost; // Number of (flits * distance) for UPDATEs 428 429 uint32_t m_cpt_inval_cost; // Number of (flits * distance) for INVALs 430 431 uint32_t m_cpt_get; 432 433 uint32_t m_cpt_put; 434 393 435 size_t m_prev_count; 394 436 … … 407 449 VciMemCache( 408 450 sc_module_name name, // Instance Name 409 const soclib::common::MappingTable &mtp, // Mapping table directnetwork410 const soclib::common::MappingTable &mtx, // Mapping table externalnetwork411 const soclib::common::IntTab &srcid_x, // global index on externalnetwork412 const soclib::common::IntTab &tgtid_d, // global index on directnetwork413 const size_t cc_global_id, // global index on ccnetwork451 const soclib::common::MappingTable &mtp, // Mapping table INT network 452 const soclib::common::MappingTable &mtx, // Mapping table RAM network 453 const soclib::common::IntTab &srcid_x, // global index RAM network 454 const soclib::common::IntTab &tgtid_d, // global index INT network 455 const size_t cc_global_id, // global index CC network 414 456 const size_t nways, // Number of ways per set 415 457 const size_t nsets, // Number of sets 416 458 const size_t nwords, // Number of words per line 417 const size_t max_copies, // max number of copies in heap459 const size_t max_copies, // max number of copies 418 460 const size_t heap_size=HEAP_ENTRIES, 419 461 const size_t trt_lines=TRT_ENTRIES, … … 437 479 438 480 // Component attributes 439 std::list<soclib::common::Segment> m_seglist; // segments allocated to memcache481 std::list<soclib::common::Segment> m_seglist; // segments allocated 440 482 size_t m_nseg; // number of segments 441 483 soclib::common::Segment **m_seg; // array of segments pointers 442 const size_t m_srcid_x; // global index on external network 484 size_t m_seg_config; // config segment index 485 const size_t m_srcid_x; // global index on RAM network 443 486 const size_t m_initiators; // Number of initiators 444 487 const size_t m_heap_size; // Size of the heap … … 458 501 size_t m_max_copies; // max number of copies in heap 459 502 GenericLLSCGlobalTable 460 < 32 , 461 4096, 462 8000, 463 addr_t > m_llsc_table; // ll/sc globalregistration table503 < 32 , // number of slots 504 4096, // number of processors in the system 505 8000, // registration life (# of LL operations) 506 addr_t > m_llsc_table; // ll/sc registration table 464 507 465 508 // adress masks … … 511 554 // (segmentation violation response request) 512 555 sc_signal<bool> r_tgt_cmd_to_tgt_rsp_req; 556 557 sc_signal<uint32_t> r_tgt_cmd_to_tgt_rsp_rdata; 558 sc_signal<size_t> r_tgt_cmd_to_tgt_rsp_error; 513 559 sc_signal<size_t> r_tgt_cmd_to_tgt_rsp_srcid; 514 560 sc_signal<size_t> r_tgt_cmd_to_tgt_rsp_trdid; 515 561 sc_signal<size_t> r_tgt_cmd_to_tgt_rsp_pktid; 516 562 563 sc_signal<addr_t> r_tgt_cmd_config_addr; 564 sc_signal<size_t> r_tgt_cmd_config_cmd; 565 566 /////////////////////////////////////////////////////// 567 // Registers controlled by the CONFIG fsm 568 /////////////////////////////////////////////////////// 569 570 sc_signal<int> r_config_fsm; // FSM state 571 sc_signal<bool> r_config_lock; // lock protecting exclusive access 572 sc_signal<int> r_config_cmd; // config request status 573 sc_signal<addr_t> r_config_address; // target buffer physical address 574 sc_signal<size_t> r_config_srcid; // config request srcid 575 sc_signal<size_t> r_config_trdid; // config request trdid 576 sc_signal<size_t> r_config_pktid; // config request pktid 577 sc_signal<size_t> r_config_nlines; // number of lines covering the buffer 578 sc_signal<size_t> r_config_way; // selected way 579 sc_signal<size_t> r_config_count; // number of copies 580 sc_signal<size_t> r_config_upt_index; // UPT index 581 sc_signal<bool> r_config_is_cnt; // counter mode (broadcast required) 582 583 // Buffer between CONFIG fsm and TGT_RSP fsm (send a done response to L1 cache) 584 sc_signal<bool> r_config_to_tgt_rsp_req; // valid request 585 sc_signal<bool> r_config_to_tgt_rsp_error; // error response 586 sc_signal<size_t> r_config_to_tgt_rsp_srcid; // Transaction srcid 587 sc_signal<size_t> r_config_to_tgt_rsp_trdid; // Transaction trdid 588 sc_signal<size_t> r_config_to_tgt_rsp_pktid; // Transaction pktid 589 590 // Buffer between CONFIG fsm and CC_SEND fsm (multi-inval / broadcast-inval) 591 sc_signal<bool> r_config_to_cc_send_multi_req; // multi-inval request 592 sc_signal<bool> r_config_to_cc_send_brdcast_req; // broadcast-inval request 593 sc_signal<size_t> r_config_to_cc_send_nline; // line index 594 sc_signal<size_t> r_config_to_cc_send_trdid; // UPT index 595 517 596 /////////////////////////////////////////////////////// 518 597 // Registers controlled by the READ fsm 519 598 /////////////////////////////////////////////////////// 520 599 521 sc_signal<int> r_read_fsm; // FSM state522 sc_signal<size_t> r_read_copy; // Srcid of the first copy523 sc_signal<size_t> r_read_copy_cache; // Srcid of the first copy524 sc_signal<bool> r_read_copy_inst; // Type of the first copy525 sc_signal<tag_t> r_read_tag; // cache line tag (in directory)526 sc_signal<bool> r_read_is_cnt; // is_cnt bit (in directory)527 sc_signal<bool> r_read_lock; // lock bit (in directory)528 sc_signal<bool> r_read_dirty; // dirty bit (in directory)529 sc_signal<size_t> r_read_count; // number of copies530 sc_signal<size_t> r_read_ptr; // pointer to the heap531 sc_signal<data_t> * r_read_data; // data (one cache line)532 sc_signal<size_t> r_read_way; // associative way (in cache)533 sc_signal<size_t> r_read_trt_index; // Transaction Table index534 sc_signal<size_t> r_read_next_ptr; // Next entry to point to535 sc_signal<bool> r_read_last_free; // Last free entry536 sc_signal<addr_t> r_read_ll_key; // LL key from the llsc_global_table600 sc_signal<int> r_read_fsm; // FSM state 601 sc_signal<size_t> r_read_copy; // Srcid of the first copy 602 sc_signal<size_t> r_read_copy_cache; // Srcid of the first copy 603 sc_signal<bool> r_read_copy_inst; // Type of the first copy 604 sc_signal<tag_t> r_read_tag; // cache line tag (in directory) 605 sc_signal<bool> r_read_is_cnt; // is_cnt bit (in directory) 606 sc_signal<bool> r_read_lock; // lock bit (in directory) 607 sc_signal<bool> r_read_dirty; // dirty bit (in directory) 608 sc_signal<size_t> r_read_count; // number of copies 609 sc_signal<size_t> r_read_ptr; // pointer to the heap 610 sc_signal<data_t> * r_read_data; // data (one cache line) 611 sc_signal<size_t> r_read_way; // associative way (in cache) 612 sc_signal<size_t> r_read_trt_index; // Transaction Table index 613 sc_signal<size_t> r_read_next_ptr; // Next entry to point to 614 sc_signal<bool> r_read_last_free; // Last free entry 615 sc_signal<addr_t> r_read_ll_key; // LL key from the llsc_global_table 537 616 538 617 // Buffer between READ fsm and IXR_CMD fsm (ask a missing cache line to XRAM) … … 626 705 sc_signal<addr_t> r_multi_ack_nline; // pending write nline 627 706 707 // signaling completion of multi-inval to CONFIG fsm 708 sc_signal<bool> r_multi_ack_to_config_ack; 709 628 710 // Buffer between MULTI_ACK fsm and TGT_RSP fsm (complete write/update transaction) 629 711 sc_signal<bool> r_multi_ack_to_tgt_rsp_req; // valid request … … 662 744 sc_signal<size_t> r_cleanup_way; // associative way (in cache) 663 745 664 sc_signal<size_t> r_cleanup_write_srcid; // srcid of write r esponse746 sc_signal<size_t> r_cleanup_write_srcid; // srcid of write rsp 665 747 sc_signal<size_t> r_cleanup_write_trdid; // trdid of write rsp 666 748 sc_signal<size_t> r_cleanup_write_pktid; // pktid of write rsp 667 sc_signal<bool> r_cleanup_write_need_rsp;// needs a write rsp 749 750 sc_signal<bool> r_cleanup_need_rsp; // write response required 751 sc_signal<bool> r_cleanup_need_ack; // config acknowledge required 668 752 669 753 sc_signal<size_t> r_cleanup_index; // index of the INVAL line (in the UPT) 670 754 755 // signaling completion of broadcast-inval to CONFIG fsm 756 sc_signal<bool> r_cleanup_to_config_ack; 757 671 758 // Buffer between CLEANUP fsm and TGT_RSP fsm (acknowledge a write command from L1) 672 759 sc_signal<bool> r_cleanup_to_tgt_rsp_req; // valid request -
trunk/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp
r431 r434 34 34 #include "../include/vci_mem_cache.h" 35 35 36 ////// debug services /////////////////////////////////////////////////////// 36 ////// debug services ///////////////////////////////////////////////////////////// 37 37 // All debug messages are conditionned by two variables: 38 38 // - compile time : DEBUG_MEMC_*** : defined below 39 // - execution time : m_debug_*** : defined by constructor arguments 40 // m_debug_* = (m_debug_ok) and (m_cpt_cycle > m_debug_start_cycle) 41 ///////////////////////////////////////////////////////////////////////////////// 39 // - execution time : m_debug = (m_debug_ok) and (m_cpt_cycle > m_debug_start_cycle) 40 /////////////////////////////////////////////////////////////////////////////////////// 42 41 43 42 #define DEBUG_MEMC_GLOBAL 0 // synthetic trace of all FSMs 43 #define DEBUG_MEMC_CONFIG 1 // detailed trace of CONFIG FSM 44 44 #define DEBUG_MEMC_READ 1 // detailed trace of READ FSM 45 45 #define DEBUG_MEMC_WRITE 1 // detailed trace of WRITE FSM … … 64 64 "TGT_CMD_READ", 65 65 "TGT_CMD_WRITE", 66 "TGT_CMD_CAS" 66 "TGT_CMD_CAS", 67 "TGT_CMD_CONFIG" 67 68 }; 68 69 const char *tgt_rsp_fsm_str[] = … … 118 119 "MULTI_ACK_UPT_LOCK", 119 120 "MULTI_ACK_UPT_CLEAR", 120 "MULTI_ACK_WRITE_RSP" 121 "MULTI_ACK_WRITE_RSP", 122 "MULTI_ACK_CONFIG_ACK" 121 123 }; 122 124 const char *read_fsm_str[] = … … 237 239 "CLEANUP_UPT_CLEAR", 238 240 "CLEANUP_WRITE_RSP", 239 "CLEANUP_SEND_ACK" 241 "CLEANUP_CONFIG_ACK", 242 "CLEANUP_SEND_CLACK" 240 243 }; 241 244 const char *alloc_dir_fsm_str[] = … … 457 460 for(seg = m_seglist.begin() ; seg != m_seglist.end() ; seg++) 458 461 { 462 if ( seg->special() ) m_seg_config = i; 459 463 m_seg[i] = & (*seg); 460 464 i++; … … 631 635 // Initializing FSMs 632 636 r_tgt_cmd_fsm = TGT_CMD_IDLE; 637 r_config_fsm = CONFIG_IDLE; 633 638 r_tgt_rsp_fsm = TGT_RSP_TGT_CMD_IDLE; 634 639 r_cc_send_fsm = CC_SEND_XRAM_RSP_IDLE; … … 647 652 r_ixr_cmd_fsm = IXR_CMD_READ_IDLE; 648 653 649 m_debug_global = false; 650 m_debug_tgt_cmd_fsm = false; 651 m_debug_tgt_rsp_fsm = false; 652 m_debug_cc_send_fsm = false; 653 m_debug_cc_receive_fsm = false; 654 m_debug_multi_ack_fsm = false; 655 m_debug_read_fsm = false; 656 m_debug_write_fsm = false; 657 m_debug_cas_fsm = false; 658 m_debug_cleanup_fsm = false; 659 m_debug_ixr_cmd_fsm = false; 660 m_debug_ixr_rsp_fsm = false; 661 m_debug_xram_rsp_fsm = false; 654 m_debug = false; 662 655 m_debug_previous_hit = false; 663 656 m_debug_previous_count = 0; … … 690 683 m_cmd_cas_eop_fifo.init() ; 691 684 685 r_config_cmd = MEMC_CMD_NOP; 686 r_config_lock = false; 687 692 688 r_tgt_cmd_to_tgt_rsp_req = false; 693 689 … … 697 693 r_write_to_tgt_rsp_req = false; 698 694 r_write_to_ixr_cmd_req = false; 699 r_write_to_cc_send_multi_req = false;700 r_write_to_cc_send_brdcast_req = false;695 r_write_to_cc_send_multi_req = false; 696 r_write_to_cc_send_brdcast_req = false; 701 697 r_write_to_multi_ack_req = false; 702 698 … … 816 812 #endif 817 813 818 m_debug_global = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 819 m_debug_tgt_cmd_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 820 m_debug_tgt_rsp_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 821 m_debug_cc_send_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 822 m_debug_cc_receive_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 823 m_debug_multi_ack_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 824 m_debug_read_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 825 m_debug_write_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 826 m_debug_cas_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 827 m_debug_cleanup_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 828 m_debug_ixr_cmd_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 829 m_debug_ixr_rsp_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 830 m_debug_xram_rsp_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 814 m_debug = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 831 815 832 816 #if DEBUG_MEMC_GLOBAL 833 if(m_debug_global)834 817 if(m_debug) 818 { 835 819 std::cout 836 820 << "---------------------------------------------" << std::dec << std::endl … … 853 837 << " - ALLOC_UPT FSM = " << alloc_upt_fsm_str[r_alloc_upt_fsm.read()] << std::endl 854 838 << " - ALLOC_HEAP FSM = " << alloc_heap_fsm_str[r_alloc_heap_fsm.read()] << std::endl; 855 839 } 856 840 #endif 857 841 … … 859 843 // TGT_CMD FSM 860 844 //////////////////////////////////////////////////////////////////////////////////// 861 // The TGT_CMD_FSM controls the incoming VCI command pakets from the processors 845 // The TGT_CMD_FSM controls the incoming VCI command pakets from the processors, 846 // and dispatch these commands to the proper FSM through dedicated FIFOs. 862 847 // 863 // There are 5 types of accepted commands : 864 // - READ : A READ request has a length of 1 VCI cell. It can be a single word 865 // or an entire cache line, depending on the PLEN value. 866 // - WRITE : A WRITE request has a maximum length of 16 cells, and can only 867 // concern words in a same line. 868 // - CAS : A CAS request has a length of 2 cells or 4 cells. 869 // - LL : An LL request has a length of 1 cell. 870 // - SC : An SC request has a length of 2 cells. First cell contains the 871 // acces key, second cell the data to write in case of success. 848 // There are 5 types of commands accepted in the XRAM segment: 849 // - READ : A READ request has a length of 1 VCI flit. It can be a single word 850 // or an entire cache line, depending on the PLEN value => READ FSM 851 // - WRITE : A WRITE request has a maximum length of 16 flits, and can only 852 // concern words in a same line => WRITE FSM 853 // - CAS : A CAS request has a length of 2 flits or 4 flits => CAS FSM 854 // - LL : An LL request has a length of 1 flit => READ FSM 855 // - SC : An SC request has a length of 2 flits. First flit contains the 856 // acces key, second flit the data to write => WRITE FSM. 857 // 858 // The READ/WRITE commands accepted in the configuration segment are targeting, 859 // configuration or status registers. They must contain one single flit. 860 // - For almost all addressable registers, the response is returned immediately. 861 // - For MEMC_CMD_TYPE, the response is delayed until the operation is completed. 872 862 //////////////////////////////////////////////////////////////////////////////////// 873 863 874 864 switch(r_tgt_cmd_fsm.read()) 875 865 { 876 877 case TGT_CMD_IDLE: 878 879 866 ////////////////// 867 case TGT_CMD_IDLE: // waiting a VCI command (RAM or CONFIG) 868 if(p_vci_tgt.cmdval) 869 { 880 870 881 871 #if DEBUG_MEMC_TGT_CMD 882 if(m_debug_tgt_cmd_fsm) 883 { 884 std::cout 885 << " <MEMC " << name() 886 << " TGT_CMD_IDLE> Receive command from srcid " 887 << std::dec << p_vci_tgt.srcid.read() 888 << " / for address " 889 << std::hex << p_vci_tgt.address.read() 890 << std::endl; 891 } 872 if(m_debug) 873 std::cout << " <MEMC " << name() 874 << " TGT_CMD_IDLE> Receive command from srcid " 875 << std::dec << p_vci_tgt.srcid.read() 876 << " / address " << std::hex << p_vci_tgt.address.read() << std::endl; 892 877 #endif 893 878 // checking segmentation violation 894 addr_t address = p_vci_tgt.address.read(); 895 uint32_t plen = p_vci_tgt.plen.read(); 896 bool found = false; 897 for(size_t seg_id = 0 ; seg_id < m_nseg ; seg_id++) 898 { 899 if(m_seg[seg_id]->contains(address) && 900 m_seg[seg_id]->contains(address + plen - vci_param_int::B)) 901 { 902 found = true; 903 } 904 } 905 906 if(not found) 907 { 908 r_tgt_cmd_fsm = TGT_CMD_ERROR; 909 } 910 else if(p_vci_tgt.cmd.read() == vci_param_int::CMD_READ) 911 { 912 // check that the pktid is either : 913 // TYPE_READ_DATA_UNC 914 // TYPE_READ_DATA_MISS 915 // TYPE_READ_INS_UNC 916 // TYPE_READ_INS_MISS 917 // ==> bit2 must be zero with the TSAR encoding 918 // ==> mask = 0b0100 = 0x4 919 assert(((p_vci_tgt.pktid.read() & 0x4) == 0x0) && 920 "The type specified in the pktid field is incompatible with the READ CMD"); 921 r_tgt_cmd_fsm = TGT_CMD_READ; 922 } 923 else if(p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) 924 { 925 // check that the pktid is TYPE_WRITE 926 // ==> TYPE_WRITE = X100 with the TSAR encoding 927 // ==> mask = 0b0111 = 0x7 928 assert(((p_vci_tgt.pktid.read() & 0x7) == 0x4) && 929 "The type specified in the pktid field is incompatible with the WRITE CMD"); 930 r_tgt_cmd_fsm = TGT_CMD_WRITE; 931 } 932 else if(p_vci_tgt.cmd.read() == vci_param_int::CMD_LOCKED_READ) 933 { 934 // check that the pktid is TYPE_LL 935 // ==> TYPE_LL = X110 with the TSAR encoding 936 // ==> mask = 0b0111 = 0x7 937 assert(((p_vci_tgt.pktid.read() & 0x7) == 0x6) && 938 "The type specified in the pktid field is incompatible with the LL CMD"); 939 r_tgt_cmd_fsm = TGT_CMD_READ; 940 } 941 else if(p_vci_tgt.cmd.read() == vci_param_int::CMD_NOP) 942 { 943 // check that the pktid is either : 944 // TYPE_CAS 945 // TYPE_SC 946 // ==> TYPE_CAS = X101 with the TSAR encoding 947 // ==> TYPE_SC = X111 with the TSAR encoding 948 // ==> mask = 0b0101 = 0x5 949 assert(((p_vci_tgt.pktid.read() & 0x5) == 0x5) && 950 "The type specified in the pktid field is incompatible with the NOP CMD"); 951 952 if((p_vci_tgt.pktid.read() & 0x7) == TYPE_CAS) 953 r_tgt_cmd_fsm = TGT_CMD_CAS; 954 else // TYPE_SC 955 r_tgt_cmd_fsm = TGT_CMD_WRITE; 956 } 957 else 958 { 959 std::cout << "VCI_MEM_CACHE ERROR " << name() 960 << " TGT_CMD_IDLE state" << std::endl; 961 std::cout << " illegal VCI command type" << std::endl; 962 exit(0); 963 } 964 } 965 break; 966 967 case TGT_CMD_ERROR: 968 // A segmentation violation has been detected, thus a response with error 969 // must be sent 970 971 // wait if pending TGT_CMD request to TGT_RSP FSM 972 if(r_tgt_cmd_to_tgt_rsp_req.read()) break; 973 974 // consume all the command packet flits and set new request to the 975 // TGT_RSP FSM 976 if(p_vci_tgt.cmdval and p_vci_tgt.eop) 977 { 978 r_tgt_cmd_to_tgt_rsp_req = true; 879 addr_t address = p_vci_tgt.address.read(); 880 uint32_t plen = p_vci_tgt.plen.read(); 881 bool found = false; 882 bool config = false; 883 884 // register arguments for response (segmentation violation or config) 979 885 r_tgt_cmd_to_tgt_rsp_srcid = p_vci_tgt.srcid.read(); 980 886 r_tgt_cmd_to_tgt_rsp_trdid = p_vci_tgt.trdid.read(); 981 887 r_tgt_cmd_to_tgt_rsp_pktid = p_vci_tgt.pktid.read(); 982 888 983 r_tgt_cmd_fsm = TGT_CMD_IDLE; 889 for(size_t seg_id = 0 ; (seg_id < m_nseg) and not found ; seg_id++) 890 { 891 if( m_seg[seg_id]->contains(address) and 892 m_seg[seg_id]->contains(address + plen - vci_param_int::B) ) 893 { 894 found = true; 895 if ( m_seg[seg_id]->special() ) config = true; 896 } 897 } 898 899 if ( not found ) /////////// out of segment error 900 { 901 r_tgt_cmd_fsm = TGT_CMD_ERROR; 902 } 903 else if ( config ) /////////// configuration command 904 { 905 if ( not p_vci_tgt.eop.read() ) r_tgt_cmd_fsm = TGT_CMD_ERROR; 906 else r_tgt_cmd_fsm = TGT_CMD_CONFIG; 907 } 908 else //////////// memory access 909 { 910 if ( p_vci_tgt.cmd.read() == vci_param_int::CMD_READ ) 911 { 912 // check that the pktid is either : 913 // TYPE_READ_DATA_UNC 914 // TYPE_READ_DATA_MISS 915 // TYPE_READ_INS_UNC 916 // TYPE_READ_INS_MISS 917 // ==> bit2 must be zero with the TSAR encoding 918 // ==> mask = 0b0100 = 0x4 919 assert( ((p_vci_tgt.pktid.read() & 0x4) == 0x0) and 920 "The type specified in the pktid field is incompatible with the READ CMD"); 921 r_tgt_cmd_fsm = TGT_CMD_READ; 922 } 923 else if(p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) 924 { 925 // check that the pktid is TYPE_WRITE 926 // ==> TYPE_WRITE = X100 with the TSAR encoding 927 // ==> mask = 0b0111 = 0x7 928 assert(((p_vci_tgt.pktid.read() & 0x7) == 0x4) and 929 "The type specified in the pktid field is incompatible with the WRITE CMD"); 930 r_tgt_cmd_fsm = TGT_CMD_WRITE; 931 } 932 else if(p_vci_tgt.cmd.read() == vci_param_int::CMD_LOCKED_READ) 933 { 934 // check that the pktid is TYPE_LL 935 // ==> TYPE_LL = X110 with the TSAR encoding 936 // ==> mask = 0b0111 = 0x7 937 assert(((p_vci_tgt.pktid.read() & 0x7) == 0x6) and 938 "The type specified in the pktid field is incompatible with the LL CMD"); 939 r_tgt_cmd_fsm = TGT_CMD_READ; 940 } 941 else if(p_vci_tgt.cmd.read() == vci_param_int::CMD_NOP) 942 { 943 // check that the pktid is either : 944 // TYPE_CAS 945 // TYPE_SC 946 // ==> TYPE_CAS = X101 with the TSAR encoding 947 // ==> TYPE_SC = X111 with the TSAR encoding 948 // ==> mask = 0b0101 = 0x5 949 assert(((p_vci_tgt.pktid.read() & 0x5) == 0x5) and 950 "The type specified in the pktid field is incompatible with the NOP CMD"); 951 952 if((p_vci_tgt.pktid.read() & 0x7) == TYPE_CAS) r_tgt_cmd_fsm = TGT_CMD_CAS; 953 else r_tgt_cmd_fsm = TGT_CMD_WRITE; 954 } 955 else 956 { 957 r_tgt_cmd_fsm = TGT_CMD_ERROR; 958 } 959 } 960 } 961 break; 962 963 /////////////////// 964 case TGT_CMD_ERROR: // response error must be sent 965 966 // wait if pending TGT_CMD request to TGT_RSP FSM 967 if(r_tgt_cmd_to_tgt_rsp_req.read()) break; 968 969 // consume all the command packet flits before sending response error 970 if ( p_vci_tgt.cmdval and p_vci_tgt.eop ) 971 { 972 r_tgt_cmd_to_tgt_rsp_req = true; 973 r_tgt_cmd_to_tgt_rsp_error = 1; 974 r_tgt_cmd_fsm = TGT_CMD_IDLE; 984 975 985 976 #if DEBUG_MEMC_TGT_CMD 986 if(m_debug _tgt_cmd_fsm)977 if(m_debug) 987 978 std::cout << " <MEMC " << name() 988 979 << " TGT_CMD_ERROR> Segmentation violation:" … … 993 984 << " / plen = " << std::dec << p_vci_tgt.plen.read() << std::endl; 994 985 #endif 995 } 996 997 break; 998 999 ////////////////// 1000 case TGT_CMD_READ: 1001 // This test checks that the read does not cross a cache line limit. 1002 // It must not be taken into account when dealing with an LL CMD. 1003 if(((m_x[(addr_t) p_vci_tgt.address.read()]+ (p_vci_tgt.plen.read() >>2)) > 16) && 986 987 } 988 break; 989 990 //////////////////// 991 case TGT_CMD_CONFIG: // execute config request and return response 992 { 993 if ( r_tgt_cmd_to_tgt_rsp_req.read() ) break; 994 995 addr_t seg_base = m_seg[m_seg_config]->baseAddress(); 996 addr_t address = p_vci_tgt.address.read(); 997 size_t cell = (address - seg_base)/vci_param_int::B; 998 bool need_rsp = true; // default value 999 size_t error = 0; // default value 1000 uint32_t rdata = 0; // default value 1001 1002 if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_READ) // get lock 1003 and (cell == MEMC_LOCK) ) 1004 { 1005 rdata = (uint32_t)r_config_lock.read(); 1006 r_config_lock = true; 1007 } 1008 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // release lock 1009 and (cell == MEMC_LOCK) ) 1010 { 1011 r_config_lock = false; 1012 } 1013 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set cmd type 1014 and (cell == MEMC_CMD_TYPE) ) 1015 { 1016 r_config_cmd = p_vci_tgt.wdata.read(); 1017 need_rsp = false; 1018 } 1019 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set addr_lo 1020 and (cell == MEMC_ADDR_LO) ) 1021 { 1022 r_config_address = (r_config_address.read() & 0xFFFFFFFF00000000LL) | 1023 (addr_t)p_vci_tgt.wdata.read(); 1024 } 1025 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set addr_hi 1026 and (cell == MEMC_ADDR_HI) ) 1027 { 1028 r_config_address = (r_config_address.read() & 0x00000000FFFFFFFFLL) | 1029 ((addr_t)p_vci_tgt.wdata.read())<<32; 1030 } 1031 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set buf_lines 1032 and (cell == MEMC_BUF_LENGTH) ) 1033 { 1034 size_t lines = (size_t)(p_vci_tgt.wdata.read()/(m_words*vci_param_int::B)); 1035 if ( r_config_address.read()/(m_words*vci_param_int::B) ) lines++; 1036 r_config_nlines = lines; 1037 } 1038 else 1039 { 1040 error = 1; 1041 } 1042 1043 if ( need_rsp ) 1044 { 1045 // blocked if previous pending request to TGT_RSP FSM 1046 if ( r_tgt_cmd_to_tgt_rsp_req.read() ) break; 1047 1048 r_tgt_cmd_to_tgt_rsp_req = true; 1049 r_tgt_cmd_to_tgt_rsp_error = error; 1050 r_tgt_cmd_to_tgt_rsp_rdata = rdata; 1051 r_tgt_cmd_fsm = TGT_CMD_IDLE; 1052 } 1053 else 1054 { 1055 r_tgt_cmd_fsm = TGT_CMD_IDLE; 1056 } 1057 1058 #if DEBUG_MEMC_TGT_CMD 1059 if(m_debug) 1060 std::cout << " <MEMC " << name() << " TGT_CMD_CONFIG> Configuration request:" 1061 << " address = " << std::hex << p_vci_tgt.address.read() 1062 << " / wdata = " << p_vci_tgt.wdata.read() 1063 << " / error = " << error << std::endl; 1064 #endif 1065 break; 1066 } 1067 ////////////////// 1068 case TGT_CMD_READ: // Push a read request into read fifo 1069 1070 // check that the read does not cross a cache line limit. 1071 if ( ((m_x[(addr_t) p_vci_tgt.address.read()]+ (p_vci_tgt.plen.read() >>2)) > 16) and 1004 1072 (p_vci_tgt.cmd.read() != vci_param_int::CMD_LOCKED_READ)) 1005 { 1006 std::cout 1007 << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_READ state" 1008 << std::endl; 1009 std::cout 1010 << " illegal address/plen combination for VCI read command" << std::endl; 1073 { 1074 std::cout << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_READ state" 1075 << " illegal address/plen for VCI read command" << std::endl; 1011 1076 exit(0); 1012 } 1013 if(!p_vci_tgt.eop.read()) 1014 { 1015 std::cout 1016 << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_READ state" 1017 << std::endl; 1018 std::cout 1019 << " read or ll command packets must contain one single flit" 1020 << std::endl; 1077 } 1078 // check single flit 1079 if(!p_vci_tgt.eop.read()) 1080 { 1081 std::cout << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_READ state" 1082 << " read command packet must contain one single flit" << std::endl; 1021 1083 exit(0); 1022 } 1023 if((p_vci_tgt.cmd.read() == vci_param_int::CMD_LOCKED_READ) && (p_vci_tgt.plen.read() != 8)) 1024 { 1025 std::cout 1026 << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_READ state" 1027 << std::endl; 1028 std::cout 1029 << " ll command packets must have a plen of 8" 1030 << std::endl; 1084 } 1085 // check plen for LL 1086 if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_LOCKED_READ) and 1087 (p_vci_tgt.plen.read() != 8) ) 1088 { 1089 std::cout << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_READ state" 1090 << " ll command packets must have a plen of 8" << std::endl; 1031 1091 exit(0); 1032 1033 1034 if(p_vci_tgt.cmdval && m_cmd_read_addr_fifo.wok())1035 1092 } 1093 1094 if ( p_vci_tgt.cmdval and m_cmd_read_addr_fifo.wok() ) 1095 { 1036 1096 1037 1097 #if DEBUG_MEMC_TGT_CMD 1038 if(m_debug _tgt_cmd_fsm)1098 if(m_debug) 1039 1099 std::cout << " <MEMC " << name() << " TGT_CMD_READ> Push into read_fifo:" 1040 1100 << " address = " << std::hex << p_vci_tgt.address.read() … … 1045 1105 #endif 1046 1106 cmd_read_fifo_put = true; 1047 if(p_vci_tgt.cmd.read() == vci_param_int::CMD_LOCKED_READ) 1048 m_cpt_ll++; 1049 else 1050 m_cpt_read++; 1107 if(p_vci_tgt.cmd.read() == vci_param_int::CMD_LOCKED_READ) m_cpt_ll++; 1108 else m_cpt_read++; 1051 1109 r_tgt_cmd_fsm = TGT_CMD_IDLE; 1052 1053 1054 1055 1110 } 1111 break; 1112 1113 /////////////////// 1056 1114 case TGT_CMD_WRITE: 1057 if(p_vci_tgt.cmdval &&m_cmd_write_addr_fifo.wok())1058 1115 if(p_vci_tgt.cmdval and m_cmd_write_addr_fifo.wok()) 1116 { 1059 1117 1060 1118 #if DEBUG_MEMC_TGT_CMD 1061 if(m_debug _tgt_cmd_fsm)1119 if(m_debug) 1062 1120 std::cout << " <MEMC " << name() << " TGT_CMD_WRITE> Push into write_fifo:" 1063 1121 << " address = " << std::hex << p_vci_tgt.address.read() … … 1071 1129 cmd_write_fifo_put = true; 1072 1130 if(p_vci_tgt.eop) r_tgt_cmd_fsm = TGT_CMD_IDLE; 1073 1074 1075 1076 ////////////////////1131 } 1132 break; 1133 1134 ///////////////// 1077 1135 case TGT_CMD_CAS: 1078 if((p_vci_tgt.plen.read() != 8) && (p_vci_tgt.plen.read() != 16)) 1079 { 1080 std::cout 1081 << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_CAS state" 1082 << std::endl 1083 << "illegal format for CAS command " << std::endl; 1084 1136 if((p_vci_tgt.plen.read() != 8) and (p_vci_tgt.plen.read() != 16)) 1137 { 1138 std::cout << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_CAS state" 1139 << "illegal format for CAS command " << std::endl; 1085 1140 exit(0); 1086 1087 1088 if(p_vci_tgt.cmdval &&m_cmd_cas_addr_fifo.wok())1089 1141 } 1142 1143 if(p_vci_tgt.cmdval and m_cmd_cas_addr_fifo.wok()) 1144 { 1090 1145 1091 1146 #if DEBUG_MEMC_TGT_CMD 1092 if(m_debug _tgt_cmd_fsm)1147 if(m_debug) 1093 1148 std::cout << " <MEMC " << name() << " TGT_CMD_CAS> Pushing command into cmd_cas_fifo:" 1094 1149 << " address = " << std::hex << p_vci_tgt.address.read() … … 1102 1157 cmd_cas_fifo_put = true; 1103 1158 if(p_vci_tgt.eop) r_tgt_cmd_fsm = TGT_CMD_IDLE; 1104 1105 1159 } 1160 break; 1106 1161 } // end switch tgt_cmd_fsm 1107 1162 … … 1115 1170 // It can be update or inval requests initiated by the WRITE or CAS FSM, 1116 1171 // or inval requests initiated by the XRAM_RSP FSM. 1117 // It can also be a direct request from the WRITE FSM.1118 1172 // 1119 1173 // The FSM decrements the proper entry in UPT. … … 1129 1183 switch(r_multi_ack_fsm.read()) 1130 1184 { 1131 /////////////////// 1185 //////////////////// 1132 1186 case MULTI_ACK_IDLE: 1133 1187 { 1134 1188 bool multi_ack_fifo_rok = m_cc_receive_to_multi_ack_fifo.rok(); 1135 1189 … … 1165 1219 1166 1220 #if DEBUG_MEMC_MULTI_ACK 1167 if(m_debug_multi_ack_fsm) 1168 { 1169 if (multi_ack_fifo_rok) 1170 { 1171 std::cout 1172 << " <MEMC " << name() 1173 << " MULTI_ACK_IDLE> Response for UPT entry " 1174 << updt_index 1175 << std::endl; 1176 } 1177 else 1178 { 1179 std::cout 1180 << " <MEMC " << name() 1181 << " MULTI_ACK_IDLE> Write FSM request to decrement UPT entry " 1182 << updt_index 1183 << std::endl; 1184 } 1185 } 1221 if(m_debug) 1222 { 1223 if (multi_ack_fifo_rok) 1224 { 1225 std::cout << " <MEMC " << name() 1226 << " MULTI_ACK_IDLE> Response for UPT entry " 1227 << updt_index << std::endl; 1228 } 1229 else 1230 { 1231 std::cout << " <MEMC " << name() 1232 << " MULTI_ACK_IDLE> Write FSM request to decrement UPT entry " 1233 << updt_index << std::endl; 1234 } 1235 } 1186 1236 #endif 1187 1237 break; … … 1190 1240 //////////////////////// 1191 1241 case MULTI_ACK_UPT_LOCK: 1192 1242 { 1193 1243 // get lock to the UPDATE table 1194 1244 if(r_alloc_upt_fsm.read() != ALLOC_UPT_MULTI_ACK) break; … … 1200 1250 if(not valid) 1201 1251 { 1202 std::cout 1203 << "VCI_MEM_CACHE ERROR " << name() 1204 << " MULTI_ACK_UPT_LOCK state" << std::endl 1205 << "unsuccessful access to decrement the UPT" 1206 << std::endl; 1207 1208 exit(0); 1252 std::cout << "VCI_MEM_CACHE ERROR " << name() 1253 << " MULTI_ACK_UPT_LOCK state" << std::endl 1254 << "unsuccessful access to decrement the UPT" << std::endl; 1255 exit(0); 1209 1256 } 1210 1257 … … 1219 1266 1220 1267 #if DEBUG_MEMC_MULTI_ACK 1221 if(m_debug_multi_ack_fsm) 1222 { 1223 std::cout 1224 << " <MEMC " << name() 1225 << " MULTI_ACK_UPT_LOCK> Decrement the responses counter for UPT:" 1226 << " entry = " << r_multi_ack_upt_index.read() 1227 << " / rsp_count = " << std::dec << count 1228 << std::endl; 1229 } 1268 if(m_debug) 1269 std::cout << " <MEMC " << name() 1270 << " MULTI_ACK_UPT_LOCK> Decrement the responses counter for UPT:" 1271 << " entry = " << r_multi_ack_upt_index.read() 1272 << " / rsp_count = " << std::dec << count << std::endl; 1230 1273 #endif 1231 1274 break; 1232 1275 } 1233 1276 1234 1277 ///////////////////////// 1235 case MULTI_ACK_UPT_CLEAR: 1236 1278 case MULTI_ACK_UPT_CLEAR: // Clear UPT entry / Test if rsp or ack required 1279 { 1237 1280 if(r_alloc_upt_fsm.read() != ALLOC_UPT_MULTI_ACK) 1238 1281 { 1239 std::cout 1240 << "VCI_MEM_CACHE ERROR " << name() 1241 << " MULTI_ACK_UPT_CLEAR state" 1242 << " bad UPT allocation" 1243 << std::endl; 1244 1245 exit(0); 1282 std::cout << "VCI_MEM_CACHE ERROR " << name() 1283 << " MULTI_ACK_UPT_CLEAR state" 1284 << " bad UPT allocation" << std::endl; 1285 exit(0); 1246 1286 } 1247 1287 … … 1251 1291 r_multi_ack_nline = m_upt.nline(r_multi_ack_upt_index.read()); 1252 1292 bool need_rsp = m_upt.need_rsp(r_multi_ack_upt_index.read()); 1293 bool need_ack = m_upt.need_ack(r_multi_ack_upt_index.read()); 1253 1294 1254 1295 // clear the UPT entry 1255 1296 m_upt.clear(r_multi_ack_upt_index.read()); 1256 1297 1257 if(need_rsp) 1258 { 1259 r_multi_ack_fsm = MULTI_ACK_WRITE_RSP; 1260 } 1261 else 1262 { 1263 r_multi_ack_fsm = MULTI_ACK_IDLE; 1264 } 1298 if ( need_rsp ) r_multi_ack_fsm = MULTI_ACK_WRITE_RSP; 1299 else if ( need_ack ) r_multi_ack_fsm = MULTI_ACK_CONFIG_ACK; 1300 else r_multi_ack_fsm = MULTI_ACK_IDLE; 1265 1301 1266 1302 #if DEBUG_MEMC_MULTI_ACK 1267 if(m_debug_multi_ack_fsm) 1268 { 1269 std::cout 1270 << " <MEMC " << name() 1271 << " MULTI_ACK_UPT_CLEAR> Clear UPT entry " 1272 << r_multi_ack_upt_index.read() 1273 << std::endl; 1274 } 1303 if(m_debug) 1304 std::cout << " <MEMC " << name() 1305 << " MULTI_ACK_UPT_CLEAR> Clear UPT entry " 1306 << std::dec << r_multi_ack_upt_index.read() << std::endl; 1275 1307 #endif 1276 1308 break; 1277 } 1278 1309 } 1279 1310 ///////////////////////// 1280 case MULTI_ACK_WRITE_RSP: 1281 { 1282 // Post a request to TGT_RSP FSM 1283 // Wait if pending request to the TGT_RSP FSM 1284 if(r_multi_ack_to_tgt_rsp_req.read()) break; 1311 case MULTI_ACK_WRITE_RSP: // Post a response request to TGT_RSP FSM 1312 // Wait if pending request 1313 { 1314 if ( r_multi_ack_to_tgt_rsp_req.read() ) break; 1285 1315 1286 1316 r_multi_ack_to_tgt_rsp_req = true; … … 1291 1321 1292 1322 #if DEBUG_MEMC_MULTI_ACK 1293 if(m_debug_multi_ack_fsm) 1294 { 1295 std::cout 1296 << " <MEMC " << name() 1297 << " MULTI_ACK_WRITE_RSP> Request TGT_RSP FSM to send a response to srcid " 1298 << r_multi_ack_srcid.read() 1299 << std::endl; 1300 } 1323 if(m_debug) 1324 std::cout << " <MEMC " << name() << " MULTI_ACK_WRITE_RSP>" 1325 << " Request TGT_RSP FSM to send a response to srcid " 1326 << std::hex << r_multi_ack_srcid.read() << std::endl; 1301 1327 #endif 1302 1328 break; 1303 } 1329 } 1330 ////////////////////////// 1331 case MULTI_ACK_CONFIG_ACK: // Signals multi-inval completion to CONFIG FSM 1332 // Wait if pending request 1333 { 1334 if ( r_multi_ack_to_config_ack.read() ) break; 1335 1336 r_multi_ack_to_config_ack = true; 1337 r_multi_ack_fsm = MULTI_ACK_IDLE; 1338 1339 #if DEBUG_MEMC_MULTI_ACK 1340 if(m_debug) 1341 std::cout << " <MEMC " << name() << " MULTI_ACK_CONFIG_ACK>" 1342 << " Signals inval completion to CONFIG FSM" << std::endl; 1343 #endif 1344 break; 1345 } 1304 1346 } // end switch r_multi_ack_fsm 1347 1348 //////////////////////////////////////////////////////////////////////////////////// 1349 // CONFIG FSM 1350 //////////////////////////////////////////////////////////////////////////////////// 1351 // The CONFIG FSM handles the VCI configuration requests (INVAL & SYNC). 1352 // The target buffer can have any size, and there is one single command for 1353 // all cache lines covered by the target buffer. 1354 // An INVAL or SYNC configuration request is defined by the followinf registers: 1355 // - bool r_config_cmd : INVAL / SYNC / NOP) 1356 // - uint64_t r_config_address : buffer base address 1357 // - uint32_t r_config_nlines : number of lines covering buffer 1358 // 1359 // For both INVAL and SYNC commands, the CONFIG FSM contains the loop handling 1360 // all cache lines covered by the target buffer. 1361 // 1362 // - INVAL request: 1363 // For each line, it access to the DIR array. 1364 // In case of miss, it does nothing, and a response is requested to TGT_RSP FSM. 1365 // In case of hit, with no copies in L1 caches, the line is invalidated and 1366 // a response is requested to TGT_RSP FSM. 1367 // If there is copies, a multi-inval, or a broadcast-inval coherence transaction 1368 // is launched and registered in UPT. The multi-inval transaction is signaled 1369 // by the r_multi_ack_to config_ack or r_cleanup_to_config_ack flip-flops. 1370 // The config inval response is sent only when the last line has been invalidated. 1371 // 1372 // - SYNC request: Not implemented yet 1373 // 1374 // From the software point of view, a configuration request is a sequence 1375 // of 6 atomic accesses: 1376 // - Read MEMC_LOCK : Get the lock 1377 // - Write MEMC_ADDR_LO : Set the buffer address LSB 1378 // - Write MEMC_ADDR_HI : Set the buffer address MSB 1379 // - Write MEMC_BUF_LENGTH : set buffer length (bytes) 1380 // - Write MEMC_CMD_TYPE : launch the actual operation 1381 // - WRITE MEMC_LOCK : release the lock 1382 //////////////////////////////////////////////////////////////////////////////////// 1383 1384 switch( r_config_fsm.read() ) 1385 { 1386 ///////////////// 1387 case CONFIG_IDLE: // waiting a config request 1388 { 1389 if ( r_config_cmd.read() != MEMC_CMD_NOP ) 1390 { 1391 r_config_fsm = CONFIG_LOOP; 1392 } 1393 1394 #if DEBUG_MEMC_CONFIG 1395 if(m_debug) 1396 std::cout << " <MEMC " << name() << " CONFIG_IDLE> Config Request received" 1397 << " address = " << std::hex << r_config_address.read() 1398 << " / nlines = " << std::dec << r_config_nlines.read() 1399 << " / type = " << r_config_cmd.read() << std::endl; 1400 #endif 1401 break; 1402 } 1403 ///////////////// 1404 case CONFIG_LOOP: // test last line 1405 { 1406 if ( r_config_nlines.read() == 0 ) 1407 { 1408 r_config_cmd = MEMC_CMD_NOP; 1409 r_config_fsm = CONFIG_RSP; 1410 } 1411 else 1412 { 1413 r_config_fsm = CONFIG_DIR_REQ; 1414 } 1415 1416 #if DEBUG_MEMC_CONFIG 1417 if(m_debug) 1418 std::cout << " <MEMC " << name() << " CONFIG_SYNC_LOOP>" 1419 << " address = " << std::hex << r_config_address.read() 1420 << " / nlines = " << std::dec << r_config_nlines.read() 1421 << " / type = " << r_config_cmd.read() << std::endl; 1422 #endif 1423 break; 1424 } 1425 //////////////////// 1426 case CONFIG_DIR_REQ: // Request directory lock 1427 { 1428 if ( r_alloc_dir_fsm.read() == ALLOC_DIR_CONFIG ) 1429 { 1430 r_config_fsm = CONFIG_DIR_ACCESS; 1431 } 1432 1433 #if DEBUG_MEMC_CONFIG 1434 if(m_debug) 1435 std::cout << " <MEMC " << name() << " CONFIG_INVAL_DIR_REQ>" 1436 << " Request DIR access" << std::endl; 1437 #endif 1438 break; 1439 } 1440 /////////////////////// 1441 case CONFIG_DIR_ACCESS: // Access directory and decode cmd 1442 { 1443 size_t way = 0; 1444 DirectoryEntry entry = m_cache_directory.read(r_config_address.read(), way); 1445 1446 if ( entry.valid and // hit & inval command 1447 (r_config_cmd.read() == MEMC_CMD_INVAL) ) 1448 { 1449 r_config_way = way; 1450 r_config_is_cnt = entry.is_cnt; 1451 r_config_count = entry.count; 1452 r_config_fsm = CONFIG_DIR_INVAL; 1453 } 1454 else if ( entry.valid and // hit & sync command 1455 entry.dirty and 1456 (r_config_cmd.read() == MEMC_CMD_SYNC) ) 1457 { 1458 std::cout << "VCI_MEM_CACHE ERROR: " 1459 << "SYNC config request not implemented yet" << std::endl; 1460 exit(0); 1461 } 1462 else // nothing to do : return to LOOP 1463 { 1464 r_config_nlines = r_config_nlines.read() - 1; 1465 r_config_address = r_config_address.read() + (m_words*vci_param_int::B); 1466 r_config_fsm = CONFIG_LOOP; 1467 } 1468 1469 #if DEBUG_MEMC_CONFIG 1470 if(m_debug) 1471 std::cout << " <MEMC " << name() << " CONFIG_DIR_ACCESS> Accessing directory: " 1472 << " address = " << std::hex << m_cmd_read_addr_fifo.read() 1473 << " / hit = " << std::dec << entry.valid 1474 << " / dirty = " <<std::dec << entry.dirty 1475 << " / count = " <<std::dec << entry.count 1476 << " / is_cnt = " << entry.is_cnt << std::endl; 1477 #endif 1478 break; 1479 } 1480 ////////////////////// 1481 case CONFIG_DIR_INVAL: // Invalidate the directory entry 1482 { 1483 size_t set = m_y[(addr_t)(r_config_address.read())]; 1484 size_t way = r_config_way.read(); 1485 1486 m_cache_directory.inval( way, set ); 1487 1488 if ( r_config_count.read() == 0 ) // return to LOOP 1489 { 1490 r_config_nlines = r_config_nlines.read() - 1; 1491 r_config_address = r_config_address.read() + (m_words*vci_param_int::B); 1492 r_config_fsm = CONFIG_LOOP; 1493 } 1494 else if ( r_config_is_cnt.read() ) // broacast required 1495 { 1496 r_config_fsm = CONFIG_BC_UPT_LOCK; 1497 } 1498 else 1499 { 1500 r_config_fsm = CONFIG_UPT_LOCK; 1501 } 1502 1503 #if DEBUG_MEMC_CONFIG 1504 if(m_debug) 1505 std::cout << " <MEMC " << name() << " CONFIG_DIR_INVAL> Inval directory entry" << std::endl; 1506 #endif 1507 break; 1508 } 1509 //////////////////////// 1510 case CONFIG_BC_UPT_LOCK: // try to register BC transaction in UPT 1511 { 1512 if ( r_alloc_upt_fsm.read() == ALLOC_UPT_CONFIG ) 1513 { 1514 bool wok = false; 1515 size_t index = 0; 1516 size_t srcid = r_config_srcid.read(); 1517 size_t trdid = r_config_trdid.read(); 1518 size_t pktid = r_config_pktid.read(); 1519 addr_t nline = m_nline[(addr_t)(r_config_address.read())]; 1520 size_t nb_copies = r_config_count.read(); 1521 1522 wok = m_upt.set(false, // it's an inval transaction 1523 true, // it's a broadcast 1524 false, // no response required 1525 true, // acknowledge required 1526 srcid, 1527 trdid, 1528 pktid, 1529 nline, 1530 nb_copies, 1531 index); 1532 if ( wok ) 1533 { 1534 r_config_fsm = CONFIG_BC_SEND; 1535 r_config_upt_index = index; 1536 1537 #if DEBUG_MEMC_CONFIG 1538 if( m_debug ) 1539 std::cout << " <MEMC " << name() 1540 << " CONFIG_BC_UPT_LOCK> Register broadcast inval in UPT" << std::endl; 1541 #endif 1542 } 1543 else 1544 { 1545 r_config_fsm = CONFIG_UPT_WAIT; 1546 1547 #if DEBUG_MEMC_CONFIG 1548 if( m_debug ) 1549 std::cout << " <MEMC " << name() << " CONFIG_BC_UPT_LOCK>" 1550 << " UPT full" << std::endl; 1551 #endif 1552 } 1553 } 1554 break; 1555 } 1556 //////////////////// 1557 case CONFIG_BC_SEND: // Post a broadcast inval request to CC_SEND FSM 1558 { 1559 if( not r_config_to_cc_send_multi_req.read() and 1560 not r_config_to_cc_send_brdcast_req.read() ) 1561 { 1562 r_config_to_cc_send_multi_req = false; 1563 r_config_to_cc_send_brdcast_req = true; 1564 r_config_to_cc_send_trdid = r_config_upt_index.read(); 1565 r_config_to_cc_send_nline = m_nline[(addr_t)(r_config_address.read())]; 1566 1567 r_cleanup_to_config_ack = false; 1568 1569 r_config_fsm = CONFIG_BC_WAIT; 1570 1571 #if DEBUG_MEMC_CONFIG 1572 if(m_debug) 1573 std::cout << " <MEMC " << name() << " CONFIG_BC_SEND>" 1574 << " Post a broadcast inval request to CC_SEND FSM" 1575 << " / address = " << r_config_address.read() <<std::endl; 1576 #endif 1577 } 1578 break; 1579 } 1580 //////////////////// 1581 case CONFIG_BC_WAIT: // wait broadcast completion to return to LOOP 1582 { 1583 if ( r_cleanup_to_config_ack.read() ) r_config_fsm = CONFIG_LOOP; 1584 1585 #if DEBUG_MEMC_CONFIG 1586 if(m_debug) 1587 std::cout << " <MEMC " << name() << " CONFIG_BC_WAIT>" 1588 << " Waiting broadcast inval completion" << std::endl; 1589 #endif 1590 break; 1591 } 1592 ///////////////////// 1593 case CONFIG_UPT_LOCK: // Try to register multi-update in UPT 1594 { 1595 if ( r_alloc_upt_fsm.read() == ALLOC_UPT_CONFIG ) 1596 { 1597 bool wok = false; 1598 size_t index = 0; 1599 size_t srcid = r_config_srcid.read(); 1600 size_t trdid = r_config_trdid.read(); 1601 size_t pktid = r_config_pktid.read(); 1602 addr_t nline = m_nline[(addr_t)(r_config_address.read())]; 1603 size_t nb_copies = r_config_count.read(); 1604 1605 wok = m_upt.set(false, // it's an inval transaction 1606 false, // not a broadcast 1607 false, // no response required 1608 true, // acknowledge required 1609 srcid, 1610 trdid, 1611 pktid, 1612 nline, 1613 nb_copies, 1614 index); 1615 if ( wok ) 1616 { 1617 r_config_fsm = CONFIG_BC_SEND; 1618 r_config_upt_index = index; 1619 1620 #if DEBUG_MEMC_CONFIG 1621 if( m_debug ) 1622 std::cout << " <MEMC " << name() 1623 << " CONFIG_BC_UPT_LOCK> Register broadcast inval in UPT" << std::endl; 1624 #endif 1625 } 1626 else 1627 { 1628 r_config_fsm = CONFIG_UPT_WAIT; 1629 1630 #if DEBUG_MEMC_CONFIG 1631 if( m_debug ) 1632 std::cout << " <MEMC " << name() << " CONFIG_BC_UPT_LOCK>" 1633 << " UPT full" << std::endl; 1634 #endif 1635 } 1636 1637 #if DEBUG_MEMC_CONFIG 1638 if(m_debug) 1639 std::cout << " <MEMC " << name() << " CONFIG_UPT_LOCK> Request access to UPT" << std::endl; 1640 #endif 1641 } 1642 break; 1643 } 1644 ///////////////////// 1645 case CONFIG_HEAP_REQ: // request access to the heap 1646 { 1647 break; 1648 } 1649 1650 //////////////// 1651 case CONFIG_RSP: // request TGT_RSP FSM to return response 1652 { 1653 if ( not r_config_to_tgt_rsp_req ) 1654 { 1655 r_config_to_tgt_rsp_srcid = r_config_srcid.read(); 1656 r_config_to_tgt_rsp_trdid = r_config_trdid.read(); 1657 r_config_to_tgt_rsp_pktid = r_config_pktid.read(); 1658 r_config_to_tgt_rsp_error = false; 1659 r_config_to_tgt_rsp_req = true; 1660 r_config_fsm = CONFIG_IDLE; 1661 1662 #if DEBUG_MEMC_CONFIG 1663 if(m_debug) 1664 std::cout << " <MEMC " << name() << " CONFIG_RSP> Request TGT_RSP FSM to return response:" 1665 << " error = " << r_config_to_tgt_rsp_error.read() 1666 << " / rsrcid = " << std::hex << m_cmd_read_srcid_fifo.read() << std::endl; 1667 #endif 1668 } 1669 break; 1670 1671 } 1672 ///////////////////// 1673 case CONFIG_UPT_WAIT: // release the lock on UPT for one cycle, and retry 1674 { 1675 if ( r_config_is_cnt.read() ) r_config_fsm = CONFIG_BC_UPT_LOCK; 1676 else r_config_fsm = CONFIG_UPT_LOCK; 1677 1678 #if DEBUG_MEMC_CONFIG 1679 if(m_debug) 1680 std::cout << " <MEMC " << name() << " CONFIG_UPT_WAIT>" 1681 << " Release UPT lock" << std::endl; 1682 #endif 1683 break; 1684 } 1685 } // end switch r_config_fsm 1305 1686 1306 1687 //////////////////////////////////////////////////////////////////////////////////// … … 1329 1710 switch(r_read_fsm.read()) 1330 1711 { 1331 /////////////// 1332 case READ_IDLE: 1333 // waiting a read request 1334 { 1712 /////////////// 1713 case READ_IDLE: // waiting a read request 1714 { 1335 1715 if(m_cmd_read_addr_fifo.rok()) 1336 1716 { 1337 1717 1338 1718 #if DEBUG_MEMC_READ 1339 if(m_debug _read_fsm)1719 if(m_debug) 1340 1720 std::cout << " <MEMC " << name() << " READ_IDLE> Read request" 1341 1721 << " : address = " << std::hex << m_cmd_read_addr_fifo.read() … … 1350 1730 } 1351 1731 1732 ////////////////// 1733 case READ_DIR_REQ: // Get the lock to the directory 1734 { 1735 if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ) 1736 { 1737 r_read_fsm = READ_DIR_LOCK; 1738 } 1739 1740 #if DEBUG_MEMC_READ 1741 if(m_debug) 1742 std::cout << " <MEMC " << name() << " READ_DIR_REQ> Requesting DIR lock " << std::endl; 1743 #endif 1744 break; 1745 } 1746 1352 1747 /////////////////// 1353 case READ_DIR_REQ: 1354 // Get the lock to the directory 1355 { 1356 if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ) 1357 { 1358 r_read_fsm = READ_DIR_LOCK; 1359 } 1360 1361 #if DEBUG_MEMC_READ 1362 if(m_debug_read_fsm) 1363 std::cout << " <MEMC " << name() << " READ_DIR_REQ> Requesting DIR lock " << std::endl; 1364 #endif 1365 break; 1366 } 1367 1368 /////////////////// 1369 case READ_DIR_LOCK: 1370 // check directory for hit / miss 1748 case READ_DIR_LOCK: // check directory for hit / miss 1371 1749 { 1372 1750 if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ) … … 1400 1778 { 1401 1779 // test if we need to register a new copy in the heap 1402 if(entry.is_cnt || (entry.count == 0) ||!cached_read)1780 if(entry.is_cnt or (entry.count == 0) or !cached_read) 1403 1781 { 1404 1782 r_read_fsm = READ_DIR_HIT; … … 1415 1793 1416 1794 #if DEBUG_MEMC_READ 1417 if(m_debug _read_fsm)1795 if(m_debug) 1418 1796 { 1419 1797 std::cout << " <MEMC " << name() << " READ_DIR_LOCK> Accessing directory: " … … 1503 1881 1504 1882 #if DEBUG_MEMC_READ 1505 if(m_debug _read_fsm)1883 if(m_debug) 1506 1884 std::cout << " <MEMC " << name() << " READ_DIR_HIT> Update directory entry:" 1507 1885 << " addr = " << std::hex << m_cmd_read_addr_fifo.read() … … 1539 1917 1540 1918 #if DEBUG_MEMC_READ 1541 if(m_debug _read_fsm)1919 if(m_debug) 1542 1920 std::cout << " <MEMC " << name() << " READ_HEAP_REQ>" 1543 1921 << " Requesting HEAP lock " << std::endl; … … 1553 1931 { 1554 1932 // enter counter mode when we reach the limit of copies or the heap is full 1555 bool go_cnt = (r_read_count.read() >= m_max_copies) ||m_heap.is_full();1933 bool go_cnt = (r_read_count.read() >= m_max_copies) or m_heap.is_full(); 1556 1934 1557 1935 // read data in the cache … … 1626 2004 1627 2005 #if DEBUG_MEMC_READ 1628 if(m_debug _read_fsm)2006 if(m_debug) 1629 2007 std::cout << " <MEMC " << name() << " READ_HEAP_LOCK> Update directory:" 1630 2008 << " tag = " << std::hex << entry.tag … … 1670 2048 1671 2049 #if DEBUG_MEMC_READ 1672 if(m_debug _read_fsm)2050 if(m_debug) 1673 2051 std::cout << " <MEMC " << name() << " READ_HEAP_WRITE> Add an entry in the heap:" 1674 2052 << " owner_id = " << std::hex << heap_entry.owner.srcid … … 1758 2136 1759 2137 #if DEBUG_MEMC_READ 1760 if(m_debug _read_fsm)2138 if(m_debug) 1761 2139 std::cout << " <MEMC " << name() << " READ_RSP> Request TGT_RSP FSM to return data:" 1762 2140 << " rsrcid = " << std::hex << m_cmd_read_srcid_fifo.read() … … 1778 2156 bool wok = !m_trt.full(index); 1779 2157 1780 if(hit_read || !wok ||hit_write) // missing line already requested or no space2158 if(hit_read or !wok or hit_write) // missing line already requested or no space 1781 2159 { 1782 2160 if(!wok) m_cpt_trt_full++; 1783 if(hit_read ||hit_write) m_cpt_trt_rb++;2161 if(hit_read or hit_write) m_cpt_trt_rb++; 1784 2162 r_read_fsm = READ_IDLE; 1785 2163 } … … 1792 2170 1793 2171 #if DEBUG_MEMC_READ 1794 if(m_debug _read_fsm)2172 if(m_debug) 1795 2173 std::cout << " <MEMC " << name() << " READ_TRT_LOCK> Check TRT:" 1796 2174 << " hit_read = " << hit_read … … 1820 2198 r_read_ll_key.read()); 1821 2199 #if DEBUG_MEMC_READ 1822 if(m_debug _read_fsm)2200 if(m_debug) 1823 2201 std::cout << " <MEMC " << name() << " READ_TRT_SET> Write in Transaction Table:" 1824 2202 << " address = " << std::hex << m_cmd_read_addr_fifo.read() 1825 << " / srcid = " << std:: dec<< m_cmd_read_srcid_fifo.read() << std::endl;2203 << " / srcid = " << std::hex << m_cmd_read_srcid_fifo.read() << std::endl; 1826 2204 #endif 1827 2205 r_read_fsm = READ_TRT_REQ; … … 1842 2220 1843 2221 #if DEBUG_MEMC_READ 1844 if(m_debug _read_fsm)2222 if(m_debug) 1845 2223 std::cout << " <MEMC " << name() << " READ_TRT_REQ> Request GET transaction for address " 1846 2224 << std::hex << m_cmd_read_addr_fifo.read() << std::endl; … … 1884 2262 switch(r_write_fsm.read()) 1885 2263 { 1886 2264 //////////////// 1887 2265 case WRITE_IDLE: // copy first word of a write burst in local buffer 1888 2266 { … … 1917 2295 } 1918 2296 1919 if (m_cmd_write_eop_fifo.read() ||((m_cmd_write_pktid_fifo.read() & 0x7) == TYPE_SC))2297 if (m_cmd_write_eop_fifo.read() or ((m_cmd_write_pktid_fifo.read() & 0x7) == TYPE_SC)) 1920 2298 { 1921 2299 r_write_fsm = WRITE_DIR_REQ; … … 1927 2305 1928 2306 #if DEBUG_MEMC_WRITE 1929 if(m_debug _write_fsm)2307 if(m_debug) 1930 2308 { 1931 2309 std::cout << " <MEMC " << name() << " WRITE_IDLE> Write request " … … 1946 2324 1947 2325 #if DEBUG_MEMC_WRITE 1948 if(m_debug _write_fsm)2326 if(m_debug) 1949 2327 { 1950 2328 std::cout << " <MEMC " << name() … … 1999 2377 if(not m_cmd_write_addr_fifo.rok()) break; 2000 2378 2001 assert(m_cmd_write_eop_fifo.read() &&2379 assert(m_cmd_write_eop_fifo.read() and 2002 2380 "Error in VCI_MEM_CACHE : " 2003 2381 "invalid packet format for SC command"); … … 2030 2408 2031 2409 #if DEBUG_MEMC_WRITE 2032 if(m_debug _write_fsm)2410 if(m_debug) 2033 2411 { 2034 2412 std::cout … … 2065 2443 r_write_way = way; 2066 2444 2067 if(entry.is_cnt &&entry.count)2445 if(entry.is_cnt and entry.count) 2068 2446 { 2069 2447 r_write_fsm = WRITE_DIR_READ; … … 2080 2458 2081 2459 #if DEBUG_MEMC_WRITE 2082 if(m_debug _write_fsm)2460 if(m_debug) 2083 2461 { 2084 2462 std::cout << " <MEMC " << name() << " WRITE_DIR_LOCK> Check the directory: " … … 2130 2508 2131 2509 #if DEBUG_MEMC_WRITE 2132 if(m_debug _write_fsm)2510 if(m_debug) 2133 2511 { 2134 2512 std::cout << " <MEMC " << name() << " WRITE_DIR_READ> Read the cache to complete local buffer" << std::endl; … … 2172 2550 // no_update is true when there is no need for coherence transaction 2173 2551 // (tests for sc requests) 2174 bool no_update = ((r_write_count.read() ==0) || (owner && (r_write_count.read() ==1) && (r_write_pktid.read() != TYPE_SC))); 2552 bool no_update = ( (r_write_count.read() == 0) or 2553 (owner and (r_write_count.read() ==1) and (r_write_pktid.read() != TYPE_SC))); 2175 2554 2176 2555 // write data in the cache if no coherence transaction … … 2205 2584 // coherence update required 2206 2585 { 2207 if(!r_write_to_cc_send_multi_req.read() &&2586 if(!r_write_to_cc_send_multi_req.read() and 2208 2587 !r_write_to_cc_send_brdcast_req.read()) 2209 2588 { … … 2217 2596 2218 2597 #if DEBUG_MEMC_WRITE 2219 if(m_debug_write_fsm)2220 2221 2222 2223 std::cout << " <MEMC " << name() << " WRITE_DIR_HIT> Write into cache / No coherence transaction"2224 << std::endl;2225 }2226 else2227 {2228 std::cout << " <MEMC " << name() << " WRITE_DIR_HIT> Coherence update required:"2229 << " is_cnt = " << r_write_is_cnt.read()2230 << " nb_copies = " << std::dec << r_write_count.read() << std::endl;2231 if(owner)2232 2233 2234 2598 if(m_debug) 2599 { 2600 if(no_update) 2601 { 2602 std::cout << " <MEMC " << name() 2603 << " WRITE_DIR_HIT> Write into cache / No coherence transaction" 2604 << std::endl; 2605 } 2606 else 2607 { 2608 std::cout << " <MEMC " << name() << " WRITE_DIR_HIT> Coherence update required:" 2609 << " is_cnt = " << r_write_is_cnt.read() 2610 << " nb_copies = " << std::dec << r_write_count.read() << std::endl; 2611 if(owner) std::cout << " ... but the first copy is the writer" << std::endl; 2612 } 2613 } 2235 2614 #endif 2236 2615 break; … … 2253 2632 2254 2633 wok = m_upt.set(true, // it's an update transaction 2255 false, // it's not a broadcast 2256 true, // it needs a response 2257 srcid, 2258 trdid, 2259 pktid, 2260 nline, 2261 nb_copies, 2262 index); 2634 false, // it's not a broadcast 2635 true, // response required 2636 false, // no acknowledge required 2637 srcid, 2638 trdid, 2639 pktid, 2640 nline, 2641 nb_copies, 2642 index); 2263 2643 if(wok) // write data in cache 2264 2644 { … … 2282 2662 2283 2663 #if DEBUG_MEMC_WRITE 2284 if(m_debug_write_fsm) 2285 { 2286 if(wok) 2287 { 2288 std::cout << " <MEMC " << name() << " WRITE_UPT_LOCK> Register the multicast update in UPT / " 2289 << " nb_copies = " << r_write_count.read() << std::endl; 2290 } 2291 } 2664 if(m_debug) 2665 { 2666 if(wok) 2667 { 2668 std::cout << " <MEMC " << name() 2669 << " WRITE_UPT_LOCK> Register the multicast update in UPT / " 2670 << " nb_copies = " << r_write_count.read() << std::endl; 2671 } 2672 } 2292 2673 #endif 2293 2674 r_write_upt_index = index; … … 2306 2687 2307 2688 #if DEBUG_MEMC_WRITE 2308 if(m_debug_write_fsm) 2309 { 2310 std::cout << " <MEMC " << name() << " WRITE_UPT_HEAP_LOCK> Get acces to the HEAP" << std::endl; 2311 } 2689 if(m_debug) 2690 std::cout << " <MEMC " << name() 2691 << " WRITE_UPT_HEAP_LOCK> Get acces to the HEAP" << std::endl; 2312 2692 #endif 2313 2693 r_write_fsm = WRITE_UPT_REQ; … … 2317 2697 2318 2698 ////////////////// 2319 case WRITE_UPT_REQ: 2320 { 2321 // prepare the coherence transaction for the CC_SEND FSM 2322 // and write the first copy in the FIFO 2323 // send the request if only one copy 2324 2699 case WRITE_UPT_REQ: // prepare the coherence transaction for the CC_SEND FSM 2700 // and write the first copy in the FIFO 2701 // send the request if only one copy 2702 { 2325 2703 assert(not r_write_to_cc_send_multi_req.read() and 2326 2704 not r_write_to_cc_send_brdcast_req.read() and … … 2373 2751 2374 2752 #if DEBUG_MEMC_WRITE 2375 if(m_debug _write_fsm)2753 if(m_debug) 2376 2754 { 2377 2755 std::cout … … 2404 2782 bool dec_upt_counter; 2405 2783 2406 if(((entry.owner.srcid != r_write_srcid.read()) ||(r_write_pktid.read() == TYPE_SC)) or2784 if(((entry.owner.srcid != r_write_srcid.read()) or (r_write_pktid.read() == TYPE_SC)) or 2407 2785 #if L1_MULTI_CACHE 2408 2786 (entry.owner.cache_id != r_write_pktid.read()) or … … 2419 2797 2420 2798 #if DEBUG_MEMC_WRITE 2421 if(m_debug _write_fsm)2799 if(m_debug) 2422 2800 { 2423 2801 std::cout << " <MEMC " << name() << " WRITE_UPT_NEXT> Post another request to CC_SEND FSM" … … 2435 2813 2436 2814 #if DEBUG_MEMC_WRITE 2437 if(m_debug _write_fsm)2815 if(m_debug) 2438 2816 { 2439 2817 std::cout << " <MEMC " << name() << " WRITE_UPT_NEXT> Skip one entry in heap matching the writer" … … 2533 2911 } 2534 2912 2535 if(m_cmd_write_eop_fifo.read() ||((m_cmd_write_pktid_fifo.read() & 0x7) == TYPE_SC))2913 if(m_cmd_write_eop_fifo.read() or ((m_cmd_write_pktid_fifo.read() & 0x7) == TYPE_SC)) 2536 2914 { 2537 2915 r_write_fsm = WRITE_DIR_REQ; … … 2548 2926 2549 2927 #if DEBUG_MEMC_WRITE 2550 if(m_debug _write_fsm)2928 if(m_debug) 2551 2929 { 2552 2930 std::cout << " <MEMC " << name() << " WRITE_RSP> Post a request to TGT_RSP FSM" … … 2572 2950 2573 2951 #if DEBUG_MEMC_WRITE 2574 if(m_debug _write_fsm)2952 if(m_debug) 2575 2953 std::cout << " <MEMC " << name() << " WRITE_MISS_TRT_LOCK> Check the TRT" << std::endl; 2576 2954 #endif … … 2588 2966 m_cpt_write_miss++; 2589 2967 } 2590 else if(wok &&!hit_write) // set a new entry in TRT2968 else if(wok and !hit_write) // set a new entry in TRT 2591 2969 { 2592 2970 r_write_trt_index = wok_index; … … 2608 2986 2609 2987 #if DEBUG_MEMC_WRITE 2610 if(m_debug _write_fsm)2988 if(m_debug) 2611 2989 std::cout << " <MEMC " << name() << " WRITE_WAIT> Releases the locks before retry" << std::endl; 2612 2990 #endif … … 2643 3021 2644 3022 #if DEBUG_MEMC_WRITE 2645 if(m_debug _write_fsm)3023 if(m_debug) 2646 3024 std::cout << " <MEMC " << name() << " WRITE_MISS_TRT_SET> Set a new entry in TRT" << std::endl; 2647 3025 #endif … … 2670 3048 2671 3049 #if DEBUG_MEMC_WRITE 2672 if(m_debug _write_fsm)3050 if(m_debug) 2673 3051 std::cout << " <MEMC " << name() << " WRITE_MISS_TRT_DATA> Modify an existing entry in TRT" << std::endl; 2674 3052 #endif … … 2689 3067 2690 3068 #if DEBUG_MEMC_WRITE 2691 if(m_debug _write_fsm)3069 if(m_debug) 2692 3070 std::cout << " <MEMC " << name() << " WRITE_MISS_XRAM_REQ> Post a GET request to the IXR_CMD FSM" << std::endl; 2693 3071 #endif … … 2714 3092 2715 3093 #if DEBUG_MEMC_WRITE 2716 if(m_debug _write_fsm)3094 if(m_debug) 2717 3095 std::cout << " <MEMC " << name() << " WRITE_BC_TRT_LOCK> Check TRT" 2718 3096 << " : wok = " << wok << " / index = " << wok_index << std::endl; … … 2735 3113 size_t nb_copies = r_write_count.read(); 2736 3114 2737 wok =m_upt.set(false, // it's an inval transaction 2738 true, // it's a broadcast 2739 true, // it needs a response 2740 srcid, 2741 trdid, 2742 pktid, 2743 nline, 2744 nb_copies, 2745 index); 3115 wok = m_upt.set(false, // it's an inval transaction 3116 true, // it's a broadcast 3117 true, // response required 3118 false, // no acknowledge required 3119 srcid, 3120 trdid, 3121 pktid, 3122 nline, 3123 nb_copies, 3124 index); 2746 3125 2747 3126 #if DEBUG_MEMC_WRITE 2748 if( m_debug _write_fsmand wok )3127 if( m_debug and wok ) 2749 3128 std::cout << " <MEMC " << name() << " WRITE_BC_UPT_LOCK> Register broadcast inval in UPT" 2750 3129 << " / nb_copies = " << r_write_count.read() << std::endl; … … 2763 3142 // Register a put transaction to XRAM in TRT 2764 3143 // and invalidate the line in directory 2765 if((r_alloc_trt_fsm.read() != ALLOC_TRT_WRITE) ||2766 (r_alloc_upt_fsm.read() != ALLOC_UPT_WRITE) ||3144 if((r_alloc_trt_fsm.read() != ALLOC_TRT_WRITE) or 3145 (r_alloc_upt_fsm.read() != ALLOC_UPT_WRITE) or 2767 3146 (r_alloc_dir_fsm.read() != ALLOC_DIR_WRITE)) 2768 3147 { … … 2805 3184 2806 3185 #if DEBUG_MEMC_WRITE 2807 if(m_debug _write_fsm)3186 if(m_debug) 2808 3187 std::cout << " <MEMC " << name() << " WRITE_BC_DIR_INVAL> Invalidate the directory entry: @ = " 2809 3188 << r_write_address.read() << " / register the put transaction in TRT:" << std::endl; … … 2816 3195 case WRITE_BC_CC_SEND: // Post a coherence broadcast request to CC_SEND FSM 2817 3196 { 2818 if(!r_write_to_cc_send_multi_req.read() &&!r_write_to_cc_send_brdcast_req.read())3197 if(!r_write_to_cc_send_multi_req.read() and !r_write_to_cc_send_brdcast_req.read()) 2819 3198 { 2820 3199 r_write_to_cc_send_multi_req = false; … … 2833 3212 2834 3213 #if DEBUG_MEMC_WRITE 2835 if(m_debug_write_fsm) 2836 { 2837 std::cout << " <MEMC " << name() 2838 << " WRITE_BC_CC_SEND> Post a broadcast request to CC_SEND FSM" << std::endl; 2839 } 3214 if(m_debug) 3215 std::cout << " <MEMC " << name() 3216 << " WRITE_BC_CC_SEND> Post a broadcast request to CC_SEND FSM" << std::endl; 2840 3217 #endif 2841 3218 } … … 2858 3235 2859 3236 #if DEBUG_MEMC_WRITE 2860 if(m_debug_write_fsm) 2861 { 2862 std::cout << " <MEMC " << name() 2863 << " WRITE_BC_XRAM_REQ> Post a put request to IXR_CMD FSM" << std::endl; 2864 } 3237 if(m_debug) 3238 std::cout << " <MEMC " << name() 3239 << " WRITE_BC_XRAM_REQ> Post a put request to IXR_CMD FSM" << std::endl; 2865 3240 #endif 2866 3241 } … … 2934 3309 2935 3310 #if DEBUG_MEMC_IXR_CMD 2936 if(m_debug _ixr_cmd_fsm)3311 if(m_debug) 2937 3312 std::cout << " <MEMC " << name() << " IXR_CMD_READ>" 2938 3313 << " Send a get request to xram / address = " << std::hex … … 2961 3336 2962 3337 #if DEBUG_MEMC_IXR_CMD 2963 if(m_debug _ixr_cmd_fsm)3338 if(m_debug) 2964 3339 std::cout << " <MEMC " << name() << " IXR_CMD_WRITE>" 2965 3340 << " Send a put request to xram / address = " << std::hex … … 2974 3349 2975 3350 #if DEBUG_MEMC_IXR_CMD 2976 if(m_debug _ixr_cmd_fsm)3351 if(m_debug) 2977 3352 std::cout << " <MEMC " << name() << " IXR_CMD_WRITE>" 2978 3353 << " Send a get request to xram / address = " << std::hex … … 3002 3377 3003 3378 #if DEBUG_MEMC_IXR_CMD 3004 if(m_debug _ixr_cmd_fsm)3379 if(m_debug) 3005 3380 std::cout << " <MEMC " << name() << " IXR_CMD_CAS>" 3006 3381 << " Send a put request to xram / address = " << std::hex … … 3015 3390 3016 3391 #if DEBUG_MEMC_IXR_CMD 3017 if(m_debug _ixr_cmd_fsm)3392 if(m_debug) 3018 3393 std::cout << " <MEMC " << name() << " IXR_CMD_CAS>" 3019 3394 << " Send a get request to xram / address = " << std::hex … … 3041 3416 3042 3417 #if DEBUG_MEMC_IXR_CMD 3043 if(m_debug _ixr_cmd_fsm)3418 if(m_debug) 3044 3419 std::cout << " <MEMC " << name() << " IXR_CMD_XRAM>" 3045 3420 << " Send a put request to xram / address = " << std::hex … … 3081 3456 r_ixr_rsp_cpt = 0; 3082 3457 r_ixr_rsp_trt_index = p_vci_ixr.rtrdid.read(); 3083 if(p_vci_ixr.reop.read() &&!(p_vci_ixr.rerror.read() &0x1)) // PUT transaction3458 if(p_vci_ixr.reop.read() and !(p_vci_ixr.rerror.read() &0x1)) // PUT transaction 3084 3459 { 3085 3460 r_ixr_rsp_fsm = IXR_RSP_ACK; 3086 3461 3087 3462 #if DEBUG_MEMC_IXR_RSP 3088 if(m_debug_ixr_rsp_fsm) 3089 { 3090 std::cout << " <MEMC " << name() 3091 << " IXR_RSP_IDLE> Response from XRAM to a put transaction" << std::endl; 3092 } 3463 if(m_debug) 3464 std::cout << " <MEMC " << name() 3465 << " IXR_RSP_IDLE> Response from XRAM to a put transaction" << std::endl; 3093 3466 #endif 3094 3467 } … … 3098 3471 3099 3472 #if DEBUG_MEMC_IXR_RSP 3100 if(m_debug_ixr_rsp_fsm) 3101 { 3102 std::cout << " <MEMC " << name() 3103 << " IXR_RSP_IDLE> Response from XRAM to a get transaction" << std::endl; 3104 } 3473 if(m_debug) 3474 std::cout << " <MEMC " << name() 3475 << " IXR_RSP_IDLE> Response from XRAM to a get transaction" << std::endl; 3105 3476 #endif 3106 3477 } … … 3114 3485 3115 3486 #if DEBUG_MEMC_IXR_RSP 3116 if(m_debug_ixr_rsp_fsm) 3117 { 3118 std::cout << " <MEMC " << name() << " IXR_RSP_ACK>" << std::endl; 3119 } 3487 if(m_debug) 3488 std::cout << " <MEMC " << name() << " IXR_RSP_ACK>" << std::endl; 3120 3489 #endif 3121 3490 break; … … 3130 3499 3131 3500 #if DEBUG_MEMC_IXR_RSP 3132 if(m_debug_ixr_rsp_fsm) 3133 { 3134 std::cout << " <MEMC " << name() << " IXR_RSP_TRT_ERASE> Erase TRT entry " 3135 << r_ixr_rsp_trt_index.read() << std::endl; 3136 } 3501 if(m_debug) 3502 std::cout << " <MEMC " << name() << " IXR_RSP_TRT_ERASE> Erase TRT entry " 3503 << r_ixr_rsp_trt_index.read() << std::endl; 3137 3504 #endif 3138 3505 } … … 3142 3509 case IXR_RSP_TRT_READ: // write a 64 bits data in the TRT 3143 3510 { 3144 if((r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) &&p_vci_ixr.rspval)3511 if((r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) and p_vci_ixr.rspval) 3145 3512 { 3146 3513 size_t index = r_ixr_rsp_trt_index.read(); … … 3149 3516 bool error = ((p_vci_ixr.rerror.read() & 0x1) == 1); 3150 3517 3151 assert(((eop == (r_ixr_rsp_cpt.read() == (m_words-2))) ||p_vci_ixr.rerror.read())3518 assert(((eop == (r_ixr_rsp_cpt.read() == (m_words-2))) or p_vci_ixr.rerror.read()) 3152 3519 and "Error in VCI_MEM_CACHE : invalid length for a response from XRAM"); 3153 3520 … … 3166 3533 3167 3534 #if DEBUG_MEMC_IXR_RSP 3168 if(m_debug_ixr_rsp_fsm) 3169 { 3170 std::cout << " <MEMC " << name() << " IXR_RSP_TRT_READ> Writing a word in TRT : " 3171 << " index = " << std::dec << index 3172 << " / word = " << r_ixr_rsp_cpt.read() 3173 << " / data = " << std::hex << data << std::endl; 3174 } 3535 if(m_debug) 3536 std::cout << " <MEMC " << name() << " IXR_RSP_TRT_READ> Writing a word in TRT : " 3537 << " index = " << std::dec << index 3538 << " / word = " << r_ixr_rsp_cpt.read() 3539 << " / data = " << std::hex << data << std::endl; 3175 3540 #endif 3176 3541 } … … 3219 3584 3220 3585 #if DEBUG_MEMC_XRAM_RSP 3221 if(m_debug _xram_rsp_fsm)3586 if(m_debug) 3222 3587 std::cout << " <MEMC " << name() << " XRAM_RSP_IDLE>" 3223 3588 << " Available cache line in TRT:" … … 3233 3598 // Copy the TRT entry in a local buffer 3234 3599 { 3235 if((r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP) &&3600 if((r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP) and 3236 3601 (r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP)) 3237 3602 { … … 3242 3607 r_xram_rsp_fsm = XRAM_RSP_TRT_COPY; 3243 3608 3244 // TransactionTabEntry trt_entry(m_trt.read(index));3245 // r_xram_rsp_trt_buf.copy(trt_entry); // TRT entry local buffer3246 3247 3609 #if DEBUG_MEMC_XRAM_RSP 3248 if(m_debug _xram_rsp_fsm)3610 if(m_debug) 3249 3611 std::cout << " <MEMC " << name() << " XRAM_RSP_DIR_LOCK>" 3250 3612 << " Get access to DIR and TRT" << std::endl; … … 3266 3628 DirectoryEntry victim(m_cache_directory.select(set, way)); 3267 3629 3268 bool inval = (victim.count &&victim.valid) ;3630 bool inval = (victim.count and victim.valid) ; 3269 3631 3270 3632 // copy the victim line in a local buffer … … 3296 3658 3297 3659 #if DEBUG_MEMC_XRAM_RSP 3298 if(m_debug _xram_rsp_fsm)3660 if(m_debug) 3299 3661 std::cout << " <MEMC " << name() << " XRAM_RSP_TRT_COPY>" 3300 3662 << " Select a slot: " … … 3323 3685 3324 3686 #if DEBUG_MEMC_XRAM_RSP 3325 if(m_debug _xram_rsp_fsm)3687 if(m_debug) 3326 3688 std::cout << " <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>" 3327 3689 << " Get acces to UPT, but line invalidation registered" … … 3331 3693 3332 3694 } 3333 else if(m_upt.is_full() &&r_xram_rsp_victim_inval.read()) // UPT full3695 else if(m_upt.is_full() and r_xram_rsp_victim_inval.read()) // UPT full 3334 3696 { 3335 3697 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 3336 3698 3337 3699 #if DEBUG_MEMC_XRAM_RSP 3338 if(m_debug _xram_rsp_fsm)3700 if(m_debug) 3339 3701 std::cout << " <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>" 3340 3702 << " Get acces to UPT, but inval required and UPT full" << std::endl; … … 3346 3708 3347 3709 #if DEBUG_MEMC_XRAM_RSP 3348 if(m_debug _xram_rsp_fsm)3710 if(m_debug) 3349 3711 std::cout << " <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>" 3350 3712 << " Get acces to UPT" << std::endl; … … 3359 3721 3360 3722 #if DEBUG_MEMC_XRAM_RSP 3361 if(m_debug _xram_rsp_fsm)3723 if(m_debug) 3362 3724 std::cout << " <MEMC " << name() << " XRAM_RSP_INVAL_WAIT>" 3363 3725 << " Release all locks and retry" << std::endl; … … 3373 3735 // TYPE_READ_INS_UNC 0bX010 with TSAR encoding 3374 3736 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 3375 bool inst_read = (r_xram_rsp_trt_buf.pktid & 0x2) &&r_xram_rsp_trt_buf.proc_read;3737 bool inst_read = (r_xram_rsp_trt_buf.pktid & 0x2) and r_xram_rsp_trt_buf.proc_read; 3376 3738 3377 3739 // check if this is a cached read, this means pktid is either 3378 3740 // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding 3379 3741 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 3380 bool cached_read = (r_xram_rsp_trt_buf.pktid & 0x1) &&r_xram_rsp_trt_buf.proc_read;3742 bool cached_read = (r_xram_rsp_trt_buf.pktid & 0x1) and r_xram_rsp_trt_buf.proc_read; 3381 3743 3382 3744 bool dirty = false; … … 3389 3751 m_cache_data.write(way, set, word, r_xram_rsp_trt_buf.wdata[word]); 3390 3752 3391 dirty = dirty ||(r_xram_rsp_trt_buf.wdata_be[word] != 0);3753 dirty = dirty or (r_xram_rsp_trt_buf.wdata_be[word] != 0); 3392 3754 3393 3755 if(m_monitor_ok) … … 3435 3797 bool wok = m_upt.set(false, // it's an inval transaction 3436 3798 broadcast, // set broadcast bit 3437 false, // it does not need a response 3799 false, // no response required 3800 false, // no acknowledge required 3438 3801 0, // srcid 3439 3802 0, // trdid … … 3454 3817 3455 3818 #if DEBUG_MEMC_XRAM_RSP 3456 if(m_debug _xram_rsp_fsm)3819 if(m_debug) 3457 3820 { 3458 3821 std::cout << " <MEMC " << name() << " XRAM_RSP_DIR_UPDT>" … … 3500 3863 3501 3864 #if DEBUG_MEMC_XRAM_RSP 3502 if(m_debug _xram_rsp_fsm)3865 if(m_debug) 3503 3866 std::cout << " <MEMC " << name() << " XRAM_RSP_TRT_DIRTY>" 3504 3867 << " Set TRT entry for the put transaction" … … 3534 3897 3535 3898 #if DEBUG_MEMC_XRAM_RSP 3536 if(m_debug _xram_rsp_fsm)3899 if(m_debug) 3537 3900 std::cout << " <MEMC " << name() << " XRAM_RSP_DIR_RSP>" 3538 3901 << " Request the TGT_RSP FSM to return data:" … … 3547 3910 case XRAM_RSP_INVAL: // send invalidate request to CC_SEND FSM 3548 3911 { 3549 if(!r_xram_rsp_to_cc_send_multi_req.read() &&3912 if(!r_xram_rsp_to_cc_send_multi_req.read() and 3550 3913 !r_xram_rsp_to_cc_send_brdcast_req.read()) 3551 3914 { 3552 3915 bool multi_req = !r_xram_rsp_victim_is_cnt.read(); 3553 bool last_multi_req = multi_req &&(r_xram_rsp_victim_count.read() == 1);3554 bool not_last_multi_req = multi_req &&(r_xram_rsp_victim_count.read() != 1);3916 bool last_multi_req = multi_req and (r_xram_rsp_victim_count.read() == 1); 3917 bool not_last_multi_req = multi_req and (r_xram_rsp_victim_count.read() != 1); 3555 3918 3556 3919 r_xram_rsp_to_cc_send_multi_req = last_multi_req; … … 3571 3934 3572 3935 #if DEBUG_MEMC_XRAM_RSP 3573 if(m_debug _xram_rsp_fsm)3936 if(m_debug) 3574 3937 std::cout << " <MEMC " << name() << " XRAM_RSP_INVAL>" 3575 3938 << " Send an inval request to CC_SEND FSM" … … 3593 3956 m_cpt_write_dirty++; 3594 3957 3595 bool multi_req = !r_xram_rsp_victim_is_cnt.read() &&r_xram_rsp_victim_inval.read();3596 bool not_last_multi_req = multi_req &&(r_xram_rsp_victim_count.read() != 1);3958 bool multi_req = !r_xram_rsp_victim_is_cnt.read() and r_xram_rsp_victim_inval.read(); 3959 bool not_last_multi_req = multi_req and (r_xram_rsp_victim_count.read() != 1); 3597 3960 3598 3961 if(not_last_multi_req) r_xram_rsp_fsm = XRAM_RSP_HEAP_REQ; … … 3600 3963 3601 3964 #if DEBUG_MEMC_XRAM_RSP 3602 if(m_debug _xram_rsp_fsm)3965 if(m_debug) 3603 3966 std::cout << " <MEMC " << name() << " XRAM_RSP_WRITE_DIRTY>" 3604 3967 << " Send the put request to IXR_CMD FSM" … … 3617 3980 3618 3981 #if DEBUG_MEMC_XRAM_RSP 3619 if(m_debug _xram_rsp_fsm)3982 if(m_debug) 3620 3983 std::cout << " <MEMC " << name() << " XRAM_RSP_HEAP_REQ>" 3621 3984 << " Requesting HEAP lock" << std::endl; … … 3655 4018 3656 4019 #if DEBUG_MEMC_XRAM_RSP 3657 if(m_debug _xram_rsp_fsm)4020 if(m_debug) 3658 4021 std::cout << " <MEMC " << name() << " XRAM_RSP_HEAP_ERASE>" 3659 4022 << " Erase copy:" 3660 << " srcid = " << std:: dec<< entry.owner.srcid4023 << " srcid = " << std::hex << entry.owner.srcid 3661 4024 << " / inst = " << std::dec << entry.owner.inst << std::endl; 3662 4025 #endif … … 3697 4060 3698 4061 #if DEBUG_MEMC_XRAM_RSP 3699 if(m_debug _xram_rsp_fsm)4062 if(m_debug) 3700 4063 std::cout << " <MEMC " << name() << " XRAM_RSP_HEAP_LAST>" 3701 4064 << " Heap housekeeping" << std::endl; … … 3713 4076 3714 4077 #if DEBUG_MEMC_XRAM_RSP 3715 if(m_debug _xram_rsp_fsm)4078 if(m_debug) 3716 4079 std::cout << " <MEMC " << name() << " XRAM_RSP_ERROR_ERASE>" 3717 4080 << " Error reported by XRAM / erase the TRT entry" << std::endl; … … 3739 4102 3740 4103 #if DEBUG_MEMC_XRAM_RSP 3741 if(m_debug _xram_rsp_fsm)3742 3743 3744 4104 if(m_debug) 4105 std::cout << " <MEMC " << name() 4106 << " XRAM_RSP_ERROR_RSP> Request a response error to TGT_RSP FSM:" 4107 << " srcid = " << std::dec << r_xram_rsp_trt_buf.srcid << std::endl; 3745 4108 #endif 3746 4109 } … … 3803 4166 3804 4167 #if DEBUG_MEMC_CLEANUP 3805 if(m_debug_cleanup_fsm) 3806 { 3807 std::cout 3808 << " <MEMC " << name() 3809 << " CLEANUP_IDLE> Cleanup request:" << std::hex 3810 << " / owner_id = " << srcid 3811 << " / owner_ins = " << (type == DspinDhccpParam::TYPE_CLEANUP_INST) 3812 << std::endl; 3813 } 4168 if(m_debug) 4169 std::cout << " <MEMC " << name() 4170 << " CLEANUP_IDLE> Cleanup request:" << std::hex 4171 << " / owner_id = " << srcid 4172 << " / owner_ins = " << (type == DspinDhccpParam::TYPE_CLEANUP_INST) << std::endl; 3814 4173 #endif 3815 4174 break; … … 3831 4190 3832 4191 #if DEBUG_MEMC_CLEANUP 3833 if(m_debug_cleanup_fsm) 3834 { 3835 std::cout 3836 << " <MEMC " << name() 3837 << " CLEANUP_GET_NLINE> Cleanup request:" 3838 << std::hex 3839 << " / address = " << nline * m_words * 4 3840 << std::endl; 3841 } 4192 if(m_debug) 4193 std::cout << " <MEMC " << name() 4194 << " CLEANUP_GET_NLINE> Cleanup request:" 4195 << " / address = " << std::hex << nline * m_words * 4 << std::endl; 3842 4196 #endif 3843 4197 break; … … 3845 4199 3846 4200 ///////////////////// 3847 case CLEANUP_DIR_REQ: 3848 { 3849 // Get the lock to the directory 4201 case CLEANUP_DIR_REQ: // Get the lock to the directory 4202 { 3850 4203 if(r_alloc_dir_fsm.read() != ALLOC_DIR_CLEANUP) break; 3851 4204 … … 3853 4206 3854 4207 #if DEBUG_MEMC_CLEANUP 3855 if(m_debug_cleanup_fsm) 3856 { 3857 std::cout 3858 << " <MEMC " << name() << " CLEANUP_DIR_REQ> Requesting DIR lock " 3859 << std::endl; 3860 } 4208 if(m_debug) 4209 std::cout << " <MEMC " << name() << " CLEANUP_DIR_REQ> Requesting DIR lock" << std::endl; 3861 4210 #endif 3862 4211 break; … … 3895 4244 #endif 3896 4245 3897 // hit : 3898 // the copy must be cleared 3899 if(entry.valid) 4246 if(entry.valid) // hit : the copy must be cleared 3900 4247 { 3901 4248 assert( 3902 (entry.count > 0) &&4249 (entry.count > 0) and 3903 4250 "VCI MEM CACHE ERROR: " 3904 4251 "In CLEANUP_DIR_LOCK, CLEANUP command on a valid entry " … … 3906 4253 3907 4254 // no access to the heap 3908 if((entry.count == 1) ||(entry.is_cnt))4255 if((entry.count == 1) or (entry.is_cnt)) 3909 4256 { 3910 4257 r_cleanup_fsm = CLEANUP_DIR_WRITE; … … 3916 4263 } 3917 4264 } 3918 // miss : 3919 // we must check the update table for a pending 3920 // invalidation transaction 3921 else 4265 else // miss : check UPT for a pending invalidation transaction 3922 4266 { 3923 4267 r_cleanup_fsm = CLEANUP_UPT_LOCK; … … 3925 4269 3926 4270 #if DEBUG_MEMC_CLEANUP 3927 if(m_debug _cleanup_fsm)4271 if(m_debug) 3928 4272 { 3929 4273 std::cout … … 3968 4312 3969 4313 bool match_inst = (r_cleanup_copy_inst.read() == r_cleanup_inst.read()); 3970 bool match = match_srcid &&match_inst;4314 bool match = match_srcid and match_inst; 3971 4315 3972 4316 if(not r_cleanup_is_cnt.read() and not match) … … 3999 4343 m_cache_directory.write(set, way, entry); 4000 4344 4001 r_cleanup_fsm = CLEANUP_SEND_ ACK;4345 r_cleanup_fsm = CLEANUP_SEND_CLACK; 4002 4346 4003 4347 #if DEBUG_MEMC_CLEANUP 4004 if(m_debug _cleanup_fsm)4348 if(m_debug) 4005 4349 { 4006 4350 std::cout … … 4029 4373 4030 4374 #if DEBUG_MEMC_CLEANUP 4031 if(m_debug _cleanup_fsm)4375 if(m_debug) 4032 4376 { 4033 4377 std::cout … … 4182 4526 4183 4527 #if DEBUG_MEMC_CLEANUP 4184 if(m_debug _cleanup_fsm)4528 if(m_debug) 4185 4529 { 4186 4530 std::cout … … 4220 4564 bool match_heap_srcid = (heap_entry.owner.srcid == r_cleanup_srcid.read()); 4221 4565 bool match_heap_inst = (heap_entry.owner.inst == r_cleanup_inst.read()); 4222 bool match_heap = match_heap_srcid &&match_heap_inst;4566 bool match_heap = match_heap_srcid and match_heap_inst; 4223 4567 4224 4568 #if L1_MULTI_CACHE … … 4260 4604 4261 4605 #if DEBUG_MEMC_CLEANUP 4262 if(m_debug _cleanup_fsm)4606 if(m_debug) 4263 4607 { 4264 4608 if(not match_heap) … … 4289 4633 break; 4290 4634 } 4291 4292 case CLEANUP_HEAP_CLEAN: 4293 { 4294 // remove a copy in the linked list 4635 //////////////////////// 4636 case CLEANUP_HEAP_CLEAN: // remove a copy in the linked list 4637 { 4295 4638 if(r_alloc_heap_fsm.read() != ALLOC_HEAP_CLEANUP) 4296 4639 { … … 4329 4672 4330 4673 #if DEBUG_MEMC_CLEANUP 4331 if(m_debug_cleanup_fsm) 4332 { 4333 std::cout 4334 << " <MEMC " << name() 4335 << " CLEANUP_HEAP_SEARCH> Remove the copy in the linked list" 4336 << std::endl; 4337 } 4338 #endif 4339 break; 4340 } 4341 4342 case CLEANUP_HEAP_FREE: 4343 { 4344 // The heap entry pointed by r_cleanup_next_ptr is freed 4345 // and becomes the head of the list of free entries 4674 if(m_debug) 4675 std::cout << " <MEMC " << name() << " CLEANUP_HEAP_SEARCH>" 4676 << " Remove the copy in the linked list" << std::endl; 4677 #endif 4678 break; 4679 } 4680 /////////////////////// 4681 case CLEANUP_HEAP_FREE: // The heap entry pointed by r_cleanup_next_ptr is freed 4682 // and becomes the head of the list of free entries 4683 { 4346 4684 if(r_alloc_heap_fsm.read() != ALLOC_HEAP_CLEANUP) 4347 4685 { … … 4375 4713 m_heap.unset_full(); 4376 4714 4377 r_cleanup_fsm = CLEANUP_SEND_ ACK;4715 r_cleanup_fsm = CLEANUP_SEND_CLACK; 4378 4716 4379 4717 #if DEBUG_MEMC_CLEANUP 4380 if(m_debug_cleanup_fsm) 4381 { 4382 std::cout 4383 << " <MEMC " << name() 4384 << " CLEANUP_HEAP_SEARCH> Update the list of free entries" 4385 << std::endl; 4386 } 4387 #endif 4388 break; 4389 } 4390 4391 case CLEANUP_UPT_LOCK: 4392 { 4393 // search pending invalidate transaction matching the Cleanup NLINE in the UPDATE TABLE 4394 // get the lock in the UPDATE_TABLE 4718 if(m_debug) 4719 std::cout << " <MEMC " << name() << " CLEANUP_HEAP_FREE>" 4720 << " Update the list of free entries" << std::endl; 4721 #endif 4722 break; 4723 } 4724 ////////////////////// 4725 case CLEANUP_UPT_LOCK: // get the lock protecting the UPT to search a pending 4726 // invalidate transaction matching the cleanup 4727 { 4395 4728 if(r_alloc_upt_fsm.read() != ALLOC_UPT_CLEANUP) break; 4396 4729 … … 4400 4733 match_inval = m_upt.search_inval(r_cleanup_nline.read(), index); 4401 4734 4402 // no pending inval 4403 if(not match_inval) 4404 { 4405 r_cleanup_fsm = CLEANUP_SEND_ACK; 4735 if ( not match_inval ) // no pending inval 4736 { 4737 r_cleanup_fsm = CLEANUP_SEND_CLACK; 4406 4738 4407 4739 #if DEBUG_MEMC_CLEANUP 4408 if(m_debug_cleanup_fsm) 4409 { 4410 std::cout 4411 << " <MEMC " << name() 4412 << " CLEANUP_UPT_LOCK> Unexpected cleanup" 4413 << " with no corresponding UPT entry:" 4414 << " address = " << std::hex 4415 << (r_cleanup_nline.read() *4*m_words) 4416 << std::endl; 4417 } 4418 #endif 4419 break; 4740 if(m_debug) 4741 std::cout << " <MEMC " << name() 4742 << " CLEANUP_UPT_LOCK> Unexpected cleanup" 4743 << " with no corresponding UPT entry:" 4744 << " address = " << std::hex 4745 << (r_cleanup_nline.read() *4*m_words) 4746 << std::endl; 4747 #endif 4748 break; 4420 4749 } 4421 4750 4422 4751 // pending inval 4423 r_cleanup_write_srcid = m_upt.srcid(index); 4424 r_cleanup_write_trdid = m_upt.trdid(index); 4425 r_cleanup_write_pktid = m_upt.pktid(index); 4426 r_cleanup_write_need_rsp = m_upt.need_rsp(index); 4427 r_cleanup_index = index; 4752 r_cleanup_write_srcid = m_upt.srcid(index); 4753 r_cleanup_write_trdid = m_upt.trdid(index); 4754 r_cleanup_write_pktid = m_upt.pktid(index); 4755 r_cleanup_need_rsp = m_upt.need_rsp(index); 4756 r_cleanup_need_ack = m_upt.need_ack(index); 4757 r_cleanup_index = index; 4428 4758 4429 4759 r_cleanup_fsm = CLEANUP_UPT_DECREMENT; 4430 4760 4431 4761 #if DEBUG_MEMC_CLEANUP 4432 if(m_debug_cleanup_fsm) 4433 { 4434 std::cout 4435 << " <MEMC " << name() 4436 << " CLEANUP_UPT_LOCK> Cleanup matching pending" 4437 << " invalidate transaction on UPT:" 4438 << std::hex 4439 << " address = " << r_cleanup_nline.read() * m_words * 4 4440 << " upt_entry = " << index 4441 << std::endl; 4442 } 4443 #endif 4444 break; 4445 } 4446 4447 case CLEANUP_UPT_DECREMENT: 4448 { 4449 // decrement response counter in UPT matching entry 4762 if(m_debug) 4763 std::cout << " <MEMC " << name() 4764 << " CLEANUP_UPT_LOCK> Cleanup matching pending" 4765 << " invalidate transaction on UPT:" 4766 << " address = " << std::hex << r_cleanup_nline.read() * m_words * 4 4767 << " / upt_entry = " << index << std::endl; 4768 #endif 4769 break; 4770 } 4771 /////////////////////////// 4772 case CLEANUP_UPT_DECREMENT: // decrement response counter in UPT matching entry 4773 { 4450 4774 if(r_alloc_upt_fsm.read() != ALLOC_UPT_CLEANUP) 4451 4775 { … … 4462 4786 m_upt.decrement(r_cleanup_index.read(), count); 4463 4787 4464 // invalidation transaction finished 4465 // (all acknowledgements received) 4466 if(count == 0) 4788 if(count == 0) // multi inval transaction completed 4467 4789 { 4468 4790 r_cleanup_fsm = CLEANUP_UPT_CLEAR; 4469 4791 } 4470 // invalidation transaction not finished 4471 else 4472 { 4473 r_cleanup_fsm = CLEANUP_SEND_ACK ; 4792 else // multi inval transaction not completed 4793 { 4794 r_cleanup_fsm = CLEANUP_SEND_CLACK ; 4474 4795 } 4475 4796 4476 4797 #if DEBUG_MEMC_CLEANUP 4477 if(m_debug_cleanup_fsm) 4478 { 4479 std::cout 4480 << " <MEMC " << name() 4481 << " CLEANUP_UPT_DECREMENT> Decrement response counter in UPT:" 4798 if(m_debug) 4799 std::cout << " <MEMC " << name() << " CLEANUP_UPT_DECREMENT>" 4800 << " Decrement response counter in UPT:" 4482 4801 << " UPT_index = " << r_cleanup_index.read() 4483 << " rsp_count = " << count 4484 << std::endl; 4485 } 4486 #endif 4487 break; 4488 } 4489 4490 case CLEANUP_UPT_CLEAR: 4491 { 4492 // Clear UPT entry of finished invalidation transaction 4802 << " / rsp_count = " << count << std::endl; 4803 #endif 4804 break; 4805 } 4806 /////////////////////// 4807 case CLEANUP_UPT_CLEAR: // Clear UPT entry 4808 { 4493 4809 if(r_alloc_upt_fsm.read() != ALLOC_UPT_CLEANUP) 4494 4810 { … … 4504 4820 m_upt.clear(r_cleanup_index.read()); 4505 4821 4506 if(r_cleanup_write_need_rsp.read()) 4507 { 4508 r_cleanup_fsm = CLEANUP_WRITE_RSP; 4509 } 4510 else 4511 { 4512 r_cleanup_fsm = CLEANUP_SEND_ACK; 4513 } 4822 if ( r_cleanup_need_rsp.read() ) r_cleanup_fsm = CLEANUP_WRITE_RSP; 4823 else if ( r_cleanup_need_ack.read() ) r_cleanup_fsm = CLEANUP_CONFIG_ACK; 4824 else r_cleanup_fsm = CLEANUP_SEND_CLACK; 4514 4825 4515 4826 #if DEBUG_MEMC_CLEANUP 4516 if(m_debug_cleanup_fsm) 4517 { 4518 std::cout 4519 << " <MEMC " << name() 4520 << " CLEANUP_UPT_CLEAR> Clear entry in UPT:" 4521 << " UPT_index = " << r_cleanup_index.read() 4522 << std::endl; 4523 } 4524 #endif 4525 break; 4526 } 4527 4528 case CLEANUP_WRITE_RSP: 4529 { 4530 // response to a previous write on the direct network 4531 // wait if pending request to the TGT_RSP FSM 4827 if(m_debug) 4828 std::cout << " <MEMC " << name() 4829 << " CLEANUP_UPT_CLEAR> Clear entry in UPT:" 4830 << " UPT_index = " << r_cleanup_index.read() << std::endl; 4831 #endif 4832 break; 4833 } 4834 /////////////////////// 4835 case CLEANUP_WRITE_RSP: // response to a previous write on the direct network 4836 // wait if pending request to the TGT_RSP FSM 4837 { 4532 4838 if(r_cleanup_to_tgt_rsp_req.read()) break; 4533 4839 … … 4538 4844 r_cleanup_to_tgt_rsp_pktid = r_cleanup_write_pktid.read(); 4539 4845 4540 r_cleanup_fsm = CLEANUP_SEND_ ACK;4846 r_cleanup_fsm = CLEANUP_SEND_CLACK; 4541 4847 4542 4848 #if DEBUG_MEMC_CLEANUP 4543 if(m_debug_cleanup_fsm) 4544 { 4545 std::cout 4546 << " <MEMC " << name() 4547 << " CLEANUP_WRITE_RSP> Send a response to a previous" 4548 << " write request waiting for coherence transaction completion: " 4549 << " rsrcid = " << std::hex << r_cleanup_write_srcid.read() 4550 << " / rtrdid = " << std::hex << r_cleanup_write_trdid.read() 4551 << std::endl; 4552 } 4553 #endif 4554 break; 4555 } 4556 4557 case CLEANUP_SEND_ACK: 4558 { 4559 // acknowledgement to a cleanup command 4560 // on the coherence network (request to the CC_SEND FSM). 4561 // wait if pending request to the CC_SEND FSM 4849 if(m_debug) 4850 std::cout << " <MEMC " << name() << " CLEANUP_WRITE_RSP>" 4851 << " Send a response to a previous write request: " 4852 << " rsrcid = " << std::hex << r_cleanup_write_srcid.read() 4853 << " / rtrdid = " << r_cleanup_write_trdid.read() 4854 << " / rpktid = " << r_cleanup_write_pktid.read() << std::endl; 4855 #endif 4856 break; 4857 } 4858 //////////////////////// 4859 case CLEANUP_CONFIG_ACK: // signals inval completion to CONFIG FSM 4860 // wait if pending request 4861 { 4862 if ( r_cleanup_to_config_ack.read() ) break; 4863 4864 r_cleanup_to_config_ack = true; 4865 r_cleanup_fsm = CLEANUP_SEND_CLACK; 4866 4867 #if DEBUG_MEMC_CLEANUP 4868 if(m_debug) 4869 std::cout << " <MEMC " << name() << " CLEANUP_CONFIG_ACK>" 4870 << " Acknowledge broacast inval completion" << std::endl; 4871 #endif 4872 break; 4873 } 4874 //////////////////////// 4875 case CLEANUP_SEND_CLACK: // acknowledgement to a cleanup command 4876 // on the coherence network (request to the CC_SEND FSM). 4877 // wait if pending request to the CC_SEND FSM 4878 { 4562 4879 if(r_cleanup_to_cc_send_req.read()) break; 4563 4880 … … 4571 4888 4572 4889 #if DEBUG_MEMC_CLEANUP 4573 if(m_debug_cleanup_fsm) 4574 { 4575 std::cout 4576 << " <MEMC " << name() 4577 << " CLEANUP_SEND_ACK> Send the response to a cleanup request:" 4578 << " srcid = " << std::dec << r_cleanup_srcid.read() 4579 << std::endl; 4580 } 4890 if(m_debug) 4891 std::cout << " <MEMC " << name() 4892 << " CLEANUP_SEND_CLACK> Send the response to a cleanup request:" 4893 << " srcid = " << std::dec << r_cleanup_srcid.read() << std::endl; 4581 4894 #endif 4582 4895 break; … … 4618 4931 4619 4932 #if DEBUG_MEMC_CAS 4620 if(m_debug _cas_fsm)4933 if(m_debug) 4621 4934 { 4622 4935 std::cout << " <MEMC " << name() << " CAS_IDLE> CAS command: " << std::hex … … 4641 4954 r_cas_rdata[r_cas_cpt.read()] = m_cmd_cas_wdata_fifo.read(); 4642 4955 4643 if((r_cas_cpt.read() == 1) &&m_cmd_cas_eop_fifo.read())4956 if((r_cas_cpt.read() == 1) and m_cmd_cas_eop_fifo.read()) 4644 4957 r_cas_wdata = m_cmd_cas_wdata_fifo.read(); 4645 4958 … … 4668 4981 4669 4982 #if DEBUG_MEMC_CAS 4670 if(m_debug _cas_fsm)4983 if(m_debug) 4671 4984 { 4672 4985 std::cout … … 4702 5015 4703 5016 #if DEBUG_MEMC_CAS 4704 if(m_debug _cas_fsm)5017 if(m_debug) 4705 5018 { 4706 5019 std::cout << " <MEMC " << name() << " CAS_DIR_LOCK> Directory acces" … … 4754 5067 4755 5068 #if DEBUG_MEMC_CAS 4756 if(m_debug _cas_fsm)5069 if(m_debug) 4757 5070 std::cout << " <MEMC " << name() << " CAS_DIR_HIT_READ> Read data from " 4758 5071 << " cache and store it in buffer" << std::endl; … … 4772 5085 4773 5086 // to avoid livelock, force the atomic access to fail pseudo-randomly 4774 bool forced_fail = ((r_cas_lfsr % (64) == 0) &&RANDOMIZE_CAS);5087 bool forced_fail = ((r_cas_lfsr % (64) == 0) and RANDOMIZE_CAS); 4775 5088 r_cas_lfsr = (r_cas_lfsr >> 1) ^ ((- (r_cas_lfsr & 1)) & 0xd0000001); 4776 5089 … … 4787 5100 4788 5101 #if DEBUG_MEMC_CAS 4789 if(m_debug _cas_fsm)5102 if(m_debug) 4790 5103 std::cout << " <MEMC " << name() << " CAS_DIR_HIT_COMPARE> Compare the old" 4791 5104 << " and the new data" … … 4810 5123 r_cas_fsm = CAS_BC_TRT_LOCK; // broadcast invalidate required 4811 5124 } 4812 else if(!r_cas_to_cc_send_multi_req.read() &&5125 else if(!r_cas_to_cc_send_multi_req.read() and 4813 5126 !r_cas_to_cc_send_brdcast_req.read()) 4814 5127 { … … 4847 5160 4848 5161 #if DEBUG_MEMC_CAS 4849 if(m_debug _cas_fsm)5162 if(m_debug) 4850 5163 std::cout << " <MEMC " << name() << " CAS_DIR_HIT_WRITE> Update cache:" 4851 5164 << " way = " << std::dec << way … … 4874 5187 size_t nb_copies = r_cas_count.read(); 4875 5188 4876 wok = m_upt.set(true, // it's an update transaction 4877 false, // it's not a broadcast 4878 true, // it needs a response 4879 srcid, 4880 trdid, 4881 pktid, 4882 nline, 4883 nb_copies, 4884 index); 5189 wok = m_upt.set(true, // it's an update transaction 5190 false, // it's not a broadcast 5191 true, // response required 5192 false, // no acknowledge required 5193 srcid, 5194 trdid, 5195 pktid, 5196 nline, 5197 nb_copies, 5198 index); 4885 5199 if(wok) // coherence transaction registered in UPT 4886 5200 { … … 4916 5230 4917 5231 #if DEBUG_MEMC_CAS 4918 if(m_debug _cas_fsm)5232 if(m_debug) 4919 5233 std::cout << " <MEMC " << name() 4920 5234 << " CAS_UPT_LOCK> Register multi-update transaction in UPT" … … 4931 5245 4932 5246 #if DEBUG_MEMC_CAS 4933 if(m_debug _cas_fsm)5247 if(m_debug) 4934 5248 { 4935 5249 std::cout << " <MEMC " << name() … … 4947 5261 4948 5262 #if DEBUG_MEMC_CAS 4949 if(m_debug _cas_fsm)5263 if(m_debug) 4950 5264 { 4951 5265 std::cout << " <MEMC " << name() … … 4963 5277 "VCI_MEM_CACHE ERROR : bad HEAP allocation"); 4964 5278 4965 if(!r_cas_to_cc_send_multi_req.read() &&!r_cas_to_cc_send_brdcast_req.read())5279 if(!r_cas_to_cc_send_multi_req.read() and !r_cas_to_cc_send_brdcast_req.read()) 4966 5280 { 4967 5281 r_cas_to_cc_send_brdcast_req = false; … … 5003 5317 5004 5318 #if DEBUG_MEMC_CAS 5005 if(m_debug _cas_fsm)5319 if(m_debug) 5006 5320 { 5007 5321 std::cout << " <MEMC " << name() << " CAS_UPT_REQ> Send the first update request to CC_SEND FSM " … … 5043 5357 5044 5358 #if DEBUG_MEMC_CAS 5045 if(m_debug _cas_fsm)5359 if(m_debug) 5046 5360 { 5047 5361 std::cout << " <MEMC " << name() << " CAS_UPT_NEXT> Send the next update request to CC_SEND FSM " … … 5069 5383 r_cas_to_ixr_cmd_data[i] = r_cas_wdata.read(); 5070 5384 } 5071 else if((i == word+1) &&(r_cas_cpt.read() == 4)) // 64 bit CAS5385 else if((i == word+1) and (r_cas_cpt.read() == 4)) // 64 bit CAS 5072 5386 { 5073 5387 r_cas_to_ixr_cmd_data[i] = m_cmd_cas_wdata_fifo.read(); … … 5113 5427 // register a broadcast inval transaction in UPT 5114 5428 wok = m_upt.set(false, // it's an inval transaction 5115 true, // it's a broadcast 5116 true, // it needs a response 5117 srcid, 5118 trdid, 5119 pktid, 5120 nline, 5121 nb_copies, 5122 index); 5429 true, // it's a broadcast 5430 true, // response required 5431 false, // no acknowledge required 5432 srcid, 5433 trdid, 5434 pktid, 5435 nline, 5436 nb_copies, 5437 index); 5123 5438 5124 5439 if(wok) // UPT not full … … 5148 5463 5149 5464 #if DEBUG_MEMC_CAS 5150 if(m_debug _cas_fsm)5465 if(m_debug) 5151 5466 std::cout << " <MEMC " << name() 5152 5467 << " CAS_BC_UPT_LOCK> Register a broadcast inval transaction in UPT" … … 5166 5481 case CAS_BC_DIR_INVAL: // Register the PUT transaction in TRT, and inval the DIR entry 5167 5482 { 5168 if((r_alloc_trt_fsm.read() == ALLOC_TRT_CAS) &&5169 (r_alloc_upt_fsm.read() == ALLOC_UPT_CAS) &&5483 if((r_alloc_trt_fsm.read() == ALLOC_TRT_CAS) and 5484 (r_alloc_upt_fsm.read() == ALLOC_UPT_CAS) and 5170 5485 (r_alloc_dir_fsm.read() == ALLOC_DIR_CAS)) 5171 5486 { … … 5204 5519 5205 5520 #if DEBUG_MEMC_CAS 5206 if(m_debug _cas_fsm)5521 if(m_debug) 5207 5522 std::cout << " <MEMC " << name() 5208 5523 << " CAS_BC_DIR_INVAL> Register the PUT in TRT and invalidate DIR entry" … … 5220 5535 case CAS_BC_CC_SEND: // Request the broadcast inval to CC_SEND FSM 5221 5536 { 5222 if(!r_cas_to_cc_send_multi_req.read() &&5537 if(!r_cas_to_cc_send_multi_req.read() and 5223 5538 !r_cas_to_cc_send_brdcast_req.read()) 5224 5539 { … … 5248 5563 5249 5564 #if DEBUG_MEMC_CAS 5250 if(m_debug _cas_fsm)5565 if(m_debug) 5251 5566 std::cout << " <MEMC " << name() 5252 5567 << " CAS_BC_XRAM_REQ> Request a PUT transaction to IXR_CMD FSM" << std::hex … … 5277 5592 5278 5593 #if DEBUG_MEMC_CAS 5279 if(m_debug _cas_fsm)5594 if(m_debug) 5280 5595 std::cout << " <MEMC " << name() 5281 5596 << " CAS_RSP_FAIL> Request TGT_RSP to send a failure response" << std::endl; … … 5299 5614 5300 5615 #if DEBUG_MEMC_CAS 5301 if(m_debug _cas_fsm)5616 if(m_debug) 5302 5617 std::cout << " <MEMC " << name() 5303 5618 << " CAS_RSP_SUCCESS> Request TGT_RSP to send a success response" << std::endl; … … 5319 5634 5320 5635 #if DEBUG_MEMC_CAS 5321 if(m_debug _cas_fsm)5636 if(m_debug) 5322 5637 { 5323 5638 std::cout << " <MEMC " << name() << " CAS_MISS_TRT_LOCK> Check TRT state" … … 5329 5644 #endif 5330 5645 5331 if(hit_read || !wok ||hit_write) // missing line already requested or no space in TRT5646 if(hit_read or !wok or hit_write) // missing line already requested or no space in TRT 5332 5647 { 5333 5648 r_cas_fsm = CAS_WAIT; … … 5370 5685 5371 5686 #if DEBUG_MEMC_CAS 5372 if(m_debug _cas_fsm)5687 if(m_debug) 5373 5688 { 5374 5689 std::cout << " <MEMC " << name() << " CAS_MISS_TRT_SET> Register a GET transaction in TRT" << std::hex … … 5392 5707 5393 5708 #if DEBUG_MEMC_CAS 5394 if(m_debug _cas_fsm)5709 if(m_debug) 5395 5710 { 5396 5711 std::cout << " <MEMC " << name() << " CAS_MISS_XRAM_REQ> Request a GET transaction to IXR_CMD FSM" << std::hex … … 5438 5753 { 5439 5754 // XRAM_RSP FSM has highest priority 5440 if(m_xram_rsp_to_cc_send_inst_fifo.rok() ||5755 if(m_xram_rsp_to_cc_send_inst_fifo.rok() or 5441 5756 r_xram_rsp_to_cc_send_multi_req.read()) 5442 5757 { … … 5453 5768 } 5454 5769 5455 if(m_cas_to_cc_send_inst_fifo.rok() ||5770 if(m_cas_to_cc_send_inst_fifo.rok() or 5456 5771 r_cas_to_cc_send_multi_req.read()) 5457 5772 { … … 5474 5789 } 5475 5790 5476 if(m_write_to_cc_send_inst_fifo.rok() ||5791 if(m_write_to_cc_send_inst_fifo.rok() or 5477 5792 r_write_to_cc_send_multi_req.read()) 5478 5793 { … … 5493 5808 { 5494 5809 // CAS FSM has highest priority 5495 if(m_cas_to_cc_send_inst_fifo.rok() ||5810 if(m_cas_to_cc_send_inst_fifo.rok() or 5496 5811 r_cas_to_cc_send_multi_req.read()) 5497 5812 { … … 5514 5829 } 5515 5830 5516 if(m_write_to_cc_send_inst_fifo.rok() ||5831 if(m_write_to_cc_send_inst_fifo.rok() or 5517 5832 r_write_to_cc_send_multi_req.read()) 5518 5833 { … … 5529 5844 } 5530 5845 5531 if(m_xram_rsp_to_cc_send_inst_fifo.rok() ||5846 if(m_xram_rsp_to_cc_send_inst_fifo.rok() or 5532 5847 r_xram_rsp_to_cc_send_multi_req.read()) 5533 5848 { … … 5555 5870 } 5556 5871 5557 if(m_write_to_cc_send_inst_fifo.rok() ||5872 if(m_write_to_cc_send_inst_fifo.rok() or 5558 5873 r_write_to_cc_send_multi_req.read()) 5559 5874 { … … 5570 5885 } 5571 5886 5572 if(m_xram_rsp_to_cc_send_inst_fifo.rok() ||5887 if(m_xram_rsp_to_cc_send_inst_fifo.rok() or 5573 5888 r_xram_rsp_to_cc_send_multi_req.read()) 5574 5889 { … … 5585 5900 } 5586 5901 5587 if(m_cas_to_cc_send_inst_fifo.rok() ||5902 if(m_cas_to_cc_send_inst_fifo.rok() or 5588 5903 r_cas_to_cc_send_multi_req.read()) 5589 5904 { … … 5604 5919 { 5605 5920 // WRITE FSM has highest priority 5606 if(m_write_to_cc_send_inst_fifo.rok() ||5921 if(m_write_to_cc_send_inst_fifo.rok() or 5607 5922 r_write_to_cc_send_multi_req.read()) 5608 5923 { … … 5619 5934 } 5620 5935 5621 if(m_xram_rsp_to_cc_send_inst_fifo.rok() ||5936 if(m_xram_rsp_to_cc_send_inst_fifo.rok() or 5622 5937 r_xram_rsp_to_cc_send_multi_req.read()) 5623 5938 { … … 5634 5949 } 5635 5950 5636 if(m_cas_to_cc_send_inst_fifo.rok() ||5951 if(m_cas_to_cc_send_inst_fifo.rok() or 5637 5952 r_cas_to_cc_send_multi_req.read()) 5638 5953 { … … 5666 5981 5667 5982 #if DEBUG_MEMC_CC_SEND 5668 if(m_debug _cc_send_fsm)5983 if(m_debug) 5669 5984 std::cout << " <MEMC " << name() 5670 5985 << " CC_SEND_CLEANUP_ACK> Cleanup Ack for srcid " … … 5705 6020 5706 6021 #if DEBUG_MEMC_CC_SEND 5707 if(m_debug _cc_send_fsm)6022 if(m_debug) 5708 6023 std::cout << " <MEMC " << name() 5709 6024 << " CC_SEND_XRAM_RSP_INVAL_NLINE> BC-Inval for line " … … 5733 6048 5734 6049 #if DEBUG_MEMC_CC_SEND 5735 if(m_debug _cc_send_fsm)6050 if(m_debug) 5736 6051 std::cout << " <MEMC " << name() 5737 6052 << " CC_SEND_XRAM_RSP_BRDCAST_NLINE> BC-Inval for line " … … 5761 6076 5762 6077 #if DEBUG_MEMC_CC_SEND 5763 if(m_debug _cc_send_fsm)6078 if(m_debug) 5764 6079 std::cout << " <MEMC " << name() 5765 6080 << " CC_SEND_WRITE_BRDCAST_NLINE> BC-Inval for line " … … 5800 6115 5801 6116 #if DEBUG_MEMC_CC_SEND 5802 if(m_debug _cc_send_fsm)6117 if(m_debug) 5803 6118 { 5804 6119 std::cout … … 5848 6163 5849 6164 #if DEBUG_MEMC_CC_SEND 5850 if(m_debug _cc_send_fsm)6165 if(m_debug) 5851 6166 { 5852 6167 std::cout … … 5892 6207 5893 6208 #if DEBUG_MEMC_CC_SEND 5894 if(m_debug_cc_send_fsm) 5895 { 5896 std::cout 5897 << " <MEMC " << name() 5898 << " CC_SEND_CAS_UPDT_NLINE> Multicast-Update for line " 5899 << r_cas_to_cc_send_nline.read() 5900 << std::endl; 5901 } 6209 if(m_debug) 6210 std::cout << " <MEMC " << name() 6211 << " CC_SEND_CAS_UPDT_NLINE> Multicast-Update for line " 6212 << r_cas_to_cc_send_nline.read() << std::endl; 5902 6213 #endif 5903 6214 break; … … 5951 6262 DspinDhccpParam::FROM_L1_TYPE); 5952 6263 5953 if((type == DspinDhccpParam::TYPE_CLEANUP_DATA) ||6264 if((type == DspinDhccpParam::TYPE_CLEANUP_DATA) or 5954 6265 (type == DspinDhccpParam::TYPE_CLEANUP_INST)) 5955 6266 { … … 5964 6275 } 5965 6276 5966 assert(false &&6277 assert(false and 5967 6278 "VCI_MEM_CACHE ERROR in CC_RECEIVE : " 5968 6279 "Illegal type in coherence request"); … … 6049 6360 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read(); 6050 6361 } 6051 else if(r_write_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_WRITE; 6052 else if(r_cas_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CAS ; 6362 else if(r_write_to_tgt_rsp_req) 6363 { 6364 r_tgt_rsp_fsm = TGT_RSP_WRITE; 6365 } 6366 else if(r_cas_to_tgt_rsp_req) 6367 { 6368 r_tgt_rsp_fsm = TGT_RSP_CAS ; 6369 } 6053 6370 else if(r_xram_rsp_to_tgt_rsp_req) 6054 6371 { … … 6056 6373 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 6057 6374 } 6058 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK; 6059 else if(r_cleanup_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 6060 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; 6375 else if(r_multi_ack_to_tgt_rsp_req) 6376 { 6377 r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK; 6378 } 6379 else if(r_cleanup_to_tgt_rsp_req) 6380 { 6381 r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 6382 } 6383 else if(r_tgt_cmd_to_tgt_rsp_req) 6384 { 6385 r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; 6386 } 6061 6387 break; 6062 6388 } … … 6185 6511 ///////////////////// 6186 6512 case TGT_RSP_TGT_CMD: // send the response after a segmentation violation 6513 // or after a config transaction 6187 6514 { 6188 6515 if ( p_vci_tgt.rspack ) … … 6192 6519 6193 6520 #if DEBUG_MEMC_TGT_RSP 6194 if( m_debug _tgt_rsp_fsm)6521 if( m_debug ) 6195 6522 { 6196 6523 std::cout 6197 6524 << " <MEMC " << name() 6198 << " TGT_RSP_TGT_CMD> Segmentation violation from TGT_CMDresponse"6525 << " TGT_RSP_TGT_CMD> Segmentation violation ior config access response" 6199 6526 << " / rsrcid = " << std::hex << r_tgt_cmd_to_tgt_rsp_srcid.read() 6200 6527 << " / rtrdid = " << r_tgt_cmd_to_tgt_rsp_trdid.read() … … 6214 6541 6215 6542 #if DEBUG_MEMC_TGT_RSP 6216 if( m_debug _tgt_rsp_fsm)6543 if( m_debug ) 6217 6544 { 6218 6545 std::cout … … 6260 6587 6261 6588 #if DEBUG_MEMC_TGT_RSP 6262 if(m_debug _tgt_rsp_fsm)6589 if(m_debug) 6263 6590 std::cout << " <MEMC " << name() << " TGT_RSP_WRITE> Write response" 6264 6591 << " / rsrcid = " << std::hex << r_write_to_tgt_rsp_srcid.read() … … 6271 6598 break; 6272 6599 } 6273 /////////////////// 6600 ///////////////////// 6274 6601 case TGT_RSP_CLEANUP: // pas clair pour moi (AG) 6275 6602 { … … 6278 6605 6279 6606 #if DEBUG_MEMC_TGT_RSP 6280 if(m_debug _tgt_rsp_fsm)6607 if(m_debug) 6281 6608 std::cout << " <MEMC " << name() << " TGT_RSP_CLEANUP> Cleanup response" 6282 6609 << " / rsrcid = " << std::hex << r_cleanup_to_tgt_rsp_srcid.read() … … 6289 6616 break; 6290 6617 } 6291 ///////////////// /6618 ///////////////// 6292 6619 case TGT_RSP_CAS: // send one atomic word response 6293 6620 { … … 6296 6623 6297 6624 #if DEBUG_MEMC_TGT_RSP 6298 if(m_debug _tgt_rsp_fsm)6625 if(m_debug) 6299 6626 std::cout << " <MEMC " << name() << " TGT_RSP_CAS> CAS response" 6300 6627 << " / rsrcid = " << std::hex << r_cas_to_tgt_rsp_srcid.read() … … 6308 6635 } 6309 6636 6310 ////////////////// /////6637 ////////////////// 6311 6638 case TGT_RSP_XRAM: // send the response after XRAM access 6312 6639 { … … 6315 6642 6316 6643 #if DEBUG_MEMC_TGT_RSP 6317 if( m_debug _tgt_rsp_fsm)6644 if( m_debug ) 6318 6645 std::cout << " <MEMC " << name() << " TGT_RSP_XRAM> Response following XRAM access" 6319 6646 << " / rsrcid = " << std::hex << r_xram_rsp_to_tgt_rsp_srcid.read() … … 6351 6678 break; 6352 6679 } 6353 ////////////////// 6680 /////////////////////// 6354 6681 case TGT_RSP_MULTI_ACK: // send the write response after coherence transaction 6355 6682 { … … 6358 6685 6359 6686 #if DEBUG_MEMC_TGT_RSP 6360 if(m_debug _tgt_rsp_fsm)6687 if(m_debug) 6361 6688 std::cout << " <MEMC " << name() << " TGT_RSP_MULTI_ACK> Write response after coherence transaction" 6362 6689 << " / rsrcid = " << std::hex << r_multi_ack_to_tgt_rsp_srcid.read() … … 6374 6701 // ALLOC_UPT FSM 6375 6702 //////////////////////////////////////////////////////////////////////////////////// 6376 // The ALLOC_UPT FSM allocates the access to the Update/Inval Table (UPT) .6377 // with a round robin priority between three FSMs : MULTI_ACK > WRITE > XRAM_RSP > CLEANUP6378 // - The WRITE FSM initiates update transactions and sets new entry in UPT.6379 // - The XRAM_RSP FSM initiates inval transactions and setsnew entry in UPT.6703 // The ALLOC_UPT FSM allocates the access to the Update/Inval Table (UPT), 6704 // with a round robin priority between six FSMs, with the following order: 6705 // CONFIG > MULTI_ACK > WRITE > XRAM_RSP > CLEANUP > CAS 6706 // - The CONFIG FSM initiates an inval transaction and sets a new entry in UPT. 6380 6707 // - The MULTI_ACK FSM complete those trasactions and erase the UPT entry. 6708 // - The WRITE FSM initiates update transaction and sets a new entry in UPT. 6709 // - The XRAM_RSP FSM initiates an inval transactions and sets a new entry in UPT. 6381 6710 // - The CLEANUP FSM decrement an entry in UPT. 6711 // - The CAS FSM does the same thing as the WRITE FSM. 6382 6712 // The resource is always allocated. 6383 6713 ///////////////////////////////////////////////////////////////////////////////////// … … 6385 6715 switch(r_alloc_upt_fsm.read()) 6386 6716 { 6387 6388 //////////////////////// 6389 case ALLOC_UPT_MULTI_ACK: 6390 if((r_multi_ack_fsm.read() != MULTI_ACK_UPT_LOCK) && 6717 ////////////////////// 6718 case ALLOC_UPT_CONFIG: // allocated to CONFIG FSM 6719 if ( (r_config_fsm.read() != CONFIG_UPT_LOCK) and 6720 (r_config_fsm.read() != CONFIG_BC_UPT_LOCK) ) 6721 { 6722 if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK) 6723 r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK; 6724 6725 else if((r_write_fsm.read() == WRITE_UPT_LOCK) or 6726 (r_write_fsm.read() == WRITE_BC_UPT_LOCK)) 6727 r_alloc_upt_fsm = ALLOC_UPT_WRITE; 6728 6729 else if(r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 6730 r_alloc_upt_fsm = ALLOC_UPT_XRAM_RSP; 6731 6732 else if(r_cleanup_fsm.read() == CLEANUP_UPT_LOCK) 6733 r_alloc_upt_fsm = ALLOC_UPT_CLEANUP; 6734 6735 else if((r_cas_fsm.read() == CAS_UPT_LOCK) or 6736 (r_cas_fsm.read() == CAS_BC_UPT_LOCK)) 6737 r_alloc_upt_fsm = ALLOC_UPT_CAS; 6738 } 6739 break; 6740 6741 ///////////////////////// 6742 case ALLOC_UPT_MULTI_ACK: // allocated to MULTI_ACK FSM 6743 if( (r_multi_ack_fsm.read() != MULTI_ACK_UPT_LOCK) and 6391 6744 (r_multi_ack_fsm.read() != MULTI_ACK_UPT_CLEAR)) 6392 6745 { 6393 if((r_write_fsm.read() == WRITE_UPT_LOCK) ||6746 if((r_write_fsm.read() == WRITE_UPT_LOCK) or 6394 6747 (r_write_fsm.read() == WRITE_BC_UPT_LOCK)) 6395 6748 r_alloc_upt_fsm = ALLOC_UPT_WRITE; … … 6401 6754 r_alloc_upt_fsm = ALLOC_UPT_CLEANUP; 6402 6755 6403 else if((r_cas_fsm.read() == CAS_UPT_LOCK) ||6756 else if((r_cas_fsm.read() == CAS_UPT_LOCK) or 6404 6757 (r_cas_fsm.read() == CAS_BC_UPT_LOCK)) 6405 6758 r_alloc_upt_fsm = ALLOC_UPT_CAS; 6759 6760 else if((r_config_fsm.read() == CONFIG_UPT_LOCK) or 6761 (r_config_fsm.read() == CONFIG_BC_UPT_LOCK)) 6762 r_alloc_upt_fsm = ALLOC_UPT_CONFIG; 6406 6763 } 6407 6764 break; 6408 6765 6409 6766 ///////////////////// 6410 case ALLOC_UPT_WRITE:6411 if((r_write_fsm.read() != WRITE_UPT_LOCK) &&6767 case ALLOC_UPT_WRITE: // allocated to WRITE FSM 6768 if((r_write_fsm.read() != WRITE_UPT_LOCK) and 6412 6769 (r_write_fsm.read() != WRITE_BC_UPT_LOCK)) 6413 6770 { … … 6418 6775 r_alloc_upt_fsm = ALLOC_UPT_CLEANUP; 6419 6776 6420 else if((r_cas_fsm.read() == CAS_UPT_LOCK) ||6777 else if((r_cas_fsm.read() == CAS_UPT_LOCK) or 6421 6778 (r_cas_fsm.read() == CAS_BC_UPT_LOCK)) 6422 6779 r_alloc_upt_fsm = ALLOC_UPT_CAS; 6423 6780 6781 else if((r_config_fsm.read() == CONFIG_UPT_LOCK) or 6782 (r_config_fsm.read() == CONFIG_BC_UPT_LOCK)) 6783 r_alloc_upt_fsm = ALLOC_UPT_CONFIG; 6784 6424 6785 else if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK) 6425 6786 r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK; … … 6428 6789 6429 6790 //////////////////////// 6430 case ALLOC_UPT_XRAM_RSP:6791 case ALLOC_UPT_XRAM_RSP: 6431 6792 if(r_xram_rsp_fsm.read() != XRAM_RSP_INVAL_LOCK) 6432 6793 { … … 6434 6795 r_alloc_upt_fsm = ALLOC_UPT_CLEANUP; 6435 6796 6436 else if((r_cas_fsm.read() == CAS_UPT_LOCK) ||6797 else if((r_cas_fsm.read() == CAS_UPT_LOCK) or 6437 6798 (r_cas_fsm.read() == CAS_BC_UPT_LOCK)) 6438 6799 r_alloc_upt_fsm = ALLOC_UPT_CAS; 6439 6800 6801 else if((r_config_fsm.read() == CONFIG_UPT_LOCK) or 6802 (r_config_fsm.read() == CONFIG_BC_UPT_LOCK)) 6803 r_alloc_upt_fsm = ALLOC_UPT_CONFIG; 6804 6440 6805 else if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK) 6441 6806 r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK; 6442 6807 6443 else if((r_write_fsm.read() == WRITE_UPT_LOCK) ||6808 else if((r_write_fsm.read() == WRITE_UPT_LOCK) or 6444 6809 (r_write_fsm.read() == WRITE_BC_UPT_LOCK)) 6445 6810 r_alloc_upt_fsm = ALLOC_UPT_WRITE; … … 6448 6813 6449 6814 ////////////////////////// 6450 case ALLOC_UPT_CLEANUP:6451 if((r_cleanup_fsm.read() != CLEANUP_UPT_LOCK ) &&6815 case ALLOC_UPT_CLEANUP: 6816 if((r_cleanup_fsm.read() != CLEANUP_UPT_LOCK ) and 6452 6817 (r_cleanup_fsm.read() != CLEANUP_UPT_DECREMENT)) 6453 6818 { 6454 if((r_cas_fsm.read() == CAS_UPT_LOCK) ||6819 if((r_cas_fsm.read() == CAS_UPT_LOCK) or 6455 6820 (r_cas_fsm.read() == CAS_BC_UPT_LOCK)) 6456 6821 r_alloc_upt_fsm = ALLOC_UPT_CAS; 6457 6822 6823 else if((r_config_fsm.read() == CONFIG_UPT_LOCK) or 6824 (r_config_fsm.read() == CONFIG_BC_UPT_LOCK)) 6825 r_alloc_upt_fsm = ALLOC_UPT_CONFIG; 6826 6458 6827 else if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK) 6459 6828 r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK; 6460 6829 6461 else if((r_write_fsm.read() == WRITE_UPT_LOCK) ||6830 else if((r_write_fsm.read() == WRITE_UPT_LOCK) or 6462 6831 (r_write_fsm.read() == WRITE_BC_UPT_LOCK)) 6463 6832 r_alloc_upt_fsm = ALLOC_UPT_WRITE; … … 6469 6838 6470 6839 ////////////////////////// 6471 case ALLOC_UPT_CAS:6472 if((r_cas_fsm.read() != CAS_UPT_LOCK) &&6840 case ALLOC_UPT_CAS: 6841 if((r_cas_fsm.read() != CAS_UPT_LOCK) and 6473 6842 (r_cas_fsm.read() != CAS_BC_UPT_LOCK)) 6474 6843 { 6475 if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK) 6844 if((r_config_fsm.read() == CONFIG_UPT_LOCK) or 6845 (r_config_fsm.read() == CONFIG_BC_UPT_LOCK)) 6846 r_alloc_upt_fsm = ALLOC_UPT_CONFIG; 6847 6848 else if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK) 6476 6849 r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK; 6477 6850 6478 else if((r_write_fsm.read() == WRITE_UPT_LOCK) ||6851 else if((r_write_fsm.read() == WRITE_UPT_LOCK) or 6479 6852 (r_write_fsm.read() == WRITE_BC_UPT_LOCK)) 6480 6853 r_alloc_upt_fsm = ALLOC_UPT_WRITE; … … 6494 6867 //////////////////////////////////////////////////////////////////////////////////// 6495 6868 // The ALLOC_DIR FSM allocates the access to the directory and 6496 // the data cache with a round robin priority between 5user FSMs :6497 // The cyclic ordering is READ > WRITE > CAS > CLEANUP > XRAM_RSP6869 // the data cache with a round robin priority between 6 user FSMs : 6870 // The cyclic ordering is CONFIG > READ > WRITE > CAS > CLEANUP > XRAM_RSP 6498 6871 // The ressource is always allocated. 6499 6872 ///////////////////////////////////////////////////////////////////////////////////// … … 6501 6874 switch(r_alloc_dir_fsm.read()) 6502 6875 { 6876 ///////////////////// 6503 6877 case ALLOC_DIR_RESET: // Initializes the directory one SET per cycle. 6504 6878 // All the WAYS of a SET initialized in parallel … … 6513 6887 break; 6514 6888 6889 ////////////////////// 6890 case ALLOC_DIR_CONFIG: // allocated to CONFIG FSM 6891 if ( (r_config_fsm.read() != CONFIG_DIR_REQ) and 6892 (r_config_fsm.read() != CONFIG_DIR_ACCESS) and 6893 (r_config_fsm.read() != CONFIG_DIR_INVAL) ) 6894 { 6895 if(r_read_fsm.read() == READ_DIR_REQ) 6896 r_alloc_dir_fsm = ALLOC_DIR_READ; 6897 6898 else if(r_write_fsm.read() == WRITE_DIR_REQ) 6899 r_alloc_dir_fsm = ALLOC_DIR_WRITE; 6900 6901 else if(r_cas_fsm.read() == CAS_DIR_REQ) 6902 r_alloc_dir_fsm = ALLOC_DIR_CAS; 6903 6904 else if(r_cleanup_fsm.read() == CLEANUP_DIR_REQ) 6905 r_alloc_dir_fsm = ALLOC_DIR_CLEANUP; 6906 6907 else if(r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) 6908 r_alloc_dir_fsm = ALLOC_DIR_XRAM_RSP; 6909 } 6910 break; 6911 6515 6912 //////////////////// 6516 case ALLOC_DIR_READ: 6517 if(((r_read_fsm.read() != READ_DIR_REQ) &&6518 (r_read_fsm.read() != READ_DIR_LOCK) &&6519 (r_read_fsm.read() != READ_TRT_LOCK) &&6520 (r_read_fsm.read()!= READ_HEAP_REQ))6521 ||6522 ((r_read_fsm.read() == READ_TRT_LOCK) &&6523 (r_alloc_trt_fsm.read() == ALLOC_TRT_READ)))6524 6913 case ALLOC_DIR_READ: // allocated to READ FSM 6914 if( ((r_read_fsm.read() != READ_DIR_REQ) and 6915 (r_read_fsm.read() != READ_DIR_LOCK) and 6916 (r_read_fsm.read() != READ_TRT_LOCK) and 6917 (r_read_fsm.read() != READ_HEAP_REQ)) 6918 or 6919 ((r_read_fsm.read() == READ_TRT_LOCK) and 6920 (r_alloc_trt_fsm.read() == ALLOC_TRT_READ)) ) 6921 { 6525 6922 if(r_write_fsm.read() == WRITE_DIR_REQ) 6526 6923 r_alloc_dir_fsm = ALLOC_DIR_WRITE; … … 6534 6931 else if(r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) 6535 6932 r_alloc_dir_fsm = ALLOC_DIR_XRAM_RSP; 6536 } 6537 break; 6538 6539 ///////////////////// 6540 case ALLOC_DIR_WRITE: 6541 if(((r_write_fsm.read() != WRITE_DIR_REQ) && 6542 (r_write_fsm.read() != WRITE_DIR_LOCK) && 6543 (r_write_fsm.read() != WRITE_DIR_READ) && 6544 (r_write_fsm.read() != WRITE_DIR_HIT) && 6545 (r_write_fsm.read() != WRITE_BC_TRT_LOCK) && 6546 (r_write_fsm.read() != WRITE_BC_UPT_LOCK) && 6547 (r_write_fsm.read() != WRITE_MISS_TRT_LOCK) && 6548 (r_write_fsm.read() != WRITE_UPT_LOCK) && 6549 (r_write_fsm.read() != WRITE_UPT_HEAP_LOCK)) 6550 || 6551 ((r_write_fsm.read() == WRITE_UPT_HEAP_LOCK) && 6552 (r_alloc_heap_fsm.read() == ALLOC_HEAP_WRITE)) 6553 || 6554 ((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) && 6555 (r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE))) 6556 { 6933 6934 else if(r_config_fsm.read() == CONFIG_DIR_REQ) 6935 r_alloc_dir_fsm = ALLOC_DIR_CONFIG; 6936 } 6937 break; 6938 6939 ///////////////////// 6940 case ALLOC_DIR_WRITE: // allocated to WRITE FSM 6941 if(((r_write_fsm.read() != WRITE_DIR_REQ) and 6942 (r_write_fsm.read() != WRITE_DIR_LOCK) and 6943 (r_write_fsm.read() != WRITE_DIR_READ) and 6944 (r_write_fsm.read() != WRITE_DIR_HIT) and 6945 (r_write_fsm.read() != WRITE_BC_TRT_LOCK) and 6946 (r_write_fsm.read() != WRITE_BC_UPT_LOCK) and 6947 (r_write_fsm.read() != WRITE_MISS_TRT_LOCK) and 6948 (r_write_fsm.read() != WRITE_UPT_LOCK) and 6949 (r_write_fsm.read() != WRITE_UPT_HEAP_LOCK)) 6950 or 6951 ((r_write_fsm.read() == WRITE_UPT_HEAP_LOCK) and 6952 (r_alloc_heap_fsm.read() == ALLOC_HEAP_WRITE)) 6953 or 6954 ((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) and 6955 (r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE))) 6956 { 6557 6957 if(r_cas_fsm.read() == CAS_DIR_REQ) 6558 6958 r_alloc_dir_fsm = ALLOC_DIR_CAS; … … 6564 6964 r_alloc_dir_fsm = ALLOC_DIR_XRAM_RSP; 6565 6965 6966 else if(r_config_fsm.read() == CONFIG_DIR_REQ) 6967 r_alloc_dir_fsm = ALLOC_DIR_CONFIG; 6968 6566 6969 else if(r_read_fsm.read() == READ_DIR_REQ) 6567 6970 r_alloc_dir_fsm = ALLOC_DIR_READ; 6568 6569 6570 6571 ////////////////////6572 case ALLOC_DIR_CAS: 6573 if(((r_cas_fsm.read() != CAS_DIR_REQ) &&6574 (r_cas_fsm.read() != CAS_DIR_LOCK) &&6575 (r_cas_fsm.read() != CAS_DIR_HIT_READ) &&6576 (r_cas_fsm.read() != CAS_DIR_HIT_COMPARE) &&6577 (r_cas_fsm.read() != CAS_DIR_HIT_WRITE) &&6578 (r_cas_fsm.read() != CAS_BC_TRT_LOCK) &&6579 (r_cas_fsm.read() != CAS_BC_UPT_LOCK) &&6580 (r_cas_fsm.read() != CAS_MISS_TRT_LOCK) &&6581 (r_cas_fsm.read() != CAS_UPT_LOCK) &&6582 6583 ||6584 ((r_cas_fsm.read() == CAS_UPT_HEAP_LOCK) &&6585 6586 ||6587 ((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) &&6588 6589 6971 } 6972 break; 6973 6974 /////////////////// 6975 case ALLOC_DIR_CAS: // allocated to CAS FSM 6976 if(((r_cas_fsm.read() != CAS_DIR_REQ) and 6977 (r_cas_fsm.read() != CAS_DIR_LOCK) and 6978 (r_cas_fsm.read() != CAS_DIR_HIT_READ) and 6979 (r_cas_fsm.read() != CAS_DIR_HIT_COMPARE) and 6980 (r_cas_fsm.read() != CAS_DIR_HIT_WRITE) and 6981 (r_cas_fsm.read() != CAS_BC_TRT_LOCK) and 6982 (r_cas_fsm.read() != CAS_BC_UPT_LOCK) and 6983 (r_cas_fsm.read() != CAS_MISS_TRT_LOCK) and 6984 (r_cas_fsm.read() != CAS_UPT_LOCK) and 6985 (r_cas_fsm.read() != CAS_UPT_HEAP_LOCK)) 6986 or 6987 ((r_cas_fsm.read() == CAS_UPT_HEAP_LOCK) and 6988 (r_alloc_heap_fsm.read() == ALLOC_HEAP_CAS)) 6989 or 6990 ((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) and 6991 (r_alloc_trt_fsm.read() == ALLOC_TRT_CAS))) 6992 { 6590 6993 if(r_cleanup_fsm.read() == CLEANUP_DIR_REQ) 6591 6994 r_alloc_dir_fsm = ALLOC_DIR_CLEANUP; … … 6594 6997 r_alloc_dir_fsm = ALLOC_DIR_XRAM_RSP; 6595 6998 6999 else if(r_config_fsm.read() == CONFIG_DIR_REQ) 7000 r_alloc_dir_fsm = ALLOC_DIR_CONFIG; 7001 6596 7002 else if(r_read_fsm.read() == READ_DIR_REQ) 6597 7003 r_alloc_dir_fsm = ALLOC_DIR_READ; … … 6599 7005 else if(r_write_fsm.read() == WRITE_DIR_REQ) 6600 7006 r_alloc_dir_fsm = ALLOC_DIR_WRITE; 6601 6602 break; 6603 6604 6605 case ALLOC_DIR_CLEANUP: 6606 if((r_cleanup_fsm.read() != CLEANUP_DIR_REQ) &&6607 (r_cleanup_fsm.read() != CLEANUP_DIR_LOCK) &&6608 (r_cleanup_fsm.read() != CLEANUP_HEAP_REQ) &&6609 6610 7007 } 7008 break; 7009 7010 /////////////////////// 7011 case ALLOC_DIR_CLEANUP: // allocated to CLEANUP FSM 7012 if((r_cleanup_fsm.read() != CLEANUP_DIR_REQ) and 7013 (r_cleanup_fsm.read() != CLEANUP_DIR_LOCK) and 7014 (r_cleanup_fsm.read() != CLEANUP_HEAP_REQ) and 7015 (r_cleanup_fsm.read() != CLEANUP_HEAP_LOCK)) 7016 { 6611 7017 if(r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) 6612 7018 r_alloc_dir_fsm = ALLOC_DIR_XRAM_RSP; 6613 7019 7020 else if(r_config_fsm.read() == CONFIG_DIR_REQ) 7021 r_alloc_dir_fsm = ALLOC_DIR_CONFIG; 7022 6614 7023 else if(r_read_fsm.read() == READ_DIR_REQ) 6615 7024 r_alloc_dir_fsm = ALLOC_DIR_READ; … … 6620 7029 else if(r_cas_fsm.read() == CAS_DIR_REQ) 6621 7030 r_alloc_dir_fsm = ALLOC_DIR_CAS; 6622 } 6623 break; 6624 6625 //////////////////////// 6626 case ALLOC_DIR_XRAM_RSP: 6627 if((r_xram_rsp_fsm.read() != XRAM_RSP_DIR_LOCK) && 6628 (r_xram_rsp_fsm.read() != XRAM_RSP_TRT_COPY) && 6629 (r_xram_rsp_fsm.read() != XRAM_RSP_INVAL_LOCK)) 6630 { 6631 if(r_read_fsm.read() == READ_DIR_REQ) 7031 } 7032 break; 7033 7034 //////////////////////// 7035 case ALLOC_DIR_XRAM_RSP: // allocated to XRAM_RSP FSM 7036 if( (r_xram_rsp_fsm.read() != XRAM_RSP_DIR_LOCK) and 7037 (r_xram_rsp_fsm.read() != XRAM_RSP_TRT_COPY) and 7038 (r_xram_rsp_fsm.read() != XRAM_RSP_INVAL_LOCK)) 7039 { 7040 if(r_config_fsm.read() == CONFIG_DIR_REQ) 7041 r_alloc_dir_fsm = ALLOC_DIR_CONFIG; 7042 7043 else if(r_read_fsm.read() == READ_DIR_REQ) 6632 7044 r_alloc_dir_fsm = ALLOC_DIR_READ; 6633 7045 … … 6640 7052 else if(r_cleanup_fsm.read() == CLEANUP_DIR_REQ) 6641 7053 r_alloc_dir_fsm = ALLOC_DIR_CLEANUP; 6642 6643 7054 } 7055 break; 6644 7056 6645 7057 } // end switch alloc_dir_fsm … … 6660 7072 if(r_read_fsm.read() != READ_TRT_LOCK) 6661 7073 { 6662 if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) ||7074 if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) or 6663 7075 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 6664 7076 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 6665 7077 6666 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) ||7078 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) or 6667 7079 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 6668 7080 r_alloc_trt_fsm = ALLOC_TRT_CAS; 6669 7081 6670 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) &&7082 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 6671 7083 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 6672 7084 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 6673 7085 6674 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) ||7086 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) or 6675 7087 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 6676 7088 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; … … 6680 7092 ///////////////////// 6681 7093 case ALLOC_TRT_WRITE: 6682 if((r_write_fsm.read() != WRITE_MISS_TRT_LOCK) &&6683 (r_write_fsm.read() != WRITE_BC_TRT_LOCK) &&7094 if((r_write_fsm.read() != WRITE_MISS_TRT_LOCK) and 7095 (r_write_fsm.read() != WRITE_BC_TRT_LOCK) and 6684 7096 (r_write_fsm.read() != WRITE_BC_UPT_LOCK)) 6685 7097 { 6686 if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) ||7098 if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) or 6687 7099 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 6688 7100 r_alloc_trt_fsm = ALLOC_TRT_CAS; 6689 7101 6690 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) &&7102 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 6691 7103 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 6692 7104 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 6693 7105 6694 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) ||7106 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) or 6695 7107 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 6696 7108 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; … … 6703 7115 //////////////////// 6704 7116 case ALLOC_TRT_CAS: 6705 if((r_cas_fsm.read() != CAS_MISS_TRT_LOCK) &&6706 (r_cas_fsm.read() != CAS_BC_TRT_LOCK) &&7117 if((r_cas_fsm.read() != CAS_MISS_TRT_LOCK) and 7118 (r_cas_fsm.read() != CAS_BC_TRT_LOCK) and 6707 7119 (r_cas_fsm.read() != CAS_BC_UPT_LOCK)) 6708 7120 { 6709 if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) &&7121 if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 6710 7122 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 6711 7123 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 6712 7124 6713 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) ||7125 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) or 6714 7126 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 6715 7127 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; … … 6718 7130 r_alloc_trt_fsm = ALLOC_TRT_READ; 6719 7131 6720 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) ||7132 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) or 6721 7133 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 6722 7134 r_alloc_trt_fsm = ALLOC_TRT_WRITE; … … 6726 7138 //////////////////////// 6727 7139 case ALLOC_TRT_XRAM_RSP: 6728 if(((r_xram_rsp_fsm.read() != XRAM_RSP_DIR_LOCK) ||6729 (r_alloc_dir_fsm.read() != ALLOC_DIR_XRAM_RSP)) &&6730 (r_xram_rsp_fsm.read() != XRAM_RSP_TRT_COPY) &&6731 (r_xram_rsp_fsm.read() != XRAM_RSP_DIR_UPDT) &&7140 if(((r_xram_rsp_fsm.read() != XRAM_RSP_DIR_LOCK) or 7141 (r_alloc_dir_fsm.read() != ALLOC_DIR_XRAM_RSP)) and 7142 (r_xram_rsp_fsm.read() != XRAM_RSP_TRT_COPY) and 7143 (r_xram_rsp_fsm.read() != XRAM_RSP_DIR_UPDT) and 6732 7144 (r_xram_rsp_fsm.read() != XRAM_RSP_INVAL_LOCK)) 6733 7145 { 6734 if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) ||7146 if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) or 6735 7147 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 6736 7148 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; … … 6739 7151 r_alloc_trt_fsm = ALLOC_TRT_READ; 6740 7152 6741 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) ||7153 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) or 6742 7154 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 6743 7155 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 6744 7156 6745 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) ||7157 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) or 6746 7158 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 6747 7159 r_alloc_trt_fsm = ALLOC_TRT_CAS; … … 6751 7163 //////////////////////// 6752 7164 case ALLOC_TRT_IXR_RSP: 6753 if((r_ixr_rsp_fsm.read() != IXR_RSP_TRT_ERASE) &&7165 if((r_ixr_rsp_fsm.read() != IXR_RSP_TRT_ERASE) and 6754 7166 (r_ixr_rsp_fsm.read() != IXR_RSP_TRT_READ)) 6755 7167 { … … 6757 7169 r_alloc_trt_fsm = ALLOC_TRT_READ; 6758 7170 6759 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) ||7171 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) or 6760 7172 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 6761 7173 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 6762 7174 6763 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) ||7175 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) or 6764 7176 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 6765 7177 r_alloc_trt_fsm = ALLOC_TRT_CAS; 6766 7178 6767 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) &&7179 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 6768 7180 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 6769 7181 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; … … 6800 7212 //////////////////// 6801 7213 case ALLOC_HEAP_READ: 6802 if((r_read_fsm.read() != READ_HEAP_REQ) &&6803 (r_read_fsm.read() != READ_HEAP_LOCK) &&7214 if((r_read_fsm.read() != READ_HEAP_REQ) and 7215 (r_read_fsm.read() != READ_HEAP_LOCK) and 6804 7216 (r_read_fsm.read() != READ_HEAP_ERASE)) 6805 7217 { … … 6820 7232 ///////////////////// 6821 7233 case ALLOC_HEAP_WRITE: 6822 if((r_write_fsm.read() != WRITE_UPT_HEAP_LOCK) &&6823 (r_write_fsm.read() != WRITE_UPT_REQ) &&7234 if((r_write_fsm.read() != WRITE_UPT_HEAP_LOCK) and 7235 (r_write_fsm.read() != WRITE_UPT_REQ) and 6824 7236 (r_write_fsm.read() != WRITE_UPT_NEXT)) 6825 7237 { … … 6840 7252 //////////////////// 6841 7253 case ALLOC_HEAP_CAS: 6842 if((r_cas_fsm.read() != CAS_UPT_HEAP_LOCK) &&6843 (r_cas_fsm.read() != CAS_UPT_REQ) &&7254 if((r_cas_fsm.read() != CAS_UPT_HEAP_LOCK) and 7255 (r_cas_fsm.read() != CAS_UPT_REQ) and 6844 7256 (r_cas_fsm.read() != CAS_UPT_NEXT)) 6845 7257 { … … 6860 7272 /////////////////////// 6861 7273 case ALLOC_HEAP_CLEANUP: 6862 if((r_cleanup_fsm.read() != CLEANUP_HEAP_REQ) &&6863 (r_cleanup_fsm.read() != CLEANUP_HEAP_LOCK) &&6864 (r_cleanup_fsm.read() != CLEANUP_HEAP_SEARCH) &&7274 if((r_cleanup_fsm.read() != CLEANUP_HEAP_REQ) and 7275 (r_cleanup_fsm.read() != CLEANUP_HEAP_LOCK) and 7276 (r_cleanup_fsm.read() != CLEANUP_HEAP_SEARCH) and 6865 7277 (r_cleanup_fsm.read() != CLEANUP_HEAP_CLEAN)) 6866 7278 { … … 6881 7293 //////////////////////// 6882 7294 case ALLOC_HEAP_XRAM_RSP: 6883 if((r_xram_rsp_fsm.read() != XRAM_RSP_HEAP_REQ) &&7295 if((r_xram_rsp_fsm.read() != XRAM_RSP_HEAP_REQ) and 6884 7296 (r_xram_rsp_fsm.read() != XRAM_RSP_HEAP_ERASE)) 6885 7297 { … … 6901 7313 } // end switch alloc_heap_fsm 6902 7314 6903 6904 //////////////////////////////////////////////////////////////////////////////////// 7315 ///////////////////////////////////////////////////////////////////// 6905 7316 // TGT_CMD to READ FIFO 6906 //////////////////////////////////////////////////////////////////////////////////// 6907 6908 if(cmd_read_fifo_put) 6909 { 6910 if(cmd_read_fifo_get) 6911 { 6912 m_cmd_read_addr_fifo.put_and_get((addr_t)(p_vci_tgt.address.read())); 6913 m_cmd_read_length_fifo.put_and_get(p_vci_tgt.plen.read() >>2); 6914 m_cmd_read_srcid_fifo.put_and_get(p_vci_tgt.srcid.read()); 6915 m_cmd_read_trdid_fifo.put_and_get(p_vci_tgt.trdid.read()); 6916 m_cmd_read_pktid_fifo.put_and_get(p_vci_tgt.pktid.read()); 6917 } 6918 else 6919 { 6920 m_cmd_read_addr_fifo.simple_put((addr_t)(p_vci_tgt.address.read())); 6921 m_cmd_read_length_fifo.simple_put(p_vci_tgt.plen.read() >>2); 6922 m_cmd_read_srcid_fifo.simple_put(p_vci_tgt.srcid.read()); 6923 m_cmd_read_trdid_fifo.simple_put(p_vci_tgt.trdid.read()); 6924 m_cmd_read_pktid_fifo.simple_put(p_vci_tgt.pktid.read()); 6925 } 6926 } 6927 else 6928 { 6929 if(cmd_read_fifo_get) 6930 { 6931 m_cmd_read_addr_fifo.simple_get(); 6932 m_cmd_read_length_fifo.simple_get(); 6933 m_cmd_read_srcid_fifo.simple_get(); 6934 m_cmd_read_trdid_fifo.simple_get(); 6935 m_cmd_read_pktid_fifo.simple_get(); 6936 } 6937 } 7317 ///////////////////////////////////////////////////////////////////// 7318 7319 m_cmd_read_addr_fifo.update( cmd_read_fifo_get, cmd_read_fifo_put, 7320 p_vci_tgt.address.read() ); 7321 m_cmd_read_length_fifo.update( cmd_read_fifo_get, cmd_read_fifo_put, 7322 p_vci_tgt.plen.read()>>2 ); 7323 m_cmd_read_srcid_fifo.update( cmd_read_fifo_get, cmd_read_fifo_put, 7324 p_vci_tgt.srcid.read() ); 7325 m_cmd_read_trdid_fifo.update( cmd_read_fifo_get, cmd_read_fifo_put, 7326 p_vci_tgt.trdid.read() ); 7327 m_cmd_read_pktid_fifo.update( cmd_read_fifo_get, cmd_read_fifo_put, 7328 p_vci_tgt.pktid.read() ); 7329 6938 7330 ///////////////////////////////////////////////////////////////////// 6939 7331 // TGT_CMD to WRITE FIFO … … 7264 7656 //////////////////////////////////////////////////// 7265 7657 7266 if(((r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) &&7267 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) ||7658 if(((r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) and 7659 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) or 7268 7660 (r_ixr_rsp_fsm.read() == IXR_RSP_ACK)) 7269 7661 … … 7333 7725 p_vci_tgt.rtrdid = r_tgt_cmd_to_tgt_rsp_trdid.read(); 7334 7726 p_vci_tgt.rpktid = r_tgt_cmd_to_tgt_rsp_pktid.read(); 7335 p_vci_tgt.rerror = 0x1;7727 p_vci_tgt.rerror = r_tgt_cmd_to_tgt_rsp_error.read(); 7336 7728 p_vci_tgt.reop = true; 7337 7729 … … 7368 7760 case TGT_RSP_WRITE: 7369 7761 p_vci_tgt.rspval = true; 7370 if(((r_write_to_tgt_rsp_pktid.read() & 0x7) == TYPE_SC) &&r_write_to_tgt_rsp_sc_fail.read())7762 if(((r_write_to_tgt_rsp_pktid.read() & 0x7) == TYPE_SC) and r_write_to_tgt_rsp_sc_fail.read()) 7371 7763 p_vci_tgt.rdata = 1; 7372 7764 else
Note: See TracChangeset
for help on using the changeset viewer.