mirror of
https://github.com/Minres/RDL-Editor.git
synced 2025-01-02 11:07:50 +01:00
Fixed size calculation and error generating std::array of plain
datatypes
This commit is contained in:
parent
f950322d05
commit
0e526f811a
@ -3,7 +3,6 @@ package com.minres.rdl.generator
|
|||||||
import com.minres.rdl.generator.RdlBaseGenerator
|
import com.minres.rdl.generator.RdlBaseGenerator
|
||||||
import com.minres.rdl.rdl.ComponentDefinition
|
import com.minres.rdl.rdl.ComponentDefinition
|
||||||
import com.minres.rdl.IntegerWithRadix
|
import com.minres.rdl.IntegerWithRadix
|
||||||
import com.minres.rdl.rdl.Instantiation
|
|
||||||
import com.minres.rdl.rdl.ComponentDefinitionType
|
import com.minres.rdl.rdl.ComponentDefinitionType
|
||||||
|
|
||||||
class AddrmapGenerator extends RdlBaseGenerator {
|
class AddrmapGenerator extends RdlBaseGenerator {
|
||||||
@ -21,7 +20,7 @@ class AddrmapGenerator extends RdlBaseGenerator {
|
|||||||
const std::array<sysc::target_memory_map_entry<32>, «componentDefinition.instanceCount(ComponentDefinitionType.REGFILE)»> e300_plat_map = {{
|
const std::array<sysc::target_memory_map_entry<32>, «componentDefinition.instanceCount(ComponentDefinitionType.REGFILE)»> e300_plat_map = {{
|
||||||
«FOR instantiation : componentDefinition.instantiationsOfType(ComponentDefinitionType.REGFILE)»
|
«FOR instantiation : componentDefinition.instantiationsOfType(ComponentDefinitionType.REGFILE)»
|
||||||
«FOR instance : instantiation.componentInstances»
|
«FOR instance : instantiation.componentInstances»
|
||||||
{&i_«instance.name», 0x«Long.toHexString((instance.address as IntegerWithRadix).value)», 0x«Long.toHexString(instantiation.occupiedSize)»},
|
{&i_«instance.name», 0x«Long.toHexString((instance.address as IntegerWithRadix).value)», 0x«Long.toHexString(instantiation.byteSize)»},
|
||||||
«ENDFOR»
|
«ENDFOR»
|
||||||
«ENDFOR»
|
«ENDFOR»
|
||||||
}};
|
}};
|
||||||
@ -34,16 +33,5 @@ class AddrmapGenerator extends RdlBaseGenerator {
|
|||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
||||||
def int instanceCount(ComponentDefinition definition, ComponentDefinitionType type){
|
|
||||||
definition.instantiationsOfType(type).map[it.componentInstances.size].reduce[p1, p2| p1+p2]
|
|
||||||
}
|
|
||||||
|
|
||||||
def instantiationsOfType(ComponentDefinition definition, ComponentDefinitionType type){
|
|
||||||
definition.instantiations.filter[it.definingComponent.type == type]
|
|
||||||
}
|
|
||||||
|
|
||||||
def long occupiedSize(Instantiation instantiation){
|
|
||||||
return 4096
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -13,7 +13,8 @@ import com.minres.rdl.rdl.InstancePropertyRef
|
|||||||
import com.minres.rdl.rdl.ComponentDefinitionType
|
import com.minres.rdl.rdl.ComponentDefinitionType
|
||||||
|
|
||||||
abstract class RdlBaseGenerator {
|
abstract class RdlBaseGenerator {
|
||||||
def long accessWidth(ComponentDefinition definition){
|
|
||||||
|
def long accessWidth(ComponentDefinition definition){
|
||||||
var size = 32L
|
var size = 32L
|
||||||
val pa = definition.propertyAssignments.findFirst[PropertyAssignment pa |
|
val pa = definition.propertyAssignments.findFirst[PropertyAssignment pa |
|
||||||
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.ACCESSWIDTH
|
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.ACCESSWIDTH
|
||||||
@ -24,7 +25,19 @@ abstract class RdlBaseGenerator {
|
|||||||
}
|
}
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def long regWidth(ComponentDefinition definition){
|
||||||
|
var size = 32L
|
||||||
|
val pa = definition.propertyAssignments.findFirst[PropertyAssignment pa |
|
||||||
|
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.REGWIDTH
|
||||||
|
]
|
||||||
|
if(pa !== null){
|
||||||
|
val sz = new IntegerWithRadix((pa as ExplicitPropertyAssignment).rhs.effectiveValue)
|
||||||
|
size=sz.value
|
||||||
|
}
|
||||||
|
return size
|
||||||
|
}
|
||||||
|
|
||||||
def long getSize(Instantiation instantiation){
|
def long getSize(Instantiation instantiation){
|
||||||
val componentDef= instantiation.definingComponent
|
val componentDef= instantiation.definingComponent
|
||||||
switch (componentDef.type) {
|
switch (componentDef.type) {
|
||||||
@ -87,13 +100,51 @@ abstract class RdlBaseGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def String effectiveValue(InstancePropertyRef ref){
|
def String effectiveValue(InstancePropertyRef ref){
|
||||||
|
throw new RuntimeException()
|
||||||
}
|
}
|
||||||
|
|
||||||
def ComponentDefinition definingComponent(Instantiation instantiation){
|
def ComponentDefinition definingComponent(Instantiation instantiation){
|
||||||
if(instantiation.componentRef!==null) instantiation.componentRef else instantiation.component
|
if(instantiation.componentRef!==null) instantiation.componentRef else instantiation.component
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def int instanceCount(ComponentDefinition definition, ComponentDefinitionType type){
|
||||||
|
definition.instantiationsOfType(type).map[it.componentInstances.size].reduce[p1, p2| p1+p2]
|
||||||
|
}
|
||||||
|
|
||||||
|
def instantiationsOfType(ComponentDefinition definition, ComponentDefinitionType type){
|
||||||
|
definition.instantiations.filter[it.definingComponent.type == type]
|
||||||
|
}
|
||||||
|
|
||||||
|
def long byteSize(Instantiation instantiation, long start){
|
||||||
|
val componentDefinition = instantiation.definingComponent
|
||||||
|
var long componentSize=0;
|
||||||
|
if(instantiation.definingComponent.type == ComponentDefinitionType.REG){
|
||||||
|
componentSize=instantiation.definingComponent.regWidth/8
|
||||||
|
} else
|
||||||
|
for(subInstantiation: componentDefinition.instantiations)
|
||||||
|
componentSize = subInstantiation.byteSize(componentSize)
|
||||||
|
|
||||||
|
var long lastTopAddress = start
|
||||||
|
var long topAddress=start
|
||||||
|
for(componentInstance: instantiation.componentInstances ){
|
||||||
|
val byteSize = if(componentInstance.address !== null) (componentInstance.address as IntegerWithRadix).value+componentSize else componentSize + lastTopAddress
|
||||||
|
topAddress = Math.max(topAddress, byteSize)
|
||||||
|
lastTopAddress = byteSize
|
||||||
|
}
|
||||||
|
return topAddress
|
||||||
|
}
|
||||||
|
|
||||||
|
def long byteSize(Instantiation instantiation){
|
||||||
|
val componentDefinition = instantiation.definingComponent
|
||||||
|
var long componentSize=0;
|
||||||
|
if(instantiation.definingComponent.type == ComponentDefinitionType.REG){
|
||||||
|
componentSize=instantiation.definingComponent.regWidth/8
|
||||||
|
} else
|
||||||
|
for(subInstantiation: componentDefinition.instantiations)
|
||||||
|
componentSize = subInstantiation.byteSize(componentSize)
|
||||||
|
return componentSize
|
||||||
|
}
|
||||||
|
|
||||||
def String generateHeader()
|
def String generateHeader()
|
||||||
|
|
||||||
def String generateSource()
|
def String generateSource()
|
||||||
|
@ -81,7 +81,9 @@ class RegfileGenerator extends RdlBaseGenerator{
|
|||||||
«ENDIF»
|
«ENDIF»
|
||||||
«IF instantiation.component !== null && instantiation.component.type == ComponentDefinitionType.REG»
|
«IF instantiation.component !== null && instantiation.component.type == ComponentDefinitionType.REG»
|
||||||
«IF instantiation.isFilledByField»
|
«IF instantiation.isFilledByField»
|
||||||
uint«instantiation.size»_t «instantiation.componentInstances.filter[it.range===null].map['r_'+it.name].join(', ')»;
|
«IF instantiation.componentInstances.filter[it.range===null].size>0»
|
||||||
|
uint«instantiation.size»_t «instantiation.componentInstances.filter[it.range===null].map['r_'+it.name].join(', ')»;
|
||||||
|
«ENDIF»
|
||||||
«FOR componentInstance : instantiation.componentInstances.filter[it.range!==null]»
|
«FOR componentInstance : instantiation.componentInstances.filter[it.range!==null]»
|
||||||
std::array<uint«instantiation.size»_t, «componentInstance.range.absSize»> r_«componentInstance.name»;
|
std::array<uint«instantiation.size»_t, «componentInstance.range.absSize»> r_«componentInstance.name»;
|
||||||
«ENDFOR»
|
«ENDFOR»
|
||||||
@ -110,7 +112,7 @@ class RegfileGenerator extends RdlBaseGenerator{
|
|||||||
«ENDIF»
|
«ENDIF»
|
||||||
«IF instance.range!==null»
|
«IF instance.range!==null»
|
||||||
«IF instantiation.isFilledByField»
|
«IF instantiation.isFilledByField»
|
||||||
sysc::sc_register_indexed<«instantiation.size»_t, «instance.range.absSize»> «instance.name»;
|
sysc::sc_register_indexed<uint«instantiation.size»_t, «instance.range.absSize»> «instance.name»;
|
||||||
«ENDIF»
|
«ENDIF»
|
||||||
«IF !instantiation.isFilledByField»
|
«IF !instantiation.isFilledByField»
|
||||||
sysc::sc_register_indexed<«instantiation.component.effectiveName»_t, «instance.range.absSize»> «instance.name»;
|
sysc::sc_register_indexed<«instantiation.component.effectiveName»_t, «instance.range.absSize»> «instance.name»;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.minres.rdl.generator;
|
package com.minres.rdl.generator;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.minres.rdl.IntegerWithRadix;
|
import com.minres.rdl.IntegerWithRadix;
|
||||||
import com.minres.rdl.generator.RdlBaseGenerator;
|
import com.minres.rdl.generator.RdlBaseGenerator;
|
||||||
import com.minres.rdl.rdl.ComponentDefinition;
|
import com.minres.rdl.rdl.ComponentDefinition;
|
||||||
@ -9,9 +8,6 @@ import com.minres.rdl.rdl.ComponentInstance;
|
|||||||
import com.minres.rdl.rdl.Instantiation;
|
import com.minres.rdl.rdl.Instantiation;
|
||||||
import org.eclipse.emf.common.util.EList;
|
import org.eclipse.emf.common.util.EList;
|
||||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||||
import org.eclipse.xtext.xbase.lib.Functions.Function1;
|
|
||||||
import org.eclipse.xtext.xbase.lib.Functions.Function2;
|
|
||||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
|
||||||
|
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
public class AddrmapGenerator extends RdlBaseGenerator {
|
public class AddrmapGenerator extends RdlBaseGenerator {
|
||||||
@ -50,7 +46,7 @@ public class AddrmapGenerator extends RdlBaseGenerator {
|
|||||||
String _hexString = Long.toHexString(((IntegerWithRadix) _address).value);
|
String _hexString = Long.toHexString(((IntegerWithRadix) _address).value);
|
||||||
_builder.append(_hexString, " ");
|
_builder.append(_hexString, " ");
|
||||||
_builder.append(", 0x");
|
_builder.append(", 0x");
|
||||||
String _hexString_1 = Long.toHexString(this.occupiedSize(instantiation));
|
String _hexString_1 = Long.toHexString(this.byteSize(instantiation));
|
||||||
_builder.append(_hexString_1, " ");
|
_builder.append(_hexString_1, " ");
|
||||||
_builder.append("},");
|
_builder.append("},");
|
||||||
_builder.newLineIfNotEmpty();
|
_builder.newLineIfNotEmpty();
|
||||||
@ -70,26 +66,4 @@ public class AddrmapGenerator extends RdlBaseGenerator {
|
|||||||
public String generateSource() {
|
public String generateSource() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int instanceCount(final ComponentDefinition definition, final ComponentDefinitionType type) {
|
|
||||||
final Function1<Instantiation, Integer> _function = (Instantiation it) -> {
|
|
||||||
return Integer.valueOf(it.getComponentInstances().size());
|
|
||||||
};
|
|
||||||
final Function2<Integer, Integer, Integer> _function_1 = (Integer p1, Integer p2) -> {
|
|
||||||
return Integer.valueOf(((p1).intValue() + (p2).intValue()));
|
|
||||||
};
|
|
||||||
return (int) IterableExtensions.<Integer>reduce(IterableExtensions.<Instantiation, Integer>map(this.instantiationsOfType(definition, type), _function), _function_1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iterable<Instantiation> instantiationsOfType(final ComponentDefinition definition, final ComponentDefinitionType type) {
|
|
||||||
final Function1<Instantiation, Boolean> _function = (Instantiation it) -> {
|
|
||||||
ComponentDefinitionType _type = this.definingComponent(it).getType();
|
|
||||||
return Boolean.valueOf(Objects.equal(_type, type));
|
|
||||||
};
|
|
||||||
return IterableExtensions.<Instantiation>filter(definition.getInstantiations(), _function);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long occupiedSize(final Instantiation instantiation) {
|
|
||||||
return 4096;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.google.common.base.Objects;
|
|||||||
import com.minres.rdl.IntegerWithRadix;
|
import com.minres.rdl.IntegerWithRadix;
|
||||||
import com.minres.rdl.rdl.ComponentDefinition;
|
import com.minres.rdl.rdl.ComponentDefinition;
|
||||||
import com.minres.rdl.rdl.ComponentDefinitionType;
|
import com.minres.rdl.rdl.ComponentDefinitionType;
|
||||||
|
import com.minres.rdl.rdl.ComponentInstance;
|
||||||
import com.minres.rdl.rdl.EnumDefinition;
|
import com.minres.rdl.rdl.EnumDefinition;
|
||||||
import com.minres.rdl.rdl.ExplicitPropertyAssignment;
|
import com.minres.rdl.rdl.ExplicitPropertyAssignment;
|
||||||
import com.minres.rdl.rdl.InstancePropertyRef;
|
import com.minres.rdl.rdl.InstancePropertyRef;
|
||||||
@ -13,7 +14,9 @@ import com.minres.rdl.rdl.PropertyAssignmentRhs;
|
|||||||
import com.minres.rdl.rdl.PropertyEnum;
|
import com.minres.rdl.rdl.PropertyEnum;
|
||||||
import com.minres.rdl.rdl.RValue;
|
import com.minres.rdl.rdl.RValue;
|
||||||
import com.minres.rdl.rdl.RValueConstant;
|
import com.minres.rdl.rdl.RValueConstant;
|
||||||
|
import org.eclipse.emf.common.util.EList;
|
||||||
import org.eclipse.xtext.xbase.lib.Functions.Function1;
|
import org.eclipse.xtext.xbase.lib.Functions.Function1;
|
||||||
|
import org.eclipse.xtext.xbase.lib.Functions.Function2;
|
||||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
||||||
|
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@ -32,6 +35,20 @@ public abstract class RdlBaseGenerator {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long regWidth(final ComponentDefinition definition) {
|
||||||
|
long size = 32L;
|
||||||
|
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
|
||||||
|
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.REGWIDTH)));
|
||||||
|
};
|
||||||
|
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(definition.getPropertyAssignments(), _function);
|
||||||
|
if ((pa != null)) {
|
||||||
|
String _effectiveValue = this.effectiveValue(((ExplicitPropertyAssignment) pa).getRhs());
|
||||||
|
final IntegerWithRadix sz = new IntegerWithRadix(_effectiveValue);
|
||||||
|
size = sz.value;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
public long getSize(final Instantiation instantiation) {
|
public long getSize(final Instantiation instantiation) {
|
||||||
final ComponentDefinition componentDef = this.definingComponent(instantiation);
|
final ComponentDefinition componentDef = this.definingComponent(instantiation);
|
||||||
ComponentDefinitionType _type = componentDef.getType();
|
ComponentDefinitionType _type = componentDef.getType();
|
||||||
@ -146,7 +163,7 @@ public abstract class RdlBaseGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String effectiveValue(final InstancePropertyRef ref) {
|
public String effectiveValue(final InstancePropertyRef ref) {
|
||||||
return null;
|
throw new RuntimeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComponentDefinition definingComponent(final Instantiation instantiation) {
|
public ComponentDefinition definingComponent(final Instantiation instantiation) {
|
||||||
@ -161,6 +178,79 @@ public abstract class RdlBaseGenerator {
|
|||||||
return _xifexpression;
|
return _xifexpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int instanceCount(final ComponentDefinition definition, final ComponentDefinitionType type) {
|
||||||
|
final Function1<Instantiation, Integer> _function = (Instantiation it) -> {
|
||||||
|
return Integer.valueOf(it.getComponentInstances().size());
|
||||||
|
};
|
||||||
|
final Function2<Integer, Integer, Integer> _function_1 = (Integer p1, Integer p2) -> {
|
||||||
|
return Integer.valueOf(((p1).intValue() + (p2).intValue()));
|
||||||
|
};
|
||||||
|
return (int) IterableExtensions.<Integer>reduce(IterableExtensions.<Instantiation, Integer>map(this.instantiationsOfType(definition, type), _function), _function_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Iterable<Instantiation> instantiationsOfType(final ComponentDefinition definition, final ComponentDefinitionType type) {
|
||||||
|
final Function1<Instantiation, Boolean> _function = (Instantiation it) -> {
|
||||||
|
ComponentDefinitionType _type = this.definingComponent(it).getType();
|
||||||
|
return Boolean.valueOf(Objects.equal(_type, type));
|
||||||
|
};
|
||||||
|
return IterableExtensions.<Instantiation>filter(definition.getInstantiations(), _function);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long byteSize(final Instantiation instantiation, final long start) {
|
||||||
|
final ComponentDefinition componentDefinition = this.definingComponent(instantiation);
|
||||||
|
long componentSize = 0;
|
||||||
|
ComponentDefinitionType _type = this.definingComponent(instantiation).getType();
|
||||||
|
boolean _equals = Objects.equal(_type, ComponentDefinitionType.REG);
|
||||||
|
if (_equals) {
|
||||||
|
long _regWidth = this.regWidth(this.definingComponent(instantiation));
|
||||||
|
long _divide = (_regWidth / 8);
|
||||||
|
componentSize = _divide;
|
||||||
|
} else {
|
||||||
|
EList<Instantiation> _instantiations = componentDefinition.getInstantiations();
|
||||||
|
for (final Instantiation subInstantiation : _instantiations) {
|
||||||
|
componentSize = this.byteSize(subInstantiation, componentSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
long lastTopAddress = start;
|
||||||
|
long topAddress = start;
|
||||||
|
EList<ComponentInstance> _componentInstances = instantiation.getComponentInstances();
|
||||||
|
for (final ComponentInstance componentInstance : _componentInstances) {
|
||||||
|
{
|
||||||
|
long _xifexpression = (long) 0;
|
||||||
|
Object _address = componentInstance.getAddress();
|
||||||
|
boolean _tripleNotEquals = (_address != null);
|
||||||
|
if (_tripleNotEquals) {
|
||||||
|
Object _address_1 = componentInstance.getAddress();
|
||||||
|
_xifexpression = (((IntegerWithRadix) _address_1).value + componentSize);
|
||||||
|
} else {
|
||||||
|
_xifexpression = (componentSize + lastTopAddress);
|
||||||
|
}
|
||||||
|
final long byteSize = _xifexpression;
|
||||||
|
topAddress = Math.max(topAddress, byteSize);
|
||||||
|
lastTopAddress = byteSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return topAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long byteSize(final Instantiation instantiation) {
|
||||||
|
final ComponentDefinition componentDefinition = this.definingComponent(instantiation);
|
||||||
|
long componentSize = 0;
|
||||||
|
ComponentDefinitionType _type = this.definingComponent(instantiation).getType();
|
||||||
|
boolean _equals = Objects.equal(_type, ComponentDefinitionType.REG);
|
||||||
|
if (_equals) {
|
||||||
|
long _regWidth = this.regWidth(this.definingComponent(instantiation));
|
||||||
|
long _divide = (_regWidth / 8);
|
||||||
|
componentSize = _divide;
|
||||||
|
} else {
|
||||||
|
EList<Instantiation> _instantiations = componentDefinition.getInstantiations();
|
||||||
|
for (final Instantiation subInstantiation : _instantiations) {
|
||||||
|
componentSize = this.byteSize(subInstantiation, componentSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return componentSize;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract String generateHeader();
|
public abstract String generateHeader();
|
||||||
|
|
||||||
public abstract String generateSource();
|
public abstract String generateSource();
|
||||||
|
@ -192,34 +192,44 @@ public class RegfileGenerator extends RdlBaseGenerator {
|
|||||||
{
|
{
|
||||||
boolean _isFilledByField = this.isFilledByField(instantiation);
|
boolean _isFilledByField = this.isFilledByField(instantiation);
|
||||||
if (_isFilledByField) {
|
if (_isFilledByField) {
|
||||||
_builder.append(" ");
|
|
||||||
_builder.append("uint");
|
|
||||||
long _size = this.getSize(instantiation);
|
|
||||||
_builder.append(_size, " ");
|
|
||||||
_builder.append("_t ");
|
|
||||||
final Function1<ComponentInstance, Boolean> _function_1 = (ComponentInstance it) -> {
|
|
||||||
Range _range = it.getRange();
|
|
||||||
return Boolean.valueOf((_range == null));
|
|
||||||
};
|
|
||||||
final Function1<ComponentInstance, String> _function_2 = (ComponentInstance it) -> {
|
|
||||||
String _name_2 = it.getName();
|
|
||||||
return ("r_" + _name_2);
|
|
||||||
};
|
|
||||||
String _join_1 = IterableExtensions.join(IterableExtensions.<ComponentInstance, String>map(IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_1), _function_2), ", ");
|
|
||||||
_builder.append(_join_1, " ");
|
|
||||||
_builder.append(";");
|
|
||||||
_builder.newLineIfNotEmpty();
|
|
||||||
{
|
{
|
||||||
final Function1<ComponentInstance, Boolean> _function_3 = (ComponentInstance it) -> {
|
final Function1<ComponentInstance, Boolean> _function_1 = (ComponentInstance it) -> {
|
||||||
|
Range _range = it.getRange();
|
||||||
|
return Boolean.valueOf((_range == null));
|
||||||
|
};
|
||||||
|
int _size = IterableExtensions.size(IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_1));
|
||||||
|
boolean _greaterThan = (_size > 0);
|
||||||
|
if (_greaterThan) {
|
||||||
|
_builder.append(" ");
|
||||||
|
_builder.append("uint");
|
||||||
|
long _size_1 = this.getSize(instantiation);
|
||||||
|
_builder.append(_size_1, " ");
|
||||||
|
_builder.append("_t ");
|
||||||
|
final Function1<ComponentInstance, Boolean> _function_2 = (ComponentInstance it) -> {
|
||||||
|
Range _range = it.getRange();
|
||||||
|
return Boolean.valueOf((_range == null));
|
||||||
|
};
|
||||||
|
final Function1<ComponentInstance, String> _function_3 = (ComponentInstance it) -> {
|
||||||
|
String _name_2 = it.getName();
|
||||||
|
return ("r_" + _name_2);
|
||||||
|
};
|
||||||
|
String _join_1 = IterableExtensions.join(IterableExtensions.<ComponentInstance, String>map(IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_2), _function_3), ", ");
|
||||||
|
_builder.append(_join_1, " ");
|
||||||
|
_builder.append(";");
|
||||||
|
_builder.newLineIfNotEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
final Function1<ComponentInstance, Boolean> _function_4 = (ComponentInstance it) -> {
|
||||||
Range _range = it.getRange();
|
Range _range = it.getRange();
|
||||||
return Boolean.valueOf((_range != null));
|
return Boolean.valueOf((_range != null));
|
||||||
};
|
};
|
||||||
Iterable<ComponentInstance> _filter = IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_3);
|
Iterable<ComponentInstance> _filter = IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_4);
|
||||||
for(final ComponentInstance componentInstance : _filter) {
|
for(final ComponentInstance componentInstance : _filter) {
|
||||||
_builder.append(" ");
|
_builder.append(" ");
|
||||||
_builder.append("std::array<uint");
|
_builder.append("std::array<uint");
|
||||||
long _size_1 = this.getSize(instantiation);
|
long _size_2 = this.getSize(instantiation);
|
||||||
_builder.append(_size_1, " ");
|
_builder.append(_size_2, " ");
|
||||||
_builder.append("_t, ");
|
_builder.append("_t, ");
|
||||||
long _absSize = this.absSize(componentInstance.getRange());
|
long _absSize = this.absSize(componentInstance.getRange());
|
||||||
_builder.append(_absSize, " ");
|
_builder.append(_absSize, " ");
|
||||||
@ -241,8 +251,8 @@ public class RegfileGenerator extends RdlBaseGenerator {
|
|||||||
String _effectiveName_2 = this.effectiveName(instantiation.getComponent());
|
String _effectiveName_2 = this.effectiveName(instantiation.getComponent());
|
||||||
_builder.append(_effectiveName_2, " ");
|
_builder.append(_effectiveName_2, " ");
|
||||||
_builder.append("_t, uint");
|
_builder.append("_t, uint");
|
||||||
long _size_2 = this.getSize(instantiation);
|
long _size_3 = this.getSize(instantiation);
|
||||||
_builder.append(_size_2, " ");
|
_builder.append(_size_3, " ");
|
||||||
_builder.append("_t);");
|
_builder.append("_t);");
|
||||||
_builder.newLineIfNotEmpty();
|
_builder.newLineIfNotEmpty();
|
||||||
_builder.append(" ");
|
_builder.append(" ");
|
||||||
@ -252,24 +262,24 @@ public class RegfileGenerator extends RdlBaseGenerator {
|
|||||||
_builder.newLineIfNotEmpty();
|
_builder.newLineIfNotEmpty();
|
||||||
_builder.append(" ");
|
_builder.append(" ");
|
||||||
_builder.append("END_BF_DECL() ");
|
_builder.append("END_BF_DECL() ");
|
||||||
final Function1<ComponentInstance, Boolean> _function_4 = (ComponentInstance it) -> {
|
final Function1<ComponentInstance, Boolean> _function_5 = (ComponentInstance it) -> {
|
||||||
Range _range = it.getRange();
|
Range _range = it.getRange();
|
||||||
return Boolean.valueOf((_range == null));
|
return Boolean.valueOf((_range == null));
|
||||||
};
|
};
|
||||||
final Function1<ComponentInstance, String> _function_5 = (ComponentInstance it) -> {
|
final Function1<ComponentInstance, String> _function_6 = (ComponentInstance it) -> {
|
||||||
String _name_3 = it.getName();
|
String _name_3 = it.getName();
|
||||||
return ("r_" + _name_3);
|
return ("r_" + _name_3);
|
||||||
};
|
};
|
||||||
String _join_2 = IterableExtensions.join(IterableExtensions.<ComponentInstance, String>map(IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_4), _function_5), ", ");
|
String _join_2 = IterableExtensions.join(IterableExtensions.<ComponentInstance, String>map(IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_5), _function_6), ", ");
|
||||||
_builder.append(_join_2, " ");
|
_builder.append(_join_2, " ");
|
||||||
_builder.append(";");
|
_builder.append(";");
|
||||||
_builder.newLineIfNotEmpty();
|
_builder.newLineIfNotEmpty();
|
||||||
{
|
{
|
||||||
final Function1<ComponentInstance, Boolean> _function_6 = (ComponentInstance it) -> {
|
final Function1<ComponentInstance, Boolean> _function_7 = (ComponentInstance it) -> {
|
||||||
Range _range = it.getRange();
|
Range _range = it.getRange();
|
||||||
return Boolean.valueOf((_range != null));
|
return Boolean.valueOf((_range != null));
|
||||||
};
|
};
|
||||||
Iterable<ComponentInstance> _filter_1 = IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_6);
|
Iterable<ComponentInstance> _filter_1 = IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_7);
|
||||||
for(final ComponentInstance componentInstance_1 : _filter_1) {
|
for(final ComponentInstance componentInstance_1 : _filter_1) {
|
||||||
_builder.append(" ");
|
_builder.append(" ");
|
||||||
_builder.append("std::array<");
|
_builder.append("std::array<");
|
||||||
@ -311,8 +321,8 @@ public class RegfileGenerator extends RdlBaseGenerator {
|
|||||||
if (_isFilledByField_2) {
|
if (_isFilledByField_2) {
|
||||||
_builder.append(" ");
|
_builder.append(" ");
|
||||||
_builder.append("sysc::sc_register<uint");
|
_builder.append("sysc::sc_register<uint");
|
||||||
long _size_3 = this.getSize(instantiation_1);
|
long _size_4 = this.getSize(instantiation_1);
|
||||||
_builder.append(_size_3, " ");
|
_builder.append(_size_4, " ");
|
||||||
_builder.append("_t> ");
|
_builder.append("_t> ");
|
||||||
String _name_4 = instance.getName();
|
String _name_4 = instance.getName();
|
||||||
_builder.append(_name_4, " ");
|
_builder.append(_name_4, " ");
|
||||||
@ -345,9 +355,9 @@ public class RegfileGenerator extends RdlBaseGenerator {
|
|||||||
boolean _isFilledByField_4 = this.isFilledByField(instantiation_1);
|
boolean _isFilledByField_4 = this.isFilledByField(instantiation_1);
|
||||||
if (_isFilledByField_4) {
|
if (_isFilledByField_4) {
|
||||||
_builder.append(" ");
|
_builder.append(" ");
|
||||||
_builder.append("sysc::sc_register_indexed<");
|
_builder.append("sysc::sc_register_indexed<uint");
|
||||||
long _size_4 = this.getSize(instantiation_1);
|
long _size_5 = this.getSize(instantiation_1);
|
||||||
_builder.append(_size_4, " ");
|
_builder.append(_size_5, " ");
|
||||||
_builder.append("_t, ");
|
_builder.append("_t, ");
|
||||||
long _absSize_2 = this.absSize(instance.getRange());
|
long _absSize_2 = this.absSize(instance.getRange());
|
||||||
_builder.append(_absSize_2, " ");
|
_builder.append(_absSize_2, " ");
|
||||||
|
Loading…
Reference in New Issue
Block a user