Esempio n. 1
0
void BaseMemory::set_storage(std::string implementation, uint32_t size) {
    sc_core::sc_object *obj = SrModuleRegistry::create_object_by_name("MemoryStorage", implementation, "storage");
    m_storage = dynamic_cast<Storage *>(obj);
    if(!m_storage) {
        srError("BaseMemory")
        ("storage", implementation)
        ("size", size)
        ("Memory Store not created");
    }
    m_storage->set_size(size);
}
Esempio n. 2
0
//SC_HAS_PROCESS(mmu_cache<>);
/// Constructor
mmu_cache::mmu_cache(
      ModuleName name,
      bool icen, 
      uint32_t irepl, 
      uint32_t isets,
      uint32_t ilinesize, 
      uint32_t isetsize,
      uint32_t isetlock,
      uint32_t dcen,
      uint32_t drepl,
      uint32_t dsets,
      uint32_t dlinesize,
      uint32_t dsetsize,
      bool dsetlock,
      bool dsnoop,
      bool ilram,
      uint32_t ilramsize,
      uint32_t ilramstart,
      uint32_t dlram,
      uint32_t dlramsize,
      uint32_t dlramstart,
      uint32_t cached,
      bool mmu_en,
      uint32_t itlb_num,
      uint32_t dtlb_num,
      uint32_t tlb_type,
      uint32_t tlb_rep,
      uint32_t mmupgsz,
      uint32_t hindex,
      bool pow_mon,
      AbstractionLayer abstractionLayer) :
  mmu_cache_base(
      name,
      icen, 
      irepl, 
      isets,
      ilinesize, 
      isetsize,
      isetlock,
      dcen,
      drepl,
      dsets,
      dlinesize,
      dsetsize,
      dsetlock,
      dsnoop,
      ilram,
      ilramsize,
      ilramstart,
      dlram,
      dlramsize,
      dlramstart,
      cached,
      mmu_en,
      itlb_num,
      dtlb_num,
      tlb_type,
      tlb_rep,
      mmupgsz,
      hindex,
      pow_mon,
      abstractionLayer),
  icio("icio"),
  dcio("dcio"),
  icio_PEQ("icio_PEQ"),
  dcio_PEQ("dcio_PEQ") {
    // Loosely-Timed
    if (abstractionLayer==amba::amba_LT) {

      // Register blocking forward transport functions for icio and dcio sockets (slave)
      icio.register_b_transport(this, &mmu_cache::icio_b_transport);
      dcio.register_b_transport(this, &mmu_cache::dcio_b_transport);

    // Approximately-Timed
    } else if (abstractionLayer==amba::amba_AT) {

      // Register non-blocking forward transport functions for icio and dcio sockets
      icio.register_nb_transport_fw(this, &mmu_cache::icio_nb_transport_fw);
      dcio.register_nb_transport_fw(this, &mmu_cache::dcio_nb_transport_fw);

      // Register icio service thread (for AT)
      SC_THREAD(icio_service_thread);
      sensitive << icio_PEQ.get_event();
      dont_initialize();

      // Register dcio service thread (for AT)
      SC_THREAD(dcio_service_thread);
      sensitive << dcio_PEQ.get_event();
      dont_initialize();

    } else {

      srError(name)
        ("Abstraction Layer not valid!!");
      assert(0);

    }

    // Instruction debug transport
    icio.register_transport_dbg(this, &mmu_cache::icio_transport_dbg);
    // Data debug transport
    dcio.register_transport_dbg(this, &mmu_cache::dcio_transport_dbg);
}