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