Skip to content

Commit

Permalink
Consider DIV a valid state after RAW (#316)
Browse files Browse the repository at this point in the history
Also fix a unit test that didn't fail as it should have and improve the
logging of this issue.
  • Loading branch information
lupino3 committed Apr 13, 2020
1 parent 65424f4 commit 39b2f3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/main/java/org/edumips64/utils/CycleElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ void addState(String newState) {

if (!validateStateTransition(lastState, newState)) {
hasInvalidTransaction = true;
logger.severe("Instruction: " + instruction + ", startTime: " + startTime);
logger.severe("State " + newState + " is not allowed after state " + lastState);
logger.severe("Instruction " + instruction + ", startTime: " + startTime + ". State " + newState + " is not allowed after state " + lastState);
}

states.add(newState);
Expand Down Expand Up @@ -142,7 +141,7 @@ public boolean shouldRender() {
allowedTransitions = new HashMap<>();
allowedTransitions.put("IF", new HashSet<>(Arrays.asList("ID", " ")));
allowedTransitions.put("ID", new HashSet<>(Arrays.asList("ID", "EX", "RAW", "WAW", "DIV", "StDiv", "StEx", "StFun", "A1", "M1")));
allowedTransitions.put("RAW", new HashSet<>(Arrays.asList("RAW", "WAW", "EX", "M1", "A1")));
allowedTransitions.put("RAW", new HashSet<>(Arrays.asList("RAW", "WAW", "EX", "M1", "A1", "DIV")));
allowedTransitions.put("WAW", new HashSet<>(Arrays.asList("WAW", "EX", "M1", "A1")));

allowedTransitions.put("EX", new HashSet<>(Arrays.asList("MEM", "Str")));
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/edumips64/EndToEndTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ public void testSubtraction() throws Exception {

@Test(timeout=2000)
public void testDivision() throws Exception {
runMipsTest("div.d.s");
runMipsTestWithAndWithoutForwarding("div.d.s");
}

@Test(timeout=2000)
Expand Down

0 comments on commit 39b2f3d

Please sign in to comment.