/// <summary> /// Returns a string representing the cycles and the bus output /// </summary> /// <param name="format">Format for output</param> /// <returns></returns> public string Bus2Out(DFBValueFormat format, bool showAllCycles) { var sb = new StringBuilder(); for (int i = 0; i < stateFrames.Count; i++) { string value = null; switch (format) { case DFBValueFormat.Hex: value = stateFrames[i].Hold_B.OutputHex.FormattedValue; break; case DFBValueFormat.Int: value = stateFrames[i].Hold_B.OutputInt.FormattedValue; break; case DFBValueFormat.q23Decimal: value = stateFrames[i].Hold_B.OutputDFBDec.FormattedValue; break; } if (!showAllCycles && string.IsNullOrEmpty(value)) { continue; } sb.AppendFormat("{0:6}\t{1}\n", i.ToString().PadLeft(4), value); } return(sb.ToString()); }
public DFBState( Wrapper dfbSimulatorWrapper, DFBValueFormat valueFormat) { DFBState.dfbSimulatorWrapper = dfbSimulatorWrapper; ValueFormat = valueFormat; stateFrames = new List <DFBStateFrame>(); codeStore = new CodeStoreModel(DFBState.dfbSimulatorWrapper); // Build list of states and instructions codeStates = new List <CodeState>(); codeStates.AddRange(CodeStoreModel.InstructionStateList.Select(x => new CodeState(x))); }
/// <summary> /// Converts the value tot he specified representation /// </summary> /// <param name="numberOfPlaces">Number of characters to show in the output</param> /// <param name="value">Value to convert</param> /// <param name="valueFormat">Format to convert to</param> /// <returns></returns> private static string Formatter(int numberOfPlaces, long?value, DFBValueFormat valueFormat) { if (!value.HasValue) { return(""); } // Build string based on format identifier switch (valueFormat) { case DFBValueFormat.Hex: return(SignedInt32_To_Hex((int)value.Value, numberOfPlaces)); case DFBValueFormat.q23Decimal: return(SignedInt32_To_DFB_Q23((int)value.Value).ToString("N7")); default: throw new NotImplementedException(string.Format("DFBValueFormat: {0}", valueFormat)); } }