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 9822ff1..e061352 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
@@ -39,17 +39,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/com.minres.coredsl.json.tests/src/com/minres/coredsl/json/tests/CoreDslGenerationTest.xtend b/com.minres.coredsl.json.tests/src/com/minres/coredsl/json/tests/CoreDslGenerationTest.xtend
index 65028ed..8a13312 100644
--- a/com.minres.coredsl.json.tests/src/com/minres/coredsl/json/tests/CoreDslGenerationTest.xtend
+++ b/com.minres.coredsl.json.tests/src/com/minres/coredsl/json/tests/CoreDslGenerationTest.xtend
@@ -31,47 +31,44 @@ class CoreDslGenerationTest{
val isa_rv32i = '''
Core RV32I {
- constants {
+ architectural_state {
unsigned int XLEN, FLEN;
unsigned CSR_SIZE = 4096;
unsigned REG_FILE_SIZE=32;
+ register unsigned PC [[is_pc]];
+ register unsigned X[REG_FILE_SIZE];
+ extern char MEM[1< [
cancelIndicator = CancelIndicator.NullImpl
])
- println(fsa.textFiles)
+ println(fsa.textFiles)
assertEquals(1,fsa.textFiles.size)
- assertTrue(fsa.textFiles.containsKey("DEFAULT_OUTPUTRV32I.txt"))
-// assertEquals(
-// '''
-// public class Alice {
-//
-// }
-// '''.toString, fsa.textFiles.get(IFileSystemAccess::DEFAULT_OUTPUT+"Alice.java").toString
-// )
+ assertTrue(fsa.textFiles.containsKey("DEFAULT_OUTPUTRV32I.json"))
}
}
diff --git a/com.minres.coredsl.json/META-INF/MANIFEST.MF b/com.minres.coredsl.json/META-INF/MANIFEST.MF
index a0a873d..60c1cc6 100644
--- a/com.minres.coredsl.json/META-INF/MANIFEST.MF
+++ b/com.minres.coredsl.json/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@ Bundle-Vendor: MINRES Technologies GmbH
Bundle-Version: 2.0.0.qualifier
Bundle-SymbolicName: com.minres.coredsl.json;singleton:=true
Bundle-ActivationPolicy: lazy
-Require-Bundle: com.minres.coredsl;bundle-version="1.0.0",
+Require-Bundle: com.minres.coredsl;bundle-version="2.0.0",
org.eclipse.equinox.common;bundle-version="3.5.0",
org.eclipse.emf.ecore,
org.eclipse.emf.common,
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 ac1a095..ffefd19 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
@@ -15,12 +15,12 @@ import com.minres.coredsl.coreDsl.Encoding
import com.minres.coredsl.coreDsl.BitField
import com.minres.coredsl.coreDsl.BitValue
import java.util.List
-import com.minres.coredsl.coreDsl.AttributeName
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
+import org.eclipse.xtext.resource.XtextResource
/**
* Generates code from your model files on save.
@@ -35,14 +35,14 @@ class CoreDslJsonGenerator extends AbstractGenerator {
for (e : resource.allContents.toIterable.filter(CoreDef)) {
val root = new JSONObject()
root.put('instructions', e.compile)
- fsa.generateFile(e.name + ".json", root.toString)
+ fsa.generateFile(e.name + ".json", root.toString(2))
}
}
def Boolean isHls(Instruction inst){
val instrSet = inst.eContainer as ISA;
- !(inst.attributes.filter[it.type==AttributeName.HLS].isEmpty &&
- instrSet.attributes.filter[it.type==AttributeName.HLS].isEmpty)
+ !(inst.attributes.filter[it.type=='hls'].isEmpty &&
+ instrSet.commonInstructionAttributes.filter[it.type=='hls'].isEmpty)
}
def JSONArray compile(CoreDef coreDef) {
val insts = coreDef.allInstr
@@ -53,35 +53,15 @@ class CoreDslJsonGenerator extends AbstractGenerator {
def JSONObject jsonDescr(Instruction inst){
val ret = new JSONObject();
- ret.put("decoding", inst.encoding.fields.map[it.asString].join(' '))
+ 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('disassembly', inst.assembly !== null? inst.name.toLowerCase + ' ' + inst.assembly.toLowerCase : inst.name)
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
+ (stmt.eResource as XtextResource).serializer.serialize(stmt)
}
def Iterable allInstr(CoreDef core) {