Esempio n. 1
0
 /// <summary>
 /// Method for create the 16 ram block and initialize with cero
 /// </summary>
 private void InitializeRam()
 {
     memoryRAM = new List <RAMBlock>();
     for (int i = 0; i < NUMBLOCKS; i++)
     {
         RAMBlock block = new RAMBlock()
         {
             Address = Convert.ToString(i, 2).PadLeft(4, '0'),
             Value   = 0
         };
         //log.Info(Convert.ToInt32(block.Address, 2));
         //log.Info(block.Address);
         memoryRAM.Add(block);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Method for get the value for an specific memory addres
        /// </summary>
        /// <param name="addres"></param>
        /// <returns></returns>
        public string GetValue(string address)
        {
            string result;

            try
            {
                RAMBlock temp = memoryRAM.Where(x => x.Address == address).SingleOrDefault();
                result = temp.Value.ToString();
            }
            catch (Exception e)
            {
                log.Error("RAM, GetValue, Error No existe la dirección de Memoria " + e.Message.ToString());
                result = Constants.NO_DATA;
            }
            return(result);
        }