Fix bug in AUIPC instructions and displaying
MODIFY
src/assembler.cpp
src/assembler.cpp
@@ -322,7 +322,7 @@ QByteArray Assembler::assembleBranchInstruction(const QStringList& fields, int r
QByteArray Assembler::assembleAuipcInstruction(const QStringList& fields, int row) {
bool canConvert;
- int imm = fields[2].toInt(&canConvert, 10);
+ int imm = getImmediate(fields[2], canConvert) << 12;
if (canConvert) {
// An immediate value as been provided
} else {
@@ -342,7 +342,7 @@ QByteArray Assembler::assembleAuipcInstruction(const QStringList& fields, int ro
QByteArray Assembler::assembleJalrInstruction(const QStringList& fields, int row) {
bool canConvert;
- int imm = fields[3].toInt(&canConvert, 10);
+ int imm = getImmediate(fields[3], canConvert);
if (canConvert) {
// An immediate value as been provided
} else {

MODIFY
src/graphics/pipelinewidget.cpp
src/graphics/pipelinewidget.cpp
@@ -116,7 +116,7 @@ PipelineWidget::PipelineWidget(QWidget* parent) : QGraphicsView(parent) {
<< "");
mux_ALUSrc1->addOutput();
mux_ALUSrc1->setName("M\nu\nx");
- mux_ALUSrc1->setSignal(Graphics::SignalPos::Left, &m_pipelinePtr->s_ALUSrc1);
+ mux_ALUSrc1->setSignal(Graphics::SignalPos::Left, m_pipelinePtr->r_ALUSrc1_IDEX.getOutput());
m_animatedItems.push_back(mux_ALUSrc1);
Graphics::Shape* mux_ALUSrc2 = new Graphics::Shape(Graphics::ShapeType::MUX, Graphics::Stage::EX, 0, 0);
@@ -124,7 +124,7 @@ PipelineWidget::PipelineWidget(QWidget* parent) : QGraphicsView(parent) {
<< "");
mux_ALUSrc2->addOutput();
mux_ALUSrc2->setName("M\nu\nx");
- mux_ALUSrc2->setSignal(Graphics::SignalPos::Left, &m_pipelinePtr->s_ALUSrc2);
+ mux_ALUSrc2->setSignal(Graphics::SignalPos::Left, m_pipelinePtr->r_ALUSrc2_IDEX.getOutput());
m_animatedItems.push_back(mux_ALUSrc2);
Graphics::Shape* mux_alures_PC4_MEM = new Graphics::Shape(Graphics::ShapeType::MUX, Graphics::Stage::EX, 0, 0);

MODIFY
src/parser.cpp
src/parser.cpp
@@ -334,7 +334,7 @@ QString Parser::generateLuiString(uint32_t instr) const {
QString Parser::generateAuipcString(uint32_t instr) const {
std::vector<uint32_t> fields = decodeUInstr(instr);
- return QString("auipc x%1 %2").arg(fields[1]).arg((int32_t)(fields[0] << 12));
+ return QString("auipc x%1 %2").arg(fields[1]).arg((uint32_t)(fields[0]));
}
QString Parser::generateJalString(uint32_t instr) const {

MODIFY
src/syntaxhighlighter.cpp
src/syntaxhighlighter.cpp
@@ -306,6 +306,14 @@ void SyntaxHighlighter::createSyntaxRules() {
rule.inputs = types;
m_syntaxRules.insert(rule.instr, QList<SyntaxRule>() << rule);
+ // auipc
+ types.clear();
+ types << FieldType(Type::Register) << FieldType(Type::Immediate, 0, 1048575);
+ rule.instr = "auipc";
+ rule.fields = 3;
+ rule.inputs = types;
+ m_syntaxRules.insert(rule.instr, QList<SyntaxRule>() << rule);
+
// 2-register pseudoinstructions
types.clear();
names.clear();

Fix bug in AUIPC instructions and displaying