updates target definition and fixes error/warning handling
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/.launch/
|
/.launch/
|
||||||
/.settings/
|
/.settings/
|
||||||
|
/RV32GC.json
|
||||||
|
@@ -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>
|
||||||
|
@@ -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){
|
||||||
(stmt.eResource as XtextResource).serializer.serialize(stmt)
|
try {
|
||||||
|
(stmt.eResource as XtextResource).serializer.serialize(stmt)
|
||||||
|
} catch(RuntimeException e){
|
||||||
|
""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def Iterable<Instruction> allInstr(CoreDef core) {
|
def Iterable<Instruction> allInstr(CoreDef core) {
|
||||||
|
@@ -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> {
|
||||||
|
|
||||||
@@ -83,10 +84,17 @@ class GeneratorMain {
|
|||||||
val resource = resourceSet.getResource(URI.createFileURI(file.absolutePath), true)
|
val resource = resourceSet.getResource(URI.createFileURI(file.absolutePath), true)
|
||||||
// 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) {
|
||||||
logger.error("Error validating " + resource.URI)
|
val errors = issues.filter[it.severity == Severity.ERROR]
|
||||||
issues.forEach[logger.error(it)]
|
val warnings = issues.filter[it.severity == Severity.WARNING]
|
||||||
throw new ParseException("error validating " + resource.URI)
|
if (!errors.empty) {
|
||||||
|
logger.error("Error validating " + resource.URI)
|
||||||
|
issues.forEach[logger.error(it)]
|
||||||
|
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)
|
||||||
|
Reference in New Issue
Block a user