public List <DFFModule> Import(VerilogFile vFile) { inDffs = new List <DFFModule>(); foreach (KeyValuePair <string, VerilogModule> pair in vFile.DeclaredModules) { DFFModule dff = new DFFModule(pair.Value.Name, "clk", "d", "q"); inDffs.Add(dff); this.checkedListBox1.Items.Add(dff); } DialogResult dr = this.ShowDialog(); return(outDffs); }
public void AddDffToLibrary(DFFModule dffType) { this.dffLibrary.Add(dffType.typeName, dffType); }
public DffInstance(DFFModule dffType) { this.typeName = dffType.typeName; }
private DffInstance ParseDffInstance(StringTokenizer tknzr, Token possibleParameter, DFFModule dffType) { DffInstance dff = new DffInstance(dffType); Token currToken = tknzr.Next(); dff.ParameterBegin = possibleParameter; dff.ParametersExist = false; dff.ParametersNamed = false; dff.ParamsInParens = false; if (currToken.Value == "#") { dff.ParametersExist = true; dff.ParameterBegin = currToken; currToken = tknzr.Next(); if (currToken.Value == "(") { dff.ParamsInParens = true; dff.ParameterBegin = currToken; Token tempParamList; string paramValue = tknzr.ParseToCloseParenthesis(out tempParamList); dff.ParameterList = tempParamList; dff.ParameterEnd = tempParamList; try { dff.Size = Convert.ToInt32(paramValue); } catch (FormatException) { if (paramValue.StartsWith("`")) { // TODO: Deal with `DEFINE'd values dff.Size = 1; } else if (paramValue.StartsWith(".")) { dff.ParametersNamed = true; } else { dff.ParametersExist = true; dff.IsParameterized = true; dff.Parameter = paramValue; //throw new InvalidDataException("Wah. I don't get it. '" + currToken.Value + "' isn't a number."); } } } else { dff.ParameterEnd = currToken; try { dff.Size = Convert.ToInt32(currToken.Value); // In case they use the weird '#12' notation instead of '#(12)' } catch (FormatException) { if (currToken.Value == "`") { // TODO: Deal with `DEFINE'd values dff.Size = 1; } else { throw new InvalidDataException("Wah. I don't get it. '" + currToken.Value + "' isn't a number."); } } } //tknzr.Next(); currToken = tknzr.Next(); dff.InstanceName = currToken.Value; } else { dff.Size = 1; dff.InstanceName = currToken.Value; } while (currToken.Value != "(") { currToken = tknzr.Next(); } //currToken = tknzr.Next(); dff.PortList = currToken; while (dff.ClockPort == null || dff.DPort == null || dff.QPort == null) { currToken = tknzr.Next(); string word = currToken.Value; if (word == ";") { break; } if (word == ".") { currToken = tknzr.Next(); switch (currToken.Value) { case "clk": { tknzr.Next(); Token tempToken; dff.ClockPort = tknzr.ParseToCloseParenthesis(out tempToken); break; } case "q": { tknzr.Next(); Token tempToken; dff.QPort = tknzr.ParseToCloseParenthesis(out tempToken); break; } case "din": { tknzr.Next(); Token tempToken; dff.DPort = tknzr.ParseToCloseParenthesis(out tempToken); break; } } } } while (currToken.Value != ";" && currToken.Kind != TokenKind.EOF) { currToken = tknzr.Next(); } return(dff); }