VHDL/Verilog support is mentioned in the documentation

This commit is contained in:
hneemann 2020-08-27 11:03:03 +02:00
parent d58b7cf1a7
commit 0bf50c38e9
46 changed files with 151 additions and 45 deletions

View File

@ -27,7 +27,8 @@ public class Add extends Node implements Element, Countable {
= new ElementTypeDescription(Add.class, input("a"), input("b"), input("c_i")) = new ElementTypeDescription(Add.class, input("a"), input("b"), input("c_i"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.BITS); .addAttribute(Keys.BITS)
.supportsHDL();
private final int bits; private final int bits;
private final ObservableValue sum; private final ObservableValue sum;

View File

@ -28,7 +28,8 @@ public class BitExtender implements Element {
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.INPUT_BITS) .addAttribute(Keys.INPUT_BITS)
.addAttribute(Keys.OUTPUT_BITS); .addAttribute(Keys.OUTPUT_BITS)
.supportsHDL();
private final ObservableValue out; private final ObservableValue out;
private final int outBits; private final int outBits;

View File

@ -31,7 +31,8 @@ public class Comparator extends Node implements Element, Countable {
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.SIGNED) .addAttribute(Keys.SIGNED)
.setShortName(""); .setShortName("")
.supportsHDL();
private final int bits; private final int bits;
private final Boolean signed; private final Boolean signed;

View File

@ -28,7 +28,8 @@ public class Mul extends Node implements Element, Countable {
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.SIGNED) .addAttribute(Keys.SIGNED)
.addAttribute(Keys.BITS); .addAttribute(Keys.BITS)
.supportsHDL();
private final ObservableValue mul; private final ObservableValue mul;
private final int bits; private final int bits;

View File

@ -27,7 +27,8 @@ public class Neg extends Node implements Element, Countable {
*/ */
public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Neg.class, input("in")) public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Neg.class, input("in"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS); .addAttribute(Keys.BITS)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;
private final int bits; private final int bits;

View File

@ -23,7 +23,8 @@ public class Sub extends Add {
= new ElementTypeDescription(Sub.class, input("a"), input("b"), input("c_i")) = new ElementTypeDescription(Sub.class, input("a"), input("b"), input("c_i"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.BITS); .addAttribute(Keys.BITS)
.supportsHDL();
/** /**
* Creates a new instance * Creates a new instance

View File

@ -84,6 +84,7 @@ public abstract class FanIn extends Node implements Element, Countable {
FanInDescription(Class<? extends Element> clazz) { FanInDescription(Class<? extends Element> clazz) {
super(clazz); super(clazz);
addAttributes(); addAttributes();
supportsHDL();
} }
private void addAttributes() { private void addAttributes() {

View File

@ -28,7 +28,8 @@ public class Not extends Node implements Element, Countable {
public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Not.class, input("in")) public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Not.class, input("in"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.WIDE_SHAPE) .addAttribute(Keys.WIDE_SHAPE)
.addAttribute(Keys.BITS); .addAttribute(Keys.BITS)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;
private final int bits; private final int bits;

View File

@ -26,6 +26,7 @@ public class ElementTypeDescription {
private ElementFactory elementFactory; private ElementFactory elementFactory;
private final PinDescriptions inputPins; private final PinDescriptions inputPins;
private final ArrayList<Key> attributeList; private final ArrayList<Key> attributeList;
private boolean supportsHDL;
/** /**
* Creates a new ElementTypeDescription * Creates a new ElementTypeDescription
@ -136,10 +137,11 @@ public class ElementTypeDescription {
public String getDescription(ElementAttributes elementAttributes) { public String getDescription(ElementAttributes elementAttributes) {
String d = Lang.getNull(langKey + "_tt"); String d = Lang.getNull(langKey + "_tt");
if (d == null) { if (d == null) {
return getTranslatedName(); d = getTranslatedName();
} else {
return d;
} }
if (supportsHDL)
d += " " + Lang.get("msg_supportsHDL");
return d;
} }
/** /**
@ -156,6 +158,23 @@ public class ElementTypeDescription {
return this; return this;
} }
/**
* Used to flag this elements as supporting hdl export
*
* @return this for chained calls
*/
public ElementTypeDescription supportsHDL() {
supportsHDL = true;
return this;
}
/**
* @return true if the element supports export to HDL.
*/
public boolean isSupportsHDL() {
return supportsHDL;
}
/** /**
* Returns the list of attributes which are used by this element. * Returns the list of attributes which are used by this element.
* *

View File

@ -40,7 +40,8 @@ public class External extends Node implements Element {
.addAttribute(Keys.EXTERNAL_OUTPUTS) .addAttribute(Keys.EXTERNAL_OUTPUTS)
.addAttribute(Keys.EXTERNAL_CODE) .addAttribute(Keys.EXTERNAL_CODE)
.addAttribute(Keys.APPLICATION_TYPE) .addAttribute(Keys.APPLICATION_TYPE)
.addAttribute(Keys.GHDL_OPTIONS); .addAttribute(Keys.GHDL_OPTIONS)
.supportsHDL();
private final Application.Type type; private final Application.Type type;
private final PortDefinition ins; private final PortDefinition ins;

View File

@ -31,7 +31,8 @@ public class FlipflopD extends Node implements Element, Countable {
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.DEFAULT) .addAttribute(Keys.DEFAULT)
.addAttribute(Keys.INVERTER_CONFIG) .addAttribute(Keys.INVERTER_CONFIG)
.addAttribute(Keys.VALUE_IS_PROBE); .addAttribute(Keys.VALUE_IS_PROBE)
.supportsHDL();
private final int bits; private final int bits;
private final boolean isProbe; private final boolean isProbe;

View File

@ -33,7 +33,8 @@ public class FlipflopDAsync extends FlipflopD {
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.DEFAULT) .addAttribute(Keys.DEFAULT)
.addAttribute(Keys.INVERTER_CONFIG) .addAttribute(Keys.INVERTER_CONFIG)
.addAttribute(Keys.VALUE_IS_PROBE); .addAttribute(Keys.VALUE_IS_PROBE)
.supportsHDL();
private ObservableValue setVal; private ObservableValue setVal;
private ObservableValue clrVal; private ObservableValue clrVal;

View File

@ -30,7 +30,8 @@ public class FlipflopJK extends FlipflopBit {
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.DEFAULT) .addAttribute(Keys.DEFAULT)
.addAttribute(Keys.INVERTER_CONFIG) .addAttribute(Keys.INVERTER_CONFIG)
.addAttribute(Keys.VALUE_IS_PROBE); .addAttribute(Keys.VALUE_IS_PROBE)
.supportsHDL();
private ObservableValue jVal; private ObservableValue jVal;
private ObservableValue kVal; private ObservableValue kVal;

View File

@ -36,7 +36,8 @@ public class FlipflopJKAsync extends FlipflopJK {
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.DEFAULT) .addAttribute(Keys.DEFAULT)
.addAttribute(Keys.INVERTER_CONFIG) .addAttribute(Keys.INVERTER_CONFIG)
.addAttribute(Keys.VALUE_IS_PROBE); .addAttribute(Keys.VALUE_IS_PROBE)
.supportsHDL();
private ObservableValue setVal; private ObservableValue setVal;
private ObservableValue clrVal; private ObservableValue clrVal;

View File

@ -27,7 +27,8 @@ public class Const implements Element {
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.VALUE) .addAttribute(Keys.VALUE)
.addAttribute(Keys.INT_FORMAT); .addAttribute(Keys.INT_FORMAT)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;

View File

@ -26,7 +26,8 @@ public class Ground implements Element {
public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Ground.class) public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Ground.class)
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.LABEL); .addAttribute(Keys.LABEL)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;

View File

@ -39,7 +39,8 @@ public class In implements Element {
.addAttribute(Keys.DESCRIPTION) .addAttribute(Keys.DESCRIPTION)
.addAttribute(Keys.INT_FORMAT) .addAttribute(Keys.INT_FORMAT)
.addAttribute(Keys.PINNUMBER) .addAttribute(Keys.PINNUMBER)
.addAttribute(Keys.ADD_VALUE_TO_GRAPH); .addAttribute(Keys.ADD_VALUE_TO_GRAPH)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;
private final String label; private final String label;

View File

@ -36,7 +36,8 @@ public class Out implements Element {
.addAttribute(Keys.DESCRIPTION) .addAttribute(Keys.DESCRIPTION)
.addAttribute(Keys.INT_FORMAT) .addAttribute(Keys.INT_FORMAT)
.addAttribute(Keys.PINNUMBER) .addAttribute(Keys.PINNUMBER)
.addAttribute(Keys.ADD_VALUE_TO_GRAPH); .addAttribute(Keys.ADD_VALUE_TO_GRAPH)
.supportsHDL();
/** /**
* The LED description * The LED description

View File

@ -27,7 +27,8 @@ public class PinControl extends Node implements Element {
public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(PinControl.class, input("wr"), input("oe")) public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(PinControl.class, input("wr"), input("oe"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.MIRROR); .addAttribute(Keys.MIRROR)
.supportsHDL();
private final int bits; private final int bits;
private final ObservableValue rdValue; private final ObservableValue rdValue;

View File

@ -26,7 +26,8 @@ public class VDD implements Element {
public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(VDD.class) public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(VDD.class)
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.LABEL); .addAttribute(Keys.LABEL)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;

View File

@ -33,7 +33,8 @@ public class BlockRAMDualPort extends Node implements Element, RAMInterface {
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.ADDR_BITS) .addAttribute(Keys.ADDR_BITS)
.addAttribute(Keys.IS_PROGRAM_MEMORY) .addAttribute(Keys.IS_PROGRAM_MEMORY)
.addAttribute(Keys.LABEL); .addAttribute(Keys.LABEL)
.supportsHDL();
private DataField memory; private DataField memory;
private final ObservableValue output; private final ObservableValue output;

View File

@ -26,7 +26,8 @@ public class Counter extends Node implements Element, ProgramCounter {
.addAttribute(Keys.INVERTER_CONFIG) .addAttribute(Keys.INVERTER_CONFIG)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.VALUE_IS_PROBE) .addAttribute(Keys.VALUE_IS_PROBE)
.addAttribute(Keys.IS_PROGRAM_COUNTER); .addAttribute(Keys.IS_PROGRAM_COUNTER)
.supportsHDL();
private final ObservableValue out; private final ObservableValue out;
private final ObservableValue ovf; private final ObservableValue ovf;

View File

@ -36,7 +36,8 @@ public class CounterPreset extends Node implements Element, ProgramCounter {
.addAttribute(Keys.INVERTER_CONFIG) .addAttribute(Keys.INVERTER_CONFIG)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.VALUE_IS_PROBE) .addAttribute(Keys.VALUE_IS_PROBE)
.addAttribute(Keys.IS_PROGRAM_COUNTER); .addAttribute(Keys.IS_PROGRAM_COUNTER)
.supportsHDL();
private final ObservableValue out; private final ObservableValue out;
private final ObservableValue ovf; private final ObservableValue ovf;

View File

@ -36,7 +36,8 @@ public class LookUpTable extends Node implements Element {
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.INPUT_COUNT) .addAttribute(Keys.INPUT_COUNT)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.DATA); .addAttribute(Keys.DATA)
.supportsHDL();
private final DataField data; private final DataField data;
private final ObservableValue output; private final ObservableValue output;

View File

@ -33,7 +33,8 @@ public class RAMDualAccess extends Node implements Element, RAMInterface {
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.ADDR_BITS) .addAttribute(Keys.ADDR_BITS)
.addAttribute(Keys.IS_PROGRAM_MEMORY) .addAttribute(Keys.IS_PROGRAM_MEMORY)
.addAttribute(Keys.LABEL); .addAttribute(Keys.LABEL)
.supportsHDL();
private final DataField memory; private final DataField memory;
private final ObservableValue out1; private final ObservableValue out1;

View File

@ -32,7 +32,8 @@ public class RAMDualPort extends Node implements Element, RAMInterface {
.addAttribute(Keys.ADDR_BITS) .addAttribute(Keys.ADDR_BITS)
.addAttribute(Keys.INT_FORMAT) .addAttribute(Keys.INT_FORMAT)
.addAttribute(Keys.IS_PROGRAM_MEMORY) .addAttribute(Keys.IS_PROGRAM_MEMORY)
.addAttribute(Keys.LABEL); .addAttribute(Keys.LABEL)
.supportsHDL();
private DataField memory; private DataField memory;
private final IntFormat intFormat; private final IntFormat intFormat;

View File

@ -41,7 +41,8 @@ public class ROM extends Node implements Element, ROMInterface, ProgramMemory {
.addAttribute(Keys.DATA) .addAttribute(Keys.DATA)
.addAttribute(Keys.INT_FORMAT) .addAttribute(Keys.INT_FORMAT)
.addAttribute(Keys.IS_PROGRAM_MEMORY) .addAttribute(Keys.IS_PROGRAM_MEMORY)
.addAttribute(Keys.AUTO_RELOAD_ROM); .addAttribute(Keys.AUTO_RELOAD_ROM)
.supportsHDL();
private DataField data; private DataField data;
private final IntFormat intFormat; private final IntFormat intFormat;

View File

@ -29,7 +29,8 @@ public class Register extends Node implements Element, Countable, ProgramCounter
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.INVERTER_CONFIG) .addAttribute(Keys.INVERTER_CONFIG)
.addAttribute(Keys.IS_PROGRAM_COUNTER) .addAttribute(Keys.IS_PROGRAM_COUNTER)
.addAttribute(Keys.VALUE_IS_PROBE); .addAttribute(Keys.VALUE_IS_PROBE)
.supportsHDL();
private final int bits; private final int bits;
private final boolean isProbe; private final boolean isProbe;

View File

@ -34,7 +34,8 @@ public class RegisterFile extends Node implements Element, RAMInterface {
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.ADDR_BITS) .addAttribute(Keys.ADDR_BITS)
.addAttribute(Keys.LABEL); .addAttribute(Keys.LABEL)
.supportsHDL();
private final DataField memory; private final DataField memory;
private final ObservableValue out1; private final ObservableValue out1;

View File

@ -29,7 +29,8 @@ public class BitSelector extends Node implements Element {
input("sel")) input("sel"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.SELECTOR_BITS) .addAttribute(Keys.SELECTOR_BITS)
.addAttribute(Keys.FLIP_SEL_POSITON); .addAttribute(Keys.FLIP_SEL_POSITON)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;
private final int selBits; private final int selBits;

View File

@ -24,7 +24,8 @@ public class Clock implements Element {
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.RUN_AT_REAL_TIME) .addAttribute(Keys.RUN_AT_REAL_TIME)
.addAttribute(Keys.FREQUENCY) .addAttribute(Keys.FREQUENCY)
.addAttribute(Keys.PINNUMBER); .addAttribute(Keys.PINNUMBER)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;
private final int frequency; private final int frequency;

View File

@ -40,7 +40,8 @@ public class Decoder extends Node implements Element, Countable {
input("sel")) input("sel"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.SELECTOR_BITS) .addAttribute(Keys.SELECTOR_BITS)
.addAttribute(Keys.FLIP_SEL_POSITON); .addAttribute(Keys.FLIP_SEL_POSITON)
.supportsHDL();
/** /**
* Creates a new instance * Creates a new instance

View File

@ -46,7 +46,8 @@ public class Demultiplexer extends Node implements Element, Countable {
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.SELECTOR_BITS) .addAttribute(Keys.SELECTOR_BITS)
.addAttribute(Keys.FLIP_SEL_POSITON) .addAttribute(Keys.FLIP_SEL_POSITON)
.addAttribute(Keys.DEFAULT); .addAttribute(Keys.DEFAULT)
.supportsHDL();
/** /**
* Creates a new instance * Creates a new instance

View File

@ -30,7 +30,8 @@ public class Driver extends Node implements Element, Countable {
input("sel")) input("sel"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.FLIP_SEL_POSITON); .addAttribute(Keys.FLIP_SEL_POSITON)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;
private final int bits; private final int bits;

View File

@ -24,7 +24,8 @@ public class DriverInvSel extends Driver {
input("sel")) input("sel"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.FLIP_SEL_POSITON); .addAttribute(Keys.FLIP_SEL_POSITON)
.supportsHDL();
/** /**
* Creates a new instance * Creates a new instance

View File

@ -41,7 +41,8 @@ public class Multiplexer extends FanIn {
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
.addAttribute(Keys.SELECTOR_BITS) .addAttribute(Keys.SELECTOR_BITS)
.addAttribute(Keys.FLIP_SEL_POSITON); .addAttribute(Keys.FLIP_SEL_POSITON)
.supportsHDL();
/** /**
* Creates a new instance * Creates a new instance

View File

@ -36,7 +36,8 @@ public class PriorityEncoder extends Node implements Element, Countable {
} }
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.SELECTOR_BITS); .addAttribute(Keys.SELECTOR_BITS)
.supportsHDL();
private final ObservableValue selOut; private final ObservableValue selOut;

View File

@ -26,7 +26,8 @@ public class Reset implements Element {
public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription("Reset", Reset.class) public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription("Reset", Reset.class)
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.INVERT_OUTPUT); .addAttribute(Keys.INVERT_OUTPUT)
.supportsHDL();
private final ObservableValue output; private final ObservableValue output;
private final boolean invOut; private final boolean invOut;

View File

@ -58,7 +58,8 @@ public class Splitter implements Element {
.addAttribute(Keys.INPUT_SPLIT) .addAttribute(Keys.INPUT_SPLIT)
.addAttribute(Keys.OUTPUT_SPLIT) .addAttribute(Keys.OUTPUT_SPLIT)
.addAttribute(Keys.SPLITTER_SPREADING) .addAttribute(Keys.SPLITTER_SPREADING)
.setShortName(""); .setShortName("")
.supportsHDL();
private final ObservableValues outputs; private final ObservableValues outputs;
private final Ports inPorts; private final Ports inPorts;

View File

@ -27,7 +27,8 @@ public class Tunnel implements Element {
public static final ElementTypeDescription DESCRIPTION public static final ElementTypeDescription DESCRIPTION
= new ElementTypeDescription(Tunnel.class, input("in")) = new ElementTypeDescription(Tunnel.class, input("in"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.NETNAME); .addAttribute(Keys.NETNAME)
.supportsHDL();
private final String label; private final String label;

View File

@ -48,9 +48,9 @@ public class HDLCircuit implements Iterable<HDLNode>, HDLModel.BitProvider, Prin
private final ArrayList<HDLNet> listOfNets; private final ArrayList<HDLNet> listOfNets;
private final String description; private final String description;
private final File origin; private final File origin;
private final ArrayList<HDLNode> nodes;
private ArrayList<HDLPort> ports; private ArrayList<HDLPort> ports;
private NetList netList; private NetList netList;
private ArrayList<HDLNode> nodes;
private HashMap<Net, HDLNet> nets; private HashMap<Net, HDLNet> nets;
private String hdlEntityName; private String hdlEntityName;

View File

@ -5,6 +5,7 @@
*/ */
package de.neemann.digital.hdl.vhdl2.entities; package de.neemann.digital.hdl.vhdl2.entities;
import de.neemann.digital.core.element.ElementTypeDescription;
import de.neemann.digital.hdl.hgs.*; import de.neemann.digital.hdl.hgs.*;
import de.neemann.digital.hdl.hgs.function.JavaClass; import de.neemann.digital.hdl.hgs.function.JavaClass;
import de.neemann.digital.hdl.model2.HDLNode; import de.neemann.digital.hdl.model2.HDLNode;
@ -13,6 +14,7 @@ import de.neemann.digital.hdl.vhdl2.Separator;
import de.neemann.digital.lang.Lang; import de.neemann.digital.lang.Lang;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -49,6 +51,21 @@ public class VHDLTemplate implements VHDLEntity {
return "vhdl/" + name + ".tem"; return "vhdl/" + name + ".tem";
} }
/**
* Returns true, if a hdl template is available.
*
* @param etd the {@link ElementTypeDescription}
* @return true if VHDL template is available
*/
public static boolean isTemplate(ElementTypeDescription etd) {
ClassLoader cl = etd.getClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
URL url = cl.getResource(createFileName(ENTITY_PREFIX + etd.getName()));
return url != null;
}
/** /**
* Creates the name of the file used to load the vhdl file for the given element * Creates the name of the file used to load the vhdl file for the given element
* *

View File

@ -27,7 +27,8 @@ public class TestCaseElement implements Element {
= new ElementTypeDescription("Testcase", TestCaseElement.class) = new ElementTypeDescription("Testcase", TestCaseElement.class)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(TESTDATA) .addAttribute(TESTDATA)
.addAttribute(Keys.ENABLED); .addAttribute(Keys.ENABLED)
.supportsHDL();
/** /**
* creates a new instance * creates a new instance

View File

@ -1955,12 +1955,15 @@ Stellen Sie sicher, dass der Flash-Vorgang abgeschlossen ist, bevor Sie diesen D
<string name="msg_renameNet">Netz umbenennen</string> <string name="msg_renameNet">Netz umbenennen</string>
<string name="msg_renameNet_N_OLD_NEW">Es gibt noch {0} weitere Tunnel mit dem Netznamen ''{1}''. <string name="msg_renameNet_N_OLD_NEW">Es gibt noch {0} weitere Tunnel mit dem Netznamen ''{1}''.
Sollen alle {0} zu ''{2}'' umbenannt werden?</string> Sollen alle {0} zu ''{2}'' umbenannt werden?
</string>
<string name="msg_dataWillBeLost_n">Sollen die Änderungen im Feld "{0}" wirklich verworfen werden?</string> <string name="msg_dataWillBeLost_n">Sollen die Änderungen im Feld "{0}" wirklich verworfen werden?</string>
<string name="btn_copyToClipboard">Zwischenablage</string> <string name="btn_copyToClipboard">Zwischenablage</string>
<string name="btn_copyToClipboard_tt">Kopiert den Text in die Zwischenablage.</string> <string name="btn_copyToClipboard_tt">Kopiert den Text in die Zwischenablage.</string>
<string name="msg_supportsHDL">Exportierbar zu VHDL/Verilog.</string>
<string name="ok">Ok</string> <string name="ok">Ok</string>
<string name="rot_0"></string> <string name="rot_0"></string>
<string name="rot_180">180°</string> <string name="rot_180">180°</string>

View File

@ -1910,10 +1910,13 @@ Make sure the flash process is complete before closing this dialog!</string>
<string name="msg_renameNet">Rename Net</string> <string name="msg_renameNet">Rename Net</string>
<string name="msg_renameNet_N_OLD_NEW">There are {0} more tunnels with the net name ''{1}''. <string name="msg_renameNet_N_OLD_NEW">There are {0} more tunnels with the net name ''{1}''.
Do you want to rename all {0} to ''{2}''?</string> Do you want to rename all {0} to ''{2}''?
</string>
<string name="msg_dataWillBeLost_n">Do you really want to discard the changes in the "{0}" field?</string> <string name="msg_dataWillBeLost_n">Do you really want to discard the changes in the "{0}" field?</string>
<string name="msg_supportsHDL">Exportable to VHDL/Verilog.</string>
<string name="err_vgaModeNotDetected_N">Video mode was not detected ({0})</string> <string name="err_vgaModeNotDetected_N">Video mode was not detected ({0})</string>
<string name="ok">OK</string> <string name="ok">OK</string>

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2020 Helmut Neemann.
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.hdl;
import de.neemann.digital.core.element.ElementTypeDescription;
import de.neemann.digital.draw.library.ElementLibrary;
import de.neemann.digital.hdl.vhdl2.entities.VHDLTemplate;
import junit.framework.TestCase;
public class TestHDLExportFlag extends TestCase {
public void testHDLExportFlag() {
ElementLibrary lib = new ElementLibrary();
for (ElementLibrary.ElementContainer ec : lib) {
ElementTypeDescription etd = ec.getDescription();
boolean hdlExportFlag = etd.isSupportsHDL();
if (VHDLTemplate.isTemplate(etd))
assertTrue("HDL template available for " + etd.getName(), hdlExportFlag);
}
}
}