Exemple #1
0
 /// <summary>
 /// Empty PRAM machine model
 /// </summary>
 public PRAMMachineModel()
 {
     this.processors = new List <ProcessorModel>();
     this.pram       = new PRAMModel();
     this.state      = PRAMState.Reading;
     this.tickCount  = 0;
     this.isStopped  = false;
 }
Exemple #2
0
 public void updateMemoryCellsGrid(PRAMModel dataRows)
 {
     foreach (KeyValuePair <string, List <dynamic> > kvp in dataRows)
     {
         for (int i = 0; i < kvp.Value.Count; i++)
         {
             memoryRows[kvp.Key][i].Data = dataRows[kvp.Key][i];
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Full model built from list of the machines processors, its memory, tick count and state
 /// </summary>
 /// <param name="processors">List of models of the processors from the machine</param>
 /// <param name="pram">Model of the machines memory</param>
 /// <param name="tickCount">Global clock ticks elapsed since the start of the machine</param>
 /// <param name="state">Current machine state in the work cycle</param>
 /// <param name="actualReadCount">Curent number of read requests</param>
 /// <param name="actualWriteCount">Curent number of write requests</param>
 public PRAMMachineModel(List <ProcessorModel> processors, PRAMModel pram, int tickCount,
                         PRAMState state, bool isStopped, int actualReadCount, int actualWriteCount)
 {
     this.processors       = processors;
     this.pram             = pram;
     this.tickCount        = tickCount;
     this.state            = state;
     this.isStopped        = isStopped;
     this.actualReadCount  = actualReadCount;
     this.actualWriteCount = actualWriteCount;
 }
Exemple #4
0
        public void populateMemoryCellsGrid(PRAMModel dataRows)
        {
            int rowCount = -1;

            foreach (KeyValuePair <string, List <dynamic> > kvp in dataRows)
            {
                memoryGrid.RowDefinitions.Add(new RowDefinition());
                rowCount++;
                if (memoryGrid.ColumnDefinitions.Count < 1)
                {
                    memoryGrid.ColumnDefinitions.Add(new ColumnDefinition());
                }
                Viewbox   viewBox = new Viewbox();
                TextBlock rowName = new TextBlock();
                rowName.Margin = new Thickness(7);
                rowName.Text   = kvp.Key;
                viewBox.SetValue(Grid.ColumnProperty, 0);
                viewBox.SetValue(Grid.RowProperty, rowCount);
                viewBox.VerticalAlignment   = VerticalAlignment.Center;
                viewBox.HorizontalAlignment = HorizontalAlignment.Center;
                viewBox.Child = rowName;
                memoryGrid.Children.Add(viewBox);
                memoryRows[kvp.Key] = new List <MemoryCellView>();
                while (memoryGrid.ColumnDefinitions.Count < kvp.Value.Count + 1)
                {
                    memoryGrid.ColumnDefinitions.Add(new ColumnDefinition());
                }

                for (int i = 0; i < kvp.Value.Count; i++)
                {
                    MemoryCellView memoryCellView = new MemoryCellView();
                    memoryCellView.Data = kvp.Value[i];
                    memoryCellView.SetValue(Grid.ColumnProperty, i + 1);
                    memoryCellView.SetValue(Grid.RowProperty, rowCount);
                    memoryGrid.Children.Add(memoryCellView);

                    memoryRows[kvp.Key].Add(memoryCellView);
                }
            }
        }