source: trunk/platforms/dsx/nc_1cluster_virt/cnc_cluster.py @ 163

Last change on this file since 163 was 24, checked in by nipo, 15 years ago

Remove loggers

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Rev URL Revision"
  • Property svn:mime-type set to text/plain
File size: 3.9 KB
Line 
1
2__doc__ = '''
3This file is a Cluster library. It contains classes implementing the
4netlist of a cluster, for different tsar versions.
5'''
6
7class Cluster:
8    '''
9    A generic netlist of a cluster, which must be subclassed to
10    implement caches&dma instanciation
11    '''
12   
13    def __init__(self, pf, ringp, mtp, proc_count, cluster_no, cluster_base):
14        self.pf = pf
15        self.ringp = ringp
16        self.mtp = mtp
17        self.cluster_no = cluster_no
18
19        self.generate(proc_count, cluster_base)
20
21    def generate(self, proc_count, cluster_base):
22        '''
23        The core netlist, where caches and components are created
24        '''
25        self.cpu = []
26        for i in range(proc_count):
27            c = self.create_cpu(i,
28                                cluster_base
29                                + 0x10200000
30                                + 0x01000000 * (i+1)
31                                )
32            self.cpu.append(c)
33
34        xram = self.create_ram( segments = [(cluster_base, 0x02000000)] )
35        rom  = self.create_rom( segments = [(0xbfc00000, 0x00400000)] )
36        tty  = self.create_tty( addr = 0xd0200000 )
37        dma  = self.create_dma( addr = 0xd1200000 )
38        xicu = self.create_xicu( addr = 0xd2200000, hwi_count = 3, cpu_count = proc_count )
39
40        xicu.hwi[0] // tty.irq[0]
41        xicu.hwi[1] // dma.irq
42
43        for p, cpu in enumerate(self.cpu):
44            for i in range(6):
45                xicu.irq[i+p*6] // cpu.irq[i]
46
47    def create_rom(self, segments):
48        name = 'rom%d'%self.cluster_no
49        rom = self.pf.create('caba:vci_simple_ram', name, latency = 1)
50        self.ringp.to_target.new() // rom.vci
51        for addr, size in segments:
52            rom.addSegment(name, address = addr, size = size, cacheable = True)
53        return rom
54
55    def create_ram(self, segments):
56        name = 'ram%d'%self.cluster_no
57        ram = self.pf.create('caba:vci_simple_ram', name, latency = 1)
58        self.ringp.to_target.new() // ram.vci
59        for addr, size in segments:
60            ram.addSegment(name, address = addr, size = size, cacheable = True)
61        return ram
62
63    def create_tty(self, addr):
64        name = 'tty%d'%self.cluster_no
65        tty = self.pf.create('caba:vci_multi_tty', name, names = ['tty0'])
66        self.ringp.to_target.new() // tty.vci
67        tty.addSegment(name, address = addr, size = 0x10, cacheable = False)
68        return tty
69
70    def create_xicu(self, addr, hwi_count, cpu_count):
71        name = 'xicu%d'%self.cluster_no
72        xicu = self.pf.create('caba:vci_xicu', name,
73                              pti_count = cpu_count,
74                              hwi_count = hwi_count,
75                              wti_count = cpu_count,
76                              irq_count = 6*cpu_count,
77                              )
78        self.ringp.to_target.new() // xicu.vci
79        xicu.addSegment(name, address = addr, size = 0x1000, cacheable = False)
80        return xicu
81
82    def create_cpu(self, cpuid, addr):
83            c = self.pf.create(
84                'caba:vci_vcache_wrapper2',
85                'proc_%d_%d' % (self.cluster_no, cpuid),
86                iss_t = "common:mips32el",
87                proc_id = cpuid,
88                icache_ways = 4,
89                icache_sets = 64,
90                icache_words = 16,
91                itlb_ways = 4,
92                itlb_sets = 16,
93                dcache_ways = 4,
94                dcache_sets = 64,
95                dcache_words = 16,
96                dtlb_ways = 4,
97                dtlb_sets = 16,
98                write_buf_size = 16,
99                )
100            self.ringp.to_initiator.new() // c.vci
101            return c
102
103    def create_dma(self, addr):
104        name = 'dma%d'%self.cluster_no
105        dma = self.pf.create('caba:vci_dma', name, burst_size = 64)
106        self.ringp.to_target.new() // dma.vci_target
107        self.ringp.to_initiator.new() // dma.vci_initiator
108        dma.addSegment(name, address = addr, size = 0x14, cacheable = False)
109        return dma
Note: See TracBrowser for help on using the repository browser.