Skip to content

Commit

Permalink
Fpu (#9)
Browse files Browse the repository at this point in the history
* MIP-79
- make reserved public

* MIP-79
- add support for disabling CoProcessor1

* MIP-79
- add named system service
- add more methods to TerminalInputListener
  • Loading branch information
cleverchuk authored Jun 18, 2023
1 parent 32bc87f commit 2006213
Show file tree
Hide file tree
Showing 14 changed files with 348 additions and 243 deletions.
294 changes: 131 additions & 163 deletions mips/src/androidTest/java/com/cleverchuk/mips/MipsSimulatorTest.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class MipsLexer {
public MipsLexer() {
}

public static final Map<String, TokenType> RESERVED = new HashMap<>() {{
public static final Map<String, TokenType> RESERVED = new HashMap<String, TokenType>() {{
put("data", TokenType.DATA);
put("text", TokenType.TEXT);
put("ascii", TokenType.ASCII);
Expand All @@ -56,7 +56,7 @@ public MipsLexer() {

}};

public static final Map<String, String> DECI_TO_CPU_REG = new HashMap<>() {{
public static final Map<String, String> DECI_TO_CPU_REG = new HashMap<String, String>() {{
put("0", "zero");
put("1", "at");
put("2", "v0");
Expand Down Expand Up @@ -91,7 +91,7 @@ public MipsLexer() {
put("31", "ra");
}};

public static final Map<String, String> DECI_TO_FPU_REG = new HashMap<>() {{
public static final Map<String, String> DECI_TO_FPU_REG = new HashMap<String, String>() {{
put("0", "f0"); //FIR readonly
put("1", "f1");
put("2", "f2");
Expand Down
19 changes: 2 additions & 17 deletions mips/src/main/java/com/cleverchuk/mips/compiler/lexer/Token.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.cleverchuk.mips.compiler.lexer;

import com.cleverchuk.mips.simulator.fpu.DataFormat;

public class Token {
private final TokenType tokenType;

Expand All @@ -13,23 +11,20 @@ public class Token {

private final String code;

private DataFormat format;
public Token(TokenType tokenType, Object value, int line) {
this.tokenType = tokenType;
this.value = value;
this.line = line;
this.pos = -1;
this.code = null;
this.format = null;
}

public Token(TokenType tokenType, Object value, int line, int pos, String code, DataFormat format) {
public Token(TokenType tokenType, Object value, int line, int pos, String code) {
this.tokenType = tokenType;
this.value = value;
this.line = line;
this.pos = pos;
this.code = code;
this.format = format;
}

public TokenType getTokenType() {
Expand All @@ -48,10 +43,6 @@ public int getPos() {
return pos;
}

public DataFormat getFormat() {
return format;
}

public String getCode() {
return code;
}
Expand All @@ -69,7 +60,6 @@ public static class TokenBuilder {

private int pos;

private DataFormat format;

private String code;

Expand All @@ -93,13 +83,8 @@ public TokenBuilder pos(int pos) {
return this;
}

public TokenBuilder format(DataFormat format) {
this.format = format;
return this;
}

public Token build() {
return new Token(tokenType, value, line, pos, code, format);
return new Token(tokenType, value, line, pos, code);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.cleverchuk.mips.dev;

public interface TerminalInputListener {
default void onIntInput(int data) {
}

default void onDoubleInput(double data) {
}

default void onFloatInput(float data) {
}

default void onStringInput(String data) {
}

default void onCharInput(char data) {
}
}
Loading

0 comments on commit 2006213

Please sign in to comment.