Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 222 - Tool Instruction Counter: Wrong total number of instructions and Wrong SSLI instruction type #223

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rars/riscv/instructions/SLLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ a copy of this software and associated documentation files (the
public class SLLI extends BasicInstruction {
public SLLI() {
super("slli t1,t2,10", "Shift left logical : Set t1 to result of shifting t2 left by number of bits specified by immediate",
BasicInstructionFormat.R_FORMAT, "0000000 ttttt sssss 001 fffff 0010011",false);
BasicInstructionFormat.I_FORMAT, "0000000 ttttt sssss 001 fffff 0010011",false);
}

public void simulate(ProgramStatement statement) {
Expand Down
2 changes: 1 addition & 1 deletion src/rars/tools/InstructionCounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,13 @@ protected void processRISCVUpdate(Observable resource, AccessNotice notice) {
int a = m.getAddress();
if (a == lastAddress) return;
lastAddress = a;
counter++;
try {
ProgramStatement stmt = Memory.getInstance().getStatement(a);

// If the program is finished, getStatement() will return null,
// a null statement will cause the simulator to stall.
if(stmt != null) {
counter++;
BasicInstruction instr = (BasicInstruction) stmt.getInstruction();
BasicInstructionFormat format = instr.getInstructionFormat();
if (format == BasicInstructionFormat.R_FORMAT)
Expand Down