Skip to content

Commit ac339c7

Browse files
committed
Refactor the mars package to rars
Additionally, remove many references in the code to mars.
1 parent 0050727 commit ac339c7

File tree

273 files changed

+1337
-1344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

273 files changed

+1337
-1344
lines changed

MARSlicense.txt License.txt

File renamed without changes.

Mars.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ a copy of this software and associated documentation files (the
2626
(MIT license, http://www.opensource.org/licenses/mit-license.html)
2727
*/
2828

29+
import rars.Launch;
30+
2931
/**
3032
* Portal to Mars
3133
*
@@ -35,7 +37,7 @@ a copy of this software and associated documentation files (the
3537

3638
public class Mars {
3739
public static void main(String[] args) {
38-
new mars.MarsLaunch(args);
40+
new Launch(args);
3941
}
4042
}
4143

help/ExceptionsHelp.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h3>Introduction</h3>
5555
state to before the exception, so jumping to the value in uepc instead is not recommended</li>
5656
<li> <i>ucause</i> contains the reason that the exception handler was called.
5757
</li>
58-
<li>Exception types declared in <tt>mars.SimulatorException</tt>, but
58+
<li>Exception types declared in <tt>rars.SimulatorException</tt>, but
5959
not necessarily implemented, are INSTRUCTION_ADDR_MISALIGNED (0),
6060
INSTRUCTION_ACCESS_FAULT (1), ILLEGAL_INSTRUCTION(2),
6161
LOAD_ADDRESS_MISALIGNED(4), LOAD_ACCESS_FAULT(5),

help/Tools.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ <h4>Cool Capability: Plug-in Tools</h4>
1313
program and system resources.
1414
The requirements for such a program are:
1515
<ol>
16-
<li>It implements the <tt>mars.tools.MarsTool</tt> interface.
17-
<li>It is part of the <tt>mars.tools</tt> package.
18-
<li>It compiles cleanly into a ".class" file, stored in the <tt>mars/tools</tt> directory.
16+
<li>It implements the <tt>rars.tools.Tool</tt> interface.
17+
<li>It is part of the <tt>rars.tools</tt> package.
18+
<li>It compiles cleanly into a ".class" file, stored in the <tt>rars/tools</tt> directory.
1919
</ol>
2020

2121
RARS will detect all qualifying tools upon startup and include them in
@@ -30,7 +30,7 @@ <h4>Cool Capability: Plug-in Tools</h4>
3030
need to be "connected" to the program by clicking a button or will already be connected. Run
3131
the program as you normally would, to initiate tool interaction with the executing program.
3232

33-
<p>The abstract class <tt>mars.tools.AbstractMarsToolAndApplication</tt>
33+
<p>The abstract class <tt>rars.tools.AbstractToolAndApplication</tt>
3434
is included in the RARS distribution to provide
3535
a substantial framework for implementing your own Tool. A subclass that extends it by
3636
implementing at least its two abstract methods can be run not only from the Tools menu but also
@@ -48,10 +48,10 @@ <h4>Adding more system calls</h4>
4848
a technique similar to that for tools. This permits anyone to add a new syscall by defining
4949
a new class that meets these requirements:
5050
<li>
51-
<li>It extends the <tt>mars.riscv.AbstractSyscall</tt> class.</li>
52-
<li>It is part of the <tt>mars.riscv.syscalls</tt> package.</li>
51+
<li>It extends the <tt>rars.riscv.AbstractSyscall</tt> class.</li>
52+
<li>It is part of the <tt>rars.riscv.syscalls</tt> package.</li>
5353
<li>It compiles cleanly into a ".class" file, stored in the
54-
<tt>mars/riscv/syscalls</tt> directory.</li>
54+
<tt>rars/riscv/syscalls</tt> directory.</li>
5555
<li>An entry is added to Syscall.properties</li>
5656
</ol>
5757

mars/AssemblyException.java rars/AssemblyException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mars;
1+
package rars;
22

33
/*
44
Copyright (c) 2017, Benjamin Landers

mars/BreakpointException.java rars/BreakpointException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mars;
1+
package rars;
22

33
/**
44
* This exception is only used to trigger breakpoints for ebreak.

mars/ErrorList.java rars/ErrorList.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mars;
1+
package rars;
22

33
import java.util.ArrayList;
44
/*

mars/ErrorMessage.java rars/ErrorMessage.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mars;
1+
package rars;
22

33
import java.io.File;
44
import java.util.ArrayList;
@@ -95,7 +95,7 @@ public ErrorMessage(boolean isWarning, RISCVprogram sourceProgram, int line, int
9595
this.filename = sourceProgram.getFilename();
9696
this.line = line;
9797
} else {
98-
mars.assembler.SourceLine sourceLine = sourceProgram.getSourceLineList().get(line - 1);
98+
rars.assembler.SourceLine sourceLine = sourceProgram.getSourceLineList().get(line - 1);
9999
this.filename = sourceLine.getFilename();
100100
this.line = sourceLine.getLineNumber();
101101
}

mars/ExitingException.java rars/ExitingException.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package mars;
1+
package rars;
22

3-
import mars.riscv.hardware.AddressErrorException;
3+
import rars.riscv.hardware.AddressErrorException;
44

55
/**
66
* Exceptions that cannot be handled and must result in the ending of the simulation

mars/Globals.java rars/Globals.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package mars;
1+
package rars;
22

3-
import mars.assembler.SymbolTable;
4-
import mars.riscv.hardware.Memory;
5-
import mars.riscv.InstructionSet;
6-
import mars.riscv.SyscallNumberOverride;
7-
import mars.util.PropertiesFile;
8-
import mars.venus.VenusUI;
3+
import rars.assembler.SymbolTable;
4+
import rars.riscv.hardware.Memory;
5+
import rars.riscv.InstructionSet;
6+
import rars.riscv.SyscallNumberOverride;
7+
import rars.util.PropertiesFile;
8+
import rars.venus.VenusUI;
99

1010
import java.util.ArrayList;
1111
import java.util.Enumeration;
@@ -97,7 +97,7 @@ public class Globals {
9797
/* The GUI being used (if any) with this simulator. */
9898
static VenusUI gui = null;
9999
/**
100-
* The current MARS version number. Can't wait for "initialize()" call to get it.
100+
* The current version number. Can't wait for "initialize()" call to get it.
101101
*/
102102
public static final String version = "1.0";
103103
/**
@@ -117,11 +117,11 @@ public class Globals {
117117
*/
118118
public static final int maximumBacksteps = getBackstepLimit();
119119
/**
120-
* MARS copyright years
120+
* Copyright years
121121
*/
122122
public static final String copyrightYears = getCopyrightYears();
123123
/**
124-
* MARS copyright holders
124+
* Copyright holders
125125
*/
126126
public static final String copyrightHolders = getCopyrightHolders();
127127
/**
@@ -133,7 +133,7 @@ public class Globals {
133133
*/
134134
public static final String[] ASCII_TABLE = getAsciiStrings();
135135
/**
136-
* MARS exit code -- useful with SYSCALL 17 when running from command line (not GUI)
136+
* Exit code -- useful with SYSCALL 17 when running from command line (not GUI)
137137
*/
138138
public static int exitCode = 0;
139139

mars/MarsLaunch.java rars/Launch.java

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package mars;
2-
3-
import mars.riscv.dump.DumpFormat;
4-
import mars.riscv.dump.DumpFormatLoader;
5-
import mars.riscv.hardware.*;
6-
import mars.simulator.ProgramArgumentList;
7-
import mars.simulator.Simulator;
8-
import mars.util.Binary;
9-
import mars.util.FilenameFinder;
10-
import mars.util.MemoryDump;
11-
import mars.venus.VenusUI;
1+
package rars;
2+
3+
import rars.riscv.dump.DumpFormat;
4+
import rars.riscv.dump.DumpFormatLoader;
5+
import rars.riscv.hardware.*;
6+
import rars.simulator.ProgramArgumentList;
7+
import rars.simulator.Simulator;
8+
import rars.util.Binary;
9+
import rars.util.FilenameFinder;
10+
import rars.util.MemoryDump;
11+
import rars.venus.VenusUI;
1212

1313
import javax.swing.*;
1414
import java.io.File;
@@ -49,17 +49,17 @@ a copy of this software and associated documentation files (the
4949
*/
5050

5151
/**
52-
* Launch the Mars application
52+
* Launch the application
5353
*
5454
* @author Pete Sanderson
5555
* @version December 2009
5656
**/
5757

58-
public class MarsLaunch {
58+
public class Launch {
5959

6060
/**
6161
* Main takes a number of command line arguments.<br>
62-
* Usage: Mars [options] filename<br>
62+
* Usage: rars [options] filename<br>
6363
* Valid options (not case sensitive, separate by spaces) are:<br>
6464
* a -- assemble only, do not simulate<br>
6565
* ad -- both a and d<br>
@@ -133,7 +133,7 @@ public class MarsLaunch {
133133
private int assembleErrorExitCode; // RARS command exit code to return if assemble error occurs
134134
private int simulateErrorExitCode;// RARS command exit code to return if simulation error occurs
135135

136-
public MarsLaunch(String[] args) {
136+
public Launch(String[] args) {
137137
boolean gui = (args.length == 0);
138138
Globals.initialize(gui);
139139
if (gui) {
@@ -232,7 +232,7 @@ private void dumpSegments() {
232232

233233
private void launchIDE() {
234234
// System.setProperty("apple.laf.useScreenMenuBar", "true"); // Puts RARS menu on Mac OS menu bar
235-
new MarsSplashScreen(splashDuration).showSplash();
235+
new SplashScreen(splashDuration).showSplash();
236236
SwingUtilities.invokeLater(
237237
new Runnable() {
238238
public void run() {
@@ -438,7 +438,7 @@ private boolean parseCommandArgs(String[] args) {
438438

439439

440440
//////////////////////////////////////////////////////////////////////
441-
// Carry out the mars command: assemble then optionally run
441+
// Carry out the rars command: assemble then optionally run
442442
// Returns false if no simulation (run) occurs, true otherwise.
443443

444444
private void runCommand() {
@@ -584,7 +584,7 @@ public void update(Observable o, Object obj) {
584584
try {
585585
Globals.memory.addObserver(instructionCounter, Memory.textBaseAddress, Memory.textLimitAddress);
586586
} catch (AddressErrorException aee) {
587-
out.println("Internal error: MarsLaunch uses incorrect text segment address for instruction observer");
587+
out.println("Internal error: Launch uses incorrect text segment address for instruction observer");
588588
}
589589
}
590590
}

mars/ProgramStatement.java rars/ProgramStatement.java

+21-20
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
package mars;
2-
3-
import mars.assembler.SymbolTable;
4-
import mars.assembler.Token;
5-
import mars.assembler.TokenList;
6-
import mars.assembler.TokenTypes;
7-
import mars.riscv.hardware.FloatingPointRegisterFile;
8-
import mars.riscv.hardware.RegisterFile;
9-
import mars.riscv.BasicInstruction;
10-
import mars.riscv.BasicInstructionFormat;
11-
import mars.riscv.Instruction;
12-
import mars.util.Binary;
1+
package rars;
2+
3+
import rars.assembler.SymbolTable;
4+
import rars.assembler.Token;
5+
import rars.assembler.TokenList;
6+
import rars.assembler.TokenTypes;
7+
import rars.riscv.hardware.FloatingPointRegisterFile;
8+
import rars.riscv.hardware.RegisterFile;
9+
import rars.riscv.BasicInstruction;
10+
import rars.riscv.BasicInstructionFormat;
11+
import rars.riscv.Instruction;
12+
import rars.util.Binary;
13+
import rars.venus.NumberDisplayBaseChooser;
1314

1415
import java.util.ArrayList;
1516

@@ -232,7 +233,7 @@ public void buildBasicStatementFromBasicInstruction(ErrorList errors) {
232233
address = (address - this.textAddress) >> 1;
233234
if (address >= (1 << 19) || address < -(1 << 19)) {
234235
// attempt to jump beyond 21-bit byte (20-bit word) address range.
235-
// SPIM flags as warning, I'll flag as error b/c MARS text segment not long enough for it to be OK.
236+
// SPIM flags as warning, I'll flag as error b/c RARS text segment not long enough for it to be OK.
236237
errors.add(new ErrorMessage(this.sourceProgram, this.sourceLine, 0,
237238
"Jump target word address beyond 20-bit range"));
238239
return;
@@ -274,7 +275,7 @@ public void buildBasicStatementFromBasicInstruction(ErrorList errors) {
274275
* pseudo-instructions.
275276
*
276277
* This modification also appears inbuildBasicStatementFromBasicInstruction()
277-
* in mars.ProgramStatement.
278+
* in rars.ProgramStatement.
278279
*
279280
* ///// Begin modification 1/4/05 KENV ///////////////////////////////////////////
280281
* // We have decided to interpret non-signed (no + or -) 16-bit hexadecimal immediate
@@ -774,8 +775,8 @@ void addValue(int value) {
774775
}
775776

776777
public String toString() {
777-
int addressBase = (Globals.getSettings().getBooleanSetting(Settings.Bool.DISPLAY_ADDRESSES_IN_HEX)) ? mars.venus.NumberDisplayBaseChooser.HEXADECIMAL : mars.venus.NumberDisplayBaseChooser.DECIMAL;
778-
int valueBase = (Globals.getSettings().getBooleanSetting(Settings.Bool.DISPLAY_VALUES_IN_HEX)) ? mars.venus.NumberDisplayBaseChooser.HEXADECIMAL : mars.venus.NumberDisplayBaseChooser.DECIMAL;
778+
int addressBase = (Globals.getSettings().getBooleanSetting(Settings.Bool.DISPLAY_ADDRESSES_IN_HEX)) ? NumberDisplayBaseChooser.HEXADECIMAL : NumberDisplayBaseChooser.DECIMAL;
779+
int valueBase = (Globals.getSettings().getBooleanSetting(Settings.Bool.DISPLAY_VALUES_IN_HEX)) ? NumberDisplayBaseChooser.HEXADECIMAL : NumberDisplayBaseChooser.DECIMAL;
779780

780781
StringBuffer result = new StringBuffer();
781782
for (ListElement e : list) {
@@ -784,13 +785,13 @@ public String toString() {
784785
result.append(e.sValue);
785786
break;
786787
case 1:
787-
result.append(mars.venus.NumberDisplayBaseChooser.formatNumber(e.iValue, addressBase));
788+
result.append(NumberDisplayBaseChooser.formatNumber(e.iValue, addressBase));
788789
break;
789790
case 2:
790-
if (valueBase == mars.venus.NumberDisplayBaseChooser.HEXADECIMAL) {
791-
result.append(mars.util.Binary.intToHexString(e.iValue)); // 13-July-2011, was: intToHalfHexString()
791+
if (valueBase == NumberDisplayBaseChooser.HEXADECIMAL) {
792+
result.append(rars.util.Binary.intToHexString(e.iValue)); // 13-July-2011, was: intToHalfHexString()
792793
} else {
793-
result.append(mars.venus.NumberDisplayBaseChooser.formatNumber(e.iValue, valueBase));
794+
result.append(NumberDisplayBaseChooser.formatNumber(e.iValue, valueBase));
794795
}
795796
default:
796797
break;

mars/RISCVprogram.java rars/RISCVprogram.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package mars;
1+
package rars;
22

3-
import mars.assembler.*;
4-
import mars.riscv.hardware.RegisterFile;
5-
import mars.simulator.BackStepper;
6-
import mars.simulator.Simulator;
3+
import rars.assembler.*;
4+
import rars.riscv.hardware.RegisterFile;
5+
import rars.simulator.BackStepper;
6+
import rars.simulator.Simulator;
77

88
import java.io.BufferedReader;
99
import java.io.FileReader;

mars/Settings.java rars/Settings.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package mars;
1+
package rars;
22

3-
import mars.util.Binary;
4-
import mars.util.EditorFont;
5-
import mars.venus.editors.jeditsyntax.SyntaxStyle;
6-
import mars.venus.editors.jeditsyntax.SyntaxUtilities;
3+
import rars.util.Binary;
4+
import rars.util.EditorFont;
5+
import rars.venus.editors.jeditsyntax.SyntaxStyle;
6+
import rars.venus.editors.jeditsyntax.SyntaxUtilities;
77

88
import java.awt.*;
99
import java.util.HashMap;
@@ -53,7 +53,7 @@ a copy of this software and associated documentation files (the
5353
* <p>
5454
* Actual implementation of the Preference objects is platform-dependent.
5555
* For Windows, they are stored in Registry. To see, run regedit and browse to:
56-
* HKEY_CURRENT_USER\Software\JavaSoft\Prefs\mars
56+
* HKEY_CURRENT_USER\Software\JavaSoft\Prefs\rars
5757
*
5858
* @author Pete Sanderson
5959
**/
@@ -381,7 +381,7 @@ public Settings(boolean gui) {
381381
colorSettingsValues = new String[colorSettingsKeys.length];
382382
// This determines where the values are actually stored. Actual implementation
383383
// is platform-dependent. For Windows, they are stored in Registry. To see,
384-
// run regedit and browse to: HKEY_CURRENT_USER\Software\JavaSoft\Prefs\mars
384+
// run regedit and browse to: HKEY_CURRENT_USER\Software\JavaSoft\Prefs\rars
385385
preferences = Preferences.userNodeForPackage(this.getClass());
386386
// The gui parameter, formerly passed to initialize(), is no longer needed
387387
// because I removed (1/21/09) the call to generate the Font object for the text editor.
@@ -423,7 +423,7 @@ public void reset(boolean gui) {
423423
424424
The fallback defaults will come not from an array here, but from the
425425
existing static method SyntaxUtilities.getDefaultSyntaxStyles()
426-
in the mars.venus.editors.jeditsyntax package. It returns an array
426+
in the rars.venus.editors.jeditsyntax package. It returns an array
427427
of SyntaxStyle objects.
428428
429429
*/

mars/SimulationException.java rars/SimulationException.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package mars;
1+
package rars;
22

3-
import mars.riscv.hardware.AddressErrorException;
4-
import mars.riscv.hardware.RegisterFile;
5-
import mars.riscv.Instruction;
6-
import mars.util.Binary;
3+
import rars.riscv.hardware.AddressErrorException;
4+
import rars.riscv.hardware.RegisterFile;
5+
import rars.riscv.Instruction;
6+
import rars.util.Binary;
77

88
/**
99
* For exceptions thrown during runtime

0 commit comments

Comments
 (0)