예제 #1
0
 public Instruction(Instruction i)
 {
     InAdrA = i.InAdrA;
     HyAdrB = i.HyAdrB;
     OutAdr = i.OutAdr;
     Instuct = i.Instuct;
 }
예제 #2
0
 public Instruction(int MemSize, int InputSize, int OutputSize)
 {
     InAdrA = RandomAddress(true, true, false, MemSize, InputSize, OutputSize);
     HyAdrB = RandomAddress(true, true, false, MemSize, InputSize, OutputSize);
     OutAdr = RandomAddress(true, false, true, MemSize, InputSize, OutputSize);
     Instuct = Calcuations.GetRandom();
 }
예제 #3
0
        public static MemAdr RandomAddress(bool CanBeMemory, bool CanBeInput, bool CanBeOutput, int MemSize, int InputSize, int OutputSize)
        {
            MemAdr Ve = new MemAdr();
            int PossibleCombos = CountPossibleCombos(CanBeMemory, CanBeInput, CanBeOutput);
            ChooseTypeOfAddr(ref CanBeMemory, ref CanBeInput, ref CanBeOutput, PossibleCombos);
            GetAdrFromType(CanBeMemory, CanBeInput, MemSize, InputSize, OutputSize, Ve);

            return Ve;
        }
예제 #4
0
 public int ConvertMemAdrToInt(MemAdr Adr, int MemSize,int InputSize)
 {
     int TBR = Adr.P;
     if (Adr.T == 1)
     {
         TBR += MemSize;
     }
     else if (Adr.T == 2)
     {
         TBR += MemSize + InputSize;
     }
     return TBR;
 }
예제 #5
0
 private static void GetAdrFromType(bool CanBeMemory, bool CanBeInput, int MemSize, int InputSize, int OutputSize, MemAdr Ve)
 {
     if (CanBeMemory)
     {
         Ve.T = 0;
         Ve.P = BetterRandom.R.Next(MemSize);
     }
     else if (CanBeInput)
     {
         Ve.T = 1;
         Ve.P = BetterRandom.R.Next(InputSize);
     }
     else
     {
         Ve.T = 2;
         Ve.P = BetterRandom.R.Next(OutputSize);
     }
 }