113223Sodanrc@yahoo.com.br/* 213223Sodanrc@yahoo.com.br * Copyright (c) 2012-2013 ARM Limited 313223Sodanrc@yahoo.com.br * All rights reserved 413223Sodanrc@yahoo.com.br * 513223Sodanrc@yahoo.com.br * The license below extends only to copyright in the software and shall 613223Sodanrc@yahoo.com.br * not be construed as granting a license to any other intellectual 713223Sodanrc@yahoo.com.br * property including but not limited to intellectual property relating 813223Sodanrc@yahoo.com.br * to a hardware implementation of the functionality of the software 913223Sodanrc@yahoo.com.br * licensed hereunder. You may use the software subject to the license 1013223Sodanrc@yahoo.com.br * terms below provided that you ensure that this notice is replicated 1113223Sodanrc@yahoo.com.br * unmodified and in its entirety in all distributions of the software, 1213223Sodanrc@yahoo.com.br * modified or unmodified, in source code or in binary form. 1313223Sodanrc@yahoo.com.br * 1413223Sodanrc@yahoo.com.br * Copyright (c) 2007 The Regents of The University of Michigan 1513223Sodanrc@yahoo.com.br * All rights reserved. 1613223Sodanrc@yahoo.com.br * 1713223Sodanrc@yahoo.com.br * Redistribution and use in source and binary forms, with or without 1813223Sodanrc@yahoo.com.br * modification, are permitted provided that the following conditions are 1913223Sodanrc@yahoo.com.br * met: redistributions of source code must retain the above copyright 2013223Sodanrc@yahoo.com.br * notice, this list of conditions and the following disclaimer; 2113223Sodanrc@yahoo.com.br * redistributions in binary form must reproduce the above copyright 2213223Sodanrc@yahoo.com.br * notice, this list of conditions and the following disclaimer in the 2313223Sodanrc@yahoo.com.br * documentation and/or other materials provided with the distribution; 2413223Sodanrc@yahoo.com.br * neither the name of the copyright holders nor the names of its 2513223Sodanrc@yahoo.com.br * contributors may be used to endorse or promote products derived from 2613223Sodanrc@yahoo.com.br * this software without specific prior written permission. 2713223Sodanrc@yahoo.com.br * 2813223Sodanrc@yahoo.com.br * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2913223Sodanrc@yahoo.com.br * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3013223Sodanrc@yahoo.com.br * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3113223Sodanrc@yahoo.com.br * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3213223Sodanrc@yahoo.com.br * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3313223Sodanrc@yahoo.com.br * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3413223Sodanrc@yahoo.com.br * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3513223Sodanrc@yahoo.com.br * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3613223Sodanrc@yahoo.com.br * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3713223Sodanrc@yahoo.com.br * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3813223Sodanrc@yahoo.com.br * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3913223Sodanrc@yahoo.com.br */ 4013223Sodanrc@yahoo.com.br 4113223Sodanrc@yahoo.com.br#include "mem/cache/cache_blk.hh" 4213223Sodanrc@yahoo.com.br 4313223Sodanrc@yahoo.com.br#include "base/cprintf.hh" 4413223Sodanrc@yahoo.com.br 4513223Sodanrc@yahoo.com.brvoid 4613223Sodanrc@yahoo.com.brCacheBlk::insert(const Addr tag, const bool is_secure, 4713223Sodanrc@yahoo.com.br const int src_master_ID, const uint32_t task_ID) 4813223Sodanrc@yahoo.com.br{ 4913445Sodanrc@yahoo.com.br // Make sure that the block has been properly invalidated 5013445Sodanrc@yahoo.com.br assert(status == 0); 5113445Sodanrc@yahoo.com.br 5213223Sodanrc@yahoo.com.br // Set block tag 5313223Sodanrc@yahoo.com.br this->tag = tag; 5413223Sodanrc@yahoo.com.br 5513223Sodanrc@yahoo.com.br // Set source requestor ID 5613223Sodanrc@yahoo.com.br srcMasterId = src_master_ID; 5713223Sodanrc@yahoo.com.br 5813223Sodanrc@yahoo.com.br // Set task ID 5913223Sodanrc@yahoo.com.br task_id = task_ID; 6013223Sodanrc@yahoo.com.br 6113223Sodanrc@yahoo.com.br // Set insertion tick as current tick 6213223Sodanrc@yahoo.com.br tickInserted = curTick(); 6313223Sodanrc@yahoo.com.br 6413223Sodanrc@yahoo.com.br // Insertion counts as a reference to the block 6513223Sodanrc@yahoo.com.br refCount = 1; 6613223Sodanrc@yahoo.com.br 6713223Sodanrc@yahoo.com.br // Set secure state 6813223Sodanrc@yahoo.com.br if (is_secure) { 6913445Sodanrc@yahoo.com.br setSecure(); 7013223Sodanrc@yahoo.com.br } 7113445Sodanrc@yahoo.com.br 7213445Sodanrc@yahoo.com.br // Validate block 7313445Sodanrc@yahoo.com.br setValid(); 7413223Sodanrc@yahoo.com.br} 7513223Sodanrc@yahoo.com.br 7613223Sodanrc@yahoo.com.brvoid 7713223Sodanrc@yahoo.com.brCacheBlkPrintWrapper::print(std::ostream &os, int verbosity, 7813223Sodanrc@yahoo.com.br const std::string &prefix) const 7913223Sodanrc@yahoo.com.br{ 8013223Sodanrc@yahoo.com.br ccprintf(os, "%sblk %c%c%c%c\n", prefix, 8113223Sodanrc@yahoo.com.br blk->isValid() ? 'V' : '-', 8213223Sodanrc@yahoo.com.br blk->isWritable() ? 'E' : '-', 8313223Sodanrc@yahoo.com.br blk->isDirty() ? 'M' : '-', 8413223Sodanrc@yahoo.com.br blk->isSecure() ? 'S' : '-'); 8513223Sodanrc@yahoo.com.br} 8613223Sodanrc@yahoo.com.br 87