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

Tool Instruction Counter: Wrong total number of instructions and Wrong SSLI instruction type #222

Closed
neittien0110 opened this issue Oct 31, 2024 · 2 comments

Comments

@neittien0110
Copy link

Description

  1. The total number of instructions is always 1 more than the actual instructions.
  2. The type of SLLI is R-type, but it should be I-type.
    image

Probability

  • Always

Environment
Using tools Instruction Counter, version 1.0 (Felipe Lessa) on RARS version 1.6

@neittien0110
Copy link
Author

neittien0110 commented Nov 1, 2024

Wrong SSLI instruction type

Wrong total number of instructions

protected void processRISCVUpdate(Observable resource, AccessNotice notice) {
        //...............................................................
        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) {
	            BasicInstruction instr = (BasicInstruction) stmt.getInstruction();
	            BasicInstructionFormat format = instr.getInstructionFormat();
	            if (format == BasicInstructionFormat.R_FORMAT)
	                counterR++;
        //...............................................................
  • Detail: **counter++; ** is always executed before checking stmt !=null
  • Propose: move instruction counter++; to be inside the block if(stmt != null) { }

@neittien0110 neittien0110 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2024
@neittien0110
Copy link
Author

just propose, not fix

neittien0110 added a commit to neittien0110/rars that referenced this issue Nov 1, 2024
SLLI  instruction  should be   I_FORMAT
See also: TheThirdOne#222
neittien0110 added a commit to neittien0110/rars that referenced this issue Nov 1, 2024
Wrong total number of instructions
Detail: **counter++; ** is always executed before checking stmt !=null
Propose: move instruction counter++; to be inside the block if(stmt != null) { }
See also:  TheThirdOne#222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant