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.*
|
2022-10-24 20:18:49 +02:00
|
|
|
import java.util.Date
|
2017-09-19 18:08:17 +02:00
|
|
|
|
|
|
|
class AddrmapGenerator extends RdlBaseGenerator {
|
|
|
|
|
|
|
|
val ComponentDefinition componentDefinition
|
|
|
|
|
|
|
|
new(ComponentDefinition definition) {
|
|
|
|
componentDefinition=definition
|
|
|
|
}
|
|
|
|
|
2022-02-13 12:40:21 +01:00
|
|
|
override boolean getOverwrite(){
|
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
override generateHeader(String namespace) {'''
|
2022-10-24 20:18:49 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019 -2022 MINRES Technologies GmbH
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Created on: «new Date»
|
|
|
|
* * «componentDefinition.effectiveName».h Author: <RDL Generator>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
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
|
2022-02-13 12:40:21 +01:00
|
|
|
const std::array<scc::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»
|
2022-02-13 12:40:21 +01:00
|
|
|
{i_«instance.name».socket, «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
|
|
|
|
2022-02-13 12:40:21 +01:00
|
|
|
override generateSource(String namespace) {
|
2017-09-19 18:08:17 +02:00
|
|
|
''
|
|
|
|
}
|
|
|
|
|
2017-09-20 22:36:20 +02:00
|
|
|
|
2017-09-19 18:08:17 +02:00
|
|
|
}
|