diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-07-01 18:37:54 +0200 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-07-01 18:37:54 +0200 |
commit | b62686b24fbb65d0810475e24aba7a5c4ee3e05e (patch) | |
tree | 1071883f7f678d112126e6c934a4b9af4709619e /qtmips_machine/instruction.h | |
parent | 2db0208ed333e0bf232e396c1789085781f50d66 (diff) | |
download | qtmips-b62686b24fbb65d0810475e24aba7a5c4ee3e05e.tar.gz qtmips-b62686b24fbb65d0810475e24aba7a5c4ee3e05e.tar.bz2 qtmips-b62686b24fbb65d0810475e24aba7a5c4ee3e05e.zip |
Minimal prototype of integrated assembler.
The labels are parsed and stored into symbol table
but expressions dependent on symbols values are not evaluated.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine/instruction.h')
-rw-r--r-- | qtmips_machine/instruction.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/qtmips_machine/instruction.h b/qtmips_machine/instruction.h index f86d10c..f721835 100644 --- a/qtmips_machine/instruction.h +++ b/qtmips_machine/instruction.h @@ -38,6 +38,7 @@ #include <QObject> #include <QString> +#include <QVector> #include "machinedefs.h" @@ -74,6 +75,30 @@ enum InstructionFlags { IMF_STOP_IF = 1L<<23, /**< Stop instruction fetch until instruction processed */ }; +struct RelocExpression { + inline RelocExpression(std::int32_t location, QString expression, std::int64_t offset, std::int64_t min, + std::int64_t max, unsigned lsb_bit, unsigned bits, unsigned shift) { + this->location = location; + this->expression = expression; + this->offset = offset; + this->min = min; + this->max = max; + this->lsb_bit = lsb_bit; + this->bits = bits; + this->shift = shift; + } + std::int32_t location; + QString expression; + std::int64_t offset; + std::int64_t min; + std::int64_t max; + unsigned lsb_bit; + unsigned bits; + unsigned shift; +}; + +typedef QVector<RelocExpression *> RelocExpressionList; + class Instruction { public: Instruction(); @@ -117,7 +142,8 @@ public: QString to_str(std::int32_t inst_addr = 0) const; - static Instruction from_string(QString str, bool *pok = nullptr, std::uint32_t inst_addr = 0); + static Instruction from_string(QString str, bool *pok = nullptr, + std::uint32_t inst_addr = 0, RelocExpressionList *reloc = nullptr); private: std::uint32_t dt; }; |