mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 00:44:40 -04:00
first ide config for basic BASYS3 support.
This commit is contained in:
parent
6c2bec3b69
commit
63a3412191
@ -1,15 +1,16 @@
|
|||||||
<ide name="BASYS 3">
|
<ide name="BASYS 3">
|
||||||
<commands>
|
<commands>
|
||||||
<command name="Export to Vivado" requires="vhdl" filter="false">
|
<command name="Export to Vivado" requires="vhdl" filter="true" gui="true" timeout="0">
|
||||||
|
<arg>vivado</arg>
|
||||||
|
<arg>vivado/<?=shortname?>.xpr</arg>
|
||||||
</command>
|
</command>
|
||||||
</commands>
|
</commands>
|
||||||
<files>
|
<files>
|
||||||
<file name="<?=shortname?>_constraints.xdc" overwrite="true" filter="true">
|
<file name="<?=shortname?>_constraints.xdc" overwrite="true" filter="true">
|
||||||
<content><![CDATA[<?
|
<content><![CDATA[<?
|
||||||
|
|
||||||
port := 0;
|
|
||||||
for (i:=0; i<sizeOf(hdl.ports);i++) {
|
for (i:=0; i<sizeOf(hdl.ports);i++) {
|
||||||
port=hdl.ports[i];
|
port:=hdl.ports[i];
|
||||||
if (port.bits=1) {
|
if (port.bits=1) {
|
||||||
print("set_property PACKAGE_PIN "+port.pin+" [get_ports "+port.name+"]\n");
|
print("set_property PACKAGE_PIN "+port.pin+" [get_ports "+port.name+"]\n");
|
||||||
print("set_property IOSTANDARD LVCMOS33 [get_ports "+port.name+"]\n\n");
|
print("set_property IOSTANDARD LVCMOS33 [get_ports "+port.name+"]\n\n");
|
||||||
@ -25,7 +26,7 @@ print("set_property CONFIG_VOLTAGE 3.3 [current_design]\n");
|
|||||||
|
|
||||||
?>]]></content>
|
?>]]></content>
|
||||||
</file>
|
</file>
|
||||||
<file name="vivado/<?=shortname?>.xpr" overwrite="true" filter="true">
|
<file name="vivado/<?=shortname?>.xpr" overwrite="false" filter="true">
|
||||||
<content><![CDATA[<?print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");?>
|
<content><![CDATA[<?print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");?>
|
||||||
<!-- Created by Digital -->
|
<!-- Created by Digital -->
|
||||||
|
|
157
src/main/dig/hdl/TinyFPGA_BX_SOS.dig
Normal file
157
src/main/dig/hdl/TinyFPGA_BX_SOS.dig
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<circuit>
|
||||||
|
<version>1</version>
|
||||||
|
<attributes/>
|
||||||
|
<visualElements>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Counter</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Bits</string>
|
||||||
|
<int>26</int>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="220" y="140"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>VDD</elementName>
|
||||||
|
<elementAttributes/>
|
||||||
|
<pos x="200" y="120"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Ground</elementName>
|
||||||
|
<elementAttributes/>
|
||||||
|
<pos x="200" y="200"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Clock</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>CLK</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Frequency</string>
|
||||||
|
<int>2147483647</int>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>runRealTime</string>
|
||||||
|
<boolean>true</boolean>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="180" y="160"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Splitter</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Input Splitting</string>
|
||||||
|
<string>26</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Output Splitting</string>
|
||||||
|
<string>21-25</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="320" y="140"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>ROM</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>SOS</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>AddrBits</string>
|
||||||
|
<int>5</int>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Data</string>
|
||||||
|
<data>0,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1</data>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="380" y="140"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>VDD</elementName>
|
||||||
|
<elementAttributes/>
|
||||||
|
<pos x="360" y="160"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Out</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>LED</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="480" y="160"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Out</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>USBPU</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="480" y="200"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Ground</elementName>
|
||||||
|
<elementAttributes/>
|
||||||
|
<pos x="460" y="220"/>
|
||||||
|
</visualElement>
|
||||||
|
</visualElements>
|
||||||
|
<wires>
|
||||||
|
<wire>
|
||||||
|
<p1 x="180" y="160"/>
|
||||||
|
<p2 x="220" y="160"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="440" y="160"/>
|
||||||
|
<p2 x="480" y="160"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="200" y="180"/>
|
||||||
|
<p2 x="220" y="180"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="360" y="180"/>
|
||||||
|
<p2 x="380" y="180"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="460" y="200"/>
|
||||||
|
<p2 x="480" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="280" y="140"/>
|
||||||
|
<p2 x="320" y="140"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="340" y="140"/>
|
||||||
|
<p2 x="380" y="140"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="200" y="140"/>
|
||||||
|
<p2 x="220" y="140"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="200" y="120"/>
|
||||||
|
<p2 x="200" y="140"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="200" y="180"/>
|
||||||
|
<p2 x="200" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="360" y="160"/>
|
||||||
|
<p2 x="360" y="180"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="460" y="200"/>
|
||||||
|
<p2 x="460" y="220"/>
|
||||||
|
</wire>
|
||||||
|
</wires>
|
||||||
|
</circuit>
|
@ -73,6 +73,8 @@ public class OSExecute {
|
|||||||
* @return this for chained calls
|
* @return this for chained calls
|
||||||
*/
|
*/
|
||||||
public OSExecute setTimeOutSec(int timeOutSec) {
|
public OSExecute setTimeOutSec(int timeOutSec) {
|
||||||
|
if (timeOutSec == 0)
|
||||||
|
timeOutSec = Integer.MAX_VALUE;
|
||||||
this.timeOutSec = timeOutSec;
|
this.timeOutSec = timeOutSec;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -195,9 +197,11 @@ public class OSExecute {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
String result = os.startAndWait();
|
String result = os.startAndWait();
|
||||||
callback.processTerminated(result);
|
if (callback != null)
|
||||||
|
callback.processTerminated(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
callback.exception(e);
|
if (callback != null)
|
||||||
|
callback.exception(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,6 @@ public class Context {
|
|||||||
* @throws HGSEvalException HGSEvalException
|
* @throws HGSEvalException HGSEvalException
|
||||||
*/
|
*/
|
||||||
public Context declareVar(String name, Object value) throws HGSEvalException {
|
public Context declareVar(String name, Object value) throws HGSEvalException {
|
||||||
if (map.containsKey(name))
|
|
||||||
throw new HGSEvalException("Variable '" + name + "' already declared!");
|
|
||||||
map.put(name, value);
|
map.put(name, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,6 @@ public class ReferenceToArray implements Reference {
|
|||||||
final HGSArray array = Value.toArray(parent.get(context));
|
final HGSArray array = Value.toArray(parent.get(context));
|
||||||
if (i < 0 || i > array.hgsArraySize())
|
if (i < 0 || i > array.hgsArraySize())
|
||||||
throw new HGSEvalException("Index out of bounds: " + i);
|
throw new HGSEvalException("Index out of bounds: " + i);
|
||||||
if (i < array.hgsArraySize())
|
|
||||||
throw new HGSEvalException("Array field redeclared: " + i);
|
|
||||||
|
|
||||||
array.hgsArrayAdd(initial);
|
array.hgsArrayAdd(initial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +31,6 @@ public class ReferenceToStruct implements Reference {
|
|||||||
@Override
|
@Override
|
||||||
public void declareVar(Context context, Object initial) throws HGSEvalException {
|
public void declareVar(Context context, Object initial) throws HGSEvalException {
|
||||||
final HGSMap hgsMap = Value.toMap(parent.get(context));
|
final HGSMap hgsMap = Value.toMap(parent.get(context));
|
||||||
if (hgsMap.hgsMapGet(name) != null)
|
|
||||||
throw new HGSEvalException("Value '" + name + "' redeclared in struct!");
|
|
||||||
|
|
||||||
hgsMap.hgsMapPut(name, initial);
|
hgsMap.hgsMapPut(name, initial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,10 @@ package de.neemann.digital.ide;
|
|||||||
public class Command {
|
public class Command {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final boolean filter;
|
private final boolean filter;
|
||||||
|
private final boolean gui;
|
||||||
private final String requires;
|
private final String requires;
|
||||||
private final String[] args;
|
private final String[] args;
|
||||||
|
private final int timeout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new command
|
* Creates a new command
|
||||||
@ -20,13 +22,17 @@ public class Command {
|
|||||||
* @param name the name of the command
|
* @param name the name of the command
|
||||||
* @param requires the hdl which is required, either "verilog" of "vhdl"
|
* @param requires the hdl which is required, either "verilog" of "vhdl"
|
||||||
* @param filter the true, the commands args are filtered
|
* @param filter the true, the commands args are filtered
|
||||||
|
* @param gui if true the appp has a gui
|
||||||
|
* @param timeout the timeout value in sec
|
||||||
* @param args the arguments
|
* @param args the arguments
|
||||||
*/
|
*/
|
||||||
public Command(String name, String requires, boolean filter, String... args) {
|
public Command(String name, String requires, boolean filter, boolean gui, int timeout, String... args) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.requires = requires;
|
this.requires = requires;
|
||||||
|
this.timeout = timeout;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
|
this.gui = gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,4 +69,18 @@ public class Command {
|
|||||||
public boolean isFilter() {
|
public boolean isFilter() {
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if application has a gui
|
||||||
|
*/
|
||||||
|
public boolean isGui() {
|
||||||
|
return gui;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return timeout in seconds
|
||||||
|
*/
|
||||||
|
public int getTimeout() {
|
||||||
|
return timeout;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ package de.neemann.digital.ide;
|
|||||||
|
|
||||||
import com.thoughtworks.xstream.XStream;
|
import com.thoughtworks.xstream.XStream;
|
||||||
import com.thoughtworks.xstream.io.xml.StaxDriver;
|
import com.thoughtworks.xstream.io.xml.StaxDriver;
|
||||||
import de.neemann.digital.core.extern.ProcessStarter;
|
import de.neemann.digital.builder.tt2.OSExecute;
|
||||||
import de.neemann.digital.draw.elements.Circuit;
|
import de.neemann.digital.draw.elements.Circuit;
|
||||||
import de.neemann.digital.draw.library.ElementLibrary;
|
import de.neemann.digital.draw.library.ElementLibrary;
|
||||||
import de.neemann.digital.gui.SaveAsHelper;
|
import de.neemann.digital.gui.SaveAsHelper;
|
||||||
@ -20,6 +20,8 @@ import de.neemann.digital.hdl.verilog2.VerilogGenerator;
|
|||||||
import de.neemann.digital.hdl.vhdl2.VHDLGenerator;
|
import de.neemann.digital.hdl.vhdl2.VHDLGenerator;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
import de.neemann.gui.ErrorMessage;
|
import de.neemann.gui.ErrorMessage;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
@ -30,6 +32,7 @@ import java.util.ArrayList;
|
|||||||
* Used to create the IDE integration
|
* Used to create the IDE integration
|
||||||
*/
|
*/
|
||||||
public final class Configuration {
|
public final class Configuration {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(Configuration.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a configuration
|
* Loads a configuration
|
||||||
@ -66,6 +69,8 @@ public final class Configuration {
|
|||||||
xStream.aliasAttribute(Command.class, "name", "name");
|
xStream.aliasAttribute(Command.class, "name", "name");
|
||||||
xStream.aliasAttribute(Command.class, "requires", "requires");
|
xStream.aliasAttribute(Command.class, "requires", "requires");
|
||||||
xStream.aliasAttribute(Command.class, "filter", "filter");
|
xStream.aliasAttribute(Command.class, "filter", "filter");
|
||||||
|
xStream.aliasAttribute(Command.class, "gui", "gui");
|
||||||
|
xStream.aliasAttribute(Command.class, "timeout", "timeout");
|
||||||
xStream.addImplicitCollection(Command.class, "args", "arg", String.class);
|
xStream.addImplicitCollection(Command.class, "args", "arg", String.class);
|
||||||
xStream.alias("file", FileToCreate.class);
|
xStream.alias("file", FileToCreate.class);
|
||||||
xStream.aliasAttribute(FileToCreate.class, "name", "name");
|
xStream.aliasAttribute(FileToCreate.class, "name", "name");
|
||||||
@ -236,7 +241,7 @@ public final class Configuration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (args != null)
|
if (args != null)
|
||||||
getIoInterface().startProcess(digFile.getParentFile(), args);
|
getIoInterface().startProcess(command, digFile.getParentFile(), command.isGui(), args);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
getIoInterface().showError(command, e);
|
getIoInterface().showError(command, e);
|
||||||
}
|
}
|
||||||
@ -308,11 +313,13 @@ public final class Configuration {
|
|||||||
/**
|
/**
|
||||||
* Starts a process
|
* Starts a process
|
||||||
*
|
*
|
||||||
* @param dir the folder to start the process in
|
* @param command the command started
|
||||||
* @param args the arguments
|
* @param dir the folder to start the process in
|
||||||
|
* @param gui true if app has a gui
|
||||||
|
* @param args the arguments
|
||||||
* @throws IOException IOException
|
* @throws IOException IOException
|
||||||
*/
|
*/
|
||||||
void startProcess(File dir, String[] args) throws IOException;
|
void startProcess(Command command, File dir, boolean gui, String[] args) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows an error message
|
* Shows an error message
|
||||||
@ -330,14 +337,30 @@ public final class Configuration {
|
|||||||
final File parentFile = filename.getParentFile();
|
final File parentFile = filename.getParentFile();
|
||||||
if (!parentFile.exists()) {
|
if (!parentFile.exists()) {
|
||||||
if (!parentFile.mkdirs())
|
if (!parentFile.mkdirs())
|
||||||
throw new IOException("could not create "+parentFile);
|
throw new IOException("could not create " + parentFile);
|
||||||
}
|
}
|
||||||
return new FileOutputStream(filename);
|
return new FileOutputStream(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startProcess(File dir, String[] args) throws IOException {
|
public void startProcess(Command command, File dir, boolean gui, String[] args) throws IOException {
|
||||||
ProcessStarter.start(dir, args);
|
OSExecute os = new OSExecute(args)
|
||||||
|
.setTimeOutSec(command.getTimeout())
|
||||||
|
.setWorkingDir(dir);
|
||||||
|
if (gui)
|
||||||
|
os.startInThread(new OSExecute.ProcessCallback() {
|
||||||
|
@Override
|
||||||
|
public void processTerminated(String consoleOut) {
|
||||||
|
LOGGER.info("process '" + command.getName() + "' says:\n" + consoleOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exception(Exception e) {
|
||||||
|
showError(command, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
else
|
||||||
|
os.startAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,7 +75,7 @@ public class VerilogSimulatorTest extends TestCase {
|
|||||||
File examples = new File(Resources.getRoot(), "../../main/dig/hdl");
|
File examples = new File(Resources.getRoot(), "../../main/dig/hdl");
|
||||||
try {
|
try {
|
||||||
int tested = new FileScanner(this::checkVerilogExport).noOutput().scan(examples);
|
int tested = new FileScanner(this::checkVerilogExport).noOutput().scan(examples);
|
||||||
assertEquals(1, tested);
|
assertEquals(2, tested);
|
||||||
assertEquals(1, testBenches);
|
assertEquals(1, testBenches);
|
||||||
} catch (FileScanner.SkipAllException e) {
|
} catch (FileScanner.SkipAllException e) {
|
||||||
// if iverilog is not installed its also ok
|
// if iverilog is not installed its also ok
|
||||||
|
@ -68,7 +68,7 @@ public class VHDLSimulatorTest extends TestCase {
|
|||||||
File examples = new File(Resources.getRoot(), "../../main/dig/hdl");
|
File examples = new File(Resources.getRoot(), "../../main/dig/hdl");
|
||||||
try {
|
try {
|
||||||
int tested = new FileScanner(this::checkVHDLExport).noOutput().scan(examples);
|
int tested = new FileScanner(this::checkVHDLExport).noOutput().scan(examples);
|
||||||
assertEquals(1, tested);
|
assertEquals(2, tested);
|
||||||
assertEquals(1, testBenches);
|
assertEquals(1, testBenches);
|
||||||
} catch (FileScanner.SkipAllException e) {
|
} catch (FileScanner.SkipAllException e) {
|
||||||
// if ghdl is not installed its also ok
|
// if ghdl is not installed its also ok
|
||||||
|
@ -117,7 +117,7 @@ public class ConfigurationTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startProcess(File dir, String[] args) {
|
public void startProcess(Command command, File dir, boolean gui, String[] args) {
|
||||||
commands.add(new StartedCommand(dir, args));
|
commands.add(new StartedCommand(dir, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public class TestExamples extends TestCase {
|
|||||||
*/
|
*/
|
||||||
public void testDistExamples() throws Exception {
|
public void testDistExamples() throws Exception {
|
||||||
File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig");
|
File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig");
|
||||||
assertEquals(252, new FileScanner(this::check).scan(examples));
|
assertEquals(253, new FileScanner(this::check).scan(examples));
|
||||||
assertEquals(171, testCasesInFiles);
|
assertEquals(171, testCasesInFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user