public override IEnumerable <bool[]> GetBitArrayEnumerator()
 {
     while (true)
     {
         yield return(DataConvertorUtils.ToBitArray((int)NextValue(), SizeInBits));
     }
 }
Exemple #2
0
        SortedList <ulong, bool[]> IGeneratorDataFill <bool[]> .InsertValues(ulong StartTime, ulong EndTime)
        {
            SortedList <UInt64, bool[]> data = new SortedList <ulong, bool[]>();

            data.Add(StartTime, DataConvertorUtils.ToBitArray(IntegerValue, 64));
            return(data);
        }
Exemple #3
0
        /// <summary>
        /// Создание объекта STD_LOGIC_VECTOR_VALUE из числа
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static STD_LOGIC_VECTOR_VALUE CreateSTD_LOGIC_VECTOR_VALUE(Int64 value, int size)
        {
            List <AbstractValue> elements = new List <AbstractValue>();

            bool[] booleanData = DataConvertorUtils.ToBitArray(value, size);

            foreach (bool b in booleanData)
            {
                elements.Add(new STD_LOGIC_VALUE(b ? VHDL.builtin.StdLogic1164.STD_LOGIC_1 : VHDL.builtin.StdLogic1164.STD_LOGIC_0));
            }

            return(new STD_LOGIC_VECTOR_VALUE(elements));
        }
        /// <summary>
        /// Создание объекта BIT_VECTOR_VALUE из числа
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static BIT_VECTOR_VALUE CreateBIT_VECTOR_VALUE(Int64 value, int size)
        {
            List <AbstractValue> elements = new List <AbstractValue>();

            bool[] booleanData = DataConvertorUtils.ToBitArray(value, size);

            foreach (bool b in booleanData)
            {
                elements.Add(new BIT_VALUE(b ? VHDL.builtin.Standard.BIT_1 : VHDL.builtin.Standard.BIT_0));
            }

            return(new BIT_VECTOR_VALUE(elements));
        }
        private bool GenerateCounter()
        {
            Counter counter = null;

            if (RadiobuttonCounterBinary.IsChecked == true)
            {
                counter = new BinaryCounter();
            }
            if (RadiobuttonCounterGray.IsChecked == true)
            {
                counter = new GrayCounter();
            }
            if (RadiobuttonCounterJohnson.IsChecked == true)
            {
                counter = new JohnsonCounter();
            }
            if (RadiobuttonCounterOneHot.IsChecked == true)
            {
                counter = new Circular1();
            }
            if (RadiobuttonCounterOneZero.IsChecked == true)
            {
                counter = new Circular0();
            }

            counter.IsUpDirection = RadiobuttonCounterUp.IsChecked == true;
            counter.StepCount     = (uint)TextBoxCounterChangeBy.GetIntegerValue();
            counter.CurrentValue  = DataConvertorUtils.ToBitArray(TextBoxCounterStartValue.GetIntegerValue(), (int)genSettings.Size);
            if (counter.CurrentValue == null)
            {
                MessageBox.Show(string.Format("You have errors, when enter StartValue for {0}. It must be one \'0\' and other \'1\'(Circular0) or one \'1\' and other \'0\'(Circular1)", counter.ToString()), "Error!");
                return(false);
            }

            if (timeUnitUserControlClock.TimeInterval.GetTimeUnitInFS() == 0)
            {
                MessageBox.Show("Time must be non zero", "Error!", MessageBoxButton.OK);
                return(false);
            }

            counter.TimeStep = timeUnitUserControlCounter.TimeInterval;

            generator = counter;
            return(true);
        }