Address.hh revision 11118
16145Snate@binkert.org/* 26239Snate@binkert.org * Copyright (c) 1999 Mark D. Hill and David A. Wood 36239Snate@binkert.org * All rights reserved. 46145Snate@binkert.org * 56239Snate@binkert.org * Redistribution and use in source and binary forms, with or without 66239Snate@binkert.org * modification, are permitted provided that the following conditions are 76239Snate@binkert.org * met: redistributions of source code must retain the above copyright 86239Snate@binkert.org * notice, this list of conditions and the following disclaimer; 96239Snate@binkert.org * redistributions in binary form must reproduce the above copyright 106239Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 116239Snate@binkert.org * documentation and/or other materials provided with the distribution; 126239Snate@binkert.org * neither the name of the copyright holders nor the names of its 136239Snate@binkert.org * contributors may be used to endorse or promote products derived from 146239Snate@binkert.org * this software without specific prior written permission. 156145Snate@binkert.org * 166239Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176239Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186239Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196239Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206239Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216239Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226239Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236239Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246239Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256239Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266239Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276145Snate@binkert.org */ 286145Snate@binkert.org 297039Snate@binkert.org#ifndef __MEM_RUBY_COMMON_ADDRESS_HH__ 307039Snate@binkert.org#define __MEM_RUBY_COMMON_ADDRESS_HH__ 316145Snate@binkert.org 328091Snilay@cs.wisc.edu#include <cassert> 336145Snate@binkert.org#include <iomanip> 348946Sandreas.hansson@arm.com#include <iostream> 357002Snate@binkert.org 367002Snate@binkert.org#include "base/hashmap.hh" 3711025Snilay@cs.wisc.edu#include "base/types.hh" 386145Snate@binkert.org 399362Snilay@cs.wisc.educonst uint32_t ADDRESS_WIDTH = 64; // address width in bytes 406145Snate@binkert.org 4111025Snilay@cs.wisc.edu// selects bits inclusive 4211025Snilay@cs.wisc.eduAddr bitSelect(Addr addr, unsigned int small, unsigned int big); 4311025Snilay@cs.wisc.eduAddr bitRemove(Addr addr, unsigned int small, unsigned int big); 4411025Snilay@cs.wisc.eduAddr maskLowOrderBits(Addr addr, unsigned int number); 4511025Snilay@cs.wisc.eduAddr maskHighOrderBits(Addr addr, unsigned int number); 4611025Snilay@cs.wisc.eduAddr shiftLowOrderBits(Addr addr, unsigned int number); 4711025Snilay@cs.wisc.eduAddr getOffset(Addr addr); 4811025Snilay@cs.wisc.eduAddr makeLineAddress(Addr addr); 4911025Snilay@cs.wisc.eduAddr makeNextStrideAddress(Addr addr, int stride); 5011118Snilay@cs.wisc.edustd::string printAddress(Addr addr); 516145Snate@binkert.org 527039Snate@binkert.org#endif // __MEM_RUBY_COMMON_ADDRESS_HH__ 53