Merge branch 'develop' into global-methods-rename

This commit is contained in:
Marcin Orlowski 2021-10-01 10:51:21 +02:00
commit a7a2aec85c
120 changed files with 847 additions and 702 deletions

View File

@ -80,20 +80,9 @@ jobs:
echo "Downloading ${JAR}..."
wget --quiet "${URL}"
# Extracting config file for possible manipulations.
# Using built-in config.
declare -r CHECKS_FILE="/google_checks.xml"
declare -r REPORT_FILE="output.txt"
declare -r CHECKS_FILE="google_checks.xml"
# Extract built-in config file.
unzip -qq -d . "${JAR}" "${CHECKS_FILE}"
# Starting from 8.28, default checkstyle config looks for optional checkstyle-suppressions.xml
# (See https://github.com/checkstyle/checkstyle/issues/6946) so we just need to link ours
# (as it looks for it in CWD) and that should be sufficient.
supp_file="config/checkstyle/suppressions-dev.xml"
# safe fall back to non-dev file if -dev version is removed
[[ -f "${supp_file}" ]] || supp_file="config/checkstyle/suppressions.xml"
ln -s "${supp_file}" checkstyle-suppressions.xml
# Let's lint eventually...
echo "*********************************************************"

8
.gitignore vendored
View File

@ -284,9 +284,5 @@ gradle-app.setting
# Include libraries
!lib
# Default Checkstyle suppresion file. Currently excluded as we have 2 different
# in config/ folder. Once we end up with just one, this exclusion will be removed
# and suppresion file moved to checkstyle-suppressions.xml
/checkstyle-suppressions.xml
# If pre-commit is used, this entry will prevent from commiting checkstyle.jar by accident.
/checkstyle-*-all.jar
# default pre-commit config
/.pre-commit-config.yaml

View File

@ -0,0 +1,61 @@
#
# Git pre-commit framework config for Logisim-evolution project.
#
# See: https://github.com/logisim-evolution/logisim-evolution/blob/master/docs/developers.md
# for more information and setup guide.
#
# See https://pre-commit.com for more information about pre-commit.
# See https://pre-commit.com/hooks.html for more available hooks.
#
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
# Prevent giant files from being committed
- id: check-added-large-files
args: ['--maxkb=100']
# This hook checks yaml files for parseable syntax
- id: check-yaml
# Check for files that would conflict in case-insensitive filesystems
- id: check-case-conflict
# Ensures that (non-binary) executables have a shebang.
- id: check-executables-have-shebangs
# Check for files that contain merge conflict strings
- id: check-merge-conflict
# Prevent addition of new git submodules
- id: forbid-new-submodules
# Replaces or checks mixed line ending
- id: mixed-line-ending
args: ['--fix=no']
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
# Forbid files which have a UTF-8 Unicode replacement character
- id: text-unicode-replacement-char
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.5
hooks:
# Non-executable shell script filename ends in .sh
- id: script-must-have-extension
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.10
hooks:
# Forbid files containing CRLF end-lines to be committed
- id: forbid-crlf
- repo: https://github.com/MarcinOrlowski/pre-commit-hooks
rev: 1.3.0
hooks:
# Checks modified Java files with Checkstyle linter.
- id: checkstyle-jar
# This hook trims trailing whitespace.
- id: trailing-whitespaces
exclude_types: ['xml']
args: ['--markdown-linebreak-ext=md', '--fix=yes']
# Ensures that a file is either empty, or ends with one newline
- id: end-of-file
exclude_types: ['xml']
args: ['--fix=yes']

View File

@ -30,6 +30,5 @@
<suppress checks="FallThrough"/>
<!-- Auto-generated file. https://github.com/logisim-evolution/logisim-evolution/issues/563-->
<suppress id="VhdlSyntax" files="src/main/java/com/cburch/logisim/vhdl/syntax/VhdlSyntax.java"/>
<suppress id="VhdlSyntax" files="src/main/java/com/cburch/logisim/vhdl/syntax/VhdlSyntax.java"/>
</suppressions>

View File

@ -1,15 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="MissingJavadocMethod"/>
<suppress checks="MissingJavadocType"/>
<suppress checks="JavadocParagraph"/>
<suppress checks="NeedBraces"/>
<suppress checks="LineLength"/>
<!-- Auto-generated file. https://github.com/logisim-evolution/logisim-evolution/issues/563-->
<suppress id="VhdlSyntax" files="src/main/java/com/cburch/logisim/vhdl/syntax/VhdlSyntax.java"/>
</suppressions>

View File

@ -9,6 +9,7 @@
* [Editing built-in config](#editing-built-in-config)
* [Using cloned config](#using-cloned-config)
* [Using Gradle plugin](#using-gradle-plugin)
* [Using `pre-commit`](#using-pre-commit-hooks)
---
@ -18,12 +19,13 @@
static anaylyzer tool, with a few checks disabled as specified in the `suppressions.xml`
config file.
---
# Checking code style with InteliJ IDEA #
As we use a suppression config file, you can set up InteliJ's Checkstyle plugin in
two ways - one adds our suppressions to the built-in "Google Checks" config, the other
creates a completely new config using a copy from the Checkstyle source archive.
-As we use a suppression config file, you can set up InteliJ's Checkstyle plugin in
-two ways - one adds our suppressions to the built-in "Google Checks" config, the other
-creates a completely new config using a copy from the Checkstyle source archive.
Either way, you need to install the `CheckStyle-IDEA` plugin first:
* Go to `Settings -> Plugins`.
@ -37,8 +39,8 @@ Edit the existing Google Checks configuration:
* Open the `Tools -> Checkstyle` plugin settings.
* Activate the `Google Checks` configuration.
* Highlight the `Google Checks` row and click the `Pen` icon above the list to edit it.
* Look for the `org.checkstyle.google.suppressionfilter.config` named property and set its
value to `config/checkstyle/suppressions.xml`.
* Look for the `org.checkstyle.google.suppressionfilter.config` named property and set its value
to `config/checkstyle/suppressions.xml`.
* Click `Finish`.
* You can now run CheckStyle using the `Checkstyle` command or directly from the CheckStyle tab.
* Ensure `Rules:`, shown in the scan result window, reads `Google Checks`.
@ -49,8 +51,8 @@ You can configure InteliJ's CheckStyle plugin to behave exactly as we configure
* Open the `Tools -> Checkstyle` plugin settings.
* Set the `Checkstyle version` to your liking.
* Go to the [Checkstyle GitHub page](https://github.com/checkstyle/checkstyle/releases) and look
for a release matching the selected `Checkstyle version` and download the source archive.
* Go to the [Checkstyle GitHub page](https://github.com/checkstyle/checkstyle/releases) and look for a release matching the
selected `Checkstyle version` and download the source archive.
* Unpack it and copy out the `src/main/resources/google_checks.xml` file to Logisim's `config/checkstyle/`.
* Go back to the plugin configuration and add a new "Configuration file":
* Click the `+` icon.
@ -58,8 +60,8 @@ You can configure InteliJ's CheckStyle plugin to behave exactly as we configure
* Select `Use a local Checkstyle file`.
* Click `Browse` and point to the `config/checkstyle/google_checks.xml` file.
* Enable `Store relative to project location` and click `Next`.
* On the `Property` table, look for a property named `org.checkstyle.google.suppressionfilter.config`.
Set the value to `config/checkstyle/suppressions.xml` and click `Next.
* On the `Property` table, look for a property named `org.checkstyle.google.suppressionfilter.config`. Set the value
to `config/checkstyle/suppressions.xml` and click `Next.
* Click "Finish".
* You can now run CheckStyle using the `Checkstyle` command or directly from the CheckStyle tab.
* Ensure `Rules:`, shown in the scan result window, reads `Logisim-evolution`.
@ -73,3 +75,17 @@ CheckStyle is also plugged into the project's Gradle build system and provides t
```bash
$ ./gradlew checkstyleMain
```
---
# Using pre-commit hooks #
To improve quality of your commit, it's recommended to use [pre-commit](http://pre-commit.com) hooks, that will block
your commits unless all pre-commit tests pass. `Logisim-evolution` comes with predefined `.pre-commit-config.yaml`
config file for your convenience.
Installation instruction:
* See `pre-commit` [official installation docs](https://pre-commit.com/#install) and install it.
* Copy provided config file: `cp .pre-commit-config.yaml.dist .pre-commit-config.yaml`
* Plug `pre-commit` into Git pipeline: `pre-commit install`

View File

@ -13,11 +13,11 @@ import static com.cburch.draw.Strings.S;
import com.cburch.draw.model.CanvasModel;
import com.cburch.draw.model.CanvasObject;
import com.cburch.draw.undo.Action;
import com.cburch.draw.undo.UndoAction;
import java.util.Collection;
import java.util.Collections;
public abstract class ModelAction extends Action {
public abstract class ModelAction implements UndoAction {
private final CanvasModel model;
public ModelAction(CanvasModel model) {

View File

@ -9,8 +9,8 @@
package com.cburch.draw.canvas;
import com.cburch.draw.undo.Action;
import com.cburch.draw.undo.UndoAction;
public interface ActionDispatcher {
void doAction(Action action);
void doAction(UndoAction action);
}

View File

@ -11,7 +11,7 @@ package com.cburch.draw.canvas;
import com.cburch.draw.model.CanvasModel;
import com.cburch.draw.model.CanvasObject;
import com.cburch.draw.undo.Action;
import com.cburch.draw.undo.UndoAction;
import com.cburch.logisim.prefs.AppPreferences;
import java.awt.Dimension;
import java.awt.Graphics;
@ -41,7 +41,7 @@ public class Canvas extends JComponent {
setPreferredSize(new Dimension(200, 200));
}
public void doAction(Action action) {
public void doAction(UndoAction action) {
dispatcher.doAction(action);
}

View File

@ -56,6 +56,7 @@ public class DrawingAttributeSet implements AttributeSet, Cloneable {
values = DEFAULTS_ALL;
}
@Override
public void addAttributeListener(AttributeListener l) {
listeners.add(l);
}
@ -89,6 +90,7 @@ public class DrawingAttributeSet implements AttributeSet, Cloneable {
}
}
@Override
public boolean containsAttribute(Attribute<?> attr) {
return attrs.contains(attr);
}
@ -97,6 +99,7 @@ public class DrawingAttributeSet implements AttributeSet, Cloneable {
return new Restriction(tool);
}
@Override
public Attribute<?> getAttribute(String name) {
for (Attribute<?> attr : attrs) {
if (attr.getName().equals(name)) return attr;
@ -104,10 +107,12 @@ public class DrawingAttributeSet implements AttributeSet, Cloneable {
return null;
}
@Override
public List<Attribute<?>> getAttributes() {
return attrs;
}
@Override
@SuppressWarnings("unchecked")
public <V> V getValue(Attribute<V> attr) {
Iterator<Attribute<?>> ait = attrs.iterator();
@ -122,22 +127,27 @@ public class DrawingAttributeSet implements AttributeSet, Cloneable {
return null;
}
@Override
public boolean isReadOnly(Attribute<?> attr) {
return false;
}
@Override
public boolean isToSave(Attribute<?> attr) {
return attr.isToSave();
}
@Override
public void removeAttributeListener(AttributeListener l) {
listeners.remove(l);
}
@Override
public void setReadOnly(Attribute<?> attr, boolean value) {
throw new UnsupportedOperationException("setReadOnly");
}
@Override
public <V> void setValue(Attribute<V> attr, V value) {
Iterator<Attribute<?>> ait = attrs.iterator();
ListIterator<Object> vit = values.listIterator();
@ -175,10 +185,12 @@ public class DrawingAttributeSet implements AttributeSet, Cloneable {
//
// AttributeListener methods
//
@Override
public void attributeListChanged(AttributeEvent e) {
fireAttributeListChanged();
}
@Override
public void attributeValueChanged(AttributeEvent e) {
if (selectedAttrs.contains(e.getAttribute())) {
@SuppressWarnings("unchecked")

View File

@ -12,7 +12,6 @@ package com.cburch.draw.tools;
import com.cburch.draw.actions.ModelAddAction;
import com.cburch.draw.canvas.Canvas;
import com.cburch.draw.icons.DrawPolylineIcon;
import com.cburch.draw.model.CanvasModel;
import com.cburch.draw.model.CanvasObject;
import com.cburch.draw.shapes.DrawAttr;
import com.cburch.draw.shapes.LineUtil;

View File

@ -9,11 +9,11 @@
package com.cburch.draw.undo;
public abstract class Action {
public interface UndoAction {
public abstract void doIt();
public void doIt();
public abstract String getName();
public String getName();
public abstract void undo();
public void undo();
}

View File

@ -66,14 +66,17 @@ public class MatchingSet<E extends CanvasObject> extends AbstractSet<E> {
this.it = it;
}
@Override
public boolean hasNext() {
return it.hasNext();
}
@Override
public E next() {
return it.next().value;
}
@Override
public void remove() {
it.remove();
}

View File

@ -415,7 +415,7 @@ public class TruthTable {
throw new IllegalStateException("missing row");
}
public void setVisibleRows(ArrayList<Entry[]> newEntries, boolean force) {
public void setVisibleRows(List<Entry[]> newEntries, boolean force) {
final var ni = getInputColumnCount();
final var no = getOutputColumnCount();
final var newRows = new ArrayList<Row>(newEntries.size());

View File

@ -30,7 +30,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
public class CircuitHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
@ -218,7 +217,7 @@ public class CircuitHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
}
@Override
public ArrayList<String> getComponentDeclarationSection(Netlist theNetlist, AttributeSet attrs) {
public List<String> getComponentDeclarationSection(Netlist theNetlist, AttributeSet attrs) {
final var components = new ArrayList<String>();
final var instantiatedComponents = new HashSet<String>();
for (final var gate : theNetlist.getNormalComponents()) {
@ -413,7 +412,7 @@ public class CircuitHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
}
@Override
public SortedMap<String, String> getPortMap(Netlist nets, Object theMapInfo) {
public Map<String, String> getPortMap(Netlist nets, Object theMapInfo) {
final var portMap = new TreeMap<String, String>();
if (theMapInfo == null) return null;
final var topLevel = theMapInfo instanceof MappableResourcesContainer;

View File

@ -12,6 +12,7 @@ package com.cburch.logisim.circuit;
import com.cburch.logisim.fpga.data.BoardRectangle;
import com.cburch.logisim.fpga.data.MapComponent;
import java.util.ArrayList;
import java.util.List;
public class CircuitMapInfo {
@ -107,7 +108,7 @@ public class CircuitMapInfo {
return myMap;
}
public ArrayList<CircuitMapInfo> getPinMaps() {
public List<CircuitMapInfo> getPinMaps() {
return pinmaps;
}
}

View File

@ -17,7 +17,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -10,6 +10,7 @@
package com.cburch.logisim.data;
import java.util.ArrayList;
import java.util.List;
/**
* Code taken from Cornell's version of Logisim: http://www.cs.cornell.edu/courses/cs3410/2015sp/
@ -53,7 +54,7 @@ public class FailException extends TestException {
return expected;
}
public ArrayList<FailException> getMore() {
public List<FailException> getMore() {
return more;
}
@ -61,7 +62,7 @@ public class FailException extends TestException {
more.clear();
}
public ArrayList<FailException> getAll() {
public List<FailException> getAll() {
final var ret = new ArrayList<FailException>();
ret.add(this);
ret.addAll(more);

View File

@ -14,6 +14,7 @@ import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import javax.swing.filechooser.FileFilter;
@ -24,6 +25,7 @@ public class TestVector {
private static class TestVectorFilter extends FileFilter {
@Override
public boolean accept(File f) {
if (!f.isFile()) return true;
@ -32,6 +34,7 @@ public class TestVector {
return (i > 0 && name.substring(i).equalsIgnoreCase(".txt"));
}
@Override
public String getDescription() {
return "Logisim-evolution Test Vector (*.txt)";
}
@ -130,7 +133,7 @@ public class TestVector {
public BitWidth[] columnWidth;
public int[] columnRadix;
public ArrayList<Value[]> data;
public List<Value[]> data;
public TestVector(File src) throws IOException {
try (final var in = new BufferedReader(new FileReader(src))) {

View File

@ -44,7 +44,7 @@ public class BoardInformation {
MyComponents.addAll(comps);
}
public LinkedList<FpgaIoInformationContainer> getAllComponents() {
public List<FpgaIoInformationContainer> getAllComponents() {
return MyComponents;
}
@ -106,7 +106,7 @@ public class BoardInformation {
return BoardPicture;
}
public ArrayList<BoardRectangle> getIoComponentsOfType(IoComponentTypes type, int nrOfPins) {
public List<BoardRectangle> getIoComponentsOfType(IoComponentTypes type, int nrOfPins) {
final var result = new ArrayList<BoardRectangle>();
for (final var comp : MyComponents) {
if (comp.getType().equals(type)) {

View File

@ -10,23 +10,24 @@
package com.cburch.logisim.fpga.data;
import java.util.ArrayList;
import java.util.List;
public class ComponentMapInformationContainer {
private int nrOfInputBubbles;
private int nrOfInOutBubbles;
private int nrOfOutputBubbles;
private ArrayList<String> inputBubbleLabels;
private ArrayList<String> inOutBubbleLabels;
private ArrayList<String> outputBubbleLabels;
private List<String> inputBubbleLabels;
private List<String> inOutBubbleLabels;
private List<String> outputBubbleLabels;
public ComponentMapInformationContainer(
int inports,
int outports,
int inoutports,
ArrayList<String> inportLabels,
ArrayList<String> outportLabels,
ArrayList<String> inoutportLabels) {
List<String> inportLabels,
List<String> outportLabels,
List<String> inoutportLabels) {
nrOfInputBubbles = inports;
nrOfOutputBubbles = outports;
nrOfInOutBubbles = inoutports;
@ -55,9 +56,9 @@ public class ComponentMapInformationContainer {
nrOfInputBubbles,
nrOfOutputBubbles,
nrOfInOutBubbles,
inputBubbleLabels == null ? null : (ArrayList<String>) inputBubbleLabels.clone(),
outputBubbleLabels == null ? null : (ArrayList<String>) outputBubbleLabels.clone(),
inOutBubbleLabels == null ? null : (ArrayList<String>) inOutBubbleLabels.clone());
inputBubbleLabels == null ? null : (List<String>) ((ArrayList<String>) inputBubbleLabels).clone(),
outputBubbleLabels == null ? null : (List<String>) ((ArrayList<String>) outputBubbleLabels).clone(),
inOutBubbleLabels == null ? null : (List<String>) ((ArrayList<String>) inOutBubbleLabels).clone());
return myClone;
}
@ -91,17 +92,17 @@ public class ComponentMapInformationContainer {
return outputBubbleLabels.get(outputNr);
}
public void setNrOfInOutports(int count, ArrayList<String> labels) {
public void setNrOfInOutports(int count, List<String> labels) {
nrOfInOutBubbles = count;
inOutBubbleLabels = labels;
}
public void setNrOfInports(int count, ArrayList<String> labels) {
public void setNrOfInports(int count, List<String> labels) {
nrOfInputBubbles = count;
inputBubbleLabels = labels;
}
public void setNrOfOutports(int count, ArrayList<String> labels) {
public void setNrOfOutports(int count, List<String> labels) {
nrOfOutputBubbles = count;
outputBubbleLabels = labels;
}

View File

@ -11,6 +11,7 @@ package com.cburch.logisim.fpga.data;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class DriveStrength {
public static String GetContraintedDriveStrength(char id) {
@ -32,7 +33,7 @@ public class DriveStrength {
return UNKNOWN;
}
public static LinkedList<String> getStrings() {
public static List<String> getStrings() {
LinkedList<String> result = new LinkedList<>();
result.add(BEHAVIOR_STRINGS[0]);

View File

@ -26,7 +26,9 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.swing.JPanel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -63,7 +65,7 @@ public class FpgaIoInformationContainer implements Cloneable {
public int pinId;
}
public static LinkedList<String> getComponentTypes() {
public static List<String> getComponentTypes() {
final var result = new LinkedList<String>();
for (final var comp : IoComponentTypes.KNOWN_COMPONENT_SET) {
result.add(comp.toString());
@ -77,9 +79,9 @@ public class FpgaIoInformationContainer implements Cloneable {
protected BoardRectangle myRectangle;
protected int myRotation = IoComponentTypes.ROTATION_ZERO;
private Map<Integer, String> myPinLocations;
private HashSet<Integer> myInputPins;
private HashSet<Integer> myOutputPins;
private HashSet<Integer> myIoPins;
private Set<Integer> myInputPins;
private Set<Integer> myOutputPins;
private Set<Integer> myIoPins;
private Integer[][] partialMapArray;
private Integer nrOfPins;
private Integer nrOfExternalPins = 0;
@ -786,15 +788,15 @@ public class FpgaIoInformationContainer implements Cloneable {
return myIoPins == null ? 0 : myIoPins.size();
}
public HashSet<Integer> getInputs() {
public Set<Integer> getInputs() {
return myInputPins;
}
public HashSet<Integer> getOutputs() {
public Set<Integer> getOutputs() {
return myOutputPins;
}
public HashSet<Integer> getIos() {
public Set<Integer> getIos() {
return myIoPins;
}

View File

@ -36,6 +36,7 @@ import com.cburch.logisim.std.io.ReptarLocalBus;
import java.awt.Color;
import java.awt.Graphics2D;
import java.util.EnumSet;
import java.util.Set;
public enum IoComponentTypes {
Led,
@ -486,16 +487,16 @@ public enum IoComponentTypes {
}
}
public static final EnumSet<IoComponentTypes> KNOWN_COMPONENT_SET =
public static final Set<IoComponentTypes> KNOWN_COMPONENT_SET =
EnumSet.range(IoComponentTypes.Led, IoComponentTypes.LocalBus);
public static final EnumSet<IoComponentTypes> SIMPLE_INPUT_SET =
public static final Set<IoComponentTypes> SIMPLE_INPUT_SET =
EnumSet.range(IoComponentTypes.Led, IoComponentTypes.LocalBus);
public static final EnumSet<IoComponentTypes> INPUT_COMPONENT_SET =
public static final Set<IoComponentTypes> INPUT_COMPONENT_SET =
EnumSet.of(IoComponentTypes.Button, IoComponentTypes.Pin, IoComponentTypes.DIPSwitch);
public static final EnumSet<IoComponentTypes> OUTPUT_COMPONENT_SET =
public static final Set<IoComponentTypes> OUTPUT_COMPONENT_SET =
EnumSet.of(
IoComponentTypes.Led,
IoComponentTypes.Pin,
@ -504,6 +505,6 @@ public enum IoComponentTypes {
IoComponentTypes.LedArray,
IoComponentTypes.SevenSegmentNoDp);
public static final EnumSet<IoComponentTypes> IN_OUT_COMPONENT_SET =
public static final Set<IoComponentTypes> IN_OUT_COMPONENT_SET =
EnumSet.of(IoComponentTypes.Pin, IoComponentTypes.PortIo);
}

View File

@ -16,6 +16,7 @@ import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
public class IoComponentsInformation {
@ -77,7 +78,7 @@ public class IoComponentsInformation {
return !ioComps.isEmpty();
}
public ArrayList<FpgaIoInformationContainer> getComponents() {
public List<FpgaIoInformationContainer> getComponents() {
return ioComps;
}

View File

@ -10,6 +10,7 @@
package com.cburch.logisim.fpga.data;
import java.util.LinkedList;
import java.util.List;
public class IoStandards {
public static String getConstraintedIoStandard(char id) {
@ -28,7 +29,7 @@ public class IoStandards {
return UNKNOWN;
}
public static LinkedList<String> getStrings() {
public static List<String> getStrings() {
LinkedList<String> result = new LinkedList<>();
result.add(BEHAVIOR_STRINGS[0]);

View File

@ -13,6 +13,7 @@ import static com.cburch.logisim.fpga.Strings.S;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class LedArrayDriving {
@ -31,7 +32,7 @@ public class LedArrayDriving {
return UNKNOWN;
}
public static LinkedList<String> getStrings() {
public static List<String> getStrings() {
var result = new LinkedList<String>();
result.add(DRIVING_STRINGS[0]);
result.add(DRIVING_STRINGS[1]);
@ -42,7 +43,7 @@ public class LedArrayDriving {
return result;
}
public static LinkedList<String> getDisplayStrings() {
public static List<String> getDisplayStrings() {
var result = new LinkedList<String>();
result.add(S.get(DRIVING_STRINGS[0]));
result.add(S.get(DRIVING_STRINGS[1]));

View File

@ -22,6 +22,7 @@ import com.cburch.logisim.std.io.SevenSegment;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
@ -66,25 +67,25 @@ public class MapComponent {
// In the below structure the first Integer is the pin identifier,
// the second is the global bubble id
private final HashMap<Integer, Integer> myInputBubbles = new HashMap<>();
private final HashMap<Integer, Integer> myOutputBubbles = new HashMap<>();
private final HashMap<Integer, Integer> myIoBubbles = new HashMap<>();
private final Map<Integer, Integer> myInputBubbles = new HashMap<>();
private final Map<Integer, Integer> myOutputBubbles = new HashMap<>();
private final Map<Integer, Integer> myIoBubbles = new HashMap<>();
/*
* The following structure defines if the pin is mapped
*/
private final ComponentFactory myFactory;
private final AttributeSet myAttributes;
private final ArrayList<String> myName;
private final List<String> myName;
private ArrayList<MapClass> maps = new ArrayList<>();
private ArrayList<Boolean> opens = new ArrayList<>();
private ArrayList<Integer> constants = new ArrayList<>();
private final ArrayList<String> pinLabels = new ArrayList<>();
private List<MapClass> maps = new ArrayList<>();
private List<Boolean> opens = new ArrayList<>();
private List<Integer> constants = new ArrayList<>();
private final List<String> pinLabels = new ArrayList<>();
private int nrOfPins;
public MapComponent(ArrayList<String> name, netlistComponent comp) {
public MapComponent(List<String> name, netlistComponent comp) {
myFactory = comp.getComponent().getFactory();
myAttributes = comp.getComponent().getAttributeSet();
myName = name;
@ -711,7 +712,7 @@ public class MapComponent {
}
public static void getComplexMap(Element Map, CircuitMapInfo cmap) throws DOMException {
ArrayList<CircuitMapInfo> pinmaps = cmap.getPinMaps();
List<CircuitMapInfo> pinmaps = cmap.getPinMaps();
if (pinmaps != null) {
var s = new StringBuilder();
var first = true;

View File

@ -172,14 +172,14 @@ public class MappableResourcesContainer {
return result;
}
public ArrayList<String> GetMappedIoPinNames() {
var result = new ArrayList<String>();
for (var key : myMappableResources.keySet()) {
var map = myMappableResources.get(key);
public List<String> getMappedIoPinNames() {
final var result = new ArrayList<String>();
for (final var key : myMappableResources.keySet()) {
final var map = myMappableResources.get(key);
for (var i = 0; i < map.getNrOfPins(); i++) {
if (!map.isIo(i) || map.isInternalMapped(i)) continue;
if (map.isBoardMapped(i)) {
var sb = new StringBuilder();
final var sb = new StringBuilder();
if (map.isExternalInverted(i)) sb.append("n_");
sb.append(map.getHdlString(i));
result.add(sb.toString());
@ -189,14 +189,14 @@ public class MappableResourcesContainer {
return result;
}
public ArrayList<String> getMappedInputPinNames() {
var result = new ArrayList<String>();
for (var key : myMappableResources.keySet()) {
var map = myMappableResources.get(key);
public List<String> getMappedInputPinNames() {
final var result = new ArrayList<String>();
for (final var key : myMappableResources.keySet()) {
final var map = myMappableResources.get(key);
for (var i = 0; i < map.getNrOfPins(); i++) {
if (!map.isInput(i) || map.isInternalMapped(i)) continue;
if (map.isBoardMapped(i)) {
var sb = new StringBuilder();
final var sb = new StringBuilder();
if (map.isExternalInverted(i)) sb.append("n_");
sb.append(map.getHdlString(i));
result.add(sb.toString());
@ -206,14 +206,14 @@ public class MappableResourcesContainer {
return result;
}
public ArrayList<String> getMappedOutputPinNames() {
var result = new ArrayList<String>();
for (var key : myMappableResources.keySet()) {
var map = myMappableResources.get(key);
public List<String> getMappedOutputPinNames() {
final var result = new ArrayList<String>();
for (final var key : myMappableResources.keySet()) {
final var map = myMappableResources.get(key);
for (var i = 0; i < map.getNrOfPins(); i++) {
if (!map.isOutput(i) || map.isInternalMapped(i)) continue;
if (map.isBoardMapped(i)) {
var sb = new StringBuilder();
final var sb = new StringBuilder();
if (map.isExternalInverted(i)) sb.append("n_");
sb.append(map.getHdlString(i));
result.add(sb.toString());

View File

@ -11,11 +11,12 @@ package com.cburch.logisim.fpga.data;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class PinActivity {
public static char getId(String identifier) {
char result = 0;
LinkedList<String> thelist = PinActivity.getStrings();
final var thelist = PinActivity.getStrings();
Iterator<String> iter = thelist.iterator();
result = 0;
while (iter.hasNext()) {
@ -25,7 +26,7 @@ public class PinActivity {
return Unknown;
}
public static LinkedList<String> getStrings() {
public static List<String> getStrings() {
LinkedList<String> result = new LinkedList<>();
result.add(BEHAVIOR_STRINGS[0]);

View File

@ -11,6 +11,7 @@ package com.cburch.logisim.fpga.data;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class PullBehaviors {
public static String getContraintedPullString(char id) {
@ -26,8 +27,8 @@ public class PullBehaviors {
public static char getId(String identifier) {
char result = 0;
LinkedList<String> thelist = PullBehaviors.getStrings();
Iterator<String> iter = thelist.iterator();
final var thelist = PullBehaviors.getStrings();
final var iter = thelist.iterator();
result = 0;
while (iter.hasNext()) {
if (iter.next().equals(identifier)) return result;
@ -36,7 +37,7 @@ public class PullBehaviors {
return PullBehaviors.UNKNOWN;
}
public static LinkedList<String> getStrings() {
public static List<String> getStrings() {
LinkedList<String> result = new LinkedList<>();
result.add(BEHAVIOR_STRINGS[0]);

View File

@ -12,6 +12,7 @@ package com.cburch.logisim.fpga.designrulecheck;
import com.cburch.logisim.comp.Component;
import com.cburch.logisim.std.wiring.Clock;
import java.util.ArrayList;
import java.util.List;
public class ClockSourceContainer {
@ -56,7 +57,7 @@ public class ClockSourceContainer {
return sources.size();
}
public ArrayList<Component> getSources() {
public List<Component> getSources() {
return sources;
}

View File

@ -10,6 +10,7 @@
package com.cburch.logisim.fpga.designrulecheck;
import java.util.ArrayList;
import java.util.List;
class ConnectionPointArray {
@ -27,7 +28,7 @@ class ConnectionPointArray {
myConnections.clear();
}
public ArrayList<ConnectionPoint> getAll() {
public List<ConnectionPoint> getAll() {
return myConnections;
}

View File

@ -13,6 +13,7 @@ import com.cburch.logisim.circuit.Wire;
import com.cburch.logisim.data.Location;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Net {
@ -132,12 +133,12 @@ public class Net {
return this.myPoints;
}
public ArrayList<ConnectionPoint> getSinkNets(int bitIndex) {
public List<ConnectionPoint> getSinkNets(int bitIndex) {
if ((bitIndex < 0) || (bitIndex >= sinkNetsList.size())) return new ArrayList<>();
return sinkNetsList.get(bitIndex).getAll();
}
public ArrayList<ConnectionPoint> getSourceNets(int bitIndex) {
public List<ConnectionPoint> getSourceNets(int bitIndex) {
if ((bitIndex < 0) || (bitIndex >= sourceNetsList.size())) return new ArrayList<>();
return sourceNetsList.get(bitIndex).getAll();
}
@ -157,13 +158,13 @@ public class Net {
return sinkList.get(bitid).size() > 0;
}
public ArrayList<ConnectionPoint> getBitSinks(int bitIndex) {
public List<ConnectionPoint> getBitSinks(int bitIndex) {
if ((bitIndex < 0) || (bitIndex >= sourceNetsList.size()))
return new ArrayList<>();
return new ArrayList<>(sinkList.get(bitIndex).getAll());
}
public ArrayList<ConnectionPoint> getBitSources(int bitIndex) {
public List<ConnectionPoint> getBitSources(int bitIndex) {
if ((bitIndex < 0) || (bitIndex >= sourceNetsList.size())) return null;
return sourceList.get(bitIndex).getAll();
}

View File

@ -1089,11 +1089,11 @@ public class Netlist {
return true;
}
public ArrayList<Component> getAllClockSources() {
public List<Component> getAllClockSources() {
return myClockInformation.getSourceContainer().getSources();
}
public ArrayList<Net> getAllNets() {
public List<Net> getAllNets() {
return myNets;
}
@ -1105,7 +1105,7 @@ public class Netlist {
return circuitName;
}
public int getClockSourceId(ArrayList<String> hierarchyLevel, Net whichNet, Byte bitId) {
public int getClockSourceId(List<String> hierarchyLevel, Net whichNet, Byte bitId) {
return myClockInformation.getClockSourceId(hierarchyLevel, whichNet, bitId);
}
@ -1113,11 +1113,11 @@ public class Netlist {
return myClockInformation.getClockSourceId(comp);
}
public ArrayList<netlistComponent> getClockSources() {
public List<netlistComponent> getClockSources() {
return myClockGenerators;
}
public ArrayList<String> getCurrentHierarchyLevel() {
public List<String> getCurrentHierarchyLevel() {
return currentHierarchyLevel;
}
@ -1133,7 +1133,7 @@ public class Netlist {
return -1;
}
private ArrayList<ConnectionPoint> getHiddenSinks(Net thisNet, Byte bitIndex, ArrayList<Component> splitters, Set<String> handledNets, Boolean isSourceNet) {
private List<ConnectionPoint> getHiddenSinks(Net thisNet, Byte bitIndex, List<Component> splitters, Set<String> handledNets, Boolean isSourceNet) {
final var result = new ArrayList<ConnectionPoint>();
// to prevent deadlock situations we check if we already looked at this net
final var netId = myNets.indexOf(thisNet) + "-" + bitIndex;
@ -1202,7 +1202,7 @@ public class Netlist {
return ((Index < 0) || (Index >= myInputPorts.size())) ? null : myInputPorts.get(Index);
}
public Map<ArrayList<String>, netlistComponent> getMappableResources(ArrayList<String> hierarchy, boolean toplevel) {
public Map<ArrayList<String>, netlistComponent> getMappableResources(List<String> hierarchy, boolean toplevel) {
final var components = new HashMap<ArrayList<String>, netlistComponent>();
/* First we search through my sub-circuits and add those IO components */
for (final var comp : mySubCircuits) {
@ -1309,7 +1309,7 @@ public class Netlist {
return null;
}
public ArrayList<netlistComponent> getNormalComponents() {
public List<netlistComponent> getNormalComponents() {
return myComponents;
}
@ -2048,7 +2048,7 @@ public class Netlist {
}
public void getGatedClockComponents(
ArrayList<Netlist> hierarchyNetlists,
List<Netlist> hierarchyNetlists,
netlistComponent subCircuit,
Map<String, Map<netlistComponent, Circuit>> notGatedSet,
Map<String, Map<netlistComponent, Circuit>> gatedSet,
@ -2419,7 +2419,7 @@ public class Netlist {
List<Set<netlistComponent>> components,
List<Set<Wire>> wires,
Set<netlistComponent> warnedComponents,
ArrayList<Netlist> hierarchyNetlists,
List<Netlist> hierarchyNetlists,
String warning) {
if (AppPreferences.SupressGatedClockWarnings.getBoolean()) return;
for (var i = 0; i < sources.size(); i++) {

View File

@ -15,6 +15,7 @@ import com.cburch.logisim.instance.StdAttr;
import com.cburch.logisim.std.wiring.Pin;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class netlistComponent {
@ -23,7 +24,7 @@ public class netlistComponent {
private final Component compReference;
private final ArrayList<ConnectionEnd> endEnds;
final ComponentMapInformationContainer myMapInformation;
private Map<ArrayList<String>, BubbleInformationContainer> globalIds;
private Map<List<String>, BubbleInformationContainer> globalIds;
private BubbleInformationContainer localId;
private boolean isGatedInstance;
@ -56,7 +57,7 @@ public class netlistComponent {
}
public void addGlobalBubbleId(
ArrayList<String> hierarchyName,
List<String> hierarchyName,
int inputBubblesStartId,
int nrOfInputBubbles,
int outputBubblesStartId,
@ -117,7 +118,7 @@ public class netlistComponent {
return -1;
}
public ArrayList<ConnectionPoint> getConnections(Net rootNet, byte bitIndex, boolean isOutput) {
public List<ConnectionPoint> getConnections(Net rootNet, byte bitIndex, boolean isOutput) {
final var connections = new ArrayList<ConnectionPoint>();
for (final var search : endEnds) {
for (byte bit = 0; bit < search.getNrOfBits(); bit++) {
@ -139,7 +140,7 @@ public class netlistComponent {
return endEnds.get(index);
}
public BubbleInformationContainer getGlobalBubbleId(ArrayList<String> hierarchyName) {
public BubbleInformationContainer getGlobalBubbleId(List<String> hierarchyName) {
return (globalIds == null) ? null : globalIds.getOrDefault(hierarchyName, null);
}

View File

@ -25,6 +25,7 @@ import com.cburch.logisim.util.LineBuffer;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
@ -247,7 +248,7 @@ public class AlteraDownload implements VendorDownload {
return FileWriter.writeContents(scriptFile, contents.get());
}
private ArrayList<String> getPinLocStrings() {
private List<String> getPinLocStrings() {
final var contents = LineBuffer.getBuffer();
for (final var key : mapInfo.getMappableResources().keySet()) {
@ -271,7 +272,7 @@ public class AlteraDownload implements VendorDownload {
return contents.getWithIndent(4);
}
private static ArrayList<String> getAlteraAssignments(BoardInformation currentBoard) {
private static List<String> getAlteraAssignments(BoardInformation currentBoard) {
final var pkg = currentBoard.fpga.getPackage().split(" ");
final var currentBehavior = currentBoard.fpga.getUnusedPinsBehavior();
final var behavior = switch (currentBehavior) {
@ -323,8 +324,8 @@ public class AlteraDownload implements VendorDownload {
return true;
}
private ArrayList<String> getDevices(ArrayList<String> lines) {
var dev = new ArrayList<String>();
private List<String> getDevices(ArrayList<String> lines) {
final var dev = new ArrayList<String>();
for (var line : lines) {
var n = dev.size() + 1;
if (!line.matches("^" + n + "\\) .*")) continue;

View File

@ -279,7 +279,7 @@ public class Download extends DownloadBase implements Runnable, BaseWindowListen
else return null;
}
public static String execute(ProcessBuilder process, ArrayList<String> report) throws IOException, InterruptedException {
public static String execute(ProcessBuilder process, List<String> report) throws IOException, InterruptedException {
var executable = process.start();
var is = executable.getInputStream();
var isr = new InputStreamReader(is);

View File

@ -33,6 +33,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
public abstract class DownloadBase {
@ -292,7 +293,7 @@ public abstract class DownloadBase {
}
}
public static HashMap<String, String> getLedArrayMaps(MappableResourcesContainer maps, Netlist nets, BoardInformation board) {
public static Map<String, String> getLedArrayMaps(MappableResourcesContainer maps, Netlist nets, BoardInformation board) {
final var ledArrayMaps = new HashMap<String, String>();
var hasMappedClockedArray = false;
for (final var comp : maps.getIoComponentInformation().getComponents()) {

View File

@ -22,23 +22,23 @@ import com.cburch.logisim.fpga.settings.VendorSoftware;
import com.cburch.logisim.util.LineBuffer;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class VivadoDownload implements VendorDownload {
private final VendorSoftware vivadoVendor =
VendorSoftware.getSoftware(VendorSoftware.VENDOR_VIVADO);
private final String ScriptPath;
private final String SandboxPath;
private final VendorSoftware vivadoVendor = VendorSoftware.getSoftware(VendorSoftware.VENDOR_VIVADO);
private final String scriptPath;
private final String sandboxPath;
private final String xdcPath;
private final String vivadoProjectPath;
private final Netlist RootNetList;
private MappableResourcesContainer MapInfo;
private final BoardInformation BoardInfo;
private final ArrayList<String> Entities;
private final ArrayList<String> Architectures;
private final Netlist rootNetList;
private MappableResourcesContainer mapInfo;
private final BoardInformation boardInfo;
private final ArrayList<String> entities;
private final ArrayList<String> architectures;
private static String _bitStreamPath;
private static String bitStreamPath;
private static final String CREATE_PROJECT_TCL = "vivadoCreateProject.tcl";
private static final String GENERATE_BITSTREAM_FILE = "vivadoGenerateBitStream.tcl";
private static final String LOAD_BITSTEAM_FILE = "vivadoLoadBitStream.tcl";
@ -46,20 +46,20 @@ public class VivadoDownload implements VendorDownload {
private static final String VIVADO_PROJECT_NAME = "vp";
public VivadoDownload(
String ProjectPath,
Netlist RootNetList,
BoardInformation BoardInfo,
ArrayList<String> Entities,
ArrayList<String> Architectures) {
this.SandboxPath = DownloadBase.getDirectoryLocation(ProjectPath, DownloadBase.SANDBOX_PATH);
this.ScriptPath = DownloadBase.getDirectoryLocation(ProjectPath, DownloadBase.SCRIPT_PATH);
this.xdcPath = DownloadBase.getDirectoryLocation(ProjectPath, DownloadBase.XDC_PATH);
this.RootNetList = RootNetList;
this.BoardInfo = BoardInfo;
this.Entities = Entities;
this.Architectures = Architectures;
this.vivadoProjectPath = this.SandboxPath + File.separator + VIVADO_PROJECT_NAME;
_bitStreamPath =
String projectPath,
Netlist rootNetList,
BoardInformation boardInfo,
ArrayList<String> entities,
ArrayList<String> architectures) {
this.sandboxPath = DownloadBase.getDirectoryLocation(projectPath, DownloadBase.SANDBOX_PATH);
this.scriptPath = DownloadBase.getDirectoryLocation(projectPath, DownloadBase.SCRIPT_PATH);
this.xdcPath = DownloadBase.getDirectoryLocation(projectPath, DownloadBase.XDC_PATH);
this.rootNetList = rootNetList;
this.boardInfo = boardInfo;
this.entities = entities;
this.architectures = architectures;
this.vivadoProjectPath = this.sandboxPath + File.separator + VIVADO_PROJECT_NAME;
bitStreamPath =
vivadoProjectPath
+ File.separator
+ VIVADO_PROJECT_NAME
@ -69,7 +69,7 @@ public class VivadoDownload implements VendorDownload {
+ File.separator
+ ToplevelHdlGeneratorFactory.FPGA_TOP_LEVEL_NAME
+ ".bit";
_bitStreamPath = _bitStreamPath.replace("\\", "/");
bitStreamPath = bitStreamPath.replace("\\", "/");
}
@Override
@ -79,61 +79,55 @@ public class VivadoDownload implements VendorDownload {
@Override
public String getStageMessage(int stage) {
switch (stage) {
case 0:
return S.get("VivadoProject");
case 1:
return S.get("VivadoBitstream");
default:
return "Unknown";
}
return switch (stage) {
case 0 -> S.get("VivadoProject");
case 1 -> S.get("VivadoBitstream");
default -> "Unknown";
};
}
@Override
public ProcessBuilder performStep(int stage) {
switch (stage) {
case 0:
return Stage0Project();
case 1:
return Stage1Bit();
default:
return null;
}
return switch (stage) {
case 0 -> stage0Project();
case 1 -> stage1Bit();
default -> null;
};
}
@Override
public boolean readyForDownload() {
return new File(_bitStreamPath).exists();
return new File(bitStreamPath).exists();
}
@Override
public ProcessBuilder downloadToBoard() {
var command = new ArrayList<String>();
command.add(vivadoVendor.getBinaryPath(0));
command.add("-mode");
command.add("batch");
command.add("-source");
command.add(ScriptPath + File.separator + LOAD_BITSTEAM_FILE);
final var stage0 = new ProcessBuilder(command);
stage0.directory(new File(SandboxPath));
final var command = LineBuffer.getBuffer();
command.add(vivadoVendor.getBinaryPath(0))
.add("-mode")
.add("batch")
.add("-source")
.add(scriptPath + File.separator + LOAD_BITSTEAM_FILE);
final var stage0 = new ProcessBuilder(command.get());
stage0.directory(new File(sandboxPath));
return stage0;
}
@Override
public boolean createDownloadScripts() {
// create project files
var createProjectFile = FileWriter.getFilePointer(ScriptPath, CREATE_PROJECT_TCL);
var createProjectFile = FileWriter.getFilePointer(scriptPath, CREATE_PROJECT_TCL);
var xdcFile = FileWriter.getFilePointer(xdcPath, XDC_FILE);
var generateBitstreamFile = FileWriter.getFilePointer(ScriptPath, GENERATE_BITSTREAM_FILE);
var loadBitstreamFile = FileWriter.getFilePointer(ScriptPath, LOAD_BITSTEAM_FILE);
var generateBitstreamFile = FileWriter.getFilePointer(scriptPath, GENERATE_BITSTREAM_FILE);
var loadBitstreamFile = FileWriter.getFilePointer(scriptPath, LOAD_BITSTEAM_FILE);
if (createProjectFile == null
|| xdcFile == null
|| generateBitstreamFile == null
|| loadBitstreamFile == null) {
createProjectFile = new File(ScriptPath + CREATE_PROJECT_TCL);
createProjectFile = new File(scriptPath + CREATE_PROJECT_TCL);
xdcFile = new File(xdcPath, XDC_FILE);
generateBitstreamFile = new File(ScriptPath, GENERATE_BITSTREAM_FILE);
loadBitstreamFile = new File(ScriptPath, LOAD_BITSTEAM_FILE);
generateBitstreamFile = new File(scriptPath, GENERATE_BITSTREAM_FILE);
loadBitstreamFile = new File(scriptPath, LOAD_BITSTEAM_FILE);
return createProjectFile.exists()
&& xdcFile.exists()
&& generateBitstreamFile.exists()
@ -150,16 +144,16 @@ public class VivadoDownload implements VendorDownload {
+ "\"");
contents.add(
"set_property part "
+ BoardInfo.fpga.getPart()
+ BoardInfo.fpga.getPackage()
+ BoardInfo.fpga.getSpeedGrade()
+ boardInfo.fpga.getPart()
+ boardInfo.fpga.getPackage()
+ boardInfo.fpga.getSpeedGrade()
+ " [current_project]");
contents.add("set_property target_language VHDL [current_project]");
// add all entities and architectures
for (var entity : Entities) {
for (final var entity : entities) {
contents.add("add_files \"" + entity + "\"");
}
for (var architecture : Architectures) {
for (final var architecture : architectures) {
contents.add("add_files \"" + architecture + "\"");
}
// add xdc constraints
@ -169,19 +163,19 @@ public class VivadoDownload implements VendorDownload {
contents.clear();
// fill the xdc file
if (RootNetList.numberOfClockTrees() > 0 || RootNetList.requiresGlobalClockConnection()) {
final var clockPin = BoardInfo.fpga.getClockPinLocation();
if (rootNetList.numberOfClockTrees() > 0 || rootNetList.requiresGlobalClockConnection()) {
final var clockPin = boardInfo.fpga.getClockPinLocation();
final var clockSignal = TickComponentHdlGeneratorFactory.FPGA_CLOCK;
final var getPortsString = " [get_ports {" + clockSignal + "}]";
contents.add("set_property PACKAGE_PIN " + clockPin + getPortsString);
if (BoardInfo.fpga.getClockStandard() != IoStandards.DEFAULT_STANDARD
&& BoardInfo.fpga.getClockStandard() != IoStandards.UNKNOWN) {
final var clockIoStandard = IoStandards.BEHAVIOR_STRINGS[BoardInfo.fpga.getClockStandard()];
if (boardInfo.fpga.getClockStandard() != IoStandards.DEFAULT_STANDARD
&& boardInfo.fpga.getClockStandard() != IoStandards.UNKNOWN) {
final var clockIoStandard = IoStandards.BEHAVIOR_STRINGS[boardInfo.fpga.getClockStandard()];
contents.add(" set_property IOSTANDARD " + clockIoStandard + getPortsString);
}
final var clockFrequency = BoardInfo.fpga.getClockFrequency();
final var clockFrequency = boardInfo.fpga.getClockFrequency();
var clockPeriod = 1000000000.0 / (double) clockFrequency;
contents.add(
" create_clock -add -name sys_clk_pin -period "
@ -211,12 +205,12 @@ public class VivadoDownload implements VendorDownload {
contents.clear();
// load bitstream
final var JTAGPos = String.valueOf(BoardInfo.fpga.getFpgaJTAGChainPosition());
final var lindex = "[lindex [get_hw_devices] " + JTAGPos + "]";
final var jtagPos = String.valueOf(boardInfo.fpga.getFpgaJTAGChainPosition());
final var lindex = "[lindex [get_hw_devices] " + jtagPos + "]";
contents.add("open_hw");
contents.add("connect_hw_server");
contents.add("open_hw_target");
contents.add("set_property PROGRAM.FILE {" + _bitStreamPath + "} " + lindex);
contents.add("set_property PROGRAM.FILE {" + bitStreamPath + "} " + lindex);
contents.add("current_hw_device " + lindex);
contents.add("refresh_hw_device -update_hw_probes false " + lindex);
contents.add("program_hw_device " + lindex);
@ -225,10 +219,10 @@ public class VivadoDownload implements VendorDownload {
return FileWriter.writeContents(loadBitstreamFile, contents);
}
private ArrayList<String> getPinLocStrings() {
private List<String> getPinLocStrings() {
final var contents = LineBuffer.getBuffer();
for (final var key : MapInfo.getMappableResources().keySet()) {
final var map = MapInfo.getMappableResources().get(key);
for (final var key : mapInfo.getMappableResources().keySet()) {
final var map = mapInfo.getMappableResources().get(key);
for (var i = 0; i < map.getNrOfPins(); i++) {
if (map.isMapped(i) && !map.isOpenMapped(i) && !map.isConstantMapped(i) && !map.isInternalMapped(i)) {
final var netName = (map.isExternalInverted(i) ? "n_" : "") + map.getHdlString(i);
@ -243,7 +237,7 @@ public class VivadoDownload implements VendorDownload {
}
}
}
final var LedArrayMap = DownloadBase.getLedArrayMaps(MapInfo, RootNetList, BoardInfo);
final var LedArrayMap = DownloadBase.getLedArrayMaps(mapInfo, rootNetList, boardInfo);
for (final var key : LedArrayMap.keySet()) {
contents.add("set_property PACKAGE_PIN {{1}} [get_ports {{{2}}}]", key, LedArrayMap.get(key));
}
@ -252,30 +246,33 @@ public class VivadoDownload implements VendorDownload {
@Override
public void setMapableResources(MappableResourcesContainer resources) {
MapInfo = resources;
mapInfo = resources;
}
private ProcessBuilder Stage0Project() {
var command = new ArrayList<String>();
command.add(vivadoVendor.getBinaryPath(0));
command.add("-mode");
command.add("batch");
command.add("-source");
command.add(ScriptPath + File.separator + CREATE_PROJECT_TCL);
final var stage0 = new ProcessBuilder(command);
stage0.directory(new File(SandboxPath));
private ProcessBuilder stage0Project() {
final var command = LineBuffer.getBuffer();
command
.add(vivadoVendor.getBinaryPath(0))
.add("-mode")
.add("batch")
.add("-source")
.add(scriptPath + File.separator + CREATE_PROJECT_TCL);
final var stage0 = new ProcessBuilder(command.get());
stage0.directory(new File(sandboxPath));
return stage0;
}
private ProcessBuilder Stage1Bit() {
var command = new ArrayList<String>();
command.add(vivadoVendor.getBinaryPath(0));
command.add("-mode");
command.add("batch");
command.add("-source");
command.add(ScriptPath + File.separator + GENERATE_BITSTREAM_FILE);
final var stage1 = new ProcessBuilder(command);
stage1.directory(new File(SandboxPath));
private ProcessBuilder stage1Bit() {
final var command = LineBuffer.getBuffer();
command
.add(vivadoVendor.getBinaryPath(0))
.add("-mode")
.add("batch")
.add("-source")
.add(scriptPath + File.separator + GENERATE_BITSTREAM_FILE);
final var stage1 = new ProcessBuilder(command.get());
stage1.directory(new File(sandboxPath));
return stage1;
}

View File

@ -31,23 +31,23 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class XilinxDownload implements VendorDownload {
private final VendorSoftware xilinxVendor =
VendorSoftware.getSoftware(VendorSoftware.VENDOR_XILINX);
private final String ScriptPath;
private final String ProjectPath;
private final String SandboxPath;
private final String UcfPath;
private final Netlist RootNetList;
private MappableResourcesContainer MapInfo;
private final VendorSoftware xilinxVendor = VendorSoftware.getSoftware(VendorSoftware.VENDOR_XILINX);
private final String scriptPath;
private final String projectPath;
private final String sandboxPath;
private final String ucfPath;
private final Netlist rootNetList;
private MappableResourcesContainer mapInfo;
private final BoardInformation boardInfo;
private final ArrayList<String> Entities;
private final ArrayList<String> architectures;
private final String HDLType;
private final List<String> entities;
private final List<String> architectures;
private final String HdlType;
private final String bitfileExt;
private final boolean IsCPLD;
private final boolean isCpld;
private final boolean writeToFlash;
private static final String VHDL_LIST_FILE = "XilinxVHDLList.prj";
@ -59,30 +59,27 @@ public class XilinxDownload implements VendorDownload {
private static final Integer BUFFER_SIZE = 16 * 1024;
public XilinxDownload(
String ProjectPath,
Netlist RootNetList,
BoardInformation BoardInfo,
ArrayList<String> Entities,
ArrayList<String> Architectures,
String HDLType,
boolean WriteToFlash) {
this.ProjectPath = ProjectPath;
this.SandboxPath = DownloadBase.getDirectoryLocation(ProjectPath, DownloadBase.SANDBOX_PATH);
this.ScriptPath = DownloadBase.getDirectoryLocation(ProjectPath, DownloadBase.SCRIPT_PATH);
this.UcfPath = DownloadBase.getDirectoryLocation(ProjectPath, DownloadBase.UCF_PATH);
this.RootNetList = RootNetList;
this.boardInfo = BoardInfo;
this.Entities = Entities;
this.architectures = Architectures;
this.HDLType = HDLType;
this.writeToFlash = WriteToFlash;
IsCPLD =
BoardInfo.fpga.getPart().toUpperCase().startsWith("XC2C")
|| BoardInfo.fpga.getPart().toUpperCase().startsWith("XA2C")
|| BoardInfo.fpga.getPart().toUpperCase().startsWith("XCR3")
|| BoardInfo.fpga.getPart().toUpperCase().startsWith("XC9500")
|| BoardInfo.fpga.getPart().toUpperCase().startsWith("XA9500");
bitfileExt = (IsCPLD) ? "jed" : "bit";
String projectPath,
Netlist rootNetList,
BoardInformation boardInfo,
List<String> entities,
List<String> architectures,
String hdlType,
boolean writeToFlash) {
this.projectPath = projectPath;
this.sandboxPath = DownloadBase.getDirectoryLocation(projectPath, DownloadBase.SANDBOX_PATH);
this.scriptPath = DownloadBase.getDirectoryLocation(projectPath, DownloadBase.SCRIPT_PATH);
this.ucfPath = DownloadBase.getDirectoryLocation(projectPath, DownloadBase.UCF_PATH);
this.rootNetList = rootNetList;
this.boardInfo = boardInfo;
this.entities = entities;
this.architectures = architectures;
this.HdlType = hdlType;
this.writeToFlash = writeToFlash;
final var part = boardInfo.fpga.getPart().toUpperCase();
isCpld = part.startsWith("XC2C") || part.startsWith("XA2C") || part.startsWith("XCR3") || part.startsWith("XC9500") || part.startsWith("XA9500");
bitfileExt = isCpld ? "jed" : "bit";
}
@Override
@ -92,43 +89,31 @@ public class XilinxDownload implements VendorDownload {
@Override
public String getStageMessage(int stage) {
switch (stage) {
case 0:
return S.get("XilinxSynth");
case 1:
return S.get("XilinxContraints");
case 2:
return S.get("XilinxMap");
case 3:
return S.get("XilinxPAR");
case 4:
return S.get("XilinxBit");
default:
return "unknown";
}
return switch (stage) {
case 0 -> S.get("XilinxSynth");
case 1 -> S.get("XilinxContraints");
case 2 -> S.get("XilinxMap");
case 3 -> S.get("XilinxPAR");
case 4 -> S.get("XilinxBit");
default -> "unknown";
};
}
@Override
public ProcessBuilder performStep(int stage) {
switch (stage) {
case 0:
return Stage0Synth();
case 1:
return Stage1Constraints();
case 2:
return Stage2Map();
case 3:
return Stage3PAR();
case 4:
return Stage4Bit();
default:
return null;
}
return switch (stage) {
case 0 -> stage0Synth();
case 1 -> stage1Constraints();
case 2 -> stage2Map();
case 3 -> stage3Par();
case 4 -> stage4Bit();
default -> null;
};
}
@Override
public boolean readyForDownload() {
return new File(SandboxPath + ToplevelHdlGeneratorFactory.FPGA_TOP_LEVEL_NAME + "." + bitfileExt).exists();
return new File(sandboxPath + ToplevelHdlGeneratorFactory.FPGA_TOP_LEVEL_NAME + "." + bitfileExt).exists();
}
@Override
@ -137,10 +122,10 @@ public class XilinxDownload implements VendorDownload {
var command = new ArrayList<String>();
command.add(xilinxVendor.getBinaryPath(5));
command.add("-batch");
command.add(ScriptPath.replace(ProjectPath, "../") + File.separator + DOWNLOAD_FILE);
final var Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
return Xilinx;
command.add(scriptPath.replace(projectPath, "../") + File.separator + DOWNLOAD_FILE);
final var xilinx = new ProcessBuilder(command);
xilinx.directory(new File(sandboxPath));
return xilinx;
} else {
Reporter.report.clearConsole();
/* Here we do the USBTMC Download */
@ -149,28 +134,28 @@ public class XilinxDownload implements VendorDownload {
Reporter.report.addFatalError(S.get("XilinxUsbTmc"));
return null;
}
var bitfile = new File(SandboxPath + ToplevelHdlGeneratorFactory.FPGA_TOP_LEVEL_NAME + "." + bitfileExt);
var bitfile_buffer = new byte[BUFFER_SIZE];
var bitfile_buffer_size = 0;
BufferedInputStream bitfile_in;
var bitfile = new File(sandboxPath + ToplevelHdlGeneratorFactory.FPGA_TOP_LEVEL_NAME + "." + bitfileExt);
var bitfileBuffer = new byte[BUFFER_SIZE];
var bitfileBufferSize = 0;
BufferedInputStream bitfileIn;
try {
bitfile_in = new BufferedInputStream(new FileInputStream(bitfile));
bitfileIn = new BufferedInputStream(new FileInputStream(bitfile));
} catch (FileNotFoundException e) {
Reporter.report.addFatalError(S.get("XilinxOpenFailure", bitfile));
return null;
}
var usbtmc = new File("/dev/usbtmc0");
BufferedOutputStream usbtmc_out;
BufferedOutputStream usbtmcOut;
try {
usbtmc_out = new BufferedOutputStream(new FileOutputStream(usbtmc));
usbtmc_out.write("FPGA ".getBytes());
bitfile_buffer_size = bitfile_in.read(bitfile_buffer, 0, BUFFER_SIZE);
while (bitfile_buffer_size > 0) {
usbtmc_out.write(bitfile_buffer, 0, bitfile_buffer_size);
bitfile_buffer_size = bitfile_in.read(bitfile_buffer, 0, BUFFER_SIZE);
usbtmcOut = new BufferedOutputStream(new FileOutputStream(usbtmc));
usbtmcOut.write("FPGA ".getBytes());
bitfileBufferSize = bitfileIn.read(bitfileBuffer, 0, BUFFER_SIZE);
while (bitfileBufferSize > 0) {
usbtmcOut.write(bitfileBuffer, 0, bitfileBufferSize);
bitfileBufferSize = bitfileIn.read(bitfileBuffer, 0, BUFFER_SIZE);
}
usbtmc_out.close();
bitfile_in.close();
usbtmcOut.close();
bitfileIn.close();
} catch (IOException e) {
Reporter.report.addFatalError(S.get("XilinxUsbTmcError"));
}
@ -180,42 +165,42 @@ public class XilinxDownload implements VendorDownload {
@Override
public boolean createDownloadScripts() {
final var JTAGPos = String.valueOf(boardInfo.fpga.getFpgaJTAGChainPosition());
var ScriptFile = FileWriter.getFilePointer(ScriptPath, SCRIPT_FILE);
var VhdlListFile = FileWriter.getFilePointer(ScriptPath, VHDL_LIST_FILE);
var UcfFile = FileWriter.getFilePointer(UcfPath, UCF_FILE);
var DownloadFile = FileWriter.getFilePointer(ScriptPath, DOWNLOAD_FILE);
if (ScriptFile == null || VhdlListFile == null || UcfFile == null || DownloadFile == null) {
ScriptFile = new File(ScriptPath + SCRIPT_FILE);
VhdlListFile = new File(ScriptPath + VHDL_LIST_FILE);
UcfFile = new File(UcfPath + UCF_FILE);
DownloadFile = new File(ScriptPath + DOWNLOAD_FILE);
return ScriptFile.exists()
&& VhdlListFile.exists()
&& UcfFile.exists()
&& DownloadFile.exists();
final var jtagPos = String.valueOf(boardInfo.fpga.getFpgaJTAGChainPosition());
var scriptFile = FileWriter.getFilePointer(scriptPath, SCRIPT_FILE);
var vhdlListFile = FileWriter.getFilePointer(scriptPath, VHDL_LIST_FILE);
var ucfFile = FileWriter.getFilePointer(ucfPath, UCF_FILE);
var downloadFile = FileWriter.getFilePointer(scriptPath, DOWNLOAD_FILE);
if (scriptFile == null || vhdlListFile == null || ucfFile == null || downloadFile == null) {
scriptFile = new File(scriptPath + SCRIPT_FILE);
vhdlListFile = new File(scriptPath + VHDL_LIST_FILE);
ucfFile = new File(ucfPath + UCF_FILE);
downloadFile = new File(scriptPath + DOWNLOAD_FILE);
return scriptFile.exists()
&& vhdlListFile.exists()
&& ucfFile.exists()
&& downloadFile.exists();
}
final var contents = LineBuffer.getBuffer()
.pair("JTAGPos", JTAGPos)
.pair("JTAGPos", jtagPos)
.pair("fileExt", bitfileExt)
.pair("fileBaseName", ToplevelHdlGeneratorFactory.FPGA_TOP_LEVEL_NAME)
.pair("mcsFile", ScriptPath + File.separator + MCS_FILE)
.pair("hdlType", HDLType.toUpperCase().toUpperCase());
.pair("mcsFile", scriptPath + File.separator + MCS_FILE)
.pair("hdlType", HdlType.toUpperCase());
for (var entity : Entities) contents.add("{{hdlType}} work \"{{1}}\"", entity);
for (var entity : entities) contents.add("{{hdlType}} work \"{{1}}\"", entity);
for (var arch : architectures) contents.add("{{hdlType}} work \"{{1}}\"", arch);
if (!FileWriter.writeContents(VhdlListFile, contents.get())) return false;
if (!FileWriter.writeContents(vhdlListFile, contents.get())) return false;
contents
.clear()
.add(
"run -top {{1}} -ofn logisim.ngc -ofmt NGC -ifn {{2}}{{3}} -ifmt mixed -p {{4}}",
ToplevelHdlGeneratorFactory.FPGA_TOP_LEVEL_NAME,
ScriptPath.replace(ProjectPath, "../"),
scriptPath.replace(projectPath, "../"),
VHDL_LIST_FILE,
GetFPGADeviceString(boardInfo));
getFpgaDeviceString(boardInfo));
if (!FileWriter.writeContents(ScriptFile, contents.get())) return false;
if (!FileWriter.writeContents(scriptFile, contents.get())) return false;
contents.clear();
contents.add("setmode -bscan");
@ -243,7 +228,7 @@ public class XilinxDownload implements VendorDownload {
""");
} else {
contents.add("setcable -p auto").add("identify");
if (!IsCPLD) {
if (!isCpld) {
contents.add("""
assignFile -p {{JTAGPos}} -file {{fileBaseName}}.{{fileExt}}
program -p {{JTAGPos}} -onlyFpga
@ -256,14 +241,14 @@ public class XilinxDownload implements VendorDownload {
}
}
contents.add("quit");
if (!FileWriter.writeContents(DownloadFile, contents.get())) return false;
if (!FileWriter.writeContents(downloadFile, contents.get())) return false;
contents.clear();
if (RootNetList.numberOfClockTrees() > 0 || RootNetList.requiresGlobalClockConnection()) {
if (rootNetList.numberOfClockTrees() > 0 || rootNetList.requiresGlobalClockConnection()) {
contents
.pair("clock", TickComponentHdlGeneratorFactory.FPGA_CLOCK)
.pair("clockFreq", Download.getClockFrequencyString(boardInfo))
.pair("clockPin", GetXilinxClockPin(boardInfo))
.pair("clockPin", getXilinxClockPin(boardInfo))
.add("""
NET "{{clock}}" {{clockPin}} ;
NET "{{clock}}" TNM_NET = "{{clock}}" ;
@ -271,88 +256,88 @@ public class XilinxDownload implements VendorDownload {
""");
}
contents.add(getPinLocStrings());
return FileWriter.writeContents(UcfFile, contents.get());
return FileWriter.writeContents(ucfFile, contents.get());
}
private ArrayList<String> getPinLocStrings() {
var Contents = new ArrayList<String>();
var Temp = new StringBuilder();
for (var key : MapInfo.getMappableResources().keySet()) {
var map = MapInfo.getMappableResources().get(key);
var contents = new ArrayList<String>();
var temp = new StringBuilder();
for (var key : mapInfo.getMappableResources().keySet()) {
var map = mapInfo.getMappableResources().get(key);
for (var i = 0; i < map.getNrOfPins(); i++) {
if (map.isMapped(i) && !map.isOpenMapped(i) && !map.isConstantMapped(i) && !map.isInternalMapped(i)) {
Temp.setLength(0);
Temp.append("NET \"");
if (map.isExternalInverted(i)) Temp.append("n_");
Temp.append(map.getHdlString(i)).append("\" ");
Temp.append("LOC = \"").append(map.getPinLocation(i)).append("\" ");
temp.setLength(0);
temp.append("NET \"");
if (map.isExternalInverted(i)) temp.append("n_");
temp.append(map.getHdlString(i)).append("\" ");
temp.append("LOC = \"").append(map.getPinLocation(i)).append("\" ");
final var info = map.getFpgaInfo(i);
if (info != null) {
if (info.getPullBehavior() != PullBehaviors.UNKNOWN
&& info.getPullBehavior() != PullBehaviors.FLOAT) {
Temp.append("| ")
temp.append("| ")
.append(PullBehaviors.getContraintedPullString(info.getPullBehavior()))
.append(" ");
}
if (info.getDrive() != DriveStrength.UNKNOWN
&& info.getDrive() != DriveStrength.DEFAULT_STENGTH) {
Temp.append("| DRIVE = ")
temp.append("| DRIVE = ")
.append(DriveStrength.GetContraintedDriveStrength(info.getDrive())).append(" ");
}
if (info.getIoStandard() != IoStandards.UNKNOWN
&& info.getIoStandard() != IoStandards.DEFAULT_STANDARD) {
Temp.append("| IOSTANDARD = ")
temp.append("| IOSTANDARD = ")
.append(IoStandards.getConstraintedIoStandard(info.getIoStandard()))
.append(" ");
}
}
Temp.append(";");
Contents.add(Temp.toString());
temp.append(";");
contents.add(temp.toString());
}
}
}
final var LedArrayMap = DownloadBase.getLedArrayMaps(MapInfo, RootNetList, boardInfo);
final var LedArrayMap = DownloadBase.getLedArrayMaps(mapInfo, rootNetList, boardInfo);
for (var key : LedArrayMap.keySet()) {
Contents.add("NET \"" + LedArrayMap.get(key) + "\" LOC=\"" + key + "\";");
contents.add("NET \"" + LedArrayMap.get(key) + "\" LOC=\"" + key + "\";");
}
return Contents;
return contents;
}
@Override
public void setMapableResources(MappableResourcesContainer resources) {
MapInfo = resources;
mapInfo = resources;
}
private ProcessBuilder Stage0Synth() {
private ProcessBuilder stage0Synth() {
final var command = LineBuffer.getBuffer();
command
.add(xilinxVendor.getBinaryPath(0))
.add("-ifn")
.add(ScriptPath.replace(ProjectPath, "../") + File.separator + SCRIPT_FILE)
.add(scriptPath.replace(projectPath, "../") + File.separator + SCRIPT_FILE)
.add("-ofn")
.add("logisim.log");
final var stage0 = new ProcessBuilder(command.get());
stage0.directory(new File(SandboxPath));
stage0.directory(new File(sandboxPath));
return stage0;
}
private ProcessBuilder Stage1Constraints() {
private ProcessBuilder stage1Constraints() {
final var command = LineBuffer.getBuffer();
command
.add(xilinxVendor.getBinaryPath(1))
.add("-intstyle")
.add("ise")
.add("-uc")
.add(UcfPath.replace(ProjectPath, "../") + File.separator + UCF_FILE)
.add(ucfPath.replace(projectPath, "../") + File.separator + UCF_FILE)
.add("logisim.ngc")
.add("logisim.ngd");
final var stage1 = new ProcessBuilder(command.get());
stage1.directory(new File(SandboxPath));
stage1.directory(new File(sandboxPath));
return stage1;
}
private ProcessBuilder Stage2Map() {
if (IsCPLD) return null; /* mapping is skipped for the CPLD target*/
private ProcessBuilder stage2Map() {
if (isCpld) return null; /* mapping is skipped for the CPLD target*/
final var command = LineBuffer.getBuffer();
command
.add(xilinxVendor.getBinaryPath(2))
@ -362,13 +347,13 @@ public class XilinxDownload implements VendorDownload {
.add("logisim_map")
.add("logisim.ngd");
final var stage2 = new ProcessBuilder(command.get());
stage2.directory(new File(SandboxPath));
stage2.directory(new File(sandboxPath));
return stage2;
}
private ProcessBuilder Stage3PAR() {
private ProcessBuilder stage3Par() {
final var command = LineBuffer.getBuffer();
if (!IsCPLD) {
if (!isCpld) {
command
.add(xilinxVendor.getBinaryPath(3))
.add("-w")
@ -402,13 +387,13 @@ public class XilinxDownload implements VendorDownload {
.add("logisim.ngd");
}
final var stage3 = new ProcessBuilder(command.get());
stage3.directory(new File(SandboxPath));
stage3.directory(new File(sandboxPath));
return stage3;
}
private ProcessBuilder Stage4Bit() {
var command = LineBuffer.getBuffer();
if (!IsCPLD) {
private ProcessBuilder stage4Bit() {
final var command = LineBuffer.getBuffer();
if (!isCpld) {
command.add(xilinxVendor.getBinaryPath(4)).add("-w");
if (boardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PULL_UP) command.add("-g").add("UnusedPin:PULLUP");
if (boardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PULL_DOWN) command.add("-g").add("UnusedPin:PULLDOWN");
@ -417,28 +402,28 @@ public class XilinxDownload implements VendorDownload {
command.add(xilinxVendor.getBinaryPath(7)).add("-i").add("logisim.vm6");
}
final var stage4 = new ProcessBuilder(command.get());
stage4.directory(new File(SandboxPath));
stage4.directory(new File(sandboxPath));
return stage4;
}
private static String GetFPGADeviceString(BoardInformation currentBoard) {
private static String getFpgaDeviceString(BoardInformation currentBoard) {
final var fpga = currentBoard.fpga;
return String.format("%s-%s-%s", fpga.getPart(), fpga.getPackage(), fpga.getSpeedGrade());
}
private static String GetXilinxClockPin(BoardInformation CurrentBoard) {
var result = new StringBuilder();
result.append("LOC = \"").append(CurrentBoard.fpga.getClockPinLocation()).append("\"");
if (CurrentBoard.fpga.getClockPull() == PullBehaviors.PULL_UP) {
private static String getXilinxClockPin(BoardInformation currentBoard) {
final var result = new StringBuilder();
result.append("LOC = \"").append(currentBoard.fpga.getClockPinLocation()).append("\"");
if (currentBoard.fpga.getClockPull() == PullBehaviors.PULL_UP) {
result.append(" | PULLUP");
}
if (CurrentBoard.fpga.getClockPull() == PullBehaviors.PULL_DOWN) {
if (currentBoard.fpga.getClockPull() == PullBehaviors.PULL_DOWN) {
result.append(" | PULLDOWN");
}
if (CurrentBoard.fpga.getClockStandard() != IoStandards.DEFAULT_STANDARD
&& CurrentBoard.fpga.getClockStandard() != IoStandards.UNKNOWN) {
if (currentBoard.fpga.getClockStandard() != IoStandards.DEFAULT_STANDARD
&& currentBoard.fpga.getClockStandard() != IoStandards.UNKNOWN) {
result.append(" | IOSTANDARD = ")
.append(IoStandards.BEHAVIOR_STRINGS[CurrentBoard.fpga.getClockStandard()]);
.append(IoStandards.BEHAVIOR_STRINGS[currentBoard.fpga.getClockStandard()]);
}
return result.toString();
}

View File

@ -26,7 +26,7 @@ public class FileWriter {
public static final String ENTITY_EXTENSION = "_entity";
public static final String ARCHITECTURE_EXTENSION = "_behavior";
public static ArrayList<String> getExtendedLibrary() {
public static List<String> getExtendedLibrary() {
final var lines = LineBuffer.getBuffer();
lines.add("""
@ -38,7 +38,7 @@ public class FileWriter {
return lines.get();
}
public static ArrayList<String> getStandardLibrary() {
public static List<String> getStandardLibrary() {
final var lines = LineBuffer.getBuffer();
lines.add("""
@ -105,7 +105,7 @@ public class FileWriter {
}
}
public static ArrayList<String> getGenerateRemark(String compName, String projName) {
public static List<String> getGenerateRemark(String compName, String projName) {
ArrayList<String> lines = new ArrayList<>();
final int headWidth;
final String headOpen;

View File

@ -29,6 +29,7 @@ import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
@ -199,7 +200,7 @@ public class BoardEditor implements ActionListener, BaseComponentListenerContrac
}
private String getInternalBoardName() {
ArrayList<String> boards = AppPreferences.Boards.getBoardNames();
List<String> boards = AppPreferences.Boards.getBoardNames();
return (String)
OptionPane.showInputDialog(
panel,

View File

@ -46,6 +46,7 @@ import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JDialog;
@ -261,7 +262,7 @@ public class BoardManipulator extends JPanel
return image.getScaledInstance(width, height, 4);
}
public ArrayList<FpgaIoInformationContainer> getIoComponents() {
public List<FpgaIoInformationContainer> getIoComponents() {
return IOcomps.getComponents();
}

View File

@ -23,9 +23,9 @@ import com.cburch.logisim.util.LineBuffer;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import java.util.List;
import java.util.SortedMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
@ -62,7 +62,7 @@ public class AbstractHdlGeneratorFactory implements HdlGeneratorFactory {
}
@Override
public ArrayList<String> getArchitecture(Netlist theNetlist, AttributeSet attrs, String componentName) {
public List<String> getArchitecture(Netlist theNetlist, AttributeSet attrs, String componentName) {
final var contents = LineBuffer.getHdlBuffer();
final var oneLine = new StringBuilder();
if (getWiresPortsDuringHDLWriting) {
@ -81,7 +81,7 @@ public class AbstractHdlGeneratorFactory implements HdlGeneratorFactory {
}
final var components = getComponentDeclarationSection(theNetlist, attrs);
if (!components.isEmpty())
if (!components.isEmpty())
contents.addRemarkBlock("Here all used components are defined").add(components).empty();
final var typedWires = myTypedWires.getTypedWires();
@ -103,8 +103,8 @@ public class AbstractHdlGeneratorFactory implements HdlGeneratorFactory {
// now we add them
if (maxNameLength > 0) contents.addRemarkBlock("All used signals are defined here");
final var sortedSignals = new TreeSet<String>(mySignals.keySet());
for (final var signal : sortedSignals)
contents.add(" SIGNAL {{1}}{{2}} : {{3}};", signal, " ".repeat(maxNameLength - signal.length()),
for (final var signal : sortedSignals)
contents.add(" SIGNAL {{1}}{{2}} : {{3}};", signal, " ".repeat(maxNameLength - signal.length()),
mySignals.get(signal));
if (maxNameLength > 0) contents.empty();
contents.add("BEGIN")
@ -343,7 +343,7 @@ public class AbstractHdlGeneratorFactory implements HdlGeneratorFactory {
return contents.get();
}
public ArrayList<String> getComponentDeclarationSection(Netlist theNetlist, AttributeSet attrs) {
public List<String> getComponentDeclarationSection(Netlist theNetlist, AttributeSet attrs) {
/*
* This method returns all the component definitions used as component
* in the circuit. This method is only called in case of VHDL-code
@ -353,14 +353,14 @@ public class AbstractHdlGeneratorFactory implements HdlGeneratorFactory {
}
@Override
public ArrayList<String> getComponentInstantiation(Netlist theNetlist, AttributeSet attrs, String componentName) {
public List<String> getComponentInstantiation(Netlist theNetlist, AttributeSet attrs, String componentName) {
final var contents = LineBuffer.getHdlBuffer();
if (Hdl.isVhdl()) contents.add(getVHDLBlackBox(theNetlist, attrs, componentName, false));
return contents.get();
}
@Override
public ArrayList<String> getComponentMap(Netlist nets, Long componentId, Object componentInfo, String name) {
public List<String> getComponentMap(Netlist nets, Long componentId, Object componentInfo, String name) {
final var contents = LineBuffer.getHdlBuffer();
final var parameterMap = new TreeMap<String, String>();
final var portMap = getPortMap(nets, componentInfo);
@ -475,7 +475,7 @@ public class AbstractHdlGeneratorFactory implements HdlGeneratorFactory {
}
@Override
public ArrayList<String> getEntity(Netlist theNetlist, AttributeSet attrs, String componentName) {
public List<String> getEntity(Netlist theNetlist, AttributeSet attrs, String componentName) {
final var contents = LineBuffer.getHdlBuffer();
if (Hdl.isVhdl()) {
contents.add(FileWriter.getGenerateRemark(componentName, theNetlist.projName()))
@ -499,8 +499,7 @@ public class AbstractHdlGeneratorFactory implements HdlGeneratorFactory {
/* Here all public entries for HDL generation are defined */
@Override
public LineBuffer getInlinedCode(Netlist nets, Long componentId, netlistComponent componentInfo,
String circuitName) {
public LineBuffer getInlinedCode(Netlist nets, Long componentId, netlistComponent componentInfo, String circuitName) {
throw new IllegalAccessError("BUG: Inline code not supported");
}
@ -512,7 +511,7 @@ public class AbstractHdlGeneratorFactory implements HdlGeneratorFactory {
return LineBuffer.getHdlBuffer();
}
public SortedMap<String, String> getPortMap(Netlist nets, Object mapInfo) {
public Map<String, String> getPortMap(Netlist nets, Object mapInfo) {
final var result = new TreeMap<String, String>();
if ((mapInfo instanceof netlistComponent componentInfo) && !myPorts.isEmpty()) {
final var compName = componentInfo.getComponent().getFactory().getDisplayName();
@ -596,7 +595,7 @@ public class AbstractHdlGeneratorFactory implements HdlGeneratorFactory {
return directoryName.toString();
}
private ArrayList<String> getVHDLBlackBox(Netlist theNetlist, AttributeSet attrs,
private List<String> getVHDLBlackBox(Netlist theNetlist, AttributeSet attrs,
String componentName, Boolean isEntity) {
final var contents = LineBuffer.getHdlBuffer();
var maxNameLength = 0;

View File

@ -85,13 +85,13 @@ public class TickComponentHdlGeneratorFactory extends AbstractHdlGeneratorFactor
s_count_next <= (OTHERS => '0') WHEN s_tick_reg /= '0' AND s_tick_reg /= '1' ELSE -- For simulation only!
std_logic_vector(to_unsigned((ReloadValue-1), {{nrOfCounterBits}})) WHEN s_tick_next = '1' ELSE
std_logic_vector(unsigned(s_count_reg)-1);
""");
} else {
contents.add("""
assign s_tick_next = (s_count_reg == 0) ? 1'b1 : 1'b0;
assign s_count_next = (s_count_reg == 0) ? ReloadValue-1 : s_count_reg-1;
""")
.addRemarkBlock("Here the simulation only initial is defined")
.add("""
@ -112,7 +112,7 @@ public class TickComponentHdlGeneratorFactory extends AbstractHdlGeneratorFactor
s_tick_reg <= s_tick_next;
END IF;
END PROCESS make_tick;
make_counter : PROCESS( FPGAClock , s_count_next )
BEGIN
IF (FPGAClock'event AND (FPGAClock = '1')) THEN

View File

@ -136,7 +136,7 @@ public class ToplevelHdlGeneratorFactory extends AbstractHdlGeneratorFactory {
for (final var io : myIOComponents.getMappedOutputPinNames()) {
myPorts.add(Port.OUTPUT, io, 1, null);
}
for (final var io : myIOComponents.GetMappedIoPinNames())
for (final var io : myIOComponents.getMappedIoPinNames())
myPorts.add(Port.INOUT, io, 1, null);
}

View File

@ -10,6 +10,7 @@ package com.cburch.logisim.fpga.hdlgenerator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.cburch.logisim.util.LineBuffer;
@ -75,7 +76,7 @@ public class WithSelectHdlGenerator {
return this;
}
public ArrayList<String> getHdlCode() {
public List<String> getHdlCode() {
final var contents = LineBuffer.getHdlBuffer()
.pair("sourceName", sourceSignal)
.pair("destName", destinationSignal)

View File

@ -15,6 +15,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@ -139,7 +140,7 @@ public class BoardList {
}
}
public ArrayList<String> getBoardNames() {
public List<String> getBoardNames() {
SortedArrayList<String> ret = new SortedArrayList<>();
for (String board : DefinedBoards) {
ret.insertSorted(getBoardName(board));

View File

@ -19,7 +19,7 @@ import com.cburch.draw.model.CanvasModelEvent;
import com.cburch.draw.model.CanvasModelListener;
import com.cburch.draw.model.CanvasObject;
import com.cburch.draw.model.ReorderRequest;
import com.cburch.draw.undo.Action;
import com.cburch.draw.undo.UndoAction;
import com.cburch.logisim.circuit.Circuit;
import com.cburch.logisim.circuit.CircuitState;
import com.cburch.logisim.circuit.appear.AppearanceElement;
@ -109,7 +109,7 @@ public class AppearanceCanvas extends Canvas implements CanvasPaneContents, Acti
}
@Override
public void doAction(Action canvasAction) {
public void doAction(UndoAction canvasAction) {
final var circuit = circuitState.getCircuit();
if (!proj.getLogisimFile().contains(circuit)) {
return;

View File

@ -10,7 +10,7 @@
package com.cburch.logisim.gui.appear;
import com.cburch.draw.actions.ModelAction;
import com.cburch.draw.undo.Action;
import com.cburch.draw.undo.UndoAction;
import com.cburch.logisim.circuit.Circuit;
import com.cburch.logisim.circuit.CircuitMutator;
import com.cburch.logisim.circuit.CircuitTransaction;
@ -21,10 +21,10 @@ import java.util.Map;
public class CanvasActionAdapter extends com.cburch.logisim.proj.Action {
private final Circuit circuit;
private final Action canvasAction;
private final UndoAction canvasAction;
private boolean wasDefault;
public CanvasActionAdapter(Circuit circuit, Action action) {
public CanvasActionAdapter(Circuit circuit, UndoAction action) {
this.circuit = circuit;
this.canvasAction = action;
}

View File

@ -14,17 +14,18 @@ import java.awt.event.MouseEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.List;
import javax.swing.SwingUtilities;
public class BasicZoomModel implements ZoomModel {
private final ArrayList<Double> zoomOptions;
private final List<Double> zoomOptions;
private final PropertyChangeSupport support;
private final CanvasPane canvas;
private double zoomFactor;
private boolean showGrid;
public BasicZoomModel(PrefMonitor<Boolean> gridPref, PrefMonitor<Double> zoomPref, ArrayList<Double> zoomOpts, CanvasPane pane) {
public BasicZoomModel(PrefMonitor<Boolean> gridPref, PrefMonitor<Double> zoomPref, List<Double> zoomOpts, CanvasPane pane) {
zoomOptions = zoomOpts;
support = new PropertyChangeSupport(this);
zoomFactor = 1.0;
@ -59,7 +60,7 @@ public class BasicZoomModel implements ZoomModel {
}
@Override
public ArrayList<Double> getZoomOptions() {
public List<Double> getZoomOptions() {
return zoomOptions;
}

View File

@ -116,7 +116,7 @@ public class ZoomControl extends JPanel {
*/
public String zoomString() {
DecimalFormat df = new DecimalFormat("###.##");
return "\u00D7" + df.format(model.getZoomFactor()).toString();
return "\u00D7" + df.format(model.getZoomFactor());
}
public void zoomIn() {

View File

@ -12,6 +12,7 @@ package com.cburch.logisim.gui.generic;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
public interface ZoomModel {
String ZOOM = "zoom";
@ -24,7 +25,7 @@ public interface ZoomModel {
double getZoomFactor();
ArrayList<Double> getZoomOptions();
List<Double> getZoomOptions();
void setZoomFactor(double value);

View File

@ -27,9 +27,7 @@ import com.cburch.logisim.util.LocaleListener;
import com.cburch.logisim.util.LocaleManager;
import com.cburch.logisim.util.WindowMenuItemManager;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

View File

@ -514,7 +514,7 @@ public class Model implements CircuitListener, SignalInfo.Listener {
return signals.size();
}
public ArrayList<Signal> getSignals() {
public List<Signal> getSignals() {
return signals;
}

View File

@ -9,9 +9,7 @@
package com.cburch.logisim.gui.main;
import com.cburch.logisim.circuit.Circuit;
import com.cburch.logisim.circuit.SubcircuitFactory;
import com.cburch.logisim.comp.ComponentFactory;
import com.cburch.logisim.data.AttributeEvent;
import com.cburch.logisim.data.AttributeListener;
import com.cburch.logisim.data.AttributeSet;
@ -20,7 +18,6 @@ import com.cburch.logisim.file.LibraryEventSource;
import com.cburch.logisim.file.LibraryListener;
import com.cburch.logisim.file.LogisimFile;
import com.cburch.logisim.file.LogisimFileActions;
import com.cburch.logisim.gui.generic.AttrTableModel;
import com.cburch.logisim.gui.generic.ProjectExplorer;
import com.cburch.logisim.gui.generic.ProjectExplorerLibraryNode;
import com.cburch.logisim.gui.generic.ProjectExplorerToolNode;
@ -36,7 +33,6 @@ import com.cburch.logisim.tools.EditTool;
import com.cburch.logisim.tools.Library;
import com.cburch.logisim.tools.PokeTool;
import com.cburch.logisim.tools.Tool;
import com.cburch.logisim.vhdl.base.VhdlContent;
import com.cburch.logisim.vhdl.base.VhdlEntity;
import javax.swing.JPopupMenu;

View File

@ -19,6 +19,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ButtonGroup;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
@ -144,7 +145,7 @@ public class MenuSimulate extends Menu {
computeEnabled();
}
public static ArrayList<String> getTickFrequencyStrings() {
public static List<String> getTickFrequencyStrings() {
final var result = new ArrayList<String>();
for (final var supportedTickFrequency : SUPPORTED_TICK_FREQUENCIES) {
if (supportedTickFrequency < 1000) {
@ -208,7 +209,7 @@ public class MenuSimulate extends Menu {
assemblyWindow.setText("Assembly viewer");
}
private void recreateStateMenu(JMenu menu, ArrayList<CircuitStateMenuItem> items, int code) {
private void recreateStateMenu(JMenu menu, List<CircuitStateMenuItem> items, int code) {
menu.removeAll();
menu.setEnabled(items.size() > 0);
var first = true;

View File

@ -18,7 +18,6 @@ import com.cburch.logisim.gui.generic.ProjectExplorer;
import com.cburch.logisim.gui.generic.ProjectExplorerToolNode;
import com.cburch.logisim.gui.main.AttrTableToolModel;
import com.cburch.logisim.prefs.AppPreferences;
import com.cburch.logisim.tools.AddTool;
import com.cburch.logisim.tools.Tool;
import com.cburch.logisim.util.InputEventUtil;
import java.awt.Color;

View File

@ -24,7 +24,6 @@ import com.cburch.logisim.instance.InstanceState;
import com.cburch.logisim.instance.StdAttr;
import com.cburch.logisim.proj.Project;
import com.cburch.logisim.std.wiring.Pin;
import com.cburch.logisim.util.StringUtil;
import com.cburch.logisim.util.UniquelyNamedThread;
public class TestThread extends UniquelyNamedThread implements CircuitListener {

View File

@ -22,6 +22,7 @@ import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.prefs.Preferences;
import javax.swing.BorderFactory;
import javax.swing.JButton;
@ -239,7 +240,7 @@ public class FPGABoards implements ActionListener {
return buildInBoards.getBoardFilePath(boardName);
}
public ArrayList<String> getBoardNames() {
public List<String> getBoardNames() {
return buildInBoards.getBoardNames();
}

View File

@ -37,6 +37,7 @@ import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
@ -239,7 +240,7 @@ public class SocBusStateInfo extends JDialog
sniffers.remove(sniffer);
}
public ArrayList<SocBusSlaveInterface> getSlaves() {
public List<SocBusSlaveInterface> getSlaves() {
return memMap.getSlaves();
}
@ -268,7 +269,7 @@ public class SocBusStateInfo extends JDialog
public void initializeTransaction(SocBusTransaction trans, String busId) {
int nrOfReponders = 0;
int reponder = -1;
ArrayList<SocBusSlaveInterface> slaves = memMap.getSlaves();
final var slaves = memMap.getSlaves();
if (slaves.isEmpty()) trans.setError(SocBusTransaction.NO_SLAVES_ERROR);
else if (trans.isReadTransaction()
&& trans.isWriteTransaction()
@ -292,7 +293,7 @@ public class SocBusStateInfo extends JDialog
sniffer.sniffTransaction(trans);
}
if (!trans.isHidden()) {
SocBusState data = getRegPropagateState();
final var data = getRegPropagateState();
if (data != null) {
data.addTransaction(trans);
if (myComp.getAttributeSet().getValue(SocBusAttributes.SOC_TRACE_VISIBLE))

View File

@ -20,6 +20,7 @@ import java.awt.Component;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JTable;
@ -229,7 +230,7 @@ public class SocMemMapModel extends AbstractTableModel
}
}
public ArrayList<SocBusSlaveInterface> getSlaves() {
public List<SocBusSlaveInterface> getSlaves() {
return slaves;
}

View File

@ -26,6 +26,7 @@ import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
@ -102,7 +103,7 @@ public class BreakpointPanel extends JPanel
asmWindow.setCaretPosition(curetPos);
}
public HashMap<Integer, Integer> getBreakPoints() {
public Map<Integer, Integer> getBreakPoints() {
HashMap<Integer, Integer> breakPoints = new HashMap<>();
for (int i : getBreakpointLines()) breakPoints.put(debugLines.get(i), i);
return breakPoints;

View File

@ -25,6 +25,7 @@ import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
@ -40,12 +41,11 @@ public class TraceWindowTableModel extends AbstractTableModel
private static final long serialVersionUID = 1L;
private final SocBusMenuProvider.InstanceInformation parent;
private final HashMap<SocBusStateInfo.SocBusState, CircuitStateHolder.HierarchyInfo> myTraceList;
private final Map<SocBusStateInfo.SocBusState, CircuitStateHolder.HierarchyInfo> myTraceList;
private JTable table;
private int BoxWidth = SocBusStateInfo.BLOCK_WIDTH;
public TraceWindowTableModel(
HashMap<SocBusStateInfo.SocBusState, CircuitStateHolder.HierarchyInfo> traceList,
SocBusMenuProvider.InstanceInformation p) {
public TraceWindowTableModel(Map<SocBusState, CircuitStateHolder.HierarchyInfo> traceList,
SocBusMenuProvider.InstanceInformation p) {
myTraceList = traceList;
parent = p;
rebuild();

View File

@ -18,7 +18,7 @@ import com.cburch.logisim.soc.util.AssemblerAsmInstruction;
import com.cburch.logisim.soc.util.AssemblerToken;
import java.util.ArrayList;
public class Nios2ProgramControlInstructions extends AbstractExecutionUnitWithLabelSupport {
public class Nios2ProgramControlInstructions implements AbstractExecutionUnitWithLabelSupport {
private static final int INSTR_CALLR = 0;
private static final int INSTR_RET = 1;
@ -77,6 +77,7 @@ public class Nios2ProgramControlInstructions extends AbstractExecutionUnitWithLa
}
}
@Override
@SuppressWarnings("fallthrough")
public boolean execute(Object processorState, CircuitState circuitState) {
if (!valid) return false;
@ -157,6 +158,7 @@ public class Nios2ProgramControlInstructions extends AbstractExecutionUnitWithLa
return true;
}
@Override
public String getAsmInstruction() {
if (!valid) return null;
StringBuilder s = new StringBuilder();
@ -186,10 +188,12 @@ public class Nios2ProgramControlInstructions extends AbstractExecutionUnitWithLa
return s.toString();
}
@Override
public int getBinInstruction() {
return instruction;
}
@Override
public boolean setAsmInstruction(AssemblerAsmInstruction instr) {
valid = false;
if (!Opcodes.contains(instr.getOpcode().toLowerCase())) return false;
@ -331,6 +335,7 @@ public class Nios2ProgramControlInstructions extends AbstractExecutionUnitWithLa
return true;
}
@Override
public boolean setBinInstruction(int instr) {
instruction = instr;
valid = false;
@ -344,15 +349,19 @@ public class Nios2ProgramControlInstructions extends AbstractExecutionUnitWithLa
int rb = Nios2Support.getRegBIndex(instr, Nios2Support.R_TYPE);
int rc = Nios2Support.getRegCIndex(instr, Nios2Support.R_TYPE);
switch (operation) {
case INSTR_CALLR : if (rc != 0x1F || rb != 0) return false;
sourceA = ra;
break;
case INSTR_RET : if (ra != 0x1F || rb != 0 || rc != 0) return false;
break;
case INSTR_JMP : if (rb != 0 || rc != 0) return false;
sourceA = ra;
break;
default : return false;
case INSTR_CALLR:
if (rc != 0x1F || rb != 0) return false;
sourceA = ra;
break;
case INSTR_RET:
if (ra != 0x1F || rb != 0 || rc != 0) return false;
break;
case INSTR_JMP:
if (rb != 0 || rc != 0) return false;
sourceA = ra;
break;
default:
return false;
}
valid = true;
} else {
@ -380,31 +389,38 @@ public class Nios2ProgramControlInstructions extends AbstractExecutionUnitWithLa
return valid;
}
@Override
public boolean performedJump() {
return valid && jumped;
}
@Override
public boolean isValid() {
return valid;
}
@Override
public String getErrorMessage() {
return null;
}
@Override
public ArrayList<String> getInstructions() {
return Opcodes;
}
@Override
public int getInstructionSizeInBytes(String instruction) {
if (Opcodes.contains(instruction.toLowerCase())) return 4;
return -1;
}
@Override
public boolean isLabelSupported() {
return operation >= INSTR_CALL;
}
@Override
public long getLabelAddress(long pc) {
if (!isLabelSupported()) return -1;
switch (operation) {
@ -417,6 +433,7 @@ public class Nios2ProgramControlInstructions extends AbstractExecutionUnitWithLa
}
}
@Override
public String getAsmInstruction(String label) {
if (!valid) return null;
StringBuilder s = new StringBuilder();

View File

@ -45,6 +45,7 @@ import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import javax.swing.JPanel;
import org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory;
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory;
@ -291,7 +292,7 @@ public class Nios2State implements SocUpSimulationStateListener, SocProcessorInt
Nios2CustomInstructions cust = (Nios2CustomInstructions) ASSEMBLER.getExeUnit();
if (cust.isValid() && cust.waitingOnReady(this, cState)) return;
}
HashMap<Integer, Integer> breakPoints = bPanel.getBreakPoints();
Map<Integer, Integer> breakPoints = bPanel.getBreakPoints();
if (breakPoints.containsKey(pc)) {
if (simState.breakPointReached()) {
bPanel.gotoLine(breakPoints.get(pc) - 1);

View File

@ -187,8 +187,7 @@ public class PioState implements SocBusSlaveInterface {
}
public boolean setStartAddress(Integer addr) {
if (startAddress == addr)
return false;
if (startAddress.equals(addr)) return false;
startAddress = addr;
firememMapChanged();
return true;
@ -202,22 +201,19 @@ public class PioState implements SocBusSlaveInterface {
}
public boolean setOutputResetValue(Integer val) {
if (outputResetValue == val)
return false;
if (outputResetValue.equals(val)) return false;
outputResetValue = val;
return true;
}
public boolean setOutputBitManupulations(Boolean b) {
if (outputEnableBitManipulations == b)
return false;
if (outputEnableBitManipulations.equals(b)) return false;
outputEnableBitManipulations = b;
return true;
}
public boolean setInputSynchronousCapture(Boolean b) {
if (inputSynchronousCapture == b)
return false;
if (inputSynchronousCapture.equals(b)) return false;
inputSynchronousCapture = b;
return true;
}
@ -230,15 +226,13 @@ public class PioState implements SocBusSlaveInterface {
}
public boolean setInputCaptureBitClearing(Boolean b) {
if (inputCaptBitClearing == b)
return false;
if (inputCaptBitClearing.equals(b)) return false;
inputCaptBitClearing = b;
return true;
}
public boolean setIrqGeneration(Boolean b) {
if (inputGeneratesIrq == b)
return false;
if (inputGeneratesIrq.equals(b)) return false;
inputGeneratesIrq = b;
return true;
}

View File

@ -20,7 +20,7 @@ import com.cburch.logisim.soc.util.AssemblerToken;
import java.util.ArrayList;
import java.util.Arrays;
public class RV32imControlTransferInstructions extends AbstractExecutionUnitWithLabelSupport {
public class RV32imControlTransferInstructions implements AbstractExecutionUnitWithLabelSupport {
private static final int JAL = 0x6F;
private static final int JALR = 0x67;
@ -63,12 +63,14 @@ public class RV32imControlTransferInstructions extends AbstractExecutionUnitWith
private int source2;
public boolean isPcRelative;
@Override
public ArrayList<String> getInstructions() {
ArrayList<String> opcodes = new ArrayList<>(Arrays.asList(AsmOpcodes));
return opcodes;
}
public boolean execute(Object state, CircuitState cState) {
@Override
public boolean execute(Object state, CircuitState cState) {
if (!valid)
return false;
RV32im_state.ProcessorState cpuState = (RV32im_state.ProcessorState) state;
@ -135,6 +137,7 @@ public class RV32imControlTransferInstructions extends AbstractExecutionUnitWith
return false;
}
@Override
@SuppressWarnings("fallthrough")
public String getAsmInstruction() {
if (!valid)
@ -175,6 +178,7 @@ public class RV32imControlTransferInstructions extends AbstractExecutionUnitWith
return s.toString();
}
@Override
@SuppressWarnings("fallthrough")
public String getAsmInstruction(String label) {
if (!valid)
@ -214,10 +218,12 @@ public class RV32imControlTransferInstructions extends AbstractExecutionUnitWith
return s.toString();
}
@Override
public int getBinInstruction() {
return instruction;
}
@Override
public boolean setBinInstruction(int instr) {
instruction = instr;
jumped = false;
@ -225,10 +231,12 @@ public class RV32imControlTransferInstructions extends AbstractExecutionUnitWith
return valid;
}
@Override
public boolean performedJump() {
return valid & jumped;
}
@Override
public boolean isValid() {
return valid;
}
@ -264,15 +272,18 @@ public class RV32imControlTransferInstructions extends AbstractExecutionUnitWith
return false;
}
@Override
public String getErrorMessage() {
return null;
}
@Override
public int getInstructionSizeInBytes(String instruction) {
if (getInstructions().contains(instruction.toUpperCase())) return 4;
return -1;
}
@Override
public boolean setAsmInstruction(AssemblerAsmInstruction instr) {
int operation = -1;
for (int i = 0; i < AsmOpcodes.length; i++)
@ -458,10 +469,12 @@ public class RV32imControlTransferInstructions extends AbstractExecutionUnitWith
return true;
}
@Override
public boolean isLabelSupported() {
return isPcRelative;
}
@Override
public long getLabelAddress(long pc) {
return pc + immediate;
}

View File

@ -31,11 +31,12 @@ public class RV32imEnvironmentCallAndBreakpoints implements AssemblerExecutionIn
private int operation;
private boolean valid;
@Override
public ArrayList<String> getInstructions() {
ArrayList<String> opcodes = new ArrayList<>(Arrays.asList(AsmOpcodes));
return opcodes;
return new ArrayList<>(Arrays.asList(AsmOpcodes));
}
@Override
public boolean execute(Object state, CircuitState cState) {
if (!valid)
return false;
@ -43,26 +44,31 @@ public class RV32imEnvironmentCallAndBreakpoints implements AssemblerExecutionIn
return true;
}
@Override
public String getAsmInstruction() {
if (!valid)
return null;
return AsmOpcodes[operation].toLowerCase();
}
@Override
public int getBinInstruction() {
return instruction;
}
@Override
public boolean setBinInstruction(int instr) {
instruction = instr;
valid = decodeBin();
return valid;
}
@Override
public boolean performedJump() {
return false;
}
@Override
public boolean isValid() {
return valid;
}
@ -78,15 +84,18 @@ public class RV32imEnvironmentCallAndBreakpoints implements AssemblerExecutionIn
return false;
}
@Override
public String getErrorMessage() {
return null;
}
@Override
public int getInstructionSizeInBytes(String instruction) {
if (getInstructions().contains(instruction.toUpperCase())) return 4;
return -1;
}
@Override
public boolean setAsmInstruction(AssemblerAsmInstruction instr) {
int operation = -1;
for (int i = 0; i < AsmOpcodes.length; i++)

View File

@ -64,11 +64,12 @@ public class RV32imIntegerRegisterImmediateInstructions implements AssemblerExec
private int operation;
private boolean valid = false;
@Override
public ArrayList<String> getInstructions() {
ArrayList<String> opcodes = new ArrayList<>(Arrays.asList(AsmOpcodes));
return opcodes;
return new ArrayList<>(Arrays.asList(AsmOpcodes));
}
@Override
public boolean execute(Object state, CircuitState cState) {
if (!valid) return false;
RV32im_state.ProcessorState cpuState = (RV32im_state.ProcessorState) state;
@ -123,6 +124,7 @@ public class RV32imIntegerRegisterImmediateInstructions implements AssemblerExec
return true;
}
@Override
public String getAsmInstruction() {
if (!valid)
return "Unknown";
@ -160,20 +162,24 @@ public class RV32imIntegerRegisterImmediateInstructions implements AssemblerExec
return s.toString();
}
@Override
public int getBinInstruction() {
return instruction;
}
@Override
public boolean setBinInstruction(int instr) {
instruction = instr;
decodeBin();
return valid;
}
@Override
public boolean performedJump() {
return false;
}
@Override
public boolean isValid() {
return valid;
}
@ -238,15 +244,18 @@ public class RV32imIntegerRegisterImmediateInstructions implements AssemblerExec
valid = false;
}
@Override
public String getErrorMessage() {
return null;
}
@Override
public int getInstructionSizeInBytes(String instruction) {
if (getInstructions().contains(instruction.toUpperCase())) return 4;
return -1;
}
@Override
public boolean setAsmInstruction(AssemblerAsmInstruction instr) {
int operation = -1;
for (int i = 0; i < AsmOpcodes.length; i++)

View File

@ -50,11 +50,12 @@ public class RV32imIntegerRegisterRegisterOperations implements AssemblerExecuti
private int operation;
private boolean valid = false;
@Override
public ArrayList<String> getInstructions() {
ArrayList<String> opcodes = new ArrayList<>(Arrays.asList(AsmOpcodes));
return opcodes;
return new ArrayList<>(Arrays.asList(AsmOpcodes));
}
@Override
public boolean execute(Object state, CircuitState cState) {
if (!valid)
return false;
@ -103,6 +104,7 @@ public class RV32imIntegerRegisterRegisterOperations implements AssemblerExecuti
return true;
}
@Override
public String getAsmInstruction() {
if (!valid)
return "Unknown";
@ -116,20 +118,24 @@ public class RV32imIntegerRegisterRegisterOperations implements AssemblerExecuti
return s.toString();
}
@Override
public int getBinInstruction() {
return instruction;
}
@Override
public boolean setBinInstruction(int instr) {
instruction = instr;
valid = decodeBin();
return valid;
}
@Override
public boolean performedJump() {
return false;
}
@Override
public boolean isValid() {
return valid;
}
@ -174,15 +180,18 @@ public class RV32imIntegerRegisterRegisterOperations implements AssemblerExecuti
return true;
}
@Override
public String getErrorMessage() {
return null;
}
@Override
public int getInstructionSizeInBytes(String instruction) {
if (getInstructions().contains(instruction.toUpperCase())) return 4;
return -1;
}
@Override
public boolean setAsmInstruction(AssemblerAsmInstruction instr) {
int operation = -1;
for (int i = 0; i < AsmOpcodes.length; i++)

View File

@ -52,8 +52,7 @@ public class RV32imLoadAndStoreInstructions implements AssemblerExecutionInterfa
@Override
public ArrayList<String> getInstructions() {
ArrayList<String> opcodes = new ArrayList<>(Arrays.asList(AsmOpcodes));
return opcodes;
return new ArrayList<>(Arrays.asList(AsmOpcodes));
}
@Override

View File

@ -43,11 +43,12 @@ public class RV32im_M_ExtensionInstructions implements AssemblerExecutionInterfa
private int source1;
private int source2;
@Override
public ArrayList<String> getInstructions() {
ArrayList<String> opcodes = new ArrayList<>(Arrays.asList(AsmOpcodes));
return opcodes;
return new ArrayList<>(Arrays.asList(AsmOpcodes));
}
@Override
public boolean execute(Object state, CircuitState cState) {
if (!valid) return false;
RV32im_state.ProcessorState cpuState = (RV32im_state.ProcessorState) state;
@ -98,6 +99,7 @@ public class RV32im_M_ExtensionInstructions implements AssemblerExecutionInterfa
return true;
}
@Override
public String getAsmInstruction() {
if (!valid) return null;
StringBuilder s = new StringBuilder();
@ -110,20 +112,24 @@ public class RV32im_M_ExtensionInstructions implements AssemblerExecutionInterfa
return s.toString();
}
@Override
public int getBinInstruction() {
return instruction;
}
@Override
public boolean setBinInstruction(int instr) {
instruction = instr;
valid = decodeBin();
return valid;
}
@Override
public boolean performedJump() {
return false;
}
@Override
public boolean isValid() {
return valid;
}
@ -141,15 +147,18 @@ public class RV32im_M_ExtensionInstructions implements AssemblerExecutionInterfa
return false;
}
@Override
public String getErrorMessage() {
return null;
}
@Override
public int getInstructionSizeInBytes(String instruction) {
if (getInstructions().contains(instruction.toUpperCase())) return 4;
return -1;
}
@Override
public boolean setAsmInstruction(AssemblerAsmInstruction instr) {
int operation = -1;
valid = true;

View File

@ -48,6 +48,7 @@ import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import javax.swing.JPanel;
import org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory;
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory;
@ -208,7 +209,7 @@ public class RV32im_state implements SocUpSimulationStateListener, SocProcessorI
/* check the simulation state */
if (!simState.canExecute())
return;
HashMap<Integer, Integer> breakPoints = bPanel.getBreakPoints();
Map<Integer, Integer> breakPoints = bPanel.getBreakPoints();
if (breakPoints.containsKey(pc)) {
if (simState.breakPointReached()) {
bPanel.gotoLine(breakPoints.get(pc) - 1);

View File

@ -9,7 +9,7 @@
package com.cburch.logisim.soc.util;
public abstract class AbstractExecutionUnitWithLabelSupport implements AssemblerExecutionInterface {
public interface AbstractExecutionUnitWithLabelSupport extends AssemblerExecutionInterface {
public abstract boolean isLabelSupported();
public abstract long getLabelAddress(long pc);

View File

@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import javax.swing.text.BadLocationException;
import org.fife.ui.rsyntaxtextarea.RSyntaxDocument;
@ -556,7 +557,7 @@ public class Assembler extends AbstractParser implements LocaleListener {
@Override
public ParseResult parse(RSyntaxDocument doc, String style) {
DefaultParseResult result = new DefaultParseResult(this);
HashMap<Integer, String> offsets = new HashMap<>();
Map<Integer, String> offsets = new HashMap<>();
for (GutterIconInfo x : errorMarkers.keySet())
offsets.put(x.getMarkedOffset(), errorMarkers.get(x).toString());
for (Token t : doc) {

View File

@ -53,7 +53,7 @@ public class AdderHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
s_sum_result <= std_logic_vector(unsigned(s_extended_dataA) +
unsigned(s_extended_dataB) +
(""&CarryIn));
""");
if (nrOfBits == 1) {
contents.add("Result <= s_sum_result(0);");

View File

@ -88,7 +88,7 @@ public class ComparatorHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
contents.add("""
assign A_EQ_B = (DataA == DataB);
assign A_LT_B = (DataA < DataB);
assign A_GT_B = (DataA > DataB);
assign A_GT_B = (DataA > DataB);
""");
} else {
contents.add("""
@ -96,7 +96,7 @@ public class ComparatorHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
assign s_unsigned_less = (DataA < DataB);
assign s_signed_greater = ($signed(DataA) > $signed(DataB));
assign s_unsigned_greater = (DataA > DataB);
assign A_EQ_B = (DataA == DataB);
assign A_GT_B = ({{twosComplement}}==1) ? s_signed_greater : s_unsigned_greater;
assign A_LT_B = ({{twosComplement}}==1) ? s_signed_less : s_unsigned_less;

View File

@ -90,7 +90,7 @@ public class MultiplierHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
s_interm_result = $signed(s_mult_signed) + $signed(s_Cin);
end
end
assign Mult_hi = s_interm_result[{{calcBits}}-1:{{nrOfBits}}];
assign Mult_lo = s_interm_result[{{nrOfBits}}-1:0];
""");

View File

@ -18,8 +18,8 @@ import com.cburch.logisim.fpga.hdlgenerator.HdlParameters;
import com.cburch.logisim.instance.Port;
import com.cburch.logisim.instance.StdAttr;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class ShifterHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
@ -127,7 +127,7 @@ public class ShifterHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
return contents;
}
private ArrayList<String> getStageFunctionalityVerilog(int stageNumber, int nrOfBits) {
private List<String> getStageFunctionalityVerilog(int stageNumber, int nrOfBits) {
final var contents = LineBuffer.getBuffer()
.pair("shiftMode", SHIFT_MODE_STRING)
.pair("stageNumber", stageNumber)
@ -179,7 +179,7 @@ public class ShifterHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
return contents.getWithIndent();
}
private ArrayList<String> getStageFunctionalityVhdl(int stageNumber, int nrOfBits) {
private List<String> getStageFunctionalityVhdl(int stageNumber, int nrOfBits) {
final var nrOfBitsToShift = (1 << stageNumber);
final var contents =
LineBuffer.getBuffer()

View File

@ -55,7 +55,7 @@ public class SubtractorHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
s_sum_result <= std_logic_vector(unsigned(s_extended_dataA)+
unsigned(s_extended_dataB)+
(""&s_carry));
""");
contents.add(
(nrOfBits == 1)

View File

@ -43,7 +43,7 @@ public class bcd2sevensegHDLGeneratorFactory extends AbstractHdlGeneratorFactory
Segment_e <= s_output_value(4);
Segment_f <= s_output_value(5);
Segment_g <= s_output_value(6);
MakeSegs : PROCESS( BCDin )
BEGIN
CASE (BCDin) IS

View File

@ -17,7 +17,7 @@ import com.cburch.logisim.fpga.hdlgenerator.Hdl;
import com.cburch.logisim.fpga.hdlgenerator.HdlParameters;
import com.cburch.logisim.instance.Port;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import java.util.List;
public class bin2bcdHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
@ -75,7 +75,7 @@ public class bin2bcdHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
s_level_2(6) <= s_level_1(6);
s_level_3(6 DOWNTO 5) <= s_level_2(6 DOWNTO 5);
s_level_3(0) <= s_level_2(0);
BCD1 <= s_level_3( 3 DOWNTO 0);
BCD10 <= \"0\"&s_level_3(6 DOWNTO 4);
""")
@ -99,7 +99,7 @@ public class bin2bcdHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
s_level_5( 1 DOWNTO 0) <= s_level_4( 1 DOWNTO 0);
s_level_6(10 DOWNTO 9) <= s_level_5(10 DOWNTO 9);
s_level_6(0) <= s_level_5(0);
BCD1 <= s_level_6( 3 DOWNTO 0 );
BCD10 <= s_level_6( 7 DOWNTO 4 );
BCD100 <= "0"&s_level_6(10 DOWNTO 8);
@ -138,7 +138,7 @@ public class bin2bcdHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
s_level_9( 1 DOWNTO 0) <= s_level_8( 1 DOWNTO 0);
s_level_10(15 DOWNTO 13) <= s_level_9(15 DOWNTO 13);
s_level_10(0) <= s_level_9(0);
BCD1 <= s_level_10( 3 DOWNTO 0);
BCD10 <= s_level_10( 7 DOWNTO 4);
BCD100 <= s_level_10(11 DOWNTO 8);
@ -173,7 +173,7 @@ public class bin2bcdHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
return contents;
}
private ArrayList<String> getAdd3Block(String srcName, int srcStartId, String destName, int destStartId, String processName) {
private List<String> getAdd3Block(String srcName, int srcStartId, String destName, int destStartId, String processName) {
return LineBuffer.getBuffer()
.pair("srcName", srcName)
.pair("srcStartId", srcStartId)
@ -183,7 +183,7 @@ public class bin2bcdHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
.pair("destDownTo", (destStartId - 3))
.pair("proc", processName)
.add("""
ADD3_{{proc}} : PROCESS({{srcName}})
BEGIN
CASE ( {{srcName}}( {{srcStartId}} DOWNTO {{srcDownTo}}) ) IS

View File

@ -42,6 +42,7 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.BoundedRangeModel;
import javax.swing.Box;
@ -80,7 +81,7 @@ public class PLATable {
label = l;
}
public ArrayList<Row> rows() {
public List<Row> rows() {
return rows;
}

View File

@ -10,11 +10,8 @@
package com.cburch.logisim.std.gates;
import com.cburch.logisim.data.Direction;
import com.cburch.logisim.data.Location;
import com.cburch.logisim.data.Value;
import com.cburch.logisim.instance.InstancePainter;
import com.cburch.logisim.util.GraphicsUtil;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;

View File

@ -17,7 +17,6 @@ import com.cburch.logisim.data.BitWidth;
import com.cburch.logisim.data.Bounds;
import com.cburch.logisim.data.Direction;
import com.cburch.logisim.data.Value;
import com.cburch.logisim.gui.icons.ButtonIcon;
import com.cburch.logisim.gui.icons.KeyboardIcon;
import com.cburch.logisim.instance.InstanceFactory;
import com.cburch.logisim.instance.InstancePainter;

View File

@ -9,15 +9,14 @@
package com.cburch.logisim.std.io;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import com.cburch.logisim.data.AttributeSet;
import com.cburch.logisim.fpga.designrulecheck.Netlist;
import com.cburch.logisim.fpga.hdlgenerator.AbstractHdlGeneratorFactory;
import com.cburch.logisim.fpga.hdlgenerator.Hdl;
import com.cburch.logisim.fpga.hdlgenerator.TickComponentHdlGeneratorFactory;
import com.cburch.logisim.instance.Port;
import com.cburch.logisim.util.LineBuffer;
import java.util.List;
public class LedArrayColumnScanningHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
@ -65,9 +64,9 @@ public class LedArrayColumnScanningHDLGeneratorFactory extends AbstractHdlGenera
.add(Port.OUTPUT, LedArrayGenericHDLGeneratorFactory.LedArrayRowOutputs, NR_OF_ROWS_ID, 3);
}
public static ArrayList<String> getGenericMap(int nrOfRows, int nrOfColumns, long fpgaClockFrequency, boolean activeLow) {
public static List<String> getGenericMap(int nrOfRows, int nrOfColumns, long fpgaClockFrequency, boolean activeLow) {
final var nrColAddrBits = LedArrayGenericHDLGeneratorFactory.getNrOfBitsRequired(nrOfColumns);
final var scanningReload = (int) (fpgaClockFrequency / (long) 1000);
final var scanningReload = (int) (fpgaClockFrequency / 1000);
final var nrOfScanningBitsCount = LedArrayGenericHDLGeneratorFactory.getNrOfBitsRequired(scanningReload);
final var maxNrLeds = ((int) Math.pow(2.0, (double) nrColAddrBits)) * nrOfRows;
@ -116,7 +115,7 @@ public class LedArrayColumnScanningHDLGeneratorFactory extends AbstractHdlGenera
return contents.getWithIndent(6);
}
public static ArrayList<String> getPortMap(int id) {
public static List<String> getPortMap(int id) {
final var contents =
LineBuffer.getBuffer()
.pair("columnAddress", LedArrayGenericHDLGeneratorFactory.LedArrayColumnAddress)
@ -143,7 +142,7 @@ public class LedArrayColumnScanningHDLGeneratorFactory extends AbstractHdlGenera
return contents.getWithIndent(6);
}
public ArrayList<String> getColumnCounterCode() {
public List<String> getColumnCounterCode() {
final var contents =
LineBuffer.getBuffer()
.pair("columnAddress", LedArrayGenericHDLGeneratorFactory.LedArrayColumnAddress)

View File

@ -11,6 +11,8 @@ package com.cburch.logisim.std.io;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
@ -175,7 +177,7 @@ public class LedArrayGenericHDLGeneratorFactory {
return externals;
}
public static SortedMap<String, Integer> getInternalSignals(char typeId, int nrOfRows, int nrOfColumns, int identifier) {
public static Map<String, Integer> getInternalSignals(char typeId, int nrOfRows, int nrOfColumns, int identifier) {
final var wires = new TreeMap<String, Integer>();
switch (typeId) {
case LedArrayDriving.LED_DEFAULT:
@ -194,7 +196,7 @@ public class LedArrayGenericHDLGeneratorFactory {
return wires;
}
public static ArrayList<String> GetComponentMap(char typeId, int nrOfRows, int nrOfColumns, int identifier, long FpgaClockFrequency, boolean isActiveLow) {
public static List<String> GetComponentMap(char typeId, int nrOfRows, int nrOfColumns, int identifier, long FpgaClockFrequency, boolean isActiveLow) {
final var componentMap = LineBuffer.getBuffer()
.add(Hdl.isVhdl()
? " array" + identifier + " : " + getSpecificHDLName(typeId)
@ -256,7 +258,7 @@ public class LedArrayGenericHDLGeneratorFactory {
return componentMap.get();
}
public static ArrayList<String> getArrayConnections(FpgaIoInformationContainer array, int id) {
public static List<String> getArrayConnections(FpgaIoInformationContainer array, int id) {
final var connections = new ArrayList<String>();
connections.addAll(
switch (array.getArrayDriveMode()) {
@ -268,7 +270,7 @@ public class LedArrayGenericHDLGeneratorFactory {
return connections;
}
public static ArrayList<String> getLedArrayConnections(FpgaIoInformationContainer info, int id) {
public static List<String> getLedArrayConnections(FpgaIoInformationContainer info, int id) {
final var connections = LineBuffer.getHdlBuffer();
connections.pair("id", id).pair("ins", LedArrayInputs);
for (var pin = 0; pin < info.getNrOfPins(); pin++) {
@ -282,7 +284,7 @@ public class LedArrayGenericHDLGeneratorFactory {
return connections.getWithIndent();
}
public static ArrayList<String> getRGBArrayConnections(FpgaIoInformationContainer array, int id) {
public static List<String> getRGBArrayConnections(FpgaIoInformationContainer array, int id) {
final var connections =
LineBuffer.getHdlBuffer()
.pair("id", id)

View File

@ -9,14 +9,13 @@
package com.cburch.logisim.std.io;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import com.cburch.logisim.data.AttributeSet;
import com.cburch.logisim.fpga.designrulecheck.Netlist;
import com.cburch.logisim.fpga.hdlgenerator.AbstractHdlGeneratorFactory;
import com.cburch.logisim.fpga.hdlgenerator.Hdl;
import com.cburch.logisim.instance.Port;
import com.cburch.logisim.util.LineBuffer;
import java.util.List;
public class LedArrayLedDefaultHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
@ -36,7 +35,7 @@ public class LedArrayLedDefaultHDLGeneratorFactory extends AbstractHdlGeneratorF
.add(Port.OUTPUT, LedArrayGenericHDLGeneratorFactory.LedArrayOutputs, NR_OF_LEDS_ID, 1);
}
public static ArrayList<String> getGenericMap(int nrOfRows, int nrOfColumns, long fpgaClockFrequency, boolean activeLow) {
public static List<String> getGenericMap(int nrOfRows, int nrOfColumns, long fpgaClockFrequency, boolean activeLow) {
final var contents =
LineBuffer.getBuffer()
.pair("nrOfLeds", NR_OF_LEDS_STRING)
@ -60,7 +59,7 @@ public class LedArrayLedDefaultHDLGeneratorFactory extends AbstractHdlGeneratorF
return contents.getWithIndent(6);
}
public static ArrayList<String> getPortMap(int id) {
public static List<String> getPortMap(int id) {
final var map =
LineBuffer.getBuffer()
.pair("id", id)

View File

@ -9,15 +9,14 @@
package com.cburch.logisim.std.io;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import com.cburch.logisim.data.AttributeSet;
import com.cburch.logisim.fpga.designrulecheck.Netlist;
import com.cburch.logisim.fpga.hdlgenerator.AbstractHdlGeneratorFactory;
import com.cburch.logisim.fpga.hdlgenerator.Hdl;
import com.cburch.logisim.fpga.hdlgenerator.TickComponentHdlGeneratorFactory;
import com.cburch.logisim.instance.Port;
import com.cburch.logisim.util.LineBuffer;
import java.util.List;
public class LedArrayRowScanningHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
@ -65,9 +64,9 @@ public class LedArrayRowScanningHDLGeneratorFactory extends AbstractHdlGenerator
.add(Port.OUTPUT, LedArrayGenericHDLGeneratorFactory.LedArrayColumnOutputs, NR_OF_COLUMS_ID, 3);
}
public static ArrayList<String> getGenericMap(int nrOfRows, int nrOfColumns, long FpgaClockFrequency, boolean activeLow) {
public static List<String> getGenericMap(int nrOfRows, int nrOfColumns, long FpgaClockFrequency, boolean activeLow) {
final var nrRowAddrBits = LedArrayGenericHDLGeneratorFactory.getNrOfBitsRequired(nrOfRows);
final var scanningReload = (int) (FpgaClockFrequency / (long) 1000);
final var scanningReload = (int) (FpgaClockFrequency / 1000);
final var nrOfScanningBits = LedArrayGenericHDLGeneratorFactory.getNrOfBitsRequired(scanningReload);
final var maxNrLeds = ((int) Math.pow(2.0, (double) nrRowAddrBits)) * nrOfRows;
@ -116,7 +115,7 @@ public class LedArrayRowScanningHDLGeneratorFactory extends AbstractHdlGenerator
return contents.getWithIndent(6);
}
public static ArrayList<String> getPortMap(int id) {
public static List<String> getPortMap(int id) {
final var map =
LineBuffer.getBuffer()
.pair("rowAddr", LedArrayGenericHDLGeneratorFactory.LedArrayRowAddress)
@ -142,7 +141,7 @@ public class LedArrayRowScanningHDLGeneratorFactory extends AbstractHdlGenerator
return map.getWithIndent(6);
}
public ArrayList<String> getRowCounterCode() {
public List<String> getRowCounterCode() {
final var contents =
LineBuffer.getBuffer()
.pair("rowAddress", LedArrayGenericHDLGeneratorFactory.LedArrayRowAddress)
@ -151,21 +150,21 @@ public class LedArrayRowScanningHDLGeneratorFactory extends AbstractHdlGenerator
.pair("clock", TickComponentHdlGeneratorFactory.FPGA_CLOCK);
if (Hdl.isVhdl()) {
contents.add("""
{{rowAddress}} <= s_rowCounterReg;
s_tickNext <= '1' WHEN s_scanningCounterReg = std_logic_vector(to_unsigned(0, {{bits}})) ELSE '0';
s_scanningCounterNext <= (OTHERS => '0') WHEN s_tickReg /= '0' AND s_tickReg /= '1' ELSE -- for simulation
std_logic_vector(to_unsigned({{value}}-1, {{bits}})) WHEN s_scanningCounterReg = std_logic_vector(to_unsigned(0, {{bits}})) ELSE
std_logic_vector(to_unsigned({{value}}-1, {{bits}})) WHEN s_scanningCounterReg = std_logic_vector(to_unsigned(0, {{bits}})) ELSE
std_logic_vector(unsigned(s_scanningCounterReg)-1);
s_rowCounterNext <= (OTHERS => '0') WHEN s_tickReg /= '0' AND s_tickReg /= '1' ELSE -- for simulation
s_rowCounterReg WHEN s_tickReg = '0' ELSE
std_logic_vector(to_unsigned(nrOfRows-1,nrOfRowAddressBits))
WHEN s_rowCounterReg = std_logic_vector(to_unsigned(0,nrOfRowAddressBits)) ELSE
std_logic_vector(unsigned(s_rowCounterReg)-1);
makeFlops : PROCESS ({{clock}}) IS
BEGIN
IF (rising_edge({{clock}})) THEN
@ -177,12 +176,12 @@ public class LedArrayRowScanningHDLGeneratorFactory extends AbstractHdlGenerator
""");
} else {
contents.add("""
assign rowAddress = s_rowCounterReg;
assign s_tickNext = (s_scanningCounterReg == 0) ? 1'b1 : 1'b0;
assign s_scanningCounterNext = (s_scanningCounterReg == 0) ? {{value}} : s_scanningCounterReg - 1;
assign s_rowCounterNext = (s_tickReg == 1'b0) ? s_rowCounterReg :
assign s_rowCounterNext = (s_tickReg == 1'b0) ? s_rowCounterReg :
(s_rowCounterReg == 0) ? nrOfRows-1 : s_rowCounterReg-1;
""")
.addRemarkBlock("Here the simulation only initial is defined")
@ -193,7 +192,7 @@ public class LedArrayRowScanningHDLGeneratorFactory extends AbstractHdlGenerator
s_scanningCounterReg = 0;
s_tickReg = 1'b0;
end
always @(posedge {{clock}})
begin
s_rowCounterReg = s_rowCounterNext;
@ -227,7 +226,7 @@ public class LedArrayRowScanningHDLGeneratorFactory extends AbstractHdlGenerator
s_maxLedInputs({{nrOfLeds}}-1 DOWNTO 0) <= {{ins}};
END IF;
END PROCESS makeVirtualInputs;
GenOutputs : FOR n IN {{nrOfColumns}}-1 DOWNTO 0 GENERATE
{{outs}}(n) <= s_maxLedInputs({{nrOfColumns}} * to_integer(unsigned(s_rowCounterReg)) + n);
END GENERATE GenOutputs;

View File

@ -15,6 +15,7 @@ import com.cburch.logisim.fpga.designrulecheck.netlistComponent;
import com.cburch.logisim.fpga.hdlgenerator.Hdl;
import com.cburch.logisim.fpga.hdlgenerator.InlinedHdlGeneratorFactory;
import com.cburch.logisim.util.LineBuffer;
import java.util.List;
public class LedBarHdlGeneratorFactory extends InlinedHdlGeneratorFactory {

View File

@ -37,6 +37,7 @@ import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
public class PortIO extends InstanceFactory {
/**
@ -47,12 +48,12 @@ public class PortIO extends InstanceFactory {
*/
public static final String _ID = "PortIO";
public static ArrayList<String> getLabels(int size) {
ArrayList<String> LabelNames = new ArrayList<>();
public static List<String> getLabels(int size) {
List<String> labelNames = new ArrayList<>();
for (var i = 0; i < size; i++) {
LabelNames.add("pin_" + (i + 1));
labelNames.add("pin_" + (i + 1));
}
return LabelNames;
return labelNames;
}
private static class PortState implements InstanceData, Cloneable {

View File

@ -9,14 +9,13 @@
package com.cburch.logisim.std.io;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import com.cburch.logisim.data.AttributeSet;
import com.cburch.logisim.fpga.designrulecheck.Netlist;
import com.cburch.logisim.fpga.hdlgenerator.Hdl;
import com.cburch.logisim.fpga.hdlgenerator.TickComponentHdlGeneratorFactory;
import com.cburch.logisim.instance.Port;
import com.cburch.logisim.util.LineBuffer;
import java.util.List;
public class RGBArrayColumnScanningHDLGeneratorFactory extends LedArrayColumnScanningHDLGeneratorFactory {
@ -40,7 +39,7 @@ public class RGBArrayColumnScanningHDLGeneratorFactory extends LedArrayColumnSca
.add(Port.OUTPUT, LedArrayGenericHDLGeneratorFactory.LedArrayRowBlueOutputs, NR_OF_ROWS_ID, 7);
}
public static ArrayList<String> getPortMap(int id) {
public static List<String> getPortMap(int id) {
final var contents =
LineBuffer.getBuffer()
.pair("addr", LedArrayGenericHDLGeneratorFactory.LedArrayColumnAddress)
@ -111,7 +110,7 @@ public class RGBArrayColumnScanningHDLGeneratorFactory extends LedArrayColumnSca
s_maxBlueLedInputs({{nrOfLeds}}-1 DOWNTO 0) <= {{insB}};
END IF;
END PROCESS makeVirtualInputs;
GenOutputs : FOR n IN {{nrOfRows}}-1 DOWNTO 0 GENERATE
{{outsR}}(n) <= s_maxRedLedInputs(to_integer(unsigned(s_columnCounterReg)) + n*nrOfColumns);
{{outsG}}(n) <= s_maxGreenLedInputs(to_integer(unsigned(s_columnCounterReg)) + n*nrOfColumns);

View File

@ -9,14 +9,13 @@
package com.cburch.logisim.std.io;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import com.cburch.logisim.data.AttributeSet;
import com.cburch.logisim.fpga.designrulecheck.Netlist;
import com.cburch.logisim.fpga.hdlgenerator.Hdl;
import com.cburch.logisim.fpga.hdlgenerator.TickComponentHdlGeneratorFactory;
import com.cburch.logisim.instance.Port;
import com.cburch.logisim.util.LineBuffer;
import java.util.List;
public class RGBArrayLedDefaultHDLGeneratorFactory extends LedArrayLedDefaultHDLGeneratorFactory {
@ -47,7 +46,7 @@ public class RGBArrayLedDefaultHDLGeneratorFactory extends LedArrayLedDefaultHDL
}
};
public static ArrayList<String> getPortMap(int id) {
public static List<String> getPortMap(int id) {
final var contents = new LineBuffer(sharedPairs);
contents.add("id", id);

View File

@ -15,7 +15,7 @@ import com.cburch.logisim.fpga.hdlgenerator.Hdl;
import com.cburch.logisim.fpga.hdlgenerator.TickComponentHdlGeneratorFactory;
import com.cburch.logisim.instance.Port;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import java.util.List;
public class RGBArrayRowScanningHDLGeneratorFactory extends LedArrayRowScanningHDLGeneratorFactory {
@ -48,7 +48,7 @@ public class RGBArrayRowScanningHDLGeneratorFactory extends LedArrayRowScanningH
.pair("outsG", LedArrayGenericHDLGeneratorFactory.LedArrayColumnGreenOutputs)
.pair("outsB", LedArrayGenericHDLGeneratorFactory.LedArrayColumnBlueOutputs);
public static ArrayList<String> getPortMap(int id) {
public static List<String> getPortMap(int id) {
final var contents =
(new LineBuffer(sharedPairs))
.pair("addr", LedArrayGenericHDLGeneratorFactory.LedArrayRowAddress)
@ -92,7 +92,7 @@ public class RGBArrayRowScanningHDLGeneratorFactory extends LedArrayRowScanningH
contents.add(getRowCounterCode());
if (Hdl.isVhdl()) {
contents.add("""
makeVirtualInputs : PROCESS ( internalRedLeds, internalGreenLeds, internalBlueLeds ) IS
BEGIN
s_maxRedLedInputs <= (OTHERS => '0');
@ -108,7 +108,7 @@ public class RGBArrayRowScanningHDLGeneratorFactory extends LedArrayRowScanningH
s_maxRedLedInputs({{nrOfLeds}}-1 DOWNTO 0) <= {{insB}};
END IF;
END PROCESS makeVirtualInputs;
GenOutputs : FOR n IN {{nrOfColumns}}-1 DOWNTO 0 GENERATE
{{outsR}}(n) <= s_maxRedLedInputs({{nrOfColumns}} * to_integer(unsigned(s_rowCounterReg)) + n);
{{outsG}}(n) <= s_maxRedLedInputs({{nrOfColumns}} * to_integer(unsigned(s_rowCounterReg)) + n);

View File

@ -18,6 +18,8 @@ import com.cburch.logisim.fpga.hdlgenerator.Hdl;
import com.cburch.logisim.instance.Port;
import com.cburch.logisim.util.LineBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
@ -37,18 +39,18 @@ public class ReptarLocalBusHDLGeneratorFactory extends AbstractHdlGeneratorFacto
}
@Override
public ArrayList<String> getArchitecture(Netlist nets, AttributeSet attrs, String componentName) {
public List<String> getArchitecture(Netlist nets, AttributeSet attrs, String componentName) {
final var contents = LineBuffer.getBuffer();
if (Hdl.isVhdl()) {
contents
.pair("compName", componentName)
.add(FileWriter.getGenerateRemark(componentName, nets.projName()))
.add("""
ARCHITECTURE PlatformIndependent OF {{compName}} IS
ARCHITECTURE PlatformIndependent OF {{compName}} IS
BEGIN
FPGA_out(0) <= NOT SP6_LB_WAIT3_i;
FPGA_out(1) <= NOT IRQ_i;
SP6_LB_nCS3_o <= FPGA_in(0);
@ -56,7 +58,7 @@ public class ReptarLocalBusHDLGeneratorFactory extends AbstractHdlGeneratorFacto
SP6_LB_RE_nOE_o <= FPGA_in(2);
SP6_LB_nWE_o <= FPGA_in(3);
Addr_LB_o <= FPGA_in(11 DOWNTO 4);
IOBUF_Addresses_Datas : for i in 0 to Addr_Data_LB_io'length-1 generate
IOBUF_Addresse_Data : IOBUF
generic map (
@ -71,7 +73,7 @@ public class ReptarLocalBusHDLGeneratorFactory extends AbstractHdlGeneratorFacto
T => Addr_Data_LB_tris_i -- 3-state enable input, high=input, low=output
);
end generate;
END PlatformIndependent;
""");
}
@ -79,7 +81,7 @@ public class ReptarLocalBusHDLGeneratorFactory extends AbstractHdlGeneratorFacto
}
@Override
public ArrayList<String> getComponentInstantiation(Netlist theNetlist, AttributeSet attrs, String componentName) {
public List<String> getComponentInstantiation(Netlist theNetlist, AttributeSet attrs, String componentName) {
return LineBuffer.getBuffer()
.add("""
COMPONENT LocalBus
@ -102,7 +104,7 @@ public class ReptarLocalBusHDLGeneratorFactory extends AbstractHdlGeneratorFacto
}
@Override
public ArrayList<String> getEntity(Netlist nets, AttributeSet attrs, String componentName) {
public List<String> getEntity(Netlist nets, AttributeSet attrs, String componentName) {
return LineBuffer.getBuffer()
.pair("compName", componentName)
.add(FileWriter.getGenerateRemark(componentName, nets.projName()))
@ -110,7 +112,7 @@ public class ReptarLocalBusHDLGeneratorFactory extends AbstractHdlGeneratorFacto
.add("""
Library UNISIM;
use UNISIM.vcomponents.all;
ENTITY {{compName}} IS
PORT ( Addr_Data_LB_io : INOUT std_logic_vector(15 downto 0);
SP6_LB_nCS3_o : OUT std_logic;
@ -131,7 +133,7 @@ public class ReptarLocalBusHDLGeneratorFactory extends AbstractHdlGeneratorFacto
}
@Override
public SortedMap<String, String> getPortMap(Netlist nets, Object mapInfo) {
public Map<String, String> getPortMap(Netlist nets, Object mapInfo) {
final var map = new TreeMap<String, String>();
if (!(mapInfo instanceof netlistComponent)) return map;
final var ComponentInfo = (netlistComponent) mapInfo;

View File

@ -34,6 +34,7 @@ import com.cburch.logisim.util.GraphicsUtil;
import java.awt.Color;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;
public class RgbLed extends InstanceFactory implements DynamicElementProvider {
/**
@ -67,7 +68,7 @@ public class RgbLed extends InstanceFactory implements DynamicElementProvider {
}
}
public static ArrayList<String> getLabels() {
public static List<String> getLabels() {
final var labelNames = new ArrayList<String>();
for (var i = 0; i < 3; i++) labelNames.add("");
labelNames.set(RED, "RED");

View File

@ -102,8 +102,8 @@ public class CounterHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
contents.add("""
CompareOut <= s_carry;
CountValue <= s_counter_value;
s_clock <= {{clock}} WHEN {{invertClock}} = 0 ELSE NOT({{clock}});
s_clock <= {{clock}} WHEN {{invertClock}} = 0 ELSE NOT({{clock}});
make_carry : PROCESS( Up_n_Down,
s_counter_value )
BEGIN
@ -121,11 +121,11 @@ public class CounterHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
END IF; -- Up counting
END IF;
END PROCESS make_carry;
s_real_enable <= '0' WHEN (load = '0' AND enable = '0') -- Counter disabled
OR (mode = 1 AND s_carry = '1' AND load = '0') -- Stay at value situation
ELSE {{Tick}};
make_next_value : PROCESS( load , Up_n_Down , s_counter_value ,
LoadData , s_carry )
VARIABLE v_downcount : std_logic;
@ -157,7 +157,7 @@ public class CounterHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
END CASE;
END IF;
END PROCESS make_next_value;
make_flops : PROCESS( s_clock , s_real_enable , clear , s_next_counter_value )
BEGIN
IF (clear = '1') THEN s_counter_value <= (OTHERS => '0');
@ -173,7 +173,7 @@ public class CounterHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
assign CompareOut = s_carry;
assign CountValue = s_counter_value;
assign s_clock = ({{invertClock}} == 0) ? {{clock}} : ~{{clock}};
always@(*)
begin
if (Up_n_Down)
@ -181,10 +181,10 @@ public class CounterHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
else
s_carry = (s_counter_value == 0) ? 1'b1 : 1'b0;
end
assign s_real_enable = ((~(load)&~(Enable))|
((mode==1)&s_carry&~(load))) ? 1'b0 : {{Tick}};
always @(*)
begin
if ((load)|((mode==3)&s_carry))
@ -198,13 +198,13 @@ public class CounterHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
else
s_next_counter_value = s_counter_value - 1;
end
always @(posedge s_clock or posedge clear)
begin
if (clear) s_counter_value <= 0;
else if (s_real_enable) s_counter_value <= s_next_counter_value;
end
""");
}
return contents;

View File

@ -219,7 +219,7 @@ public class RamHDLGeneratorFactory extends AbstractHdlGeneratorFactory {
END IF;
END IF;
END PROCESS Res;
""");
}
}

Some files were not shown because too many files have changed in this diff Show More