Address.hh revision 11168:f98eb2da15a4
15347Ssaidi@eecs.umich.edu/* 27534Ssteve.reinhardt@amd.com * Copyright (c) 1999 Mark D. Hill and David A. Wood 33395Shsul@eecs.umich.edu * All rights reserved. 43395Shsul@eecs.umich.edu * 53395Shsul@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 63395Shsul@eecs.umich.edu * modification, are permitted provided that the following conditions are 73395Shsul@eecs.umich.edu * met: redistributions of source code must retain the above copyright 83395Shsul@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 93395Shsul@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 103395Shsul@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 113395Shsul@eecs.umich.edu * documentation and/or other materials provided with the distribution; 123395Shsul@eecs.umich.edu * neither the name of the copyright holders nor the names of its 133395Shsul@eecs.umich.edu * contributors may be used to endorse or promote products derived from 143395Shsul@eecs.umich.edu * this software without specific prior written permission. 153395Shsul@eecs.umich.edu * 163395Shsul@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 173395Shsul@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 183395Shsul@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 193395Shsul@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 203395Shsul@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 213395Shsul@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 223395Shsul@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 233395Shsul@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 243395Shsul@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 253395Shsul@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 263395Shsul@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 273395Shsul@eecs.umich.edu */ 283395Shsul@eecs.umich.edu 293395Shsul@eecs.umich.edu#ifndef __MEM_RUBY_COMMON_ADDRESS_HH__ 303395Shsul@eecs.umich.edu#define __MEM_RUBY_COMMON_ADDRESS_HH__ 313509Shsul@eecs.umich.edu 326654Snate@binkert.org#include <cassert> 333395Shsul@eecs.umich.edu#include <iomanip> 346654Snate@binkert.org#include <iostream> 353395Shsul@eecs.umich.edu 366654Snate@binkert.org#include "base/types.hh" 378724Srdreslin@umich.edu 386654Snate@binkert.orgconst uint32_t ADDRESS_WIDTH = 64; // address width in bytes 396654Snate@binkert.org 403395Shsul@eecs.umich.edu// selects bits inclusive 413481Shsul@eecs.umich.eduAddr bitSelect(Addr addr, unsigned int small, unsigned int big); 423481Shsul@eecs.umich.eduAddr bitRemove(Addr addr, unsigned int small, unsigned int big); 433481Shsul@eecs.umich.eduAddr maskLowOrderBits(Addr addr, unsigned int number); 448649Snilay@cs.wisc.eduAddr maskHighOrderBits(Addr addr, unsigned int number); 455347Ssaidi@eecs.umich.eduAddr shiftLowOrderBits(Addr addr, unsigned int number); 468724Srdreslin@umich.eduAddr getOffset(Addr addr); 478718Snilay@cs.wisc.eduAddr makeLineAddress(Addr addr); 483681Sktlim@umich.eduAddr makeNextStrideAddress(Addr addr, int stride); 493681Sktlim@umich.edustd::string printAddress(Addr addr); 508724Srdreslin@umich.edu 518724Srdreslin@umich.edu#endif // __MEM_RUBY_COMMON_ADDRESS_HH__ 528724Srdreslin@umich.edu