1a2,13
> * Copyright (c) 2017 ARM Limited
> * All rights reserved.
> *
> * The license below extends only to copyright in the software and shall
> * not be construed as granting a license to any other intellectual
> * property including but not limited to intellectual property relating
> * to a hardware implementation of the functionality of the software
> * licensed hereunder. You may use the software subject to the license
> * terms below provided that you ensure that this notice is replicated
> * unmodified and in its entirety in all distributions of the software,
> * modified or unmodified, in source code or in binary form.
> *
31a44
> #include "mem/ruby/common/MachineID.hh"
75a89,97
> const AddrRangeList &ranges = abs_cntrl->getAddrRanges();
> if (!ranges.empty()) {
> MachineID mid = abs_cntrl->getMachineID();
> AddrMapNode addr_map_node = {
> .id = mid.getNum(),
> .ranges = ranges
> };
> addrMap.emplace(mid.getType(), addr_map_node);
> }
174a197,214
>
> NodeID
> Network::addressToNodeID(Addr addr, MachineType mtype)
> {
> // Look through the address maps for entries with matching machine
> // type to get the responsible node for this address.
> const auto &matching_ranges = addrMap.equal_range(mtype);
> for (auto it = matching_ranges.first; it != matching_ranges.second; it++) {
> AddrMapNode &node = it->second;
> auto &ranges = node.ranges;
> for (AddrRange &range: ranges) {
> if (range.contains(addr)) {
> return node.id;
> }
> }
> }
> return MachineType_base_count(mtype);
> }