update target definition

This commit is contained in:
Eyck Jentzsch 2021-09-26 15:27:52 +02:00
parent 2f8940ddb1
commit 7f09cd6907
2 changed files with 30 additions and 5 deletions

View File

@ -48,9 +48,8 @@
<unit id="org.json" version="1.0.0.v201011060100"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://artifactory.minres.com/artifactory/eclipse/CoreDSL-2.0.1"/>
<unit id="com.minres.coredsl.feature.feature.group" version="2.0.1.202109251203"/>
<unit id="com.minres.coredsl.feature.source.feature.group" version="2.0.1.202109251203"/>
<repository location="https://artifactory.minres.com/artifactory/eclipse/CoreDSL/2.0"/>
<unit id="com.minres.coredsl.feature.feature.group" version="2.0.1.202109261307"/>
</location>
</locations>
</target>

View File

@ -20,6 +20,7 @@ import com.minres.coredsl.coreDsl.ISA
import org.json.JSONObject
import org.json.JSONArray
import com.minres.coredsl.util.BigIntegerWithRadix
import com.minres.coredsl.coreDsl.Statement
/**
* Generates code from your model files on save.
@ -27,7 +28,7 @@ import com.minres.coredsl.util.BigIntegerWithRadix
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation
*/
class CoreDslJsonGenerator extends AbstractGenerator {
val logger = Logger.getLogger(typeof(CoreDslJsonGenerator));
override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
@ -55,9 +56,34 @@ class CoreDslJsonGenerator extends AbstractGenerator {
ret.put("decoding", inst.encoding.fields.map[it.asString].join(' '))
ret.put("name", inst.name);
ret.put('disassembly', inst.disass !== null? inst.name.toLowerCase + ' ' + inst.disass.toLowerCase : inst.name)
ret.put('execution', inst.behavior.toString)
ret.put('execution', inst.behavior.source)
ret.put('restrictions', '')
}
def String getSource(Statement stmt){
// val c = CoreDslFactory.eINSTANCE.createDescriptionContent => [
// definitions += CoreDslFactory.eINSTANCE.createISA => [
// name = 'dummy'
// instructions += CoreDslFactory.eINSTANCE.createInstruction => [
// name = 'dummy'
// encoding = CoreDslFactory.eINSTANCE.createEncoding => [
// fields += CoreDslFactory.eINSTANCE.createBitField => [
// name = 'dummy'
// left = CoreDslFactory.eINSTANCE.createIntegerConstant => [ value= BigInteger.valueOf(32) ]
// right = CoreDslFactory.eINSTANCE.createIntegerConstant => [ value= BigInteger.ZERO ]
// ]
// ]
// behavior = stmt
// ]
// ]
// ]
// val rs = rsp.get
// val r = rs.createResource(URI.createURI("dummy.core_desc"))
// r.contents+=c
// c.serialize
stmt.toString
}
def Iterable<Instruction> allInstr(CoreDef core) {
val unique = newLinkedHashMap
val instrList = if (core.contributingType.size == 0)