9 | | class ClusteredNoirqMulti(SoclibGenericArchitecture): |
10 | | """ |
11 | | Parameters: |
12 | | - min_latency: Vgmn's latency |
13 | | - cpus: Cpus per cluster in a list |
14 | | - rams: Rams per cluster in a list |
| 8 | def _cluster(arch, no, |
| 9 | with_gdb, |
| 10 | ncpu, nram, |
| 11 | icache_lines, icache_words, |
| 12 | dcache_lines, dcache_words): |
| 13 | crossbar = arch.create('caba:vci_local_crossbar', 'lc%d'%no) |
16 | | Exports: |
17 | | - vgmn: global vgmn interconnect |
18 | | - clust[]: cluster's interconnect; contains: |
19 | | - cpu[]: cpu list for cluster |
20 | | - cram[]: cached ram list for cluster |
21 | | - uram[]: uncached ram list for cluster |
22 | | - locks: ramlocks |
23 | | - cpu[]: global cpu list |
24 | | - cram[]: global cached ram list |
25 | | - uram[]: global uncached ram list |
26 | | - locks: global ramlocks list |
27 | | """ |
28 | | def cluster(self, clustno, ncpu, nram): |
29 | | ic = LocalCrossbar('lc%d'%clustno) |
| 15 | for i in range(ncpu): |
| 16 | cn = arch.cpu_num |
| 17 | arch.cpu_num += 1 |
| 18 | if with_gdb: |
| 19 | mips = arch.create('caba:iss_wrapper', 'mips%d_%d'%(no,i), iss_t='common:gdb_iss', gdb_iss_t = 'common:mipsel', ident = cn) |
| 20 | else: |
| 21 | mips = arch.create('caba:iss_wrapper', 'mips%d_%d'%(no,i), iss_t='common:mipsel', ident = cn) |
| 22 | xcache = arch.create('caba:vci_xcache', 'xcache%d_%d'%(no,i), |
| 23 | icache_lines = icache_lines, |
| 24 | icache_words = icache_words, |
| 25 | dcache_lines = dcache_lines, |
| 26 | dcache_words = dcache_words) |
| 27 | mips.dcache // xcache.dcache |
| 28 | mips.icache // xcache.icache |
38 | | cpu.append(c) |
39 | | cache.append(xc) |
| 32 | for i in range(2): |
| 33 | ram = arch.create('caba:vci_ram', 'ram%d_%d'%(no,i)) |
| 34 | base = 0x10000000*(1+no)+0x1000000*i |
| 35 | ram.addSegment('cram%d_%d'%(no,i), base, 0x100000, True) |
| 36 | ram.addSegment('uram%d_%d'%(no,i), base + 0x200000, 0x100000, False) |
| 37 | ram.vci // crossbar.to_target.new() |
| 38 | if i == 0 and no == 0: |
| 39 | ram.addSegment('boot', 0xbfc00000, 0x800,True) |
| 40 | ram.addSegment('excep', 0x80000080, 0x800,True) |
| 41 | return crossbar |
56 | | r.vci // ic.getInit() |
57 | | ram.append(r) |
58 | | ic.ram = ram |
59 | | ic.uram = uram |
60 | | ic.cram = cram |
| 74 | for no, ncpu, nram in zip(range(len(nbcpu)), nbcpu, nbram): |
| 75 | lc = _cluster( |
| 76 | arch, no, |
| 77 | with_gdb = with_gdb, |
| 78 | ncpu = ncpu, nram = nram, |
| 79 | icache_lines = icache_lines, icache_words = icache_words, |
| 80 | dcache_lines = dcache_lines, dcache_words = dcache_words) |
| 81 | vgmn.to_initiator.new() // lc.initiator_to_up |
| 82 | vgmn.to_target.new() // lc.target_to_up |
67 | | def architecture(self): |
68 | | self.vgmn = Vgmn('vgmn', self.getParam(__remplir__)) |
69 | | self.setBase(self.vgmn) |
70 | | |
71 | | nram = self.getParam('rams') |
72 | | ncpu = self.getParam('cpus') |
73 | | assert(len(nram) == len(ncpu)) |
74 | | |
75 | | ncluster = len(nram) |
76 | | |
77 | | self.clust = [] |
78 | | for n, nc, nr in zip(range(ncluster), ncpu, nram): |
79 | | ic = self.cluster(n, nc, nr) |
80 | | self.clust.append(ic) |
81 | | ic.__remplir__ // self.vgmn.getBoth() |
82 | | |
83 | | self.clust[0].ram[0].addSegment( |
84 | | Segment('reset', Cached, addr=0xbfc00000), |
85 | | Segment('excep', Cached, addr=0x80000080)) |
86 | | |
87 | | # export global lists |
88 | | add = lambda x,y: x+y |
89 | | self.ram = reduce(add, [self.clust[i].ram for i in range(ncluster)]) |
90 | | self.uram = reduce(add, [self.clust[i].uram for i in range(ncluster)]) |
91 | | self.cram = reduce(add, [self.clust[i].cram for i in range(ncluster)]) |
92 | | self.cpu = reduce(add, [self.clust[i].cpu for i in range(ncluster)]) |
93 | | self.locks = [self.clust[i].locks for i in range(ncluster)] |
94 | | |
95 | | # Ceci permet de tester l'architecture: |
96 | | # Le bout de code dans le if ne sera exécuté que si vous faites ./clustered_noirq_multi.py |
97 | | # et pas si vous importez clustered_noirq_multi depuis une autre description. |
98 | | |
99 | | if __name__ == '__main__': |
100 | | hard = ClusteredNoirqMulti( cpus = [1, 2, 2, 1], |
101 | | rams = [1, 1, 1, 1], |
102 | | min_latency = 10 ) |
103 | | hard.dispTree() |
104 | | print hard.cpu |
105 | | print hard.ram |
106 | | print hard.cram |
107 | | print hard.uram |
108 | | print hard.locks |
109 | | hard.generate(Caba()) |
| 88 | return arch |