From: Christian Femers Date: Sun, 18 Aug 2019 12:33:12 +0000 (+0200) Subject: Added machine plugin project to repository X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=928282b9447dc92ead9f805ff7abcac46d6a137b;p=Mograsim.git Added machine plugin project to repository --- diff --git a/net.mograsim.machine/.classpath b/net.mograsim.machine/.classpath new file mode 100644 index 00000000..e801ebfb --- /dev/null +++ b/net.mograsim.machine/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/net.mograsim.machine/.gitignore b/net.mograsim.machine/.gitignore new file mode 100644 index 00000000..ae3c1726 --- /dev/null +++ b/net.mograsim.machine/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/net.mograsim.machine/.project b/net.mograsim.machine/.project new file mode 100644 index 00000000..d179b4ce --- /dev/null +++ b/net.mograsim.machine/.project @@ -0,0 +1,28 @@ + + + net.mograsim.machine + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/net.mograsim.machine/.settings/org.eclipse.jdt.core.prefs b/net.mograsim.machine/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..cd95f141 --- /dev/null +++ b/net.mograsim.machine/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/net.mograsim.machine/META-INF/MANIFEST.MF b/net.mograsim.machine/META-INF/MANIFEST.MF new file mode 100644 index 00000000..3be14f8a --- /dev/null +++ b/net.mograsim.machine/META-INF/MANIFEST.MF @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Mograsim Machine Definition +Bundle-SymbolicName: net.mograsim.machine;singleton:=true +Bundle-Version: 0.1.0.qualifier +Bundle-Vendor: Mograsim Team +Automatic-Module-Name: net.mograsim.machine +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Require-Bundle: net.mograsim.logic.core;bundle-version="0.1.0", + net.mograsim.logic.model;bundle-version="0.1.0" +Export-Package: net.mograsim.machine.isa diff --git a/net.mograsim.machine/build.properties b/net.mograsim.machine/build.properties new file mode 100644 index 00000000..e9863e28 --- /dev/null +++ b/net.mograsim.machine/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/net.mograsim.machine/plugin.xml b/net.mograsim.machine/plugin.xml new file mode 100644 index 00000000..4171a8db --- /dev/null +++ b/net.mograsim.machine/plugin.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/net.mograsim.machine/schema/net.mograsim.machinedefinition.exsd b/net.mograsim.machine/schema/net.mograsim.machinedefinition.exsd new file mode 100644 index 00000000..ea6d2580 --- /dev/null +++ b/net.mograsim.machine/schema/net.mograsim.machinedefinition.exsd @@ -0,0 +1,109 @@ + + + + + + + + + Mograsim extension for defining a machine + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The machines name + + + + + + + A Class that implements the Mograsim Machine Definition + + + + + + + + + + + + + + + 0.1.0 + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/net.mograsim.machine/src/net/mograsim/machine/AddressingScema.java b/net.mograsim.machine/src/net/mograsim/machine/AddressingScema.java new file mode 100644 index 00000000..884fa0bf --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/AddressingScema.java @@ -0,0 +1,5 @@ +package net.mograsim.machine; + +public interface AddressingScema { + +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/ISA.java b/net.mograsim.machine/src/net/mograsim/machine/ISA.java new file mode 100644 index 00000000..9f322e4b --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/ISA.java @@ -0,0 +1,4 @@ +package net.mograsim.machine; + +public interface ISA { +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/ISASchema.java b/net.mograsim.machine/src/net/mograsim/machine/ISASchema.java new file mode 100644 index 00000000..249a8925 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/ISASchema.java @@ -0,0 +1,11 @@ +package net.mograsim.machine; + +import java.util.Set; + +import net.mograsim.machine.isa.AsmOperand; + +public interface ISASchema { + Set getSupportedOperands(); + + AddressingScema getAddressingSchema(); +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/Machine.java b/net.mograsim.machine/src/net/mograsim/machine/Machine.java new file mode 100644 index 00000000..00a1e34c --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/Machine.java @@ -0,0 +1,19 @@ +package net.mograsim.machine; + +import net.mograsim.logic.core.components.Clock; +import net.mograsim.logic.core.types.BitVector; +import net.mograsim.logic.model.model.ViewModel; + +public interface Machine { + MachineDefinition getDefinition(); + + void reset(); + + ViewModel getModel(); + + Clock getClock(); + + BitVector getRegister(Register r); + + void setRegister(Register r, BitVector value); +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/MachineDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/MachineDefinition.java new file mode 100644 index 00000000..cfed1ef3 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/MachineDefinition.java @@ -0,0 +1,50 @@ +package net.mograsim.machine; + +import java.util.Set; + +public interface MachineDefinition { + + /** + * Creates a new instance of the machine + * + * @return a new object of an {@link Machine} implementation. + * @author Christian Femers + */ + Machine createNew(); + + /** + * Returns the schema that all possible ISAs (Instruction Set Architecture) must + * be based on. + * + * @return an {@link ISASchema} implementation fitting the machine + * @author Christian Femers + */ + ISASchema getISASchema(); + + /** + * Returns a set of all {@link Register}s present in the machine. + * + * @return all registers present in the machine. + * @author Christian Femers + */ + Set getRegisters(); + + /** + * The number of bits used by the machine to address main memory. Note that this + * should be the number of bits used in the CPU, not a possibly different one + * used by the bus system. + * + * @return the number of bits used by the CPU + * @see MainMemoryDefinition#getMemoryAddressBits() + * @author Christian Femers + */ + int getAddressBits(); + + /** + * Returns the definition of the machines main memory. + * + * @return the {@link MainMemoryDefinition} that defines the main memory. + * @author Christian Femers + */ + MainMemoryDefinition getMainMemoryDefinition(); +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/MainMemory.java b/net.mograsim.machine/src/net/mograsim/machine/MainMemory.java new file mode 100644 index 00000000..78c0ca05 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/MainMemory.java @@ -0,0 +1,5 @@ +package net.mograsim.machine; + +public interface MainMemory { + +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java new file mode 100644 index 00000000..3128cddd --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java @@ -0,0 +1,45 @@ +package net.mograsim.machine; + +/** + * This interface provides a means to get information about the machines memory + * architecture. It is not bound to any actual memory. + * + * @author Christian Femers + * + */ +public interface MainMemoryDefinition { + + /** + * The number of bits that the main memory uses to address cells. Note that this + * does not need to equal {@link MachineDefinition#getAddressBits()}. + * + * @return the number of bits used to address a memory cell + * @author Christian Femers + */ + int getMemoryAddressBits(); + + /** + * The width in bits of an addressable memory cell/unit. This is often 8 (= one + * byte). The actual cells/lines of the memory may be a lot larger. + * + * @return the addressable unit width in bits + * @author Christian Femers + */ + int getCellWidth(); + + /** + * The minimal address possible to address/use. This is usually 0. + * + * @return the minimal possible address. + * @author Christian Femers + */ + long getMinimalAddress(); + + /** + * The maximal address possible to address/use. + * + * @return the maximal possible address as unsigned long + * @author Christian Femers + */ + long getMaximalAddress(); +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/MicroInstruction.java b/net.mograsim.machine/src/net/mograsim/machine/MicroInstruction.java new file mode 100644 index 00000000..0846cd53 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/MicroInstruction.java @@ -0,0 +1,5 @@ +package net.mograsim.machine; + +public interface MicroInstruction { + +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/MicroprogramMemory.java b/net.mograsim.machine/src/net/mograsim/machine/MicroprogramMemory.java new file mode 100644 index 00000000..c12d6767 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/MicroprogramMemory.java @@ -0,0 +1,5 @@ +package net.mograsim.machine; + +public interface MicroprogramMemory { + +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/Register.java b/net.mograsim.machine/src/net/mograsim/machine/Register.java new file mode 100644 index 00000000..5ecf1cfc --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/Register.java @@ -0,0 +1,58 @@ +package net.mograsim.machine; + +import java.util.Set; + +/** + * A register in a machine is defined by this interface. A hardware register may + * have {@link Register#names() named sub-registers}. + * + * + * @author Christian Femers + * + */ +public interface Register { + /** + * The unique identifier of the register. This does not have to be the display + * name or name in the assembly language. + * + * @return the registers id as case sensitive String + * @author Christian Femers + */ + String id(); + + /** + * The name(s) of this register. This is the displayed name and the name used in + * the assembly language. All names of all registers must be case-insensitive + * unique. A register can have multiple names if these names address different + * regions (but still have a common hardware structure), e.g. EAX, + * AX, AL, AH. + * + * @return all the names of regions addressing this register, must be + * case-insensitive. + * @author Christian Femers + */ + Set names(); + + /** + * Returns the complete width in bits of the underlying hardware structure the + * register and possible sub-registers are part of. + * + * @param name the name of the register + * @return the width of the (sub-)register in bits. + * + * @see #names() + * @author Christian Femers + */ + int getWidth(); + + /** + * Returns the width in bits of the register or a named part of it. + * + * @param name the name of the register + * @return the width of the (sub-)register in bits. + * + * @see #names() + * @author Christian Femers + */ + int getWidth(String name); +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/AsmElement.java b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmElement.java new file mode 100644 index 00000000..07b56c29 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmElement.java @@ -0,0 +1,6 @@ +package net.mograsim.machine.isa; + +public interface AsmElement +{ + // only marker at the moment +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/AsmFloatOperand.java b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmFloatOperand.java new file mode 100644 index 00000000..7a1a6ebf --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmFloatOperand.java @@ -0,0 +1,98 @@ +package net.mograsim.machine.isa; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import net.mograsim.logic.core.types.Bit; +import net.mograsim.logic.core.types.BitVector; +import net.mograsim.logic.core.types.BitVector.BitVectorMutator; +import net.mograsim.machine.isa.types.AsmNumberFormatException; + +public class AsmFloatOperand implements AsmOperand +{ + private final int size; + private final int mantissa; + private final int exponent; + + public AsmFloatOperand(int size) + { + this.size = size; + switch (size) + { + case 8: + exponent = 4; + mantissa = 3; + break; + case 16: + exponent = 5; + mantissa = 10; + break; + case 32: + exponent = 8; + mantissa = 23; + break; + case 64: + exponent = 11; + mantissa = 52; + break; + case 128: + exponent = 15; + mantissa = 112; + break; + default: + if (size > 128 && size % 32 == 0) + { + exponent = (int) Math.round(Math.log(size) / Math.log(2)) - 13; + mantissa = size - exponent - 1; + } else + { + throw new IllegalArgumentException("Illegal floating point size: " + size); + } + } + } + + public AsmFloatOperand(int exponent, int mantissa) + { + if (exponent < 1 || mantissa < 1) + throw new IllegalArgumentException("illegal floating point specification: e=" + exponent + ", m=" + mantissa); + this.exponent = exponent; + this.mantissa = mantissa; + this.size = exponent + mantissa + 1; + } + + @Override + public int getSize() + { + return size; + } + + @Override + public BitVector parse(String s) throws AsmNumberFormatException + { + String cleaned = s.replace("_", "").toLowerCase(); + int len = cleaned.length(); + BigInteger res; + try + { + return bigDecToBitVector(new BigDecimal(cleaned)); + } + catch (NumberFormatException e) + { + throw new AsmNumberFormatException(e, "Error parsing %s: no valid float format", s); + } + } + + BitVector bigDecToBitVector(BigDecimal bi) throws AsmNumberFormatException + { + BigInteger raw = bi.unscaledValue(); + int mantLen = raw.bitLength(); +// bi. + int bitLength = raw.bitLength() - (bi.signum() - 1) / 2; + if (bitLength > size) + throw new AsmNumberFormatException("Error parsing %s: bit count %d exceeds size %d", bi, bitLength, size); + BitVectorMutator bvm = BitVectorMutator.ofLength(size); + for (int i = 0; i < size; i++) + bvm.setLSBit(i, Bit.of(raw.testBit(i))); + return bvm.toBitVector(); + } +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/AsmInstruction.java b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmInstruction.java new file mode 100644 index 00000000..29bbf73b --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmInstruction.java @@ -0,0 +1,39 @@ +package net.mograsim.machine.isa; + +import java.util.Objects; + +public final class AsmInstruction implements AsmElement +{ + private final AsmOperation operation; + private final AsmOperands operands; + + public AsmInstruction(AsmOperation operation, AsmOperands operands) + { + this.operation = Objects.requireNonNull(operation); + this.operands = Objects.requireNonNull(operands); + } + + @Override + public int hashCode() + { + return Objects.hash(operands, operation); + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!(obj instanceof AsmInstruction)) + return false; + AsmInstruction other = (AsmInstruction) obj; + return Objects.equals(operands, other.operands) && Objects.equals(operation, other.operation); + } + + @Override + public String toString() + { + return String.format("%s %s", operation, operands).trim(); + } + +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/AsmIntegerOperand.java b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmIntegerOperand.java new file mode 100644 index 00000000..d3ac80f9 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmIntegerOperand.java @@ -0,0 +1,95 @@ +package net.mograsim.machine.isa; + +import java.math.BigInteger; + +import net.mograsim.logic.core.types.Bit; +import net.mograsim.logic.core.types.BitVector; +import net.mograsim.logic.core.types.BitVector.BitVectorMutator; +import net.mograsim.machine.isa.types.AsmNumberFormatException; + +public class AsmIntegerOperand implements AsmOperand +{ + private final int size; + + public AsmIntegerOperand(int size) + { + this.size = size; + } + + @Override + public int getSize() + { + return size; + } + + @Override + public BitVector parse(String s) throws AsmNumberFormatException + { + String cleaned = s.replace("_", "").toLowerCase(); + int len = cleaned.length(); + BigInteger res; + try + { + if (cleaned.startsWith("0x")) + res = new BigInteger(cleaned.substring(2), 16); + else if (cleaned.endsWith("h")) + res = new BigInteger(cleaned.substring(0, len - 1), 16); + else if (cleaned.startsWith("0b")) + res = new BigInteger(cleaned.substring(2), 2); + else if (cleaned.endsWith("b")) + res = new BigInteger(cleaned.substring(2), 2); + else if (cleaned.endsWith("q")) + res = new BigInteger(cleaned.substring(0, len - 1), 8); + else + res = new BigInteger(cleaned); + } + catch (NumberFormatException e) + { + throw new AsmNumberFormatException(e, "Error parsing %s: no valid integer format", s); + } + return bigIntToBitVector(res); + } + + BitVector bigIntToBitVector(BigInteger bi) throws AsmNumberFormatException + { + int bitLength = bi.bitLength() - (bi.signum() - 1) / 2; + if (bitLength > size) + throw new AsmNumberFormatException("Error parsing %s: bit count %d exceeds size %d", bi, bitLength, size); + BitVectorMutator bvm = BitVectorMutator.ofLength(size); + for (int i = 0; i < size; i++) + bvm.setLSBit(i, Bit.of(bi.testBit(i))); + return bvm.toBitVector(); + } + + public static void main(String[] args) throws AsmNumberFormatException + { + AsmIntegerOperand aio = new AsmIntegerOperand(4); + System.out.println(aio.parse("0")); + System.out.println(aio.parse("1")); + System.out.println(aio.parse("2")); + System.out.println(aio.parse("3")); + System.out.println(aio.parse("4")); + System.out.println(aio.parse("5")); + System.out.println(aio.parse("6")); + System.out.println(aio.parse("7")); + System.out.println(aio.parse("8")); + System.out.println(aio.parse("9")); + System.out.println(aio.parse("10")); + System.out.println(aio.parse("11")); + System.out.println(aio.parse("12")); + System.out.println(aio.parse("13")); + System.out.println(aio.parse("14")); + System.out.println(aio.parse("15")); +// System.out.println(aio.parse("16")); + System.out.println(aio.parse("-0")); + System.out.println(aio.parse("-1")); + System.out.println(aio.parse("-2")); + System.out.println(aio.parse("-3")); + System.out.println(aio.parse("-4")); + System.out.println(aio.parse("-5")); + System.out.println(aio.parse("-6")); + System.out.println(aio.parse("-7")); + System.out.println(aio.parse("-8")); +// System.out.println(aio.parse("-9")); + } +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/AsmLabel.java b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmLabel.java new file mode 100644 index 00000000..ddb56582 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmLabel.java @@ -0,0 +1,49 @@ +package net.mograsim.machine.isa; + +import java.util.Objects; + +public final class AsmLabel implements AsmElement +{ + private final String name; + private AsmInstruction inst; + + public AsmLabel(String name) + { + this.name = Objects.requireNonNull(name); + } + + public String getName() + { + return name; + } + + public void setInst(AsmInstruction inst) + { + if (inst != null) + throw new IllegalStateException("Instrution already set for " + name); + this.inst = inst; + } + + @Override + public String toString() + { + return name + ":"; + } + + @Override + public int hashCode() + { + return Objects.hash(inst, name); + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!(obj instanceof AsmLabel)) + return false; + AsmLabel other = (AsmLabel) obj; + return Objects.equals(inst, other.inst) && Objects.equals(name, other.name); + } +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/AsmOperand.java b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmOperand.java new file mode 100644 index 00000000..ad641d6b --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmOperand.java @@ -0,0 +1,11 @@ +package net.mograsim.machine.isa; + +import net.mograsim.logic.core.types.BitVector; +import net.mograsim.machine.isa.types.AsmException; + +public interface AsmOperand +{ + int getSize(); + + BitVector parse(String s) throws AsmException; +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/AsmOperands.java b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmOperands.java new file mode 100644 index 00000000..f286c315 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmOperands.java @@ -0,0 +1,43 @@ +package net.mograsim.machine.isa; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +public final class AsmOperands +{ + private final List operands; + + public AsmOperands(List operands) + { + this.operands = List.copyOf(Objects.requireNonNull(operands)); + } + + public List getOperands() + { + return operands; + } + + @Override + public int hashCode() + { + return operands.hashCode(); + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!(obj instanceof AsmOperands)) + return false; + AsmOperands other = (AsmOperands) obj; + return operands.equals(other.operands); + } + + @Override + public String toString() + { + return operands.stream().map(AsmOperand::toString).collect(Collectors.joining(", ")); + } +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/AsmOperation.java b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmOperation.java new file mode 100644 index 00000000..abafc45f --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/AsmOperation.java @@ -0,0 +1,41 @@ +package net.mograsim.machine.isa; + +import java.util.Objects; + +public final class AsmOperation +{ + private final String mnemonic; + + public AsmOperation(String mnemonic) + { + this.mnemonic = Objects.requireNonNull(mnemonic.toLowerCase()); + } + + public String getMnemonic() + { + return mnemonic; + } + + @Override + public String toString() + { + return getMnemonic(); + } + + @Override + public int hashCode() + { + return mnemonic.hashCode(); + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!(obj instanceof AsmOperation)) + return false; + AsmOperation other = (AsmOperation) obj; + return mnemonic.equals(other.mnemonic); + } +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/NumericOperand.java b/net.mograsim.machine/src/net/mograsim/machine/isa/NumericOperand.java new file mode 100644 index 00000000..8de66267 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/NumericOperand.java @@ -0,0 +1,6 @@ +package net.mograsim.machine.isa; + +public class NumericOperand +{ + +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/types/AsmException.java b/net.mograsim.machine/src/net/mograsim/machine/isa/types/AsmException.java new file mode 100644 index 00000000..8a9d2d02 --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/types/AsmException.java @@ -0,0 +1,32 @@ +package net.mograsim.machine.isa.types; + +public class AsmException extends Exception +{ + private static final long serialVersionUID = 1L; + + public AsmException() + { + super(); + } + + public AsmException(Throwable cause, String message, boolean enableSuppression, boolean writableStackTrace) + { + super(message, cause, enableSuppression, writableStackTrace); + } + + public AsmException(Throwable cause, String formatString, Object... formatArgs) + { + super(String.format(formatString, formatArgs), cause); + } + + public AsmException(String formatString, Object... formatArgs) + { + super(String.format(formatString, formatArgs)); + } + + public AsmException(Throwable cause) + { + super(cause); + } + +} diff --git a/net.mograsim.machine/src/net/mograsim/machine/isa/types/AsmNumberFormatException.java b/net.mograsim.machine/src/net/mograsim/machine/isa/types/AsmNumberFormatException.java new file mode 100644 index 00000000..4fb4af6d --- /dev/null +++ b/net.mograsim.machine/src/net/mograsim/machine/isa/types/AsmNumberFormatException.java @@ -0,0 +1,16 @@ +package net.mograsim.machine.isa.types; + +public class AsmNumberFormatException extends AsmException +{ + private static final long serialVersionUID = 1L; + + public AsmNumberFormatException(Exception cause, String message, Object... formatArgs) + { + super(cause, message, formatArgs); + } + + public AsmNumberFormatException(String message, Object... formatArgs) + { + super(message, formatArgs); + } +}