2017-09-19 18:08:17 +02:00
|
|
|
package com.minres.rdl.generator
|
|
|
|
|
|
|
|
import com.minres.rdl.rdl.ComponentDefinition
|
2017-09-20 22:36:20 +02:00
|
|
|
import com.minres.rdl.rdl.ComponentDefinitionType
|
2018-06-04 20:55:10 +02:00
|
|
|
|
|
|
|
import static extension com.minres.rdl.RdlUtil.*
|
2017-09-19 18:08:17 +02:00
|
|
|
|
|
|
|
class AddrmapGenerator extends RdlBaseGenerator {
|
|
|
|
|
|
|
|
val ComponentDefinition componentDefinition
|
|
|
|
|
|
|
|
new(ComponentDefinition definition) {
|
|
|
|
componentDefinition=definition
|
|
|
|
}
|
|
|
|
|
|
|
|
override generateHeader() {'''
|
2018-06-04 20:55:10 +02:00
|
|
|
#ifndef _«componentDefinition.effectiveName.toUpperCase»_MAP_H_
|
|
|
|
#define _«componentDefinition.effectiveName.toUpperCase»_MAP_H_
|
2017-09-19 18:08:17 +02:00
|
|
|
// need double braces, see https://stackoverflow.com/questions/6893700/how-to-construct-stdarray-object-with-initializer-list#6894191
|
2018-06-04 20:55:10 +02:00
|
|
|
const std::array<sysc::target_memory_map_entry<32>, «componentDefinition.instanceCount(ComponentDefinitionType.REGFILE)»> «componentDefinition.effectiveName»_map = {{
|
2017-09-20 22:36:20 +02:00
|
|
|
«FOR instantiation : componentDefinition.instantiationsOfType(ComponentDefinitionType.REGFILE)»
|
|
|
|
«FOR instance : instantiation.componentInstances»
|
2018-06-04 20:55:10 +02:00
|
|
|
{&i_«instance.name», «instance.addressValue», 0x«Long.toHexString(instantiation.byteSize)»},
|
2017-09-20 22:36:20 +02:00
|
|
|
«ENDFOR»
|
|
|
|
«ENDFOR»
|
2017-09-19 18:08:17 +02:00
|
|
|
}};
|
|
|
|
|
2018-06-04 20:55:10 +02:00
|
|
|
#endif /* _«componentDefinition.effectiveName.toUpperCase»_MAP_H_ */
|
2017-09-19 18:08:17 +02:00
|
|
|
'''
|
|
|
|
}
|
2018-06-04 20:55:10 +02:00
|
|
|
|
2017-09-19 18:08:17 +02:00
|
|
|
override generateSource() {
|
|
|
|
''
|
|
|
|
}
|
|
|
|
|
2017-09-20 22:36:20 +02:00
|
|
|
|
2017-09-19 18:08:17 +02:00
|
|
|
}
|