blob: ef1dc05fd9799ef60c98ce4220aea82395e43432 [file] [log] [blame]
Zakir Meerc3b605a2019-02-12 12:28:40 +01001package templates.m2m.hw
2
Zakir Meerc3b605a2019-02-12 12:28:40 +01003import java.math.BigInteger
4import org.eclipse.app4mc.amalthea.model.AmaltheaServices
5import org.eclipse.app4mc.amalthea.model.Memory
6import templates.AbstractAmaltheaInchronTransformer
7import templates.utils.AmltCacheModel
8
Harald Mackamul505789c2019-02-14 14:28:17 +01009class MemoryTransformer extends AbstractAmaltheaInchronTransformer {
10
Zakir Meer68f6a6b2019-02-12 14:04:35 +010011// @Inject FrequencyDomainTransformer frequencyDomainTransformer
Harald Mackamul505789c2019-02-14 14:28:17 +010012 def create inchronmemoryFactory.createMemory createMemory(Memory amltMemory) {
13
14 val AmltCacheModel cacheModel = customObjsStore.getInstance(AmltCacheModel)
15
16 it.name = amltMemory.name
17
18 it.clock = cacheModel.getInchronClock(amltMemory?.frequencyDomain?.name)
19
20 var amltDataSize = amltMemory?.definition.size
21
22 if (amltDataSize !== null) {
23 var bytes = AmaltheaServices.convertToBit(amltDataSize).divide(new BigInteger("8"))
24
25 it.size = bytes.intValue
26
27 }
28
29 it.prescaler = 1d
30
31 cacheModel.addInchronMemory(it)
Zakir Meerc3b605a2019-02-12 12:28:40 +010032 }
Harald Mackamul505789c2019-02-14 14:28:17 +010033// TODO: set the right type of the Memory
34}