Changeset 712 for trunk/modules/vci_io_bridge/caba/source/include
- Timestamp:
- Jun 10, 2014, 11:32:32 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_io_bridge/caba/source/include/vci_io_bridge.h
r585 r712 37 37 // configuration or data transactions to peripherals. 38 38 // 39 // Regarding DMA transactions initiated by external peripherals, it provides 39 // It supports two types of transactions from peripherals: 40 // - DMA transactions to the RAM network, 41 // - WTI transactions to the INT network. 42 // Regarding transactions initiated by external peripherals, it provides 40 43 // an - optional - IOMMU service : the 32 bits virtual address is translated 41 44 // to a (up to) 40 bits physical address by a standard SoCLib generic TLB. 42 45 // In case of TLB MISS, the DMA transaction is stalled until the TLB is updated. 43 // In case of page fault (illegal access), a VCI error is returned to the44 // faulty peripheral.46 // In case of page fault or read_only violation (illegal access), a VCI error 47 // is returned to the faulty peripheral, and a IOMMU WTI is sent. 45 48 ///////////////////////////////////////////////////////////////////////////////// 46 49 // General Constraints: … … 63 66 // - Ne pas garder tous les champs WRITE CMD dans les FIFO a chaque flit 64 67 // (seulement 'data' et 'be') 65 // - Traiter complêtement les codes d'erreur en réponse à une transaction66 // WTI write67 68 /////////////////////////////////////////////////////////////////////////////// 68 69 … … 94 95 : public soclib::caba::BaseModule 95 96 { 96 // Data and be fields have different widths on INT and EXT networks97 // Data and be fields have different widths on INT and EXT/IOC networks 97 98 typedef typename vci_param_ext::data_t ext_data_t; 98 99 typedef typename vci_param_int::data_t int_data_t; 99 100 typedef typename vci_param_ext::be_t ext_be_t; 100 typedef typename vci_param_int::be_t ext_in_t;101 typedef typename vci_param_int::be_t int_be_t; 101 102 102 103 // Other fields must be equal … … 130 131 { 131 132 DMA_CMD_IDLE, 132 DMA_CMD_FIFO_PUT_CMD, 133 DMA_CMD_FIFO_PUT_RSP, 134 DMA_CMD_MISS_WAIT, 135 DMA_CMD_WAIT_EOP, 133 DMA_CMD_DMA_REQ, 134 DMA_CMD_WTI_IOX_REQ, 135 DMA_CMD_ERR_WAIT_EOP, 136 DMA_CMD_ERR_WTI_REQ, 137 DMA_CMD_ERR_RSP_REQ, 138 DMA_CMD_TLB_MISS_WAIT, 136 139 }; 137 140 138 // States for DMA_RSP FSM (from RAM to IOX)141 // States for DMA_RSP FSM 139 142 enum dma_rsp_fsm_state 140 143 { 141 DMA_RSP_IDLE, 142 DMA_RSP_FIFO_PUT, 144 DMA_RSP_IDLE_DMA, 145 DMA_RSP_IDLE_WTI, 146 DMA_RSP_IDLE_ERR, 147 DMA_RSP_PUT_DMA, 148 DMA_RSP_PUT_WTI, 149 DMA_RSP_PUT_ERR, 143 150 }; 144 151 … … 159 166 }; 160 167 161 // States for CONFIG_CMD FSM (from INT to IOX)168 // States for CONFIG_CMD FSM 162 169 enum config_cmd_fsm_state 163 170 { … … 168 175 }; 169 176 170 // states for CONFIG_RSP FSM (from IOX to INT)177 // states for CONFIG_RSP FSM 171 178 enum config_rsp_fsm_state 172 179 { 173 CONFIG_RSP_IDLE, 174 CONFIG_RSP_PUT_LO, 180 CONFIG_RSP_IDLE_IOX, 181 CONFIG_RSP_IDLE_LOC, 182 CONFIG_RSP_PUT_LOW, 175 183 CONFIG_RSP_PUT_HI, 176 184 CONFIG_RSP_PUT_UNC, 185 CONFIG_RSP_PUT_LOC, 186 177 187 }; 178 188 179 // States for MISS_WTI_CMD FSM (to INT network) 180 enum miss_wti_cmd_state 181 { 182 MISS_WTI_CMD_IDLE, 183 MISS_WTI_CMD_WTI, 184 MISS_WTI_CMD_MISS, 185 }; 186 187 // States for MISS_WTI_RSP FSM (from INT network) 189 // States for MISS_WTI_RSP FSM 188 190 enum miss_wti_rsp_state 189 191 { 190 192 MISS_WTI_RSP_IDLE, 191 MISS_WTI_RSP_WTI, 193 MISS_WTI_RSP_WTI_IOX, 194 MISS_WTI_RSP_WTI_MMU, 192 195 MISS_WTI_RSP_MISS, 193 196 }; … … 196 199 enum pktid_values_e 197 200 { 198 PKTID_READ = 0x0, // TSAR code for read data uncached 199 PKTID_WRITE = 0x4, // TSAR code for write 201 PKTID_MISS = 0x0, // TSAR code for read data uncached 202 PKTID_WTI_IOX = 0x4, // TSAR code for write 203 PKTID_WTI_MMU = 0xC, // TSAR code for write 200 204 }; 201 205 … … 210 214 sc_in<bool> p_clk; 211 215 sc_in<bool> p_resetn; 212 sc_in<bool>* p_irq[32]; // not always constructed213 216 214 217 soclib::caba::VciInitiator<vci_param_ext> p_vci_ini_ram; … … 222 225 private: 223 226 const size_t m_words; 224 const bool m_has_irqs;225 227 226 228 // INT & IOX Networks 227 229 std::list<soclib::common::Segment> m_int_seglist; 228 const vci_srcid_t m_int_srcid; // localSRCID on INT network230 const vci_srcid_t m_int_srcid; // SRCID on INT network 229 231 std::list<soclib::common::Segment> m_iox_seglist; 230 232 … … 241 243 // MEMORY MAPPED REGISTERS 242 244 /////////////////////////////// 243 sc_signal<uint32_t> r_iommu_ptpr; // page table pointer register245 sc_signal<uint32_t> r_iommu_ptpr; // page table pointer 244 246 sc_signal<bool> r_iommu_active; // iotlb mode 245 sc_signal<uint32_t> r_iommu_bvar; // iommu bad virtual address 246 sc_signal<uint32_t> r_iommu_etr; // iommu error type 247 sc_signal<uint32_t> r_iommu_bad_id; // SRCID of faulty peripheral 248 sc_signal<uint32_t> r_iommu_wti_enable; // enable WTI transactions 249 sc_signal<vci_addr_t> r_iommu_wti_paddr; // address of IOMMU WTI 250 sc_signal<vci_addr_t>* r_iommu_peri_wti; // array[32] WTI for peripherals 247 sc_signal<uint32_t> r_iommu_bvar; // bad vaddr 248 sc_signal<uint32_t> r_iommu_etr; // error type 249 sc_signal<uint32_t> r_iommu_bad_id; // faulty srcid 250 sc_signal<bool> r_iommu_wti_enable; // enable IOB WTI 251 sc_signal<uint32_t> r_iommu_wti_addr_lo; // IOMMU WTI paddr (32 lsb) 252 sc_signal<uint32_t> r_iommu_wti_addr_hi; // IOMMU WTI paddr (32 msb) 253 254 sc_signal<uint32_t> r_xicu_base; // XICU paddr base (cluster 0) 255 sc_signal<uint32_t> r_xicu_size; // XIXU paddr size (cluster 0) 251 256 252 257 /////////////////////////////////// … … 254 259 /////////////////////////////////// 255 260 sc_signal<int> r_dma_cmd_fsm; 256 sc_signal<uint32_t> r_dma_cmd_vaddr; // input virtual address 257 sc_signal<vci_addr_t> r_dma_cmd_paddr; // output physical address 261 sc_signal<vci_addr_t> r_dma_cmd_paddr; // output paddr 262 263 sc_signal<bool> r_dma_cmd_to_miss_wti_cmd_req; 264 sc_signal<vci_addr_t> r_dma_cmd_to_miss_wti_cmd_addr; 265 sc_signal<vci_cmd_t> r_dma_cmd_to_miss_wti_cmd_cmd; 266 sc_signal<vci_srcid_t> r_dma_cmd_to_miss_wti_cmd_srcid; 267 sc_signal<vci_trdid_t> r_dma_cmd_to_miss_wti_cmd_trdid; 268 sc_signal<vci_trdid_t> r_dma_cmd_to_miss_wti_cmd_pktid; 269 sc_signal<int_data_t> r_dma_cmd_to_miss_wti_cmd_wdata; 270 271 sc_signal<bool> r_dma_cmd_to_dma_rsp_req; 272 sc_signal<vci_srcid_t> r_dma_cmd_to_dma_rsp_rsrcid; 273 sc_signal<vci_trdid_t> r_dma_cmd_to_dma_rsp_rtrdid; 274 sc_signal<vci_pktid_t> r_dma_cmd_to_dma_rsp_rpktid; 275 sc_signal<vci_rerror_t> r_dma_cmd_to_dma_rsp_rerror; 276 sc_signal<ext_data_t> r_dma_cmd_to_dma_rsp_rdata; 277 278 sc_signal<bool> r_dma_cmd_to_tlb_req; 279 sc_signal<uint32_t> r_dma_cmd_to_tlb_vaddr; // input vaddr 258 280 259 281 /////////////////////////////////// … … 266 288 /////////////////////////////////// 267 289 sc_signal<int> r_config_cmd_fsm; 268 sc_signal<uint32_t> r_config_cmd_rdata; 269 sc_signal<bool> r_config_cmd_error; 270 sc_signal<uint32_t> r_config_cmd_inval_vaddr; 290 291 sc_signal<bool> r_config_cmd_to_tlb_req; 292 sc_signal<uint32_t> r_config_cmd_to_tlb_vaddr; 293 294 sc_signal<bool> r_config_cmd_to_config_rsp_req; 295 sc_signal<bool> r_config_cmd_to_config_rsp_rerror; 296 sc_signal<uint32_t> r_config_cmd_to_config_rsp_rdata; 271 297 272 298 sc_signal<ext_data_t> r_config_cmd_wdata; … … 293 319 // TLB FSM REGISTERS 294 320 /////////////////////////////////// 295 sc_signal<int> r_tlb_fsm; // state register296 sc_signal<bool> r_waiting_transaction; // Flag for returning from321 sc_signal<int> r_tlb_fsm; // state register 322 sc_signal<bool> r_waiting_transaction; // Flag for returning from 297 323 sc_signal<int> r_tlb_miss_type; 298 324 sc_signal<bool> r_tlb_miss_error; 299 325 300 sc_signal<vci_addr_t> r_tlb_paddr; // physical address of pte 301 sc_signal<uint32_t> r_tlb_pte_flags; // pte1 or first word of pte2 302 sc_signal<uint32_t> r_tlb_pte_ppn; // second word of pte2 303 sc_signal<size_t> r_tlb_way; // selected way in tlb 304 sc_signal<size_t> r_tlb_set; // selected set in tlb 305 306 uint32_t* r_tlb_buf_data; // prefetch buffer for PTEs 307 sc_signal<bool> r_tlb_buf_valid; // one valit flag for all PTEs 308 sc_signal<vci_addr_t> r_tlb_buf_tag; // cache line number 309 sc_signal<vci_addr_t> r_tlb_buf_vaddr; // virtual address first PTE 310 sc_signal<bool> r_tlb_buf_big_page; // ??? 311 312 /////////////////////////////////// 313 // MISS_WTI_CMD FSM REGISTERS 314 /////////////////////////////////// 315 sc_signal<int> r_miss_wti_cmd_fsm; 316 sc_signal<size_t> r_miss_wti_cmd_index; 326 sc_signal<vci_addr_t> r_tlb_paddr; // physical address of pte 327 sc_signal<uint32_t> r_tlb_pte_flags; // pte1 or first word of pte2 328 sc_signal<uint32_t> r_tlb_pte_ppn; // second word of pte2 329 sc_signal<size_t> r_tlb_way; // selected way in tlb 330 sc_signal<size_t> r_tlb_set; // selected set in tlb 331 332 uint32_t* r_tlb_buf_data; // prefetch buffer for PTEs 333 sc_signal<bool> r_tlb_buf_valid; // one valit flag for all PTEs 334 sc_signal<vci_addr_t> r_tlb_buf_tag; // cache line number 335 sc_signal<vci_addr_t> r_tlb_buf_vaddr; // vaddr for first PTE 336 sc_signal<bool> r_tlb_buf_big_page; // ??? 337 338 sc_signal<bool> r_tlb_to_miss_wti_cmd_req; 317 339 318 340 /////////////////////////////////// … … 320 342 /////////////////////////////////// 321 343 sc_signal<int> r_miss_wti_rsp_fsm; 322 sc_signal<bool> r_miss_wti_rsp_error; 323 sc_signal<size_t> r_miss_wti_rsp_count; 344 sc_signal<bool> r_miss_wti_rsp_error_wti; // VCI error on WTI 345 sc_signal<bool> r_miss_wti_rsp_error_miss; // VCI error on MISS 346 sc_signal<size_t> r_miss_wti_rsp_count; // flits counter 347 348 sc_signal<bool> r_miss_wti_rsp_to_dma_rsp_req; 349 sc_signal<vci_rerror_t> r_miss_wti_rsp_to_dma_rsp_rerror; 350 sc_signal<vci_srcid_t> r_miss_wti_rsp_to_dma_rsp_rsrcid; 351 sc_signal<vci_trdid_t> r_miss_wti_rsp_to_dma_rsp_rtrdid; 352 sc_signal<vci_pktid_t> r_miss_wti_rsp_to_dma_rsp_rpktid; 353 324 354 325 355 ///////////////////////////////////////////////////// … … 327 357 ///////////////////////////////////////////////////// 328 358 sc_signal<bool> r_alloc_fifo_config_rsp_local; 329 sc_signal<bool> r_alloc_fifo_dma_rsp_local; 330 331 ////////////////////////////////// 332 // IRQ FSM registers 333 ////////////////////////////////// 334 sc_signal<bool>* r_irq_pending; // array[32] 335 sc_signal<bool>* r_irq_request; // array[32] 359 336 360 337 361 ////////////////////////////////////////////////////////////////// … … 340 364 GenericTlb<vci_addr_t> r_iotlb; 341 365 342 //////////////////////////////////////////////////////////////////343 // Inter-FSM communications344 //////////////////////////////////////////////////////////////////345 346 // between DMA_CMD and TLB FSM347 sc_signal<bool> r_dma_tlb_req;348 349 // between CONFIG_CMD FSM and TLB FSM350 sc_signal<bool> r_config_tlb_req;351 352 // between TLB FSM and MISS_WTI FSM353 sc_signal<bool> r_tlb_miss_req;354 366 355 367 ///////////////////////// … … 405 417 GenericFifo<vci_rerror_t> m_config_rsp_rerror_fifo; 406 418 407 419 // output FIFO to VCI_INI port on INT network (VCI command) 420 GenericFifo<vci_addr_t> m_miss_wti_cmd_addr_fifo; 421 GenericFifo<vci_srcid_t> m_miss_wti_cmd_srcid_fifo; 422 GenericFifo<vci_trdid_t> m_miss_wti_cmd_trdid_fifo; 423 GenericFifo<vci_pktid_t> m_miss_wti_cmd_pktid_fifo; 424 GenericFifo<int_be_t> m_miss_wti_cmd_be_fifo; 425 GenericFifo<vci_cmd_t> m_miss_wti_cmd_cmd_fifo; 426 GenericFifo<vci_contig_t> m_miss_wti_cmd_contig_fifo; 427 GenericFifo<int_data_t> m_miss_wti_cmd_data_fifo; 428 GenericFifo<vci_eop_t> m_miss_wti_cmd_eop_fifo; 429 GenericFifo<vci_cons_t> m_miss_wti_cmd_cons_fifo; 430 GenericFifo<vci_plen_t> m_miss_wti_cmd_plen_fifo; 431 GenericFifo<vci_wrap_t> m_miss_wti_cmd_wrap_fifo; 432 GenericFifo<vci_cfixed_t> m_miss_wti_cmd_cfixed_fifo; 433 GenericFifo<vci_clen_t> m_miss_wti_cmd_clen_fifo; 434 408 435 //////////////////////////////// 409 436 // Activity counters … … 432 459 uint32_t m_cpt_fsm_config_cmd [32]; 433 460 uint32_t m_cpt_fsm_config_rsp [32]; 434 uint32_t m_cpt_fsm_miss_wti_cmd [32];435 461 uint32_t m_cpt_fsm_miss_wti_rsp [32]; 436 462 437 463 protected: 464 438 465 SC_HAS_PROCESS(VciIoBridge); 439 466 440 467 public: 468 441 469 VciIoBridge( 442 470 sc_module_name insname, … … 447 475 const soclib::common::IntTab &int_srcid, // INT network SRCID 448 476 const soclib::common::IntTab &iox_tgtid, // IOX network TGTID 449 const bool has_irqs, // component has irq ports450 477 const size_t dcache_words, 451 478 const size_t iotlb_ways, … … 462 489 463 490 private: 491 492 bool is_wti( vci_addr_t paddr ); 464 493 void transition(); 465 494 void genMoore();
Note: See TracChangeset
for help on using the changeset viewer.