From 2c293823aa7cb6d2cac4c0ff35e2023ff132a8f2 Mon Sep 17 00:00:00 2001 From: Yasuko Eckert Date: Tue, 15 Oct 2013 14:22:44 -0400 Subject: cpu: add a condition-code register class Add a third register class for condition codes, in parallel with the integer and FP classes. No ISAs use the CC class at this point though. --- src/cpu/simple/base.cc | 13 +++++++++++++ src/cpu/simple/base.hh | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'src/cpu/simple') diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc index 012a49253..078f490e8 100644 --- a/src/cpu/simple/base.cc +++ b/src/cpu/simple/base.cc @@ -1,5 +1,6 @@ /* * Copyright (c) 2010-2012 ARM Limited + * Copyright (c) 2013 Advanced Micro Devices, Inc. * All rights reserved * * The license below extends only to copyright in the software and shall @@ -211,6 +212,18 @@ BaseSimpleCPU::regStats() .desc("number of times the floating registers were written") ; + numCCRegReads + .name(name() + ".num_cc_register_reads") + .desc("number of times the CC registers were read") + .flags(nozero) + ; + + numCCRegWrites + .name(name() + ".num_cc_register_writes") + .desc("number of times the CC registers were written") + .flags(nozero) + ; + numMemRefs .name(name()+".num_mem_refs") .desc("number of memory refs") diff --git a/src/cpu/simple/base.hh b/src/cpu/simple/base.hh index f2e1b278a..8134465af 100644 --- a/src/cpu/simple/base.hh +++ b/src/cpu/simple/base.hh @@ -1,5 +1,6 @@ /* * Copyright (c) 2011-2012 ARM Limited + * Copyright (c) 2013 Advanced Micro Devices, Inc. * All rights reserved * * The license below extends only to copyright in the software and shall @@ -84,6 +85,7 @@ class BaseSimpleCPU : public BaseCPU typedef TheISA::MiscReg MiscReg; typedef TheISA::FloatReg FloatReg; typedef TheISA::FloatRegBits FloatRegBits; + typedef TheISA::CCReg CCReg; protected: Trace::InstRecord *traceData; @@ -231,6 +233,10 @@ class BaseSimpleCPU : public BaseCPU Stats::Scalar numFpRegReads; Stats::Scalar numFpRegWrites; + //number of condition code register file accesses + Stats::Scalar numCCRegReads; + Stats::Scalar numCCRegWrites; + // number of simulated memory references Stats::Scalar numMemRefs; Stats::Scalar numLoadInsts; @@ -307,6 +313,13 @@ class BaseSimpleCPU : public BaseCPU return thread->readFloatRegBits(reg_idx); } + CCReg readCCRegOperand(const StaticInst *si, int idx) + { + numCCRegReads++; + int reg_idx = si->srcRegIdx(idx) - TheISA::CC_Reg_Base; + return thread->readCCReg(reg_idx); + } + void setIntRegOperand(const StaticInst *si, int idx, uint64_t val) { numIntRegWrites++; @@ -328,6 +341,13 @@ class BaseSimpleCPU : public BaseCPU thread->setFloatRegBits(reg_idx, val); } + void setCCRegOperand(const StaticInst *si, int idx, CCReg val) + { + numCCRegWrites++; + int reg_idx = si->destRegIdx(idx) - TheISA::CC_Reg_Base; + thread->setCCReg(reg_idx, val); + } + bool readPredicate() { return thread->readPredicate(); } void setPredicate(bool val) { -- cgit v1.2.3