From ac857ce9cb04e89e25d3ee45c2468cbfdc7ce8b3 Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sat, 4 Jan 2020 22:13:49 -0500 Subject: [PATCH 01/12] Build with Gradle --- .gitignore | 2 ++ java/build.gradle | 44 ++++++++++++++++++++++++++++++ java/newisys-utils/build.gradle | 6 ++++ java/newisys-utils/settings.gradle | 1 + java/settings.gradle | 6 ++++ 5 files changed, 59 insertions(+) create mode 100644 .gitignore create mode 100644 java/build.gradle create mode 100644 java/newisys-utils/build.gradle create mode 100644 java/newisys-utils/settings.gradle create mode 100644 java/settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f6823b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.gradle +build/ diff --git a/java/build.gradle b/java/build.gradle new file mode 100644 index 0000000..145f488 --- /dev/null +++ b/java/build.gradle @@ -0,0 +1,44 @@ +subprojects { + apply plugin: "java-library" + sourceCompatibility = '1.5' + sourceSets { + main { + java { + srcDirs = ['src'] + } + } + test { + java { + srcDirs = ['test'] + } + } + } +} +project(":jove") { + repositories { + jcenter() + } + dependencies { + implementation project(":newisys-utils") + testImplementation "junit:junit:4.12" + } +} + +project(":langschema") { + dependencies { + implementation project(":newisys-utils") + } +} +project(":langschema-java") { + dependencies { + implementation project(":langschema") + implementation project(":newisys-utils") + } +} +project(":langschema-jove") { + dependencies { + implementation project(":langschema-java") + implementation project(":langschema") + implementation project(":newisys-utils") + } +} diff --git a/java/newisys-utils/build.gradle b/java/newisys-utils/build.gradle new file mode 100644 index 0000000..1da68f0 --- /dev/null +++ b/java/newisys-utils/build.gradle @@ -0,0 +1,6 @@ +plugins { + id "java-library" +} + +group = "com.newisys.utils" +version = "1.0" diff --git a/java/newisys-utils/settings.gradle b/java/newisys-utils/settings.gradle new file mode 100644 index 0000000..b4d46a1 --- /dev/null +++ b/java/newisys-utils/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "newisys-utils" diff --git a/java/settings.gradle b/java/settings.gradle new file mode 100644 index 0000000..52fcd46 --- /dev/null +++ b/java/settings.gradle @@ -0,0 +1,6 @@ +rootProject.name = "jove-root" +include "newisys-utils" +include "jove" +include "langschema" +include "langschema-java" +include "langschema-jove" From 3f5f788d641cea28c50c8ee4bcb741be746e5dd6 Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sat, 4 Jan 2020 22:14:00 -0500 Subject: [PATCH 02/12] Fix tests --- .../test/com/newisys/behsim/BehavioralRegTest.java | 13 +++++++------ java/jove/test/com/newisys/dv/MailboxTest.java | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/java/jove/test/com/newisys/behsim/BehavioralRegTest.java b/java/jove/test/com/newisys/behsim/BehavioralRegTest.java index 06c16a2..073646f 100644 --- a/java/jove/test/com/newisys/behsim/BehavioralRegTest.java +++ b/java/jove/test/com/newisys/behsim/BehavioralRegTest.java @@ -164,7 +164,7 @@ private void doDriveDelayModeTest( try { - reggie.putValueDelay(new BitVector("16'h0001"), delay, mode); + reggie.putValueDelay(new BitVector("32'h0001"), delay, mode); } catch (UnsupportedOperationException e) @@ -191,7 +191,7 @@ public void testValueChangeCallbackDefault() TimeType timeType = TimeType.SIM; ValueType valueType = ValueType.OBJ_TYPE; VerilogTime time = new VerilogSimTime(0); - valueChangeCallbackTest(value, timeType, valueType, time); + valueChangeCallbackTest(reggie, value, timeType, valueType, time); } public void testValueChangeCallbackScaledRealInt() @@ -200,7 +200,7 @@ public void testValueChangeCallbackScaledRealInt() TimeType timeType = TimeType.SCALED_REAL; ValueType valueType = ValueType.INT; VerilogTime time = new VerilogScaledRealTime(0.0); - valueChangeCallbackTest(value, timeType, valueType, time); + valueChangeCallbackTest(reggie, value, timeType, valueType, time); } public void testValueChangeCallbackSupressTimeScalar() @@ -209,7 +209,7 @@ public void testValueChangeCallbackSupressTimeScalar() TimeType timeType = TimeType.SUPPRESS; ValueType valueType = ValueType.SCALAR; VerilogTime time = null; - valueChangeCallbackTest(value, timeType, valueType, time); + valueChangeCallbackTest(new BehavioralReg(simulation, "Reggie", 1), value, timeType, valueType, time); } public void testValueChangeCallbackScaledRealVector() @@ -218,7 +218,7 @@ public void testValueChangeCallbackScaledRealVector() TimeType timeType = TimeType.SCALED_REAL; ValueType valueType = ValueType.VECTOR; VerilogTime time = new VerilogScaledRealTime(0.0); - valueChangeCallbackTest(value, timeType, valueType, time); + valueChangeCallbackTest(reggie, value, timeType, valueType, time); } public void testValueChangeCallbackSupressValueScalar() @@ -227,10 +227,11 @@ public void testValueChangeCallbackSupressValueScalar() TimeType timeType = TimeType.SCALED_REAL; ValueType valueType = ValueType.SUPPRESS; VerilogTime time = new VerilogScaledRealTime(0.0); - valueChangeCallbackTest(value, timeType, valueType, time); + valueChangeCallbackTest(reggie, value, timeType, valueType, time); } private void valueChangeCallbackTest( + BehavioralReg reggie, Object value, TimeType timeType, ValueType valueType, diff --git a/java/jove/test/com/newisys/dv/MailboxTest.java b/java/jove/test/com/newisys/dv/MailboxTest.java index bb9a369..c40b803 100644 --- a/java/jove/test/com/newisys/dv/MailboxTest.java +++ b/java/jove/test/com/newisys/dv/MailboxTest.java @@ -67,7 +67,7 @@ final public void testMailbox() doPeekNoWait(0); doSize(SIZE * 2); - doToString(m1.getClass().getName() + "{m1}"); + doToString("m1"); } public void doPut() From a0b6e6fb4c50d8724f5b07da6c08bd2451b37180 Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 5 Jan 2020 00:13:45 -0500 Subject: [PATCH 03/12] Remove non-necessary files for newisys subproject --- java/newisys-utils/build.gradle | 6 ------ java/newisys-utils/settings.gradle | 1 - 2 files changed, 7 deletions(-) delete mode 100644 java/newisys-utils/build.gradle delete mode 100644 java/newisys-utils/settings.gradle diff --git a/java/newisys-utils/build.gradle b/java/newisys-utils/build.gradle deleted file mode 100644 index 1da68f0..0000000 --- a/java/newisys-utils/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -plugins { - id "java-library" -} - -group = "com.newisys.utils" -version = "1.0" diff --git a/java/newisys-utils/settings.gradle b/java/newisys-utils/settings.gradle deleted file mode 100644 index b4d46a1..0000000 --- a/java/newisys-utils/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "newisys-utils" From 7741eb335d731d49800e1e46953856238e89a2f0 Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 5 Jan 2020 00:14:09 -0500 Subject: [PATCH 04/12] Compile randsolver --- java/build.gradle | 9 +++++++++ java/randsolver/build.gradle | 28 ++++++++++++++++++++++++++++ java/settings.gradle | 1 + 3 files changed, 38 insertions(+) create mode 100644 java/randsolver/build.gradle diff --git a/java/build.gradle b/java/build.gradle index 145f488..353a396 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -42,3 +42,12 @@ project(":langschema-jove") { implementation project(":newisys-utils") } } +project(":randsolver") { + dependencies { + implementation project(":langschema-jove") + implementation project(":langschema-java") + implementation project(":langschema") + implementation project(":jove") + testImplementation "junit:junit:4.12" + } +} diff --git a/java/randsolver/build.gradle b/java/randsolver/build.gradle new file mode 100644 index 0000000..5037c38 --- /dev/null +++ b/java/randsolver/build.gradle @@ -0,0 +1,28 @@ +plugins { + id 'com.intershop.gradle.javacc' version '3.1.1' +} +repositories { + mavenCentral() +} +javacc { + // configuration container for all javacc configurations + configs { + template { + javaCCVersion = '3.2' + inputFile = file('src/com/newisys/randsolver/parser/ConstraintParser.jj') + packageName = 'com.newisys.randsolver' + // lookahead = '2' + } + } +} + +tasks.getByName("javaccTemplate") { + // The javacc 3.0 does not create the directory it needs + doFirst { + mkdir "${buildDir}/generated/javacc/template/com/newisys/randsolver" + } + // The javacc 3.0 creates an incorrect Token file, the project provides its own. + doLast { + delete "${buildDir}/generated/javacc/template/com/newisys/randsolver/Token.java" + } +} diff --git a/java/settings.gradle b/java/settings.gradle index 52fcd46..097481a 100644 --- a/java/settings.gradle +++ b/java/settings.gradle @@ -4,3 +4,4 @@ include "jove" include "langschema" include "langschema-java" include "langschema-jove" +include "randsolver" From 8306142d839256c4a23213e93763eae379261e0d Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 9 Jan 2022 10:56:04 -0500 Subject: [PATCH 05/12] Gradle multi-project build --- java/build.gradle | 40 +++++++++++-------- java/jove/build.gradle | 22 ++++++++++ .../src/com/newisys/behsim/BehavioralReg.java | 2 +- .../newisys/behsim/BehavioralSimulation.java | 2 +- .../com/newisys/behsim/BehavioralRegTest.java | 2 +- .../eventsim/MetaEventWaitOrderingTest.java | 10 ++--- .../test/com/newisys/printf/TestPrintf.java | 2 +- java/langschema-java/build.gradle | 21 ++++++++++ java/langschema-jove/build.gradle | 22 ++++++++++ java/langschema/build.gradle | 20 ++++++++++ java/newisys-utils/build.gradle | 16 ++++++++ java/randsolver/build.gradle | 34 ++++++++++++++++ .../newisys/randsolver/ComplexExprSolver.java | 10 ++--- .../com/newisys/randsolver/RandVarSet.java | 4 +- java/randsolver/src/org/sf/javabdd/BDD.java | 10 ++--- .../src/org/sf/javabdd/BDDFactory.java | 12 +++--- .../newisys/randsolver/TestAnnotation.java | 2 +- 17 files changed, 186 insertions(+), 45 deletions(-) create mode 100644 java/jove/build.gradle create mode 100644 java/langschema-java/build.gradle create mode 100644 java/langschema-jove/build.gradle create mode 100644 java/langschema/build.gradle create mode 100644 java/newisys-utils/build.gradle diff --git a/java/build.gradle b/java/build.gradle index 353a396..f4846f5 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -1,22 +1,27 @@ -subprojects { - apply plugin: "java-library" - sourceCompatibility = '1.5' - sourceSets { - main { - java { - srcDirs = ['src'] - } - } - test { - java { - srcDirs = ['test'] - } - } - } -} +//plugins { +// id 'java-library' +//} + +//subprojects { +// apply plugin: "java-library" +// //sourceCompatibility = '1.5' +// sourceSets { +// main { +// java { +// srcDirs = ['src'] +// } +// } +// test { +// java { +// srcDirs = ['test'] +// } +// } +// } +//} +/* project(":jove") { repositories { - jcenter() + mavenCentral() } dependencies { implementation project(":newisys-utils") @@ -51,3 +56,4 @@ project(":randsolver") { testImplementation "junit:junit:4.12" } } +*/ diff --git a/java/jove/build.gradle b/java/jove/build.gradle new file mode 100644 index 0000000..730c4aa --- /dev/null +++ b/java/jove/build.gradle @@ -0,0 +1,22 @@ +plugins { + id 'java-library' +} +repositories { + mavenCentral() +} +sourceSets { + main { + java { + srcDirs = ['src'] + } + } + test { + java { + srcDirs = ['test'] + } + } +} +dependencies { + implementation project(":newisys-utils") + testImplementation "junit:junit:4.12" +} diff --git a/java/jove/src/com/newisys/behsim/BehavioralReg.java b/java/jove/src/com/newisys/behsim/BehavioralReg.java index 8b241a0..b147c0a 100644 --- a/java/jove/src/com/newisys/behsim/BehavioralReg.java +++ b/java/jove/src/com/newisys/behsim/BehavioralReg.java @@ -164,7 +164,7 @@ else if (type == ValueType.VECTOR) } else if (type == ValueType.INT) { - return new Integer(buffer.intValue()); + return Integer.valueOf(buffer.intValue()); } else if (type == ValueType.SUPPRESS) { diff --git a/java/jove/src/com/newisys/behsim/BehavioralSimulation.java b/java/jove/src/com/newisys/behsim/BehavioralSimulation.java index fdbe0cc..bb317b0 100644 --- a/java/jove/src/com/newisys/behsim/BehavioralSimulation.java +++ b/java/jove/src/com/newisys/behsim/BehavioralSimulation.java @@ -313,7 +313,7 @@ public long getSimTime() */ public double getScaledRealTime() { - Long tmp = new Long(eventScheduler.getCurrentTime()); + Long tmp = Long.valueOf(eventScheduler.getCurrentTime()); return tmp.doubleValue(); } diff --git a/java/jove/test/com/newisys/behsim/BehavioralRegTest.java b/java/jove/test/com/newisys/behsim/BehavioralRegTest.java index 073646f..8bc8aac 100644 --- a/java/jove/test/com/newisys/behsim/BehavioralRegTest.java +++ b/java/jove/test/com/newisys/behsim/BehavioralRegTest.java @@ -196,7 +196,7 @@ public void testValueChangeCallbackDefault() public void testValueChangeCallbackScaledRealInt() { - Object value = new Integer(299772); + Object value = Integer.valueOf(299772); TimeType timeType = TimeType.SCALED_REAL; ValueType valueType = ValueType.INT; VerilogTime time = new VerilogScaledRealTime(0.0); diff --git a/java/jove/test/com/newisys/eventsim/MetaEventWaitOrderingTest.java b/java/jove/test/com/newisys/eventsim/MetaEventWaitOrderingTest.java index 9bf330c..a048c45 100644 --- a/java/jove/test/com/newisys/eventsim/MetaEventWaitOrderingTest.java +++ b/java/jove/test/com/newisys/eventsim/MetaEventWaitOrderingTest.java @@ -156,11 +156,11 @@ public void run() List order = soTest.order; assertEquals(5, order.size()); - assertEquals(new Integer(1), order.get(0)); - assertEquals(new Integer(2), order.get(1)); - assertEquals(new Integer(3), order.get(2)); - assertEquals(new Integer(4), order.get(3)); - assertEquals(new Integer(5), order.get(4)); + assertEquals(Integer.valueOf(1), order.get(0)); + assertEquals(Integer.valueOf(2), order.get(1)); + assertEquals(Integer.valueOf(3), order.get(2)); + assertEquals(Integer.valueOf(4), order.get(3)); + assertEquals(Integer.valueOf(5), order.get(4)); } } diff --git a/java/jove/test/com/newisys/printf/TestPrintf.java b/java/jove/test/com/newisys/printf/TestPrintf.java index c8774b9..64c47d8 100644 --- a/java/jove/test/com/newisys/printf/TestPrintf.java +++ b/java/jove/test/com/newisys/printf/TestPrintf.java @@ -189,7 +189,7 @@ public void testStringConversions() public void testSignedConversion() { // only %d and %i should be signed for a signed type - Object o = new Short((short) -1); + Object o = Short.valueOf((short) -1); assertEquals("1111111111111111", Printf.sprintf("%b", o)); assertEquals("177777", Printf.sprintf("%o", o)); assertEquals("-1", Printf.sprintf("%d", o)); diff --git a/java/langschema-java/build.gradle b/java/langschema-java/build.gradle new file mode 100644 index 0000000..47d165c --- /dev/null +++ b/java/langschema-java/build.gradle @@ -0,0 +1,21 @@ +plugins { + id 'java-library' +} + +sourceSets { + main { + java { + srcDirs = ['src'] + } + } + test { + java { + srcDirs = ['test'] + } + } +} + +dependencies { + implementation project(":newisys-utils") + implementation project(":langschema") +} diff --git a/java/langschema-jove/build.gradle b/java/langschema-jove/build.gradle new file mode 100644 index 0000000..6a7f6f1 --- /dev/null +++ b/java/langschema-jove/build.gradle @@ -0,0 +1,22 @@ +plugins { + id 'java-library' +} + +sourceSets { + main { + java { + srcDirs = ['src'] + } + } + test { + java { + srcDirs = ['test'] + } + } +} + +dependencies { + implementation project(":newisys-utils") + implementation project(":langschema") + implementation project(":langschema-java") +} diff --git a/java/langschema/build.gradle b/java/langschema/build.gradle new file mode 100644 index 0000000..fc901db --- /dev/null +++ b/java/langschema/build.gradle @@ -0,0 +1,20 @@ +plugins { + id 'java-library' +} + +sourceSets { + main { + java { + srcDirs = ['src'] + } + } + test { + java { + srcDirs = ['test'] + } + } +} + +dependencies { + implementation project(":newisys-utils") +} diff --git a/java/newisys-utils/build.gradle b/java/newisys-utils/build.gradle new file mode 100644 index 0000000..33df307 --- /dev/null +++ b/java/newisys-utils/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java-library' +} + +sourceSets { + main { + java { + srcDirs = ['src'] + } + } + test { + java { + srcDirs = ['test'] + } + } +} diff --git a/java/randsolver/build.gradle b/java/randsolver/build.gradle index 5037c38..14f0e89 100644 --- a/java/randsolver/build.gradle +++ b/java/randsolver/build.gradle @@ -1,9 +1,39 @@ plugins { id 'com.intershop.gradle.javacc' version '3.1.1' + id 'java-library' } repositories { mavenCentral() } +sourceSets { + main { + java { + srcDirs = ['src'] + } + } + test { + java { + srcDirs = ['test'] + } + } +} +dependencies { + implementation project(":langschema-jove") + implementation project(":langschema-java") + implementation project(":langschema") + implementation project(":jove") +// testImplementation "junit:junit:4.12" + + testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1' + testCompileOnly 'junit:junit:4.13' + testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' + +} +tasks.withType(JavaCompile) { +// options.compilerArgs << '-Xlint:unchecked' + options.compilerArgs << '-Xlint:deprecation' + options.deprecation = true +} javacc { // configuration container for all javacc configurations configs { @@ -26,3 +56,7 @@ tasks.getByName("javaccTemplate") { delete "${buildDir}/generated/javacc/template/com/newisys/randsolver/Token.java" } } + +test { + useJUnitPlatform() +} diff --git a/java/randsolver/src/com/newisys/randsolver/ComplexExprSolver.java b/java/randsolver/src/com/newisys/randsolver/ComplexExprSolver.java index aa2b154..c6d69a1 100644 --- a/java/randsolver/src/com/newisys/randsolver/ComplexExprSolver.java +++ b/java/randsolver/src/com/newisys/randsolver/ComplexExprSolver.java @@ -946,7 +946,7 @@ protected Map commit(Object obj, PRNG rng) } else { - f.set(commitObj, new Boolean(b)); + f.set(commitObj, Boolean.valueOf(b)); } } else if (dataType == byte.class || dataType == Byte.class) @@ -961,7 +961,7 @@ else if (dataType == byte.class || dataType == Byte.class) } else { - f.set(commitObj, new Byte(b)); + f.set(commitObj, Byte.valueOf(b)); } } else if (dataType == char.class) @@ -982,7 +982,7 @@ else if (dataType == int.class || dataType == Integer.class) } else { - f.set(commitObj, new Integer(value)); + f.set(commitObj, Integer.valueOf(value)); } } else if (dataType == long.class || dataType == Long.class) @@ -995,7 +995,7 @@ else if (dataType == long.class || dataType == Long.class) } else { - f.set(commitObj, new Long(value)); + f.set(commitObj, Long.valueOf(value)); } } else if (dataType == short.class || dataType == Short.class) @@ -1010,7 +1010,7 @@ else if (dataType == short.class || dataType == Short.class) } else { - f.set(commitObj, new Short(s)); + f.set(commitObj, Short.valueOf(s)); } } else if (dataType == BitVector.class) diff --git a/java/randsolver/src/com/newisys/randsolver/RandVarSet.java b/java/randsolver/src/com/newisys/randsolver/RandVarSet.java index ed23daf..1e13f8b 100644 --- a/java/randsolver/src/com/newisys/randsolver/RandVarSet.java +++ b/java/randsolver/src/com/newisys/randsolver/RandVarSet.java @@ -122,7 +122,7 @@ public void addRandVar(RandomVariable rv) // only create an index if we actually added something to the set if (size != mRandVars.size()) { - mRandVarToIdx.put(rv, new Integer(mCurIndex)); + mRandVarToIdx.put(rv, Integer.valueOf(mCurIndex)); ++mCurIndex; } } @@ -228,7 +228,7 @@ private void resetIndices() while (iter.hasNext()) { RandomVariable rv = (RandomVariable) iter.next(); - mRandVarToIdx.put(rv, new Integer(newIdx)); + mRandVarToIdx.put(rv, Integer.valueOf(newIdx)); ++newIdx; } } diff --git a/java/randsolver/src/org/sf/javabdd/BDD.java b/java/randsolver/src/org/sf/javabdd/BDD.java index 2394216..1d60110 100644 --- a/java/randsolver/src/org/sf/javabdd/BDD.java +++ b/java/randsolver/src/org/sf/javabdd/BDD.java @@ -968,8 +968,8 @@ else if (this == getFactory().zero()) visited[0] = true; visited[1] = true; HashMap map = new HashMap(); - map.put(getFactory().zero(), new Integer(0)); - map.put(getFactory().one(), new Integer(1)); + map.put(getFactory().zero(), Integer.valueOf(0)); + map.put(getFactory().one(), Integer.valueOf(1)); printdot_rec(out, 1, visited, map); out.println("}"); @@ -984,7 +984,7 @@ int printdot_rec( Integer ri = ((Integer) map.get(this)); if (ri == null) { - map.put(this, ri = new Integer(++current)); + map.put(this, ri = Integer.valueOf(++current)); } int r = ri.intValue(); if (visited[r]) return current; @@ -998,13 +998,13 @@ int printdot_rec( Integer li = ((Integer) map.get(l)); if (li == null) { - map.put(l, li = new Integer(++current)); + map.put(l, li = Integer.valueOf(++current)); } int low = li.intValue(); Integer hi = ((Integer) map.get(h)); if (hi == null) { - map.put(h, hi = new Integer(++current)); + map.put(h, hi = Integer.valueOf(++current)); } int high = hi.intValue(); diff --git a/java/randsolver/src/org/sf/javabdd/BDDFactory.java b/java/randsolver/src/org/sf/javabdd/BDDFactory.java index 1fda384..92e0b30 100644 --- a/java/randsolver/src/org/sf/javabdd/BDDFactory.java +++ b/java/randsolver/src/org/sf/javabdd/BDDFactory.java @@ -84,7 +84,7 @@ public static BDDFactory init(String bddpackage, int nodenum, int cachesize) // if (bddpackage.equals("typed")) // return TypedBDDFactory.init(nodenum, cachesize); } - catch (LinkageError _) + catch (LinkageError ex) { System.out.println("Could not load BDD package " + bddpackage); } @@ -94,18 +94,18 @@ public static BDDFactory init(String bddpackage, int nodenum, int cachesize) Method m = c .getMethod("init", new Class[] { int.class, int.class }); return (BDDFactory) m.invoke(null, new Object[] { - new Integer(nodenum), new Integer(cachesize) }); + Integer.valueOf(nodenum), Integer.valueOf(cachesize) }); } - catch (ClassNotFoundException _) + catch (ClassNotFoundException ex) { } - catch (NoSuchMethodException _) + catch (NoSuchMethodException ex) { } - catch (IllegalAccessException _) + catch (IllegalAccessException ex) { } - catch (InvocationTargetException _) + catch (InvocationTargetException ex) { } // falling back to default java implementation. diff --git a/java/randsolver/test/com/newisys/randsolver/TestAnnotation.java b/java/randsolver/test/com/newisys/randsolver/TestAnnotation.java index 5bcc1e2..a2ac3fc 100644 --- a/java/randsolver/test/com/newisys/randsolver/TestAnnotation.java +++ b/java/randsolver/test/com/newisys/randsolver/TestAnnotation.java @@ -280,7 +280,7 @@ public void testXZStateVar() // good. X/Z state vars are not allowed. } - o.j = new Integer(7); + o.j = Integer.valueOf(7); Solver.randomize(o, prng); assertEquals(7, o.j.intValue()); } From f7cb505d23e5fabfed41be25bb4521cf90bebfa8 Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 9 Jan 2022 10:59:51 -0500 Subject: [PATCH 06/12] Why modernize in README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index d8e52ce..bf4b563 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,13 @@ Most of Jove is written in the Java 5.0 language, and should therefore work on a | Microsoft Windows XP + Cygwin 1.5.18-1 | Intel x86 | GPL Cver | | Apple Mac OS X 10.4.2 + J2SE 5.0 Release 1 | PowerPC | GPL Cver | + +Modernization +---- + +An attempt is being made to upgrade Jove to build with Gradle on Java 17. It might be interesting to write a scheduler using Java Loom. + + What Verilog simulators does Jove support? ---- From 46b6d2e45e33f88983fc9baa5b8af6cc2f5b4c92 Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 9 Jan 2022 13:16:55 -0500 Subject: [PATCH 07/12] Compile without VCS --- native/comp/pli4j/src/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/comp/pli4j/src/Configuration.h b/native/comp/pli4j/src/Configuration.h index ab86df5..7e28b73 100644 --- a/native/comp/pli4j/src/Configuration.h +++ b/native/comp/pli4j/src/Configuration.h @@ -29,7 +29,7 @@ //#define JVM_DEBUG //#define OVA_DEBUG -#define SIMULATOR_VCS +//#define SIMULATOR_VCS #ifdef SIMULATOR_VCS #define NO_VPI_CONTROL From 303d93fc1982f12dcb4c2b0727d1829fcda909dc Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 9 Jan 2022 13:17:35 -0500 Subject: [PATCH 08/12] Fix native compiler errors --- native/comp/jnicpp/include/jnicpp.inl | 16 ++++++++++++---- native/comp/jnicpp/src/jnicpp.cpp | 6 +++--- native/comp/vpicpp/include/vpicpp.inl | 4 ++-- native/comp/vpicpp/src/vpicpp.cpp | 4 ++-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/native/comp/jnicpp/include/jnicpp.inl b/native/comp/jnicpp/include/jnicpp.inl index 2b3e2b0..5d9a6f2 100644 --- a/native/comp/jnicpp/include/jnicpp.inl +++ b/native/comp/jnicpp/include/jnicpp.inl @@ -18,6 +18,7 @@ #include #include +#include #ifdef JNICPP_DEBUG_REF #include @@ -27,9 +28,9 @@ namespace jnicpp { ////////////////////////////////////////////////////////////////////// -void checkException(JNIEnv* penv) throw(JException); -void convertException(JNIEnv* penv, const std::string& msg) throw(JException); -const char* getJNIResultMessage(jint result) throw(); +void checkException(JNIEnv* penv); // throw(JException); +void convertException(JNIEnv* penv, const std::string& msg); //throw(JException); +const char* getJNIResultMessage(jint result); //throw(); ////////////////////////////////////////////////////////////////////// @@ -908,7 +909,14 @@ inline char* JString::convertToCharArray(JNIEnv* penv, jstring obj) if (chars == NULL) { convertException(penv, "Unable to access string characters"); } - char* result = strdup(chars); + //char* result = strdup(chars); + char* result; //= strdup(chars); + char *dst = (char *)malloc(strlen (chars) + 1); + if (dst == NULL) { + result = NULL; + } else { + strcpy(result, chars); + } penv->ReleaseStringUTFChars(obj, chars); return result; } diff --git a/native/comp/jnicpp/src/jnicpp.cpp b/native/comp/jnicpp/src/jnicpp.cpp index 595b549..d095ea5 100644 --- a/native/comp/jnicpp/src/jnicpp.cpp +++ b/native/comp/jnicpp/src/jnicpp.cpp @@ -28,7 +28,7 @@ namespace jnicpp { ////////////////////////////////////////////////////////////////////// -void checkException(JNIEnv* penv) throw(JException) +void checkException(JNIEnv* penv) //throw(JException) { jthrowable obj = penv->ExceptionOccurred(); if (obj != NULL) { @@ -37,7 +37,7 @@ void checkException(JNIEnv* penv) throw(JException) } } -void convertException(JNIEnv* penv, const std::string& msg) throw(JException) +void convertException(JNIEnv* penv, const std::string& msg) //throw(JException) { jthrowable obj = penv->ExceptionOccurred(); if (obj != NULL) { @@ -48,7 +48,7 @@ void convertException(JNIEnv* penv, const std::string& msg) throw(JException) } } -const char* getJNIResultMessage(jint result) throw() +const char* getJNIResultMessage(jint result) //throw() { switch (result) { case JNI_OK: diff --git a/native/comp/vpicpp/include/vpicpp.inl b/native/comp/vpicpp/include/vpicpp.inl index d898f9d..cfc9e1a 100644 --- a/native/comp/vpicpp/include/vpicpp.inl +++ b/native/comp/vpicpp/include/vpicpp.inl @@ -47,8 +47,8 @@ inline std::string getStringValue(vpiHandle obj) ////////////////////////////////////////////////////////////////////// -void checkException() throw(VPIException); -void convertException(const std::string& msg) throw(VPIException); +void checkException(); // throw(VPIException); +void convertException(const std::string& msg); // throw(VPIException); ////////////////////////////////////////////////////////////////////// diff --git a/native/comp/vpicpp/src/vpicpp.cpp b/native/comp/vpicpp/src/vpicpp.cpp index e605413..421dad1 100644 --- a/native/comp/vpicpp/src/vpicpp.cpp +++ b/native/comp/vpicpp/src/vpicpp.cpp @@ -39,7 +39,7 @@ vpiHandle getHandle(int type, vpiHandle refHandle) ////////////////////////////////////////////////////////////////////// -void checkException() throw(VPIException) +void checkException() // throw(VPIException) { s_vpi_error_info info; if (vpi_chk_error(&info)) { @@ -91,7 +91,7 @@ void checkException() throw(VPIException) } } -void convertException(const std::string& msg) throw(VPIException) +void convertException(const std::string& msg) //throw(VPIException) { checkException(); throw VPIException(msg); From a8c7afd80b769d138476dff7b608d8aa386eca5d Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 9 Jan 2022 13:48:49 -0500 Subject: [PATCH 09/12] Fix compiler warning about char const * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit warning: ISO C++ forbids converting a string constant to ‘PLI_BYTE8*’ {aka ‘char*’} --- native/comp/vpicpp/include/veriuser.h | 2 +- native/comp/vpicpp/include/vpi_user.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/native/comp/vpicpp/include/veriuser.h b/native/comp/vpicpp/include/veriuser.h index 0348e9b..694fe82 100644 --- a/native/comp/vpicpp/include/veriuser.h +++ b/native/comp/vpicpp/include/veriuser.h @@ -267,7 +267,7 @@ EXTERN int tf_copypvc_flag PROTO_PARAMS((int nparam)); EXTERN void tf_divide_long PROTO_PARAMS((int *aof_low1, int *aof_high1, int low2, int high2)); EXTERN int tf_dofinish PROTO_PARAMS((void)); EXTERN int tf_dostop PROTO_PARAMS((void)); -EXTERN int tf_error PROTO_PARAMS((char *fmt, ...)); +EXTERN int tf_error PROTO_PARAMS((char const *fmt, ...)); EXTERN int tf_evaluatep PROTO_PARAMS((int pnum)); EXTERN p_tfexprinfo tf_exprinfo PROTO_PARAMS((int pnum, p_tfexprinfo pinfo)); EXTERN char *tf_getcstringp PROTO_PARAMS((int nparam)); diff --git a/native/comp/vpicpp/include/vpi_user.h b/native/comp/vpicpp/include/vpi_user.h index 5469413..1a49e66 100644 --- a/native/comp/vpicpp/include/vpi_user.h +++ b/native/comp/vpicpp/include/vpi_user.h @@ -626,7 +626,7 @@ typedef struct t_vpi_systf_data PLI_INT32 type; /* vpiSysTask, vpiSysFunc */ PLI_INT32 sysfunctype; /* vpiSysTask, vpi[Int,Real,Time,Sized, SizedSigned]Func */ - PLI_BYTE8 *tfname; /* first character must be `$' */ + PLI_BYTE8 const *tfname; /* first character must be `$' */ PLI_INT32 (*calltf)(PLI_BYTE8 *); PLI_INT32 (*compiletf)(PLI_BYTE8 *); PLI_INT32 (*sizetf)(PLI_BYTE8 *); /* for sized function @@ -788,7 +788,7 @@ XXTERN PLI_BYTE8 *vpi_mcd_name PROTO_PARAMS((PLI_UINT32 cd)); XXTERN PLI_INT32 vpi_mcd_printf PROTO_PARAMS((PLI_UINT32 mcd, PLI_BYTE8 *format, ...)); -XXTERN PLI_INT32 vpi_printf PROTO_PARAMS((PLI_BYTE8 *format, +XXTERN PLI_INT32 vpi_printf PROTO_PARAMS((PLI_BYTE8 const *format, ...)); /* utility routines */ From c7536cdaeb9c1d0ae8b65553f7947ff4a0ebe6b5 Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 9 Jan 2022 13:49:31 -0500 Subject: [PATCH 10/12] Block obj from entering git --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 7f6823b..c54e387 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .gradle build/ +**/obj + From 51037d530cc65947c04d6f6866269683517b7e07 Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 9 Jan 2022 14:16:25 -0500 Subject: [PATCH 11/12] Add string.h to jvmlibpaths.c --- native/comp/jvmlibpaths/src/jvmlibpaths.c | 1 + 1 file changed, 1 insertion(+) diff --git a/native/comp/jvmlibpaths/src/jvmlibpaths.c b/native/comp/jvmlibpaths/src/jvmlibpaths.c index 2d30550..972465e 100644 --- a/native/comp/jvmlibpaths/src/jvmlibpaths.c +++ b/native/comp/jvmlibpaths/src/jvmlibpaths.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "jvminvoke.h" From 1a0d2bca2ce18711faba3eede81a35bbcecf22fd Mon Sep 17 00:00:00 2001 From: Martin d'Anjou Date: Sun, 9 Jan 2022 15:35:53 -0500 Subject: [PATCH 12/12] Add ifgen and sample --- java/jove-ifgen/build.gradle | 43 ++++++++++++++++++++++++++++++++++ java/jove-samples/build.gradle | 32 +++++++++++++++++++++++++ java/settings.gradle | 2 ++ 3 files changed, 77 insertions(+) create mode 100644 java/jove-ifgen/build.gradle create mode 100644 java/jove-samples/build.gradle diff --git a/java/jove-ifgen/build.gradle b/java/jove-ifgen/build.gradle new file mode 100644 index 0000000..77c5377 --- /dev/null +++ b/java/jove-ifgen/build.gradle @@ -0,0 +1,43 @@ +plugins { + id 'application' + id 'com.intershop.gradle.javacc' version '4.0.1' +} + +javacc { + // configuration container for all javacc configurations + configs { + template { + inputFile = file('src/com/newisys/dv/ifgen/parser/IfgenParser.jj') + packageName = 'com.newisys.dv.ifgen.parser' + lookahead = '2' + } + } +} +repositories { + mavenCentral() +} +sourceSets { + main { + java { + srcDirs = ['src'] + } + } + test { + java { + srcDirs = ['test'] + } + } +} +dependencies { + implementation project(":newisys-utils") + implementation project(":langschema") + implementation project(":langschema-java") + implementation project(":langschema-jove") + implementation project(":jove") + implementation 'org.apache.ant:ant:1.10.12' + testImplementation "junit:junit:4.12" +} + +application { + mainClass = 'com.newisys.dv.ifgen.IfgenMain' +} diff --git a/java/jove-samples/build.gradle b/java/jove-samples/build.gradle new file mode 100644 index 0000000..d1c7047 --- /dev/null +++ b/java/jove-samples/build.gradle @@ -0,0 +1,32 @@ +plugins { + id 'java-library' +} + +sourceSets { + main { + java { + srcDirs = ['src'] + } + } + test { + java { + srcDirs = ['test'] + } + } +} + +dependencies { + implementation project(":langschema") + implementation project(":langschema-java") + implementation project(":langschema-jove") + implementation project(":jove-ifgen") + implementation project(":randsolver") + implementation project(":jove") + implementation project(":newisys-utils") +} + +task createIfs(type: JavaExec) { + classpath = project(":jove-ifgen").sourceSets.main.runtimeClasspath + mainClass = 'com.newisys.dv.ifgen.IfgenMain' + args '-file', './src/com/newisys/samples/and3/and3.if' +} diff --git a/java/settings.gradle b/java/settings.gradle index 097481a..8205f0b 100644 --- a/java/settings.gradle +++ b/java/settings.gradle @@ -1,7 +1,9 @@ rootProject.name = "jove-root" include "newisys-utils" include "jove" +include "jove-ifgen" include "langschema" include "langschema-java" include "langschema-jove" +include "jove-samples" include "randsolver"