/// <summary> /// Fill the target and the source registeries or memory that the user can choose /// </summary> /// <param name="function">The function that we want to restrict some registery or memory access</param> /// <param name="editCollection">If true will update the edit collections</param> protected void FillTargetAndSourceRegisteries(FunctionsTypes function) { UpdateListOnFunctionChange(ref mTargetRegisteries, ref mSourceRegisteries, ref mCanChooseSource02, function); RaisePropertyChanged(nameof(TargetRegisters)); RaisePropertyChanged(nameof(SourceRegisteries)); RaisePropertyChanged(nameof(CanChooseSource02)); }
/// <summary> /// Updates the lists sent to it based on the value of the function that is sent to it /// </summary> /// <param name="targetRegistries"></param> /// <param name="sourceRegistries"></param> /// <param name="canChooseSource02"></param> /// <param name="function"></param> protected void UpdateListOnFunctionChange( ref ObservableCollection <string> targetRegistries, ref ObservableCollection <string> sourceRegistries, ref bool canChooseSource02, FunctionsTypes function) { targetRegistries = new ObservableCollection <string>(); sourceRegistries = new ObservableCollection <string>(); var RegisteryAndMemoryList = Enum.GetValues(typeof(RegisteriesAndMemory)); foreach (var item in RegisteryAndMemoryList) { var stringValue = Enum.GetName(typeof(RegisteriesAndMemory), item); if (function == FunctionsTypes.LD) { //If it is a registery spot add it to target if ((int)item < 31) { targetRegistries.Add(stringValue); } else { sourceRegistries.Add(stringValue); } } else if (function == FunctionsTypes.SD) { //If it is a memory add it to target if ((int)item >= 31) { targetRegistries.Add(stringValue); } else { sourceRegistries.Add(stringValue); } } else { targetRegistries.Add(stringValue); //If it is a registery spot add it to target if ((int)item < 31) { sourceRegistries.Add(stringValue); } } } //Disable source02 if the function is either load or store if (function == FunctionsTypes.LD || function == FunctionsTypes.SD || function == FunctionsTypes.ADDi || function == FunctionsTypes.SUBi) { canChooseSource02 = false; } else { canChooseSource02 = true; } RaisePropertyChanged(nameof(CanChooseSource02)); }
/// <summary> /// Constructer to initialize the properties /// </summary> /// <param name="id">The order ID of the instruction that is shown to the user</param> /// <param name="name">The name of the operation</param> /// <param name="targetRegistry">The target registry to store the value in</param> /// <param name="sourceRegistry01">The first source registry to get the value from</param> /// <param name="SourceRegistery02">The second source registry to get the value from</param> public InstructionModel(int id, FunctionsTypes name, string targetRegistry, string sourceRegistry01, string SourceRegistery02 = null) { this.ID = id; this.Name = name; this.TargetRegistery = targetRegistry; this.SourceRegistery01 = sourceRegistry01; this.SourceRegistery02 = SourceRegistery02; }
/// <summary> /// Constructer to initialize the properties /// </summary> /// <param name="id">The order ID of the instruction that is shown to the user</param> /// <param name="name">The name of the operation</param> /// <param name="targetRegistry">The target registry to store the value in</param> /// <param name="sourceRegistry01">The first source registry to get the value from</param> /// <param name="sourceRegistery02">The second source registry to get the value from</param> /// <param name="issueCycle">The Clock cycle that the operation was issued or summend</param> /// <param name="readCycle">The clock cylce that the operation was read on</param> /// <param name="executeCycle">The Clock cycle that the operation started executing</param> /// <param name="writeBackCycle">The clock cycle that the operation finished executing and is writing the result back</param> public InstructionWithStatusModel(int id, FunctionsTypes name, string targetRegistry, string sourceRegistry01, string sourceRegistery02 = null, int?issueCycle = null, int?readCycle = null, int?executeCycle = null, int?writeBackCycle = null) { this.ID = id; this.Name = name; this.TargetRegistery = targetRegistry; this.SourceRegistery01 = sourceRegistry01; this.SourceRegistery02 = sourceRegistery02; this.IssueCycle = issueCycle; this.ReadCycle = readCycle; this.ExecuteCompletedCycle = executeCycle; this.WriteBackCycle = writeBackCycle; }
/// <summary> /// Fill the target and the source registeries or memory that the user can choose /// </summary> /// <param name="function">The function that we want to restrict some registery or memory access</param> /// <param name="editCollection">If true will update the edit collections</param> protected void FillTargetAndSourceRegisteries(FunctionsTypes function, bool editCollection = false) { if (!editCollection) { UpdateListOnFunctionChange(ref mTargetRegistries, ref mSourceRegisteries, ref mCanChooseSource02, function); RaisePropertyChanged(nameof(TargetRegistries)); RaisePropertyChanged(nameof(SourceRegisteries)); RaisePropertyChanged(nameof(CanChooseSource02)); } else { UpdateListOnFunctionChange(ref mEditTargetRegistries, ref mEditSourceRegisteries, ref mCanChooseSource02OnEdit, function); RaisePropertyChanged(nameof(EditTargetRegistries)); RaisePropertyChanged(nameof(EditSourceRegisteries)); RaisePropertyChanged(nameof(CanChooseSource02OnEdit)); } }