Skip to content

Commit

Permalink
improved state listing
Browse files Browse the repository at this point in the history
  • Loading branch information
mattulbrich committed Dec 3, 2022
1 parent df808e4 commit 6017337
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/edu/kit/kastel/formal/mimaflux/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;

public class State {

Expand Down Expand Up @@ -106,9 +107,11 @@ public int get(int addr) {
public void printToConsole(Map<String, Integer> labelMap) {
System.out.printf(" IAR = 0x%06x = %8d\t\t(instruction there: %s)%n", iar, iar, toInstruction(mem[iar]));
System.out.printf(" ACCU = 0x%06x = %8d%n", accu, accu);
Optional<Integer> maxLen = labelMap.keySet().stream().map(x -> x.length()).max(Integer::compare);
for (Entry<String, Integer> entry : labelMap.entrySet()) {
int val = entry.getValue();
System.out.printf("Label '%s' at mem[0x%05x] = 0x%06x = %8d = %s%n", entry.getKey(), val, mem[val], mem[val], toInstruction(mem[val]));
System.out.printf("Label '%" + maxLen.get() +
"s' at mem[0x%05x] = 0x%06x = %8d = %s%n", entry.getKey(), val, mem[val], mem[val], toInstruction(mem[val]));
}
if (MimaFlux.mmargs.printRanges != null) {
for (Range range : MimaFlux.mmargs.printRanges) {
Expand Down

0 comments on commit 6017337

Please sign in to comment.