From 416e908d017f2cc35c72c7313e02ddacf634775f Mon Sep 17 00:00:00 2001 From: hneemann Date: Sat, 18 May 2019 15:04:21 +0200 Subject: [PATCH] improved the BASYS3 PLL parameters --- src/main/dig/hdl/BASYS3_Config.xml | 10 ++++++---- src/main/dig/hdl/TinyFPGA_BX_Config.xml | 2 +- .../de/neemann/digital/builder/tt2/OSExecute.java | 14 ++++++++------ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/dig/hdl/BASYS3_Config.xml b/src/main/dig/hdl/BASYS3_Config.xml index 58ab49f89..24180a2e7 100644 --- a/src/main/dig/hdl/BASYS3_Config.xml +++ b/src/main/dig/hdl/BASYS3_Config.xml @@ -113,10 +113,14 @@ begin F_VCO = (F_IN*M)/D; } - DIV := min(128,max(1,round(F_VCO/F_DES*1000)/1000.0)); + DIV := min(128,max(1,round(F_VCO/F_DES*8)/8.0)); + + // correct to fractional M + M=round((F_DES*D*DIV*1000)/F_IN)/1000.0; + F_VCO = (F_IN*M)/D; log(format("M_ideal=%.2f",M_IDEAL)); - log(format("M=%d",M)); + log(format("M=%.3f",M)); log(format("D=%d",D)); log(format("DIV=%f",DIV)); @@ -127,8 +131,6 @@ begin log(format("F_VCO=%.2f",F_VCO)); log(format("F_OUT=%f",F_OUT)); log(format("F_Desired=%f",F_DES)); - - M = float(M); ?> DEV_NULL <= '0'; diff --git a/src/main/dig/hdl/TinyFPGA_BX_Config.xml b/src/main/dig/hdl/TinyFPGA_BX_Config.xml index 664c5435c..a896dc2a4 100644 --- a/src/main/dig/hdl/TinyFPGA_BX_Config.xml +++ b/src/main/dig/hdl/TinyFPGA_BX_Config.xml @@ -46,7 +46,7 @@ all: $(PROJ).bin icepack $< $@ %.rpt: %.asc - icetime -d $(DEVICE) -C C:\Users\helmut.neemann\.apio\packages\toolchain-icestorm\share\icebox -mtr $@ $< + icetime -d $(DEVICE) -C icebox -mtr $@ $< %_tb: %_tb.v %.v iverilog -o $@ $^ diff --git a/src/main/java/de/neemann/digital/builder/tt2/OSExecute.java b/src/main/java/de/neemann/digital/builder/tt2/OSExecute.java index e589e4ca5..31152e500 100644 --- a/src/main/java/de/neemann/digital/builder/tt2/OSExecute.java +++ b/src/main/java/de/neemann/digital/builder/tt2/OSExecute.java @@ -106,15 +106,15 @@ public class OSExecute { throw new IOException(Lang.get("err_processDoesNotTerminate_N", processBuilder.command())); } - if (process.exitValue() != 0 && !ignoreReturnCode) - throw new IOException(Lang.get("err_processExitedWithError_N1_N2", process.exitValue(), "\n" + consoleReader.toString())); - try { consoleReader.join(); } catch (InterruptedException e) { e.printStackTrace(); } + if (process.exitValue() != 0 && !ignoreReturnCode) + throw new IOException(Lang.get("err_processExitedWithError_N1_N2", process.exitValue(), "\n" + consoleReader.toString())); + if (consoleReader.getException() != null) throw consoleReader.getException(); @@ -166,7 +166,7 @@ public class OSExecute { byte[] data = new byte[4096]; int l; while ((l = console.read(data)) >= 0) { - synchronized (this) { + synchronized (baos) { baos.write(data, 0, l); } } @@ -180,8 +180,10 @@ public class OSExecute { } @Override - public synchronized String toString() { - return baos.toString(); + public String toString() { + synchronized (baos) { + return baos.toString(); + } } }