Zakir Meer | c3b605a | 2019-02-12 12:28:40 +0100 | [diff] [blame] | 1 | package templates.m2m.hw |
| 2 | |
Zakir Meer | c3b605a | 2019-02-12 12:28:40 +0100 | [diff] [blame] | 3 | import java.math.BigInteger |
| 4 | import org.eclipse.app4mc.amalthea.model.AmaltheaServices |
| 5 | import org.eclipse.app4mc.amalthea.model.Memory |
| 6 | import templates.AbstractAmaltheaInchronTransformer |
| 7 | import templates.utils.AmltCacheModel |
| 8 | |
Harald Mackamul | 505789c | 2019-02-14 14:28:17 +0100 | [diff] [blame] | 9 | class MemoryTransformer extends AbstractAmaltheaInchronTransformer { |
| 10 | |
Zakir Meer | 68f6a6b | 2019-02-12 14:04:35 +0100 | [diff] [blame] | 11 | // @Inject FrequencyDomainTransformer frequencyDomainTransformer |
Harald Mackamul | 505789c | 2019-02-14 14:28:17 +0100 | [diff] [blame] | 12 | 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 Meer | c3b605a | 2019-02-12 12:28:40 +0100 | [diff] [blame] | 32 | } |
Harald Mackamul | 505789c | 2019-02-14 14:28:17 +0100 | [diff] [blame] | 33 | // TODO: set the right type of the Memory |
| 34 | } |