Skip to content

Commit

Permalink
added include_component_info boolean xml output parm
Browse files Browse the repository at this point in the history
if true, adds a component tag containing component id path for each
instance that has a non-anonymous component id. Addresses a subset of
issue #52 - allows instances derived from the same component to be
identified.
  • Loading branch information
Scott Nellenbach committed Dec 18, 2018
1 parent 51e096a commit 00e5c55
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions example.parms
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ output uvmregs {
// xml output parameters
output xml {
include_field_hw_info = true // include field hw characteristics
include_component_info = false // include component type info in xml output for each instance
}

// model annotation commands
Expand Down
2 changes: 1 addition & 1 deletion src/ordt/extract/Ordt.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

public class Ordt {

private static String version = "181108.01";
private static String version = "181218.01";
private static DebugController debug = new MyDebugController(); // override design annotations, input/output files

public enum InputType { RDL, JSPEC };
Expand Down
19 changes: 19 additions & 0 deletions src/ordt/output/othertypes/XmlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import ordt.extract.RegNumber;
import ordt.extract.RegNumber.NumBase;
import ordt.extract.RegNumber.NumFormat;
import ordt.extract.model.ModComponent;
import ordt.extract.model.ModEnum;
import ordt.extract.model.ModEnumElement;
import ordt.extract.model.ModInstance;
import ordt.output.FieldProperties;
import ordt.output.OutputBuilder;
import ordt.output.RhsReference;
Expand Down Expand Up @@ -55,6 +57,7 @@ public void addField() {
textName = textName.substring(0, 255);
}
addXmlElement("shorttext", textName);
if (ExtParameters.xmlIncludeComponentInfo()) addComponentPath(fieldProperties);
addXmlElement("access", getFieldAccessType());
if (fieldProperties.isSinglePulse()) addXmlElement("singlepulse", "");
if (ExtParameters.xmlIncludeFieldHwInfo()) addHwInfo(); // include field hw info
Expand Down Expand Up @@ -109,6 +112,7 @@ public void addRegister() {
textName = textName.substring(0, 255);
}
addXmlElement("shorttext", textName);
if (ExtParameters.xmlIncludeComponentInfo()) addComponentPath(regProperties);
addXmlElement("baseaddr", regProperties.getFullBaseAddress().toString());
addXmlElement("width", regProperties.getRegWidth().toString());
if (regProperties.isReplicated()) {
Expand Down Expand Up @@ -167,6 +171,7 @@ public void addRegSet() {
textName = textName.substring(0, 255);
}
addXmlElement("shorttext", textName);
if (ExtParameters.xmlIncludeComponentInfo()) addComponentPath(regSetProperties);
// address
if (regSetProperties.isRootInstance())
addXmlElement("baseaddr", ExtParameters.getPrimaryBaseAddress().toString());
Expand Down Expand Up @@ -213,6 +218,7 @@ public void addRegMap() {
textName = textName.substring(0, 255);
}
addXmlElement("shorttext", textName);
if (ExtParameters.xmlIncludeComponentInfo()) addComponentPath(regSetProperties);
if (regSetProperties.getTextDescription() != null)
addXmlElement("longtext", wrapXmlText(regSetProperties.getTextDescription()));
}
Expand All @@ -226,6 +232,19 @@ public void finishRegMap() {

//--------------------------------------------------------------------

/** if instance has a non-anonymous component type, then add its path to output */
private void addComponentPath(InstanceProperties instProperties) {
ModInstance inst = instProperties.getExtractInstance();
ModComponent comp = inst.getRegComp();
String cid = comp.getId();
// if component id is set then output path
if ((cid != null) && !cid.startsWith("aNON")) {
//System.out.println("XmlBuilder addComponentPath: cid=" + comp.getId() + ", cpath=" + comp.getFullId());
addXmlElement("component", cleanXmlText(comp.getFullId()));
}

}

/** write new element start with an attribute/value */
private void addXmlElementStart(String elemName, String attrName, String attrVal) {
outputList.add(new OutputLine(indentLvl++, "<" + elemName + " " + attrName + "=\"" + attrVal + "\">"));
Expand Down
5 changes: 5 additions & 0 deletions src/ordt/parameters/ExtParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public void set(String valStr) {

// ---- xml output defaults
initBooleanParameter("include_field_hw_info", true);
initBooleanParameter("include_component_info", false);
}

static void initBooleanParameter(String name, Boolean value) {
Expand Down Expand Up @@ -978,6 +979,10 @@ public static Boolean xmlIncludeFieldHwInfo() {
return getBooleanParameter("include_field_hw_info");
}

public static Boolean xmlIncludeComponentInfo() {
return getBooleanParameter("include_component_info");
}

/**
* @param args
*/
Expand Down
1 change: 1 addition & 0 deletions src/ordt/parse/grammars/CommonExtParms.g4
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ ext_parm_defs

xml_out_parm_assign
: 'include_field_hw_info' EQ bool
| 'include_component_info' EQ bool
;

/*
Expand Down

0 comments on commit 00e5c55

Please sign in to comment.