--- /dev/null
+import com.sun.electric.plugins.menus.ScanChainXML;
+
+/*
+ * Create a ScanChainXML object
+ */
+
+import com.sun.electric.tool.user.menus.FileMenu;
+import com.sun.electric.tool.user.menus.FileMenu.ReadLibrary;
+import com.sun.electric.tool.simulation.Simulation;
+import com.sun.electric.tool.io.output.Output;
+import com.sun.electric.tool.io.FileType;
+import com.sun.electric.database.hierarchy.EDatabase;
+import com.sun.electric.database.text.TextUtils;
+import com.sun.electric.tool.Job;
+import java.lang.Thread;
+import java.net.URL;
+import com.sun.electric.database.variable.EvalJavaBsh;
+import com.sun.electric.database.hierarchy.View;
+import com.sun.electric.tool.simulation.Simulation;
+import com.sun.electric.tool.io.output.Output;
+import com.sun.electric.database.hierarchy.EDatabase;
+import com.sun.electric.database.hierarchy.View;
+
+ String topLevelCell = "fakeMarinaPadframe";
+ String topLevelLibrary = "aMarinaM";
+ String projectName = "marina";
+
+ Simulation.setVerilogStopAtStandardCells(false);
+
+ for (Library lib : EDatabase.clientDatabase().getLibraries()) {
+ for (Cell c : lib.getCells()) {
+ if (c.getName().equals(topLevelCell) && c.getView()==View.SCHEMATIC) {
+ Output.exportCellCommand(c, null, projectName+".v", FileType.VERILOG, null);
+ Output.exportCellCommand(c, null, projectName+".schematic-parasitics.spi", FileType.SPICE, null);
+ }
+ }
+ }
+
+ ScanChainXML gen = new ScanChainXML();
+
+ // Add all the scan chain elements: name, access, clears,
+ // scan in port name, scan out port name,
+ // (optional:) data out port name (may be "" or null),
+ // data out bar port name (may be "" or null).
+ // Both data out and data out bar must be specified or left out.
+
+ //gen.addScanChainElement("scanK", "scanCellKh", "R", "-", "sin", "sout", "din[1](R)", "");
+ gen.addScanChainElement("countersL", "cntScnOne", "RW", "-", "sin", "out", "out(R)", "latch2in@0.dataBar(WI)");
+
+ gen.addScanChainElement("scanM", "scanCellE", "RW", "-", "sin", "sout", "dIn[1](R)", "latch2in@0.dataBar(WI)");
+ gen.addScanChainElement("scanM", "scanCellF", "RW", "L", "sin", "sout", "dout[1](R)", "latch2in@1.dataBar(WI)");
+ gen.addScanChainElement("scanM", "scanCellFtaller", "RW", "L", "sin", "sout", "dout[1](R)", "latch2in@1.dataBar(WI)");
+
+ // Add all the pass through elements: these pass scan data through,
+ // like inverters or buffers
+
+ gen.addPassThroughCell("scanM", "scanAmp", "in[1]", "out[1]");
+
+ // Define the jtag controller by it's library, cell name,
+ // and the number of instruction register bits
+
+ gen.setJtagController("jtagController", "jtagCentral{sch}", 8, "TDI", "TDO");
+
+ // Chip-specific configuration
+
+ gen.setChipName(projectName);
+
+ gen.setOutput(projectName+".xml");
+ gen.addJtagPort(0, "leaf0[1]", "leaf0[8]", "compare_report");
+ gen.addJtagPort(1, "leaf1[1]", "leaf1[8]", "compare_control");
+ gen.addJtagPort(2, "leaf2[1]", "leaf2[8]", "compare_data");
+ gen.addJtagPort(3, "leaf3[1]", "leaf3[8]", "ivan_report");
+ gen.addJtagPort(4, "leaf4[1]", "leaf4[8]", "ivan_data");
+ gen.addJtagPort(5, "leaf5[1]", "leaf5[8]", "ivan_control");
+ gen.addJtagPort(6, "leaf6[1]", "leaf6[8]", "marina_report");
+ gen.addJtagPort(7, "leaf7[1]", "leaf7[8]", "marina_control");
+ gen.addJtagPort(8, "leaf8[1]", "leaf8[8]", "marina_data");
+ gen.addJtagPort(12, "leaf12[1]", "leaf12[8]", "duke");
+
+ gen.start(topLevelLibrary, topLevelCell+"{sch}");
+
+