arch: Add instruction size and PC set methods (#357)
Add the instruction size of a static instruction. x86 and arm decoders add now the instruction size to the macro instruction. However, microops are still handled by the fetch stage which is not nice. Furthermore, we add a set method to the PC state. It allows setting a PC state to acertain address. Both methods are required for the decoupled front-end. Change-Id: I311fe3f637e867c42dee7781f5373ea2e69e2072
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020 ARM Limited
|
||||
* Copyright (c) 2022-2023 The University of Edinburgh
|
||||
* All rights reserved
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
@@ -250,6 +251,11 @@ class StaticInst : public RefCounted, public StaticInstFlags
|
||||
_destRegIdxPtr = dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instruction size in bytes. Necessary for dynamic instruction sizes
|
||||
*/
|
||||
size_t _size = 0;
|
||||
|
||||
/**
|
||||
* Base mnemonic (e.g., "add"). Used by generateDisassembly()
|
||||
* methods. Also useful to readily identify instructions from
|
||||
@@ -307,6 +313,17 @@ class StaticInst : public RefCounted, public StaticInstFlags
|
||||
panic("buildRetPC not defined!");
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
if (_size == 0) fatal(
|
||||
"Instruction size for this instruction not set! It's size is "
|
||||
"required for the decoupled front-end. Either use the standard "
|
||||
"front-end or this ISA needs to be extended with the instruction "
|
||||
"size. Refer to the X86, Arm or RiscV decoders for an example.");
|
||||
return _size;
|
||||
}
|
||||
virtual void size(size_t newSize) { _size = newSize; }
|
||||
|
||||
/**
|
||||
* Return the microop that goes with a particular micropc. This should
|
||||
* only be defined/used in macroops which will contain microops
|
||||
|
||||
Reference in New Issue
Block a user