diff --git a/com.minres.coredsl.json.target/com.minres.coredsl.json.target.target b/com.minres.coredsl.json.target/com.minres.coredsl.json.target.target index 2738eb1..9822ff1 100644 --- a/com.minres.coredsl.json.target/com.minres.coredsl.json.target.target +++ b/com.minres.coredsl.json.target/com.minres.coredsl.json.target.target @@ -48,9 +48,8 @@ - - - + + \ No newline at end of file diff --git a/com.minres.coredsl.json/src/com/minres/coredsl/json/CoreDslJsonGenerator.xtend b/com.minres.coredsl.json/src/com/minres/coredsl/json/CoreDslJsonGenerator.xtend index c17f0b7..ac1a095 100644 --- a/com.minres.coredsl.json/src/com/minres/coredsl/json/CoreDslJsonGenerator.xtend +++ b/com.minres.coredsl.json/src/com/minres/coredsl/json/CoreDslJsonGenerator.xtend @@ -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 allInstr(CoreDef core) { val unique = newLinkedHashMap val instrList = if (core.contributingType.size == 0)