updates target definition and fixes error/warning handling

This commit is contained in:
2025-09-18 15:50:28 +02:00
parent 0a3389e6e8
commit 6ee86b26db
4 changed files with 20 additions and 7 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/.launch/ /.launch/
/.settings/ /.settings/
/RV32GC.json

View File

@@ -39,7 +39,7 @@
<unit id="org.json" version="1.0.0.v201011060100"/> <unit id="org.json" version="1.0.0.v201011060100"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit"> <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://minres.github.io/CoreDSL/repository/2.0/2.0.14"/> <repository location="https://minres.github.io/CoreDSL/repository/2.0/2.0.17"/>
<unit id="com.minres.coredsl.feature.source.feature.group" version="0.0.0"/> <unit id="com.minres.coredsl.feature.source.feature.group" version="0.0.0"/>
<unit id="com.minres.coredsl.feature.feature.group" version="0.0.0"/> <unit id="com.minres.coredsl.feature.feature.group" version="0.0.0"/>
</location> </location>

View File

@@ -45,7 +45,7 @@ class CoreDslJsonGenerator extends AbstractGenerator {
} }
def JSONArray compile(CoreDef coreDef) { def JSONArray compile(CoreDef coreDef) {
val insts = coreDef.allInstr val insts = coreDef.allInstr
val enabled_insts = insts.filter[it.isHls] val enabled_insts = insts//.filter[it.isHls]
val res = enabled_insts.map[ inst | inst.jsonDescr ].toList val res = enabled_insts.map[ inst | inst.jsonDescr ].toList
return res.length>0?new JSONArray(res) :new JSONArray() return res.length>0?new JSONArray(res) :new JSONArray()
} }
@@ -60,7 +60,11 @@ class CoreDslJsonGenerator extends AbstractGenerator {
} }
def String getSource(Statement stmt){ def String getSource(Statement stmt){
try {
(stmt.eResource as XtextResource).serializer.serialize(stmt) (stmt.eResource as XtextResource).serializer.serialize(stmt)
} catch(RuntimeException e){
""
}
} }
def Iterable<Instruction> allInstr(CoreDef core) { def Iterable<Instruction> allInstr(CoreDef core) {

View File

@@ -28,6 +28,7 @@ import org.eclipse.xtext.generator.IFileSystemAccess
import java.lang.reflect.MalformedParametersException import java.lang.reflect.MalformedParametersException
import org.apache.log4j.Level import org.apache.log4j.Level
import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.xtext.diagnostics.Severity
class Main implements Callable<Integer> { class Main implements Callable<Integer> {
@@ -84,9 +85,16 @@ class GeneratorMain {
// Validate the resource // Validate the resource
val issues = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl) val issues = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl)
if (!issues.empty) { if (!issues.empty) {
val errors = issues.filter[it.severity == Severity.ERROR]
val warnings = issues.filter[it.severity == Severity.WARNING]
if (!errors.empty) {
logger.error("Error validating " + resource.URI) logger.error("Error validating " + resource.URI)
issues.forEach[logger.error(it)] issues.forEach[logger.error(it)]
throw new ParseException("error validating " + resource.URI) throw new ParseException("error validating " + resource.URI)
} else if (!warnings.empty) {
logger.warn("There are warnings validating " + resource.URI)
issues.forEach[logger.warn(it)]
}
} }
// Configure and start the generator // Configure and start the generator
resource.runGenerator(params.outputFile) resource.runGenerator(params.outputFile)