예제 #1
0
 public RegisterReference(RegisterLocation location, RegisterType type, int index, ComplexRegisterPart part)
 {
     this.RegisterLocation    = location;
     this.RegisterType        = type;
     this.RegisterIndex       = index;
     this.ComplexRegisterPart = part;
     this.JumpLabel           = null;
 }
예제 #2
0
 public RegisterReference(int jumpLine, string label)
 {
     this.ComplexRegisterPart = ComplexRegisterPart.Full;
     this.RegisterLocation    = RegisterLocation.Input;
     this.RegisterType        = RegisterType.Integer;
     this.RegisterIndex       = jumpLine;
     this.JumpLabel           = label;
 }
예제 #3
0
        public RegisterReference(string compact)
        {
            string name = compact.ToLowerInvariant().Trim(' ', '\t');

            this.ComplexRegisterPart = ComplexRegisterPart.Full;

            foreach (Pair pair in registersComplexParts)
            {
                if (name.EndsWith(pair.Key))
                {
                    ComplexRegisterPart currentPart;
                    if (Enum.TryParse(pair.Member, out currentPart))
                    {
                        this.ComplexRegisterPart = currentPart;
                    }
                    name = name.Remove(name.Length - pair.Key.Length);
                    break;
                }
            }
            while (name.Length > 1 && char.IsDigit(name[name.Length - 1]))
            {
                name = name.Remove(name.Length - 1);
            }
            //ii, ir, ic, i, r, c, oi, or, oc
            switch (name)
            {
            case "ii": this.RegisterLocation = RegisterLocation.Input; this.RegisterType = RegisterType.Integer; break;

            case "ir": this.RegisterLocation = RegisterLocation.Input; this.RegisterType = RegisterType.Real; break;

            case "ic": this.RegisterLocation = RegisterLocation.Input; this.RegisterType = RegisterType.Complex; break;

            case "i": this.RegisterLocation = RegisterLocation.Work; this.RegisterType = RegisterType.Integer; break;

            case "r": this.RegisterLocation = RegisterLocation.Work; this.RegisterType = RegisterType.Real; break;

            case "c": this.RegisterLocation = RegisterLocation.Work; this.RegisterType = RegisterType.Complex; break;

            case "oi": this.RegisterLocation = RegisterLocation.Output; this.RegisterType = RegisterType.Integer; break;

            case "or": this.RegisterLocation = RegisterLocation.Output; this.RegisterType = RegisterType.Real; break;

            case "oc": this.RegisterLocation = RegisterLocation.Output; this.RegisterType = RegisterType.Complex; break;

            default: throw new InvalidOperationException();
            }
            this.RegisterIndex = int.Parse(compact.Substring(name.Length));
            this.JumpLabel     = null;
        }