Added machine plugin project to repository
[Mograsim.git] / net.mograsim.machine / src / net / mograsim / machine / Register.java
1 package net.mograsim.machine;\r
2 \r
3 import java.util.Set;\r
4 \r
5 /**\r
6  * A register in a machine is defined by this interface. A hardware register may\r
7  * have {@link Register#names() named sub-registers}.\r
8  *\r
9  *\r
10  * @author Christian Femers\r
11  *\r
12  */\r
13 public interface Register {\r
14         /**\r
15          * The unique identifier of the register. This does not have to be the display\r
16          * name or name in the assembly language.\r
17          * \r
18          * @return the registers id as case sensitive String\r
19          * @author Christian Femers\r
20          */\r
21         String id();\r
22 \r
23         /**\r
24          * The name(s) of this register. This is the displayed name and the name used in\r
25          * the assembly language. All names of all registers must be case-insensitive\r
26          * unique. A register can have multiple names if these names address different\r
27          * regions (but still have a common hardware structure), e.g. <code>EAX</code>,\r
28          * <code>AX</code>, <code>AL</code>, <code>AH</code>.\r
29          * \r
30          * @return all the names of regions addressing this register, must be\r
31          *         case-insensitive.\r
32          * @author Christian Femers\r
33          */\r
34         Set<String> names();\r
35 \r
36         /**\r
37          * Returns the complete width in bits of the underlying hardware structure the\r
38          * register and possible sub-registers are part of.\r
39          * \r
40          * @param name the name of the register\r
41          * @return the width of the (sub-)register in bits.\r
42          * \r
43          * @see #names()\r
44          * @author Christian Femers\r
45          */\r
46         int getWidth();\r
47 \r
48         /**\r
49          * Returns the width in bits of the register or a named part of it.\r
50          * \r
51          * @param name the name of the register\r
52          * @return the width of the (sub-)register in bits.\r
53          * \r
54          * @see #names()\r
55          * @author Christian Femers\r
56          */\r
57         int getWidth(String name);\r
58 }\r