//
    // Cannot use DMI through plug & play devices. This is probably OK for present.
    //
    bool getDMIPointer(int SocketId, transaction_type& trans, tlm::tlm_dmi&  dmi_data)
    {
        Addr address = trans.get_address();
        Addr offset;
        int  portId = getPortId(address, offset);
        Bool result = false;

        if(portId >= 0) {
            initiator_socket_type* decodeSocket = &initiator_socket[portId];

            // send on the transaction with the new address, adjusted for the decoder offset
            trans.set_address(offset);
            result = (*decodeSocket)->get_direct_mem_ptr(trans, dmi_data);

            // put the address back how it was
            trans.set_address(address);

            // Should always succeed
            Addr start = dmi_data.get_start_address();
            Addr end   = dmi_data.get_end_address();

            if (result) {
                // Range must contain address
                assert(start <= offset);
                assert(end   >= offset);
            }

            adjustRange(portId, address, start, end);

            dmi_data.set_start_address(start);
            dmi_data.set_end_address(end);
        }

        return result;
    }
Exemple #2
0
//==============================================================================
void
dmi_memory::load_dmi_ptr
(
  tlm::tlm_dmi &dmi_properties
)
{
  report::print(m_ID,dmi_properties,filename);
//  m_dmi_properties = dmi_properties;
  m_dmi_ptr           = dmi_properties.get_dmi_ptr();
  m_dmi_read_latency  = dmi_properties.get_read_latency();
  m_dmi_write_latency = dmi_properties.get_write_latency();
  m_dmi_base_address       = dmi_properties.get_start_address();
  m_dmi_size          = dmi_properties.get_end_address()
                      - m_dmi_base_address;
  m_granted_access    = dmi_properties.get_granted_access();

  return;
}
  // Tagged TLM-2 forward DMI method
  virtual bool get_direct_mem_ptr(int id,
                                  tlm::tlm_generic_payload& trans,
                                  tlm::tlm_dmi&  dmi_data)
  {
    sc_dt::uint64 masked_address;
    unsigned int target_nr = decode_address( trans.get_address(), masked_address );
    if (target_nr >= init_socket.size())
      return false;

    trans.set_address( masked_address );

    bool status = init_socket[target_nr]->get_direct_mem_ptr( trans, dmi_data );

    // Calculate DMI address of target in system address space
    dmi_data.set_start_address( compose_address( target_nr, dmi_data.get_start_address() ));
    dmi_data.set_end_address  ( compose_address( target_nr, dmi_data.get_end_address() ));

    return status;
  }