Allow setting entry point of processor
MODIFY
external/VSRTL
external/VSRTL
-Subproject commit 8106150acdaa1477d0bc69ca6a4e1f79165754bf
+Subproject commit d1a70ecf625c2b1a78d2e68cbf828175b8996dec

MODIFY
src/edittab.cpp
src/edittab.cpp
@@ -151,6 +151,7 @@ bool EditTab::loadFlatBinaryFile(Program& program, QFile& file, uint32_t entryPo
program.text.first = loadAt;
program.text.second = text;
+ program.entryPoint = entryPoint;
m_ui->curInputSrcLabel->setText("Flat binary");
m_ui->inputSrcPath->setText(file.fileName());

MODIFY
src/processorhandler.cpp
src/processorhandler.cpp
@@ -24,6 +24,8 @@ void ProcessorHandler::loadProgram(const Program* p) {
mem.addInitializationMemory(seg.first, seg.second.data(), seg.second.length());
}
+ m_currentProcessor->setPCInitialValue(p->entryPoint);
+
// Set the valid execution range to be contained within the .text segment.
m_validExecutionRange = {p->text.first, p->text.first + p->text.second.length()};

MODIFY
src/processors/ripesprocessor.h
src/processors/ripesprocessor.h
@@ -96,6 +96,12 @@ public:
*/
virtual void setProgramCounter(uint32_t address) = 0;
+ /**
+ * @brief setPCInitialValue
+ * Sets the program counters value upon reset to @param address
+ */
+ virtual void setPCInitialValue(uint32_t address) = 0;
+
void reset() override {
Design::reset();
m_instructionsRetired = 0;

MODIFY
src/processors/ss/riscv_ss.h
src/processors/ss/riscv_ss.h
@@ -154,6 +154,7 @@ public:
pc_reg->forceValue(0, address);
propagateDesign();
}
+ void setPCInitialValue(uint32_t address) override { pc_reg->setInitValue(address); }
SparseArray& getMemory() override { return *m_memory; }
unsigned int getRegister(unsigned i) const override { return registerFile->getRegister(i); }
SparseArray& getRegisters() override { return *m_regMem; }

MODIFY
src/program.h
src/program.h
@@ -23,6 +23,7 @@ struct LoadFileParams {
struct Program {
using Section = std::pair<uint32_t, QByteArray>;
Section text;
+ uint32_t entryPoint = 0;
std::vector<Section> others;
};
} // namespace Ripes

Allow setting entry point of processor