source: trunk/platforms/dsx/v1_1cluster_phys/cluster.py @ 85

Last change on this file since 85 was 30, checked in by nipo, 14 years ago

Fix netlist

File size: 4.2 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, ringc, mtp, mtc, mtx, proc_count, cluster_no, cluster_base):
14        self.pf = pf
15        self.ringp = ringp
16        self.ringc = ringc
17        self.mtp = mtp
18        self.mtc = mtc
19        self.mtx = mtx
20        self.cluster_no = cluster_no
21
22        self.generate(proc_count, cluster_base)
23
24    def generate(self, proc_count, cluster_base):
25        '''
26        The core netlist, where caches and components are created
27        '''
28        self.cpu = []
29        for i in range(proc_count):
30            c = self.create_cpu(i,
31                                cluster_base
32                                + 0x01200000
33                                + 0x01000000 * i
34                                )
35            self.cpu.append(c)
36
37        memc, xram = self.create_memcache( segments = [
38            ('reset', 0xbfc00000, 0x00010000),
39            ('excep', 0x80000000, 0x00010000),
40            ('text', 0x00400000, 0x00050000),
41            ('data', 0x10000000, 0x00100000),
42            ] )
43        tty  = self.create_tty( addr = 0xc0200000, tty_count = proc_count )
44
45    def create_tty(self, addr, tty_count = 1):
46        names = map(lambda x:'tty%d'%x, range(tty_count))
47        name = 'tty%d'%self.cluster_no
48        tty = self.pf.create('caba:vci_multi_tty', name, names = names)
49        self.ringp.to_target.new() // tty.vci
50        tty.addSegment(name, address = addr, size = 0x40, cacheable = False)
51        return tty
52   
53
54class ClusterV3(Cluster):
55    '''
56    A TsarV3 implementation, using vci_cc_vcache_wrapper2_v1,
57    vci_mem_cache_v3 and vci_dma_tsar_v2.
58    '''
59
60    def create_cpu(self, cpuid, addr):
61            c = self.pf.create(
62                'caba:vci_cc_xcache_wrapper_v1',
63                'proc_%d_%d' % (self.cluster_no, cpuid),
64                iss_t = "common:mips32el",
65                proc_id = cpuid,
66                icache_ways = 4,
67                icache_sets = 64,
68                icache_words = 16,
69                dcache_ways = 4,
70                dcache_sets = 64,
71                dcache_words = 16,
72                write_buf_size = 16,
73                )
74            self.ringc.to_initiator.new() // c.vci_ini_c
75            self.ringc.to_target.new() // c.vci_tgt
76            self.ringp.to_initiator.new() // c.vci_ini_rw
77
78            c.addSegment('proc_%d_%d' % (self.cluster_no, cpuid),
79                         address = addr,
80                         size = 0x10,
81                         cacheable = False,
82                         )
83
84            return c
85
86    def create_memcache(self, segments):
87        memc = self.pf.create('caba:vci_mem_cache_v1', 'memc',
88                              mtx = self.mtx,
89                              vci_ixr_index = (self.cluster_no,),
90                              nways = 16,
91                              nsets = 256,
92                              nwords = 16,
93                              )
94        self.ringc.to_target.new() // memc.vci_tgt_cleanup
95        self.ringp.to_target.new() // memc.vci_tgt
96        self.ringc.to_initiator.new() // memc.vci_ini
97
98        xram = self.pf.create('caba:vci_simple_ram', 'xram',
99                              mt = self.mtx,
100                              ident = (self.cluster_no,),
101                              latency = 1,
102                 )
103        memc.vci_ixr // xram.vci
104
105        for name, addr, size in segments:
106            # Here DSX knows the only way to address xram is through its
107            # vci port. It also knows the only associated mapping_table.
108            xram.addSegment('ram_x_'+name, address = addr, size = size, cacheable = True)
109
110            # For these segments, there is ambiguity for the mapping_table
111            # we are talking about, so we specify mt = ...
112            memc.addSegment('ram_p_'+name, address = addr, size = size, cacheable = True, mt = self.mtp)
113            memc.addSegment('ram_c_'+name, address = addr, size = size, cacheable = True, mt = self.mtc)
114        return memc, xram
Note: See TracBrowser for help on using the repository browser.