35#include "debug/Decode.hh"
45 ISA *isa =
dynamic_cast<ISA*
>(
p.isa);
66 constexpr size_t max_bit =
sizeof(
machInst) * 8 - 1;
67 constexpr size_t mid_bit =
sizeof(
machInst) * 4 - 1;
70 DPRINTF(Decode,
"Requesting bytes 0x%08x from address %#x\n", inst,
98 emi.instBits =
bits(inst, mid_bit, 0);
103 assert(
bits(
emi.instBits, max_bit, mid_bit + 1) == 0);
109 emi.instBits =
bits(inst, max_bit, mid_bit + 1);
120 DPRINTF(Decode,
"Decoding instruction 0x%08x at address %#x\n",
121 mach_inst.instBits,
addr);
129 DPRINTF(Decode,
"Decode: Decoded %s instruction: %#x\n",
130 si->getName(), mach_inst);
143 if (GEM5_UNLIKELY(next_pc.zcmtSecondFetch())) {
148 next_pc.npc(next_pc.instAddr() +
sizeof(
machInst) / 2);
149 next_pc.compressed(
true);
151 next_pc.npc(next_pc.instAddr() +
sizeof(
machInst));
152 next_pc.compressed(
false);
155 if (GEM5_UNLIKELY(
squashed || next_pc.new_vconf())) {
157 next_pc.new_vconf(
false);
159 vtype = next_pc.vtype();
162 next_pc.vtype(
vtype);
168 emi.rv_type =
static_cast<int>(next_pc.rvType());
InstDecoder(const InstDecoderParams ¶ms, MoreBytesType *mb_buf)
void moreBytes(const PCStateBase &pc, Addr fetchPC) override
Feed data to the decoder.
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr)
Decode a machine instruction.
virtual StaticInstPtr decodeInst(ExtMachInst mach_inst)
Decoder(const RiscvDecoderParams &p)
decode_cache::InstMap< ExtMachInst > instMap
unsigned getVecElemLenInBits()
unsigned getVecLenInBits()
Methods for getting VLEN, VLENB and ELEN values.
void zcmtSecondFetch(bool z)
void rvType(RiscvType rvType)
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
constexpr uint64_t sext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
constexpr void replaceBits(T &val, unsigned first, unsigned last, B bit_val)
A convenience function to replace bits first to last of val with bit_val in place.
constexpr enums::RiscvType RV32
Bitfield< 61 > compressed
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
RefCountingPtr< StaticInst > StaticInstPtr