Skip to content

Commit

Permalink
Dev (#15)
Browse files Browse the repository at this point in the history
* MIP-37: update build.gradle

* MIP-37: minor changes
  • Loading branch information
cleverchuk authored Aug 26, 2024
1 parent 3ad94f7 commit 08e8572
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public MipsLexer() {
public static final Map<String, TokenType> RESERVED = new HashMap<String, TokenType>() {{
put("data", TokenType.DATA);
put("text", TokenType.TEXT);
put("ascii", TokenType.ASCII);
put("asciiz", TokenType.ASCIIZ);
put("ascii", TokenType.ASCII);
put("space", TokenType.SPACE_STORAGE);
put("byte", TokenType.BYTE_STORAGE);
put("half", TokenType.HALF_STORAGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class FpuRegisterFileArray {
private final Map<String, RegisterFile> registerFile = new HashMap<>();

public FpuRegisterFileArray() {
MipsLexer.DECI_TO_FPU_REG.forEach((key, value) -> registerFile.put("$" + value, new DefaultRegisterFile(Integer.parseInt(key))));
MipsLexer.DECI_TO_FPU_REG.forEach((key, name) -> registerFile.put("$" + name, createReg(name, Integer.parseInt(key))));
}

public RegisterFile getFile(String reg) {
Expand All @@ -51,6 +51,14 @@ public String regContents() {
return content.toString();
}

private RegisterFile createReg(String name, int id) {
if (name.equals("f0")) {
return new ReadOnlyRegisterFile(new DefaultRegisterFile(id), 0);
}

return new DefaultRegisterFile(id);
}

public static class DefaultRegisterFile implements RegisterFile {
private final byte[] dflops = new byte[8];

Expand Down

0 comments on commit 08e8572

Please sign in to comment.