--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>\r
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+ <classpathentry kind="src" path="src"/>\r
+ <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>net.mograsim.machine</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.ManifestBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.SchemaBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.pde.PluginNature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11\r
+org.eclipse.jdt.core.compiler.compliance=11\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.release=enabled\r
+org.eclipse.jdt.core.compiler.source=11\r
--- /dev/null
+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
--- /dev/null
+source.. = src/\r
+output.. = bin/\r
+bin.includes = META-INF/,\\r
+ .,\\r
+ plugin.xml\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<?eclipse version="3.4"?>\r
+<plugin>\r
+ <extension-point id="net.mograsim.machinedefinition" name="Mograsim Machine Definition" schema="schema/net.mograsim.machinedefinition.exsd"/>\r
+\r
+</plugin>\r
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>\r
+<!-- Schema file written by PDE -->\r
+<schema targetNamespace="net.mograsim.machine" xmlns="http://www.w3.org/2001/XMLSchema">\r
+<annotation>\r
+ <appinfo>\r
+ <meta.schema plugin="net.mograsim.machine" id="net.mograsim.machinedefinition" name="Mograsim Machine Definition"/>\r
+ </appinfo>\r
+ <documentation>\r
+ Mograsim extension for defining a machine\r
+ </documentation>\r
+ </annotation>\r
+\r
+ <element name="extension">\r
+ <annotation>\r
+ <appinfo>\r
+ <meta.element />\r
+ </appinfo>\r
+ </annotation>\r
+ <complexType>\r
+ <choice minOccurs="1" maxOccurs="unbounded">\r
+ <element ref="MachineDefinitionImplementation"/>\r
+ </choice>\r
+ <attribute name="point" type="string" use="required">\r
+ <annotation>\r
+ <documentation>\r
+ \r
+ </documentation>\r
+ </annotation>\r
+ </attribute>\r
+ <attribute name="id" type="string">\r
+ <annotation>\r
+ <documentation>\r
+ \r
+ </documentation>\r
+ </annotation>\r
+ </attribute>\r
+ <attribute name="name" type="string">\r
+ <annotation>\r
+ <documentation>\r
+ \r
+ </documentation>\r
+ <appinfo>\r
+ <meta.attribute translatable="true"/>\r
+ </appinfo>\r
+ </annotation>\r
+ </attribute>\r
+ </complexType>\r
+ </element>\r
+\r
+ <element name="MachineDefinitionImplementation">\r
+ <complexType>\r
+ <attribute name="name" type="string" use="required">\r
+ <annotation>\r
+ <documentation>\r
+ The machines name\r
+ </documentation>\r
+ </annotation>\r
+ </attribute>\r
+ <attribute name="class" type="string" use="required">\r
+ <annotation>\r
+ <documentation>\r
+ A Class that implements the Mograsim Machine Definition\r
+ </documentation>\r
+ <appinfo>\r
+ <meta.attribute kind="java" basedOn=":net.mograsim.machine.MachineDefinition"/>\r
+ </appinfo>\r
+ </annotation>\r
+ </attribute>\r
+ </complexType>\r
+ </element>\r
+\r
+ <annotation>\r
+ <appinfo>\r
+ <meta.section type="since"/>\r
+ </appinfo>\r
+ <documentation>\r
+ 0.1.0\r
+ </documentation>\r
+ </annotation>\r
+\r
+ <annotation>\r
+ <appinfo>\r
+ <meta.section type="examples"/>\r
+ </appinfo>\r
+ <documentation>\r
+ [Enter extension point usage example here.]\r
+ </documentation>\r
+ </annotation>\r
+\r
+ <annotation>\r
+ <appinfo>\r
+ <meta.section type="apiinfo"/>\r
+ </appinfo>\r
+ <documentation>\r
+ [Enter API information here.]\r
+ </documentation>\r
+ </annotation>\r
+\r
+ <annotation>\r
+ <appinfo>\r
+ <meta.section type="implementation"/>\r
+ </appinfo>\r
+ <documentation>\r
+ [Enter information about supplied implementation of this extension point.]\r
+ </documentation>\r
+ </annotation>\r
+\r
+\r
+</schema>\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+public interface AddressingScema {\r
+ \r
+}\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+public interface ISA {\r
+}\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+import java.util.Set;\r
+\r
+import net.mograsim.machine.isa.AsmOperand;\r
+\r
+public interface ISASchema {\r
+ Set<AsmOperand> getSupportedOperands();\r
+ \r
+ AddressingScema getAddressingSchema();\r
+}\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+import net.mograsim.logic.core.components.Clock;\r
+import net.mograsim.logic.core.types.BitVector;\r
+import net.mograsim.logic.model.model.ViewModel;\r
+\r
+public interface Machine {\r
+ MachineDefinition getDefinition();\r
+ \r
+ void reset();\r
+ \r
+ ViewModel getModel();\r
+ \r
+ Clock getClock();\r
+ \r
+ BitVector getRegister(Register r);\r
+ \r
+ void setRegister(Register r, BitVector value);\r
+}\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+import java.util.Set;\r
+\r
+public interface MachineDefinition {\r
+\r
+ /**\r
+ * Creates a new instance of the machine\r
+ * \r
+ * @return a new object of an {@link Machine} implementation.\r
+ * @author Christian Femers\r
+ */\r
+ Machine createNew();\r
+\r
+ /**\r
+ * Returns the schema that all possible ISAs (Instruction Set Architecture) must\r
+ * be based on.\r
+ * \r
+ * @return an {@link ISASchema} implementation fitting the machine\r
+ * @author Christian Femers\r
+ */\r
+ ISASchema getISASchema();\r
+\r
+ /**\r
+ * Returns a set of all {@link Register}s present in the machine.\r
+ * \r
+ * @return all registers present in the machine.\r
+ * @author Christian Femers\r
+ */\r
+ Set<Register> getRegisters();\r
+\r
+ /**\r
+ * The number of bits used by the machine to address main memory. Note that this\r
+ * should be the number of bits used in the CPU, not a possibly different one\r
+ * used by the bus system.\r
+ * \r
+ * @return the number of bits used by the CPU\r
+ * @see MainMemoryDefinition#getMemoryAddressBits()\r
+ * @author Christian Femers\r
+ */\r
+ int getAddressBits();\r
+\r
+ /**\r
+ * Returns the definition of the machines main memory.\r
+ * \r
+ * @return the {@link MainMemoryDefinition} that defines the main memory.\r
+ * @author Christian Femers\r
+ */\r
+ MainMemoryDefinition getMainMemoryDefinition();\r
+}\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+public interface MainMemory {\r
+ \r
+}\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+/**\r
+ * This interface provides a means to get information about the machines memory\r
+ * architecture. It is not bound to any actual memory.\r
+ *\r
+ * @author Christian Femers\r
+ *\r
+ */\r
+public interface MainMemoryDefinition {\r
+\r
+ /**\r
+ * The number of bits that the main memory uses to address cells. Note that this\r
+ * does not need to equal {@link MachineDefinition#getAddressBits()}.\r
+ * \r
+ * @return the number of bits used to address a memory cell\r
+ * @author Christian Femers\r
+ */\r
+ int getMemoryAddressBits();\r
+\r
+ /**\r
+ * The width in bits of an addressable memory cell/unit. This is often 8 (= one\r
+ * byte). The actual cells/lines of the memory may be a lot larger.\r
+ * \r
+ * @return the addressable unit width in bits\r
+ * @author Christian Femers\r
+ */\r
+ int getCellWidth();\r
+\r
+ /**\r
+ * The minimal address possible to address/use. This is usually 0.\r
+ * \r
+ * @return the minimal possible address.\r
+ * @author Christian Femers\r
+ */\r
+ long getMinimalAddress();\r
+\r
+ /**\r
+ * The maximal address possible to address/use.\r
+ * \r
+ * @return the maximal possible address as <b>unsigned long</b>\r
+ * @author Christian Femers\r
+ */\r
+ long getMaximalAddress();\r
+}\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+public interface MicroInstruction {\r
+\r
+}\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+public interface MicroprogramMemory {\r
+\r
+}\r
--- /dev/null
+package net.mograsim.machine;\r
+\r
+import java.util.Set;\r
+\r
+/**\r
+ * A register in a machine is defined by this interface. A hardware register may\r
+ * have {@link Register#names() named sub-registers}.\r
+ *\r
+ *\r
+ * @author Christian Femers\r
+ *\r
+ */\r
+public interface Register {\r
+ /**\r
+ * The unique identifier of the register. This does not have to be the display\r
+ * name or name in the assembly language.\r
+ * \r
+ * @return the registers id as case sensitive String\r
+ * @author Christian Femers\r
+ */\r
+ String id();\r
+\r
+ /**\r
+ * The name(s) of this register. This is the displayed name and the name used in\r
+ * the assembly language. All names of all registers must be case-insensitive\r
+ * unique. A register can have multiple names if these names address different\r
+ * regions (but still have a common hardware structure), e.g. <code>EAX</code>,\r
+ * <code>AX</code>, <code>AL</code>, <code>AH</code>.\r
+ * \r
+ * @return all the names of regions addressing this register, must be\r
+ * case-insensitive.\r
+ * @author Christian Femers\r
+ */\r
+ Set<String> names();\r
+\r
+ /**\r
+ * Returns the complete width in bits of the underlying hardware structure the\r
+ * register and possible sub-registers are part of.\r
+ * \r
+ * @param name the name of the register\r
+ * @return the width of the (sub-)register in bits.\r
+ * \r
+ * @see #names()\r
+ * @author Christian Femers\r
+ */\r
+ int getWidth();\r
+\r
+ /**\r
+ * Returns the width in bits of the register or a named part of it.\r
+ * \r
+ * @param name the name of the register\r
+ * @return the width of the (sub-)register in bits.\r
+ * \r
+ * @see #names()\r
+ * @author Christian Femers\r
+ */\r
+ int getWidth(String name);\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa;\r
+\r
+public interface AsmElement\r
+{\r
+ // only marker at the moment\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa;\r
+\r
+import java.math.BigDecimal;\r
+import java.math.BigInteger;\r
+\r
+import net.mograsim.logic.core.types.Bit;\r
+import net.mograsim.logic.core.types.BitVector;\r
+import net.mograsim.logic.core.types.BitVector.BitVectorMutator;\r
+import net.mograsim.machine.isa.types.AsmNumberFormatException;\r
+\r
+public class AsmFloatOperand implements AsmOperand\r
+{\r
+ private final int size;\r
+ private final int mantissa;\r
+ private final int exponent;\r
+\r
+ public AsmFloatOperand(int size)\r
+ {\r
+ this.size = size;\r
+ switch (size)\r
+ {\r
+ case 8:\r
+ exponent = 4;\r
+ mantissa = 3;\r
+ break;\r
+ case 16:\r
+ exponent = 5;\r
+ mantissa = 10;\r
+ break;\r
+ case 32:\r
+ exponent = 8;\r
+ mantissa = 23;\r
+ break;\r
+ case 64:\r
+ exponent = 11;\r
+ mantissa = 52;\r
+ break;\r
+ case 128:\r
+ exponent = 15;\r
+ mantissa = 112;\r
+ break;\r
+ default:\r
+ if (size > 128 && size % 32 == 0)\r
+ {\r
+ exponent = (int) Math.round(Math.log(size) / Math.log(2)) - 13;\r
+ mantissa = size - exponent - 1;\r
+ } else\r
+ {\r
+ throw new IllegalArgumentException("Illegal floating point size: " + size);\r
+ }\r
+ }\r
+ }\r
+\r
+ public AsmFloatOperand(int exponent, int mantissa)\r
+ {\r
+ if (exponent < 1 || mantissa < 1)\r
+ throw new IllegalArgumentException("illegal floating point specification: e=" + exponent + ", m=" + mantissa);\r
+ this.exponent = exponent;\r
+ this.mantissa = mantissa;\r
+ this.size = exponent + mantissa + 1;\r
+ }\r
+\r
+ @Override\r
+ public int getSize()\r
+ {\r
+ return size;\r
+ }\r
+\r
+ @Override\r
+ public BitVector parse(String s) throws AsmNumberFormatException\r
+ {\r
+ String cleaned = s.replace("_", "").toLowerCase();\r
+ int len = cleaned.length();\r
+ BigInteger res;\r
+ try\r
+ {\r
+ return bigDecToBitVector(new BigDecimal(cleaned));\r
+ }\r
+ catch (NumberFormatException e)\r
+ {\r
+ throw new AsmNumberFormatException(e, "Error parsing %s: no valid float format", s);\r
+ }\r
+ }\r
+\r
+ BitVector bigDecToBitVector(BigDecimal bi) throws AsmNumberFormatException\r
+ {\r
+ BigInteger raw = bi.unscaledValue();\r
+ int mantLen = raw.bitLength();\r
+// bi.\r
+ int bitLength = raw.bitLength() - (bi.signum() - 1) / 2;\r
+ if (bitLength > size)\r
+ throw new AsmNumberFormatException("Error parsing %s: bit count %d exceeds size %d", bi, bitLength, size);\r
+ BitVectorMutator bvm = BitVectorMutator.ofLength(size);\r
+ for (int i = 0; i < size; i++)\r
+ bvm.setLSBit(i, Bit.of(raw.testBit(i)));\r
+ return bvm.toBitVector();\r
+ }\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa;\r
+\r
+import java.util.Objects;\r
+\r
+public final class AsmInstruction implements AsmElement\r
+{\r
+ private final AsmOperation operation;\r
+ private final AsmOperands operands;\r
+\r
+ public AsmInstruction(AsmOperation operation, AsmOperands operands)\r
+ {\r
+ this.operation = Objects.requireNonNull(operation);\r
+ this.operands = Objects.requireNonNull(operands);\r
+ }\r
+\r
+ @Override\r
+ public int hashCode()\r
+ {\r
+ return Objects.hash(operands, operation);\r
+ }\r
+\r
+ @Override\r
+ public boolean equals(Object obj)\r
+ {\r
+ if (this == obj)\r
+ return true;\r
+ if (!(obj instanceof AsmInstruction))\r
+ return false;\r
+ AsmInstruction other = (AsmInstruction) obj;\r
+ return Objects.equals(operands, other.operands) && Objects.equals(operation, other.operation);\r
+ }\r
+\r
+ @Override\r
+ public String toString()\r
+ {\r
+ return String.format("%s %s", operation, operands).trim();\r
+ }\r
+\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa;\r
+\r
+import java.math.BigInteger;\r
+\r
+import net.mograsim.logic.core.types.Bit;\r
+import net.mograsim.logic.core.types.BitVector;\r
+import net.mograsim.logic.core.types.BitVector.BitVectorMutator;\r
+import net.mograsim.machine.isa.types.AsmNumberFormatException;\r
+\r
+public class AsmIntegerOperand implements AsmOperand\r
+{\r
+ private final int size;\r
+\r
+ public AsmIntegerOperand(int size)\r
+ {\r
+ this.size = size;\r
+ }\r
+\r
+ @Override\r
+ public int getSize()\r
+ {\r
+ return size;\r
+ }\r
+\r
+ @Override\r
+ public BitVector parse(String s) throws AsmNumberFormatException\r
+ {\r
+ String cleaned = s.replace("_", "").toLowerCase();\r
+ int len = cleaned.length();\r
+ BigInteger res;\r
+ try\r
+ {\r
+ if (cleaned.startsWith("0x"))\r
+ res = new BigInteger(cleaned.substring(2), 16);\r
+ else if (cleaned.endsWith("h"))\r
+ res = new BigInteger(cleaned.substring(0, len - 1), 16);\r
+ else if (cleaned.startsWith("0b"))\r
+ res = new BigInteger(cleaned.substring(2), 2);\r
+ else if (cleaned.endsWith("b"))\r
+ res = new BigInteger(cleaned.substring(2), 2);\r
+ else if (cleaned.endsWith("q"))\r
+ res = new BigInteger(cleaned.substring(0, len - 1), 8);\r
+ else\r
+ res = new BigInteger(cleaned);\r
+ }\r
+ catch (NumberFormatException e)\r
+ {\r
+ throw new AsmNumberFormatException(e, "Error parsing %s: no valid integer format", s);\r
+ }\r
+ return bigIntToBitVector(res);\r
+ }\r
+\r
+ BitVector bigIntToBitVector(BigInteger bi) throws AsmNumberFormatException\r
+ {\r
+ int bitLength = bi.bitLength() - (bi.signum() - 1) / 2;\r
+ if (bitLength > size)\r
+ throw new AsmNumberFormatException("Error parsing %s: bit count %d exceeds size %d", bi, bitLength, size);\r
+ BitVectorMutator bvm = BitVectorMutator.ofLength(size);\r
+ for (int i = 0; i < size; i++)\r
+ bvm.setLSBit(i, Bit.of(bi.testBit(i)));\r
+ return bvm.toBitVector();\r
+ }\r
+\r
+ public static void main(String[] args) throws AsmNumberFormatException\r
+ {\r
+ AsmIntegerOperand aio = new AsmIntegerOperand(4);\r
+ System.out.println(aio.parse("0"));\r
+ System.out.println(aio.parse("1"));\r
+ System.out.println(aio.parse("2"));\r
+ System.out.println(aio.parse("3"));\r
+ System.out.println(aio.parse("4"));\r
+ System.out.println(aio.parse("5"));\r
+ System.out.println(aio.parse("6"));\r
+ System.out.println(aio.parse("7"));\r
+ System.out.println(aio.parse("8"));\r
+ System.out.println(aio.parse("9"));\r
+ System.out.println(aio.parse("10"));\r
+ System.out.println(aio.parse("11"));\r
+ System.out.println(aio.parse("12"));\r
+ System.out.println(aio.parse("13"));\r
+ System.out.println(aio.parse("14"));\r
+ System.out.println(aio.parse("15"));\r
+// System.out.println(aio.parse("16"));\r
+ System.out.println(aio.parse("-0"));\r
+ System.out.println(aio.parse("-1"));\r
+ System.out.println(aio.parse("-2"));\r
+ System.out.println(aio.parse("-3"));\r
+ System.out.println(aio.parse("-4"));\r
+ System.out.println(aio.parse("-5"));\r
+ System.out.println(aio.parse("-6"));\r
+ System.out.println(aio.parse("-7"));\r
+ System.out.println(aio.parse("-8"));\r
+// System.out.println(aio.parse("-9"));\r
+ }\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa;\r
+\r
+import java.util.Objects;\r
+\r
+public final class AsmLabel implements AsmElement\r
+{\r
+ private final String name;\r
+ private AsmInstruction inst;\r
+\r
+ public AsmLabel(String name)\r
+ {\r
+ this.name = Objects.requireNonNull(name);\r
+ }\r
+\r
+ public String getName()\r
+ {\r
+ return name;\r
+ }\r
+\r
+ public void setInst(AsmInstruction inst)\r
+ {\r
+ if (inst != null)\r
+ throw new IllegalStateException("Instrution already set for " + name);\r
+ this.inst = inst;\r
+ }\r
+\r
+ @Override\r
+ public String toString()\r
+ {\r
+ return name + ":";\r
+ }\r
+\r
+ @Override\r
+ public int hashCode()\r
+ {\r
+ return Objects.hash(inst, name);\r
+ }\r
+\r
+ @Override\r
+ public boolean equals(Object obj)\r
+ {\r
+ if (this == obj)\r
+ return true;\r
+ if (!(obj instanceof AsmLabel))\r
+ return false;\r
+ AsmLabel other = (AsmLabel) obj;\r
+ return Objects.equals(inst, other.inst) && Objects.equals(name, other.name);\r
+ }\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa;\r
+\r
+import net.mograsim.logic.core.types.BitVector;\r
+import net.mograsim.machine.isa.types.AsmException;\r
+\r
+public interface AsmOperand\r
+{\r
+ int getSize();\r
+\r
+ BitVector parse(String s) throws AsmException;\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa;\r
+\r
+import java.util.List;\r
+import java.util.Objects;\r
+import java.util.stream.Collectors;\r
+\r
+public final class AsmOperands\r
+{\r
+ private final List<AsmOperand> operands;\r
+\r
+ public AsmOperands(List<AsmOperand> operands)\r
+ {\r
+ this.operands = List.copyOf(Objects.requireNonNull(operands));\r
+ }\r
+\r
+ public List<AsmOperand> getOperands()\r
+ {\r
+ return operands;\r
+ }\r
+\r
+ @Override\r
+ public int hashCode()\r
+ {\r
+ return operands.hashCode();\r
+ }\r
+\r
+ @Override\r
+ public boolean equals(Object obj)\r
+ {\r
+ if (this == obj)\r
+ return true;\r
+ if (!(obj instanceof AsmOperands))\r
+ return false;\r
+ AsmOperands other = (AsmOperands) obj;\r
+ return operands.equals(other.operands);\r
+ }\r
+\r
+ @Override\r
+ public String toString()\r
+ {\r
+ return operands.stream().map(AsmOperand::toString).collect(Collectors.joining(", "));\r
+ }\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa;\r
+\r
+import java.util.Objects;\r
+\r
+public final class AsmOperation\r
+{\r
+ private final String mnemonic;\r
+\r
+ public AsmOperation(String mnemonic)\r
+ {\r
+ this.mnemonic = Objects.requireNonNull(mnemonic.toLowerCase());\r
+ }\r
+\r
+ public String getMnemonic()\r
+ {\r
+ return mnemonic;\r
+ }\r
+\r
+ @Override\r
+ public String toString()\r
+ {\r
+ return getMnemonic();\r
+ }\r
+\r
+ @Override\r
+ public int hashCode()\r
+ {\r
+ return mnemonic.hashCode();\r
+ }\r
+\r
+ @Override\r
+ public boolean equals(Object obj)\r
+ {\r
+ if (this == obj)\r
+ return true;\r
+ if (!(obj instanceof AsmOperation))\r
+ return false;\r
+ AsmOperation other = (AsmOperation) obj;\r
+ return mnemonic.equals(other.mnemonic);\r
+ }\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa;\r
+\r
+public class NumericOperand\r
+{\r
+\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa.types;\r
+\r
+public class AsmException extends Exception\r
+{\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public AsmException()\r
+ {\r
+ super();\r
+ }\r
+\r
+ public AsmException(Throwable cause, String message, boolean enableSuppression, boolean writableStackTrace)\r
+ {\r
+ super(message, cause, enableSuppression, writableStackTrace);\r
+ }\r
+\r
+ public AsmException(Throwable cause, String formatString, Object... formatArgs)\r
+ {\r
+ super(String.format(formatString, formatArgs), cause);\r
+ }\r
+\r
+ public AsmException(String formatString, Object... formatArgs)\r
+ {\r
+ super(String.format(formatString, formatArgs));\r
+ }\r
+\r
+ public AsmException(Throwable cause)\r
+ {\r
+ super(cause);\r
+ }\r
+\r
+}\r
--- /dev/null
+package net.mograsim.machine.isa.types;\r
+\r
+public class AsmNumberFormatException extends AsmException\r
+{\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public AsmNumberFormatException(Exception cause, String message, Object... formatArgs)\r
+ {\r
+ super(cause, message, formatArgs);\r
+ }\r
+\r
+ public AsmNumberFormatException(String message, Object... formatArgs)\r
+ {\r
+ super(message, formatArgs);\r
+ }\r
+}\r