Skip to content

Commit

Permalink
Merge branch 'release/2.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
eyck committed Jun 19, 2022
2 parents 97cc2fa + 64e2385 commit 1e8dbc2
Show file tree
Hide file tree
Showing 20 changed files with 151 additions and 112 deletions.
2 changes: 1 addition & 1 deletion com.minres.coredsl.feature/feature.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature id="com.minres.coredsl.feature"
label="CoreDsl Feature "
version="2.0.3.qualifier">
version="2.0.4">
<plugin
id="com.minres.coredsl"
download-size="0"
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.coredsl</groupId>
<artifactId>com.minres.coredsl.parent</artifactId>
<version>2.0.3-SNAPSHOT</version>
<version>2.0.4</version>
</parent>
<artifactId>com.minres.coredsl.feature</artifactId>
<packaging>eclipse-feature</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl.ide/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: com.minres.coredsl.ide
Bundle-ManifestVersion: 2
Bundle-Name: com.minres.coredsl.ide
Bundle-Vendor: MINRES Technologies GmbH
Bundle-Version: 2.0.3.qualifier
Bundle-Version: 2.0.4
Bundle-SymbolicName: com.minres.coredsl.ide; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: com.minres.coredsl,
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl.ide/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.coredsl</groupId>
<artifactId>com.minres.coredsl.parent</artifactId>
<version>2.0.3-SNAPSHOT</version>
<version>2.0.4</version>
</parent>
<artifactId>com.minres.coredsl.ide</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl.repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.coredsl</groupId>
<artifactId>com.minres.coredsl.parent</artifactId>
<version>2.0.3-SNAPSHOT</version>
<version>2.0.4</version>
</parent>
<artifactId>com.minres.coredsl.repository</artifactId>
<packaging>eclipse-repository</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl.target/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.coredsl</groupId>
<artifactId>com.minres.coredsl.parent</artifactId>
<version>2.0.3-SNAPSHOT</version>
<version>2.0.4</version>
</parent>
<artifactId>com.minres.coredsl.target</artifactId>
<packaging>eclipse-target-definition</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl.ui.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: com.minres.coredsl.ui.tests
Bundle-ManifestVersion: 2
Bundle-Name: com.minres.coredsl.ui.tests
Bundle-Vendor: MINRES Technologies GmbH
Bundle-Version: 2.0.3.qualifier
Bundle-Version: 2.0.4
Bundle-SymbolicName: com.minres.coredsl.ui.tests; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: com.minres.coredsl.ui,
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl.ui.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.coredsl</groupId>
<artifactId>com.minres.coredsl.parent</artifactId>
<version>2.0.3-SNAPSHOT</version>
<version>2.0.4</version>
</parent>
<artifactId>com.minres.coredsl.ui.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: com.minres.coredsl.ui
Bundle-ManifestVersion: 2
Bundle-Name: com.minres.coredsl.ui
Bundle-Vendor: MINRES Technologies GmbH
Bundle-Version: 2.0.3.qualifier
Bundle-Version: 2.0.4
Bundle-SymbolicName: com.minres.coredsl.ui; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: com.minres.coredsl,
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.coredsl</groupId>
<artifactId>com.minres.coredsl.parent</artifactId>
<version>2.0.3-SNAPSHOT</version>
<version>2.0.4</version>
</parent>
<artifactId>com.minres.coredsl.ui</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,75 +24,78 @@ import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider
*/
class XtCoreDslLabelProvider extends CoreDslLabelProvider {

@Inject
new(AdapterFactoryLabelProvider delegate) {
super(delegate);
}

def text(CoreDef core) {
'Core ' + core.name
@Inject
new(AdapterFactoryLabelProvider delegate) {
super(delegate);
}

def text(InstructionSet isa) {
'ISA ' + isa.name
def text(CoreDef core) {
'Core ' + core.name
}

def text(Declaration decl) {
decl.declarators.map[it.name].join(', ')
def text(InstructionSet isa) {
'ISA ' + isa.name
}

def text(Instruction ele) {
ele.name
def text(Declaration decl) {
decl.declarators.map[it.name].join(', ')
}

def text(FunctionDefinition ele) {
ele.name
def text(Instruction ele) {
if (ele.attributes.size > 0)
return '''«ele.name» [«FOR attr : ele.attributes SEPARATOR ', '»«attr.type»«ENDFOR»]'''
else
ele.name
}

def text(Encoding ele) {
'encoding: ' + ele.fields.map[it.toText].join('::')
def text(FunctionDefinition ele) {
ele.name
}

def text(EObject ele){
def text(Encoding ele) {
'encoding: ' + ele.fields.map[it.toText].join('::')
}

def text(EObject ele) {
ele.eClass.name
}
private def dispatch String getToText(BitField field){
if(field.startIndex !== null && field.endIndex!== null)

private def dispatch String getToText(BitField field) {
if (field.startIndex !== null && field.endIndex !== null)
field.name + "[" + field.startIndex.value.intValue + ":" + field.endIndex.value.intValue + "]"
else
field.name
}
private def dispatch String getToText(BitValue value){
value.value.toString(2)
}
def image(CoreDef e){
'application.png'
}

def image(InstructionSet e){
'package.png'
}
def image(Instruction e){
'brick.png'
}
def image(Statement e){
'script.png'
}
def image(Encoding e){
'pill.png'
}

def image(EObject e){
'brick.png'
}

def image(EList<?> e){
'folder_brick.png'
}
else
field.name
}

private def dispatch String getToText(BitValue value) {
value.value.toString(2)
}

def image(CoreDef e) {
'application.png'
}

def image(InstructionSet e) {
'package.png'
}

def image(Instruction e) {
'brick.png'
}

def image(Statement e) {
'script.png'
}

def image(Encoding e) {
'pill.png'
}

def image(EObject e) {
'brick.png'
}

def image(EList<?> e) {
'folder_brick.png'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class XtCoreDslOutlineTreeProvider extends CoreDslOutlineTreeProvider {
image, "Instructions", false)
}

def void _createChildren(IOutlineNode parentNode, Instruction stmt) {
createNode(parentNode, stmt.encoding)
createNode(parentNode, stmt.behavior)
def void _createChildren(IOutlineNode parentNode, Instruction instr) {
createNode(parentNode, instr.encoding)
createNode(parentNode, instr.behavior)
}

def boolean _isLeaf(NamedEntity variable) {
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: com.minres.coredsl
Bundle-ManifestVersion: 2
Bundle-Name: com.minres.coredsl
Bundle-Vendor: MINRES Technologies GmbH
Bundle-Version: 2.0.3.qualifier
Bundle-Version: 2.0.4
Bundle-SymbolicName: com.minres.coredsl; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext,
Expand Down
2 changes: 1 addition & 1 deletion com.minres.coredsl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.coredsl</groupId>
<artifactId>com.minres.coredsl.parent</artifactId>
<version>2.0.3-SNAPSHOT</version>
<version>2.0.4</version>
</parent>
<artifactId>com.minres.coredsl</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
13 changes: 8 additions & 5 deletions com.minres.coredsl/src/com/minres/coredsl/CoreDsl.xtext
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ fragment ISA:
('instructions' commonInstructionAttributes+=Attribute* '{' instructions+=Instruction+ '}')?;

FunctionDefinition:
extern?='extern'?
returnType=TypeSpecifier name=ID
'(' (parameters+=ParameterDeclaration (',' parameters+=ParameterDeclaration)*)? ')'
attributes+=Attribute*
body=CompoundStatement;
extern?='extern'
returnType=TypeSpecifier name=ID
'(' (parameters+=ParameterDeclaration (',' parameters+=ParameterDeclaration)*)? ')'
attributes+=Attribute* ';'
|
returnType=TypeSpecifier name=ID
'(' (parameters+=ParameterDeclaration (',' parameters+=ParameterDeclaration)*)? ')'
attributes+=Attribute* body=CompoundStatement;

Instruction:
name=ID attributes+=Attribute* '{'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,26 @@ import com.minres.coredsl.coreDsl.EntityReference

class CoreDSLInterpreter {

/* TODO:
*
*
*/
def static Value evaluate(Declarator decl, EvaluationContext ctx) {
if (decl.initializer !== null) {
val context = ctx.definitionContext
if (context === null) {
if (decl.initializer instanceof ExpressionInitializer)
return (decl.initializer as ExpressionInitializer).value.valueFor(ctx)
else
return null
}
val stmts = context.allDefinitions.toList
val assignments = stmts
.filter[it instanceof ExpressionStatement]
.map[(it as ExpressionStatement).expression]
.filter[it instanceof AssignmentExpression]
.map[it as AssignmentExpression];
val declAssignment = assignments.filter[
it.target instanceof EntityReference && (it.target as EntityReference).target == decl
].last
if (declAssignment === null) {
if (decl.initializer instanceof ExpressionInitializer)
return (decl.initializer as ExpressionInitializer).value.valueFor(ctx)
else
return null
} else
(declAssignment as AssignmentExpression).value.valueFor(ctx)
} else
null
val context = ctx.definitionContext
if (context === null) {
if (decl.initializer instanceof ExpressionInitializer)
return (decl.initializer as ExpressionInitializer).value.valueFor(ctx)
else
return null
}
val assignmentValues = context.allStateDeclarations
.flatMap[it.declaration.declarators]
.filter[it== decl && it.initializer !== null && it.initializer instanceof ExpressionInitializer]
.map[(it.initializer as ExpressionInitializer).value] +
context.allStateAssignments
.map[it.expression as AssignmentExpression]
.filter[
val x = it.target.primary.target
x === decl
]
.map[it.value]
assignmentValues.size > 0? assignmentValues.last.valueFor(ctx ): null
}

def static dispatch Value valueFor(TypeSpecifier e, EvaluationContext ctx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,20 @@ class TypeProvider {
var size=0
for(EncodingField f:list.fields)
switch(f){
BitField:{size += f.endIndex.value.intValue - f.startIndex.value.intValue + 1}
BitField:{
val left = f.startIndex.value.intValue
val right = f.endIndex.value.intValue
size += (left>right?left-right:right-left) + 1
}
BitValue:{size += (f.value as BigIntegerWithRadix).size}
}
new DataType(DataType.Type.INTEGRAL_UNSIGNED, size)
}

def static dispatch DataType typeFor(BitField e, ISA ctx) {
new DataType(DataType.Type.INTEGRAL_UNSIGNED, e.endIndex.value.intValue - e.startIndex.value.intValue + 1)
val left = e.startIndex.value.intValue
val right = e.endIndex.value.intValue
new DataType(DataType.Type.INTEGRAL_UNSIGNED, (left>right?left-right:right-left) + 1)
}

def static dispatch DataType typeFor(BitValue e, ISA ctx) {
Expand Down
Loading

0 comments on commit 1e8dbc2

Please sign in to comment.