namespace AlphaISA
{
+class ISA;
class Decoder
{
protected:
bool instDone;
public:
- Decoder() : instDone(false)
+ Decoder(ISA* isa = nullptr) : instDone(false)
{}
void
-# Copyright (c) 2012-2013 ARM Limited
+# Copyright (c) 2012-2013, 2015 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
from ArmPMU import ArmPMU
+# Enum for DecoderFlavour
+class DecoderFlavour(Enum): vals = ['Generic']
+
class ArmISA(SimObject):
type = 'ArmISA'
cxx_class = 'ArmISA::ISA'
system = Param.System(Parent.any, "System this ISA object belongs to")
pmu = Param.ArmPMU(NULL, "Performance Monitoring Unit")
+ decoderFlavour = Param.DecoderFlavour('Generic', "Decoder flavour specification")
midr = Param.UInt32(0x410fc0f0, "MIDR value")
*/
#include "arch/arm/decoder.hh"
+
+#include "arch/arm/isa.hh"
#include "arch/arm/isa_traits.hh"
#include "arch/arm/utility.hh"
#include "base/trace.hh"
GenericISA::BasicDecodeCache Decoder::defaultCache;
-Decoder::Decoder()
- : data(0), fpscrLen(0), fpscrStride(0)
+Decoder::Decoder(ISA* isa)
+ : data(0), fpscrLen(0), fpscrStride(0), decoderFlavour(isa
+ ? isa->decoderFlavour()
+ : Enums::Generic)
{
reset();
}
#include "arch/generic/decode_cache.hh"
#include "base/types.hh"
#include "cpu/static_inst.hh"
+#include "enums/DecoderFlavour.hh"
namespace ArmISA
{
+class ISA;
class Decoder
{
protected:
int fpscrLen;
int fpscrStride;
+ Enums::DecoderFlavour decoderFlavour;
+
/// A cache of decoded instruction objects.
static GenericISA::BasicDecodeCache defaultCache;
void consumeBytes(int numBytes);
public: // Decoder API
- Decoder();
+ Decoder(ISA* isa = nullptr);
/** Reset the decoders internal state. */
void reset();
ISA::ISA(Params *p)
: SimObject(p),
system(NULL),
+ _decoderFlavour(p->decoderFlavour),
pmu(p->pmu),
lookUpMiscReg(NUM_MISCREGS, {0,0})
{
#include "arch/arm/types.hh"
#include "debug/Checkpoint.hh"
#include "sim/sim_object.hh"
+#include "enums/DecoderFlavour.hh"
struct ArmISAParams;
struct DummyArmISADeviceParams;
// Parent system
ArmSystem *system;
+ // Micro Architecture
+ const Enums::DecoderFlavour _decoderFlavour;
+
/** Dummy device for to handle non-existing ISA devices */
DummyISADevice dummyDevice;
void startup(ThreadContext *tc) {}
+ Enums::DecoderFlavour decoderFlavour() const { return _decoderFlavour; }
+
/// Explicitly import the otherwise hidden startup
using SimObject::startup;
-// Copyright (c) 2011-2014 ARM Limited
+// Copyright (c) 2011-2015 ARM Limited
// All rights reserved
//
// The license below extends only to copyright in the software and shall
StaticInstPtr decodeLoadsStores(ExtMachInst machInst);
StaticInstPtr decodeDataProcReg(ExtMachInst machInst);
+ template <typename DecoderFeatures>
StaticInstPtr decodeFpAdvSIMD(ExtMachInst machInst);
StaticInstPtr decodeFp(ExtMachInst machInst);
+ template <typename DecoderFeatures>
StaticInstPtr decodeAdvSIMD(ExtMachInst machInst);
StaticInstPtr decodeAdvSIMDScalar(ExtMachInst machInst);
output decoder {{
namespace Aarch64
{
+ template <typename DecoderFeatures>
StaticInstPtr
decodeAdvSIMD(ExtMachInst machInst)
{
if (bits(machInst, 24) == 1) {
if (bits(machInst, 10) == 0) {
- return decodeNeonIndexedElem(machInst);
+ return decodeNeonIndexedElem<DecoderFeatures>(machInst);
} else if (bits(machInst, 23) == 1) {
return new Unknown64(machInst);
} else {
}
} else if (bits(machInst, 21) == 1) {
if (bits(machInst, 10) == 1) {
- return decodeNeon3Same(machInst);
+ return decodeNeon3Same<DecoderFeatures>(machInst);
} else if (bits(machInst, 11) == 0) {
return decodeNeon3Diff(machInst);
} else if (bits(machInst, 20, 17) == 0x0) {
output decoder {{
namespace Aarch64
{
+ template <typename DecoderFeatures>
StaticInstPtr
decodeFpAdvSIMD(ExtMachInst machInst)
{
if (bits(machInst, 28) == 0) {
if (bits(machInst, 31) == 0) {
- return decodeAdvSIMD(machInst);
+ return decodeAdvSIMD<DecoderFeatures>(machInst);
} else {
return new Unknown64(machInst);
}
}
}};
+let {{
+ decoder_output ='''
+namespace Aarch64
+{'''
+ for decoderFlavour, type_dict in decoders.iteritems():
+ decoder_output +='''
+template StaticInstPtr decodeFpAdvSIMD<%(df)sDecoder>(ExtMachInst machInst);
+''' % { "df" : decoderFlavour }
+ decoder_output +='''
+}'''
+}};
+
output decoder {{
namespace Aarch64
{
return decodeGem5Ops(machInst);
} else {
// bit 27:25=111
- return decodeFpAdvSIMD(machInst);
+ switch(decoderFlavour){
+ default:
+ return decodeFpAdvSIMD<GenericDecoder>(machInst);
+ }
}
}
'''
namespace Aarch64
{
// AdvSIMD three same
+ template <typename DecoderFeatures>
StaticInstPtr decodeNeon3Same(ExtMachInst machInst);
// AdvSIMD three different
- StaticInstPtr decodeNeon3Diff(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeon3Diff(ExtMachInst machInst);
// AdvSIMD two-reg misc
- StaticInstPtr decodeNeon2RegMisc(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeon2RegMisc(ExtMachInst machInst);
// AdvSIMD across lanes
- StaticInstPtr decodeNeonAcrossLanes(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonAcrossLanes(ExtMachInst machInst);
// AdvSIMD copy
- StaticInstPtr decodeNeonCopy(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonCopy(ExtMachInst machInst);
// AdvSIMD vector x indexed element
+ template <typename DecoderFeatures>
StaticInstPtr decodeNeonIndexedElem(ExtMachInst machInst);
// AdvSIMD modified immediate
- StaticInstPtr decodeNeonModImm(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonModImm(ExtMachInst machInst);
// AdvSIMD shift by immediate
- StaticInstPtr decodeNeonShiftByImm(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonShiftByImm(ExtMachInst machInst);
// AdvSIMD TBL/TBX
- StaticInstPtr decodeNeonTblTbx(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonTblTbx(ExtMachInst machInst);
// AdvSIMD ZIP/UZP/TRN
- StaticInstPtr decodeNeonZipUzpTrn(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonZipUzpTrn(ExtMachInst machInst);
// AdvSIMD EXT
- StaticInstPtr decodeNeonExt(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonExt(ExtMachInst machInst);
// AdvSIMD scalar three same
- StaticInstPtr decodeNeonSc3Same(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonSc3Same(ExtMachInst machInst);
// AdvSIMD scalar three different
- StaticInstPtr decodeNeonSc3Diff(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonSc3Diff(ExtMachInst machInst);
// AdvSIMD scalar two-reg misc
- StaticInstPtr decodeNeonSc2RegMisc(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonSc2RegMisc(ExtMachInst machInst);
// AdvSIMD scalar pairwise
- StaticInstPtr decodeNeonScPwise(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonScPwise(ExtMachInst machInst);
// AdvSIMD scalar copy
- StaticInstPtr decodeNeonScCopy(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonScCopy(ExtMachInst machInst);
// AdvSIMD scalar x indexed element
- StaticInstPtr decodeNeonScIndexedElem(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonScIndexedElem(ExtMachInst machInst);
// AdvSIMD scalar shift by immediate
- StaticInstPtr decodeNeonScShiftByImm(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonScShiftByImm(ExtMachInst machInst);
// AdvSIMD load/store
- StaticInstPtr decodeNeonMem(ExtMachInst machInst);
+ inline StaticInstPtr decodeNeonMem(ExtMachInst machInst);
}
}};
output decoder {{
namespace Aarch64
{
+ template <typename DecoderFeatures>
StaticInstPtr
decodeNeon3Same(ExtMachInst machInst)
{
}
}
+ template <typename DecoderFeatures>
StaticInstPtr
decodeNeonIndexedElem(ExtMachInst machInst)
{
#include "arch/arm/isa_traits.hh"
#include "mem/packet.hh"
#include "sim/faults.hh"
+#include "enums/DecoderFlavour.hh"
}};
output decoder {{
// -*- mode: c++ -*-
-// Copyright (c) 2012-2013 ARM Limited
+// Copyright (c) 2012-2013, 2015 ARM Limited
// All rights reserved
//
// The license below extends only to copyright in the software and shall
header_output = ""
exec_output = ""
+ decoders = { 'Generic' : {} }
# FP types (FP operations always work with unsigned representations)
floatTypes = ("uint32_t", "uint64_t")
def threeEqualRegInstX(name, Name, opClass, types, rCount, op,
readDest=False, pairwise=False, scalar=False,
- byElem=False):
+ byElem=False, decoder='Generic'):
assert (not pairwise) or ((not byElem) and (not scalar))
- global header_output, exec_output
+ global header_output, exec_output, decoders
eWalkCode = simd64EnabledCheckCode + '''
RegVect srcReg1, destReg;
'''
threeRegScrambleInstX("zip2", "Zip2QX", "SimdAluOp", unsignedTypes, 4,
zipCode % "eCount / 2")
+ for decoderFlavour, type_dict in decoders.iteritems():
+ header_output += '''
+ class %(decoder_flavour)sDecoder {
+ public:
+ ''' % { "decoder_flavour" : decoderFlavour }
+ for type,name in type_dict.iteritems():
+ header_output += '''
+ template<typename Elem> using %(type)s = %(new_name)s<Elem>;''' % {
+ "type" : type, "new_name" : name
+ }
+ header_output += '''
+ };'''
}};
namespace MipsISA
{
+class ISA;
class Decoder
{
protected:
bool instDone;
public:
- Decoder() : instDone(false)
+ Decoder(ISA* isa = nullptr) : instDone(false)
{}
void
namespace PowerISA
{
+class ISA;
class Decoder
{
protected:
bool instDone;
public:
- Decoder() : instDone(false)
+ Decoder(ISA* isa = nullptr) : instDone(false)
{
}
namespace SparcISA
{
+class ISA;
class Decoder
{
protected:
MiscReg asi;
public:
- Decoder() : instDone(false), asi(0)
+ Decoder(ISA* isa = nullptr) : instDone(false), asi(0)
{}
void process() {}
namespace X86ISA
{
+class ISA;
class Decoder
{
private:
static InstCacheMap instCacheMap;
public:
- Decoder() : basePC(0), origPC(0), offset(0),
+ Decoder(ISA* isa = nullptr) : basePC(0), origPC(0), offset(0),
outOfBytes(true), instDone(false),
state(ResetState)
{
#include "sim/eventq.hh"
#include "sim/full_system.hh"
#include "sim/system.hh"
+#include "cpu/o3/isa_specific.hh"
using namespace std;
branchPred = params->branchPred;
for (ThreadID tid = 0; tid < numThreads; tid++) {
- decoder[tid] = new TheISA::Decoder;
+ decoder[tid] = new TheISA::Decoder(params->isa[tid]);
// Create space to buffer the cache line data,
// which may not hold the entire cache line.
fetchBuffer[tid] = new uint8_t[fetchBufferSize];