source: trunk/platforms/tsar_generic_iob/arch_info.py @ 1064

Last change on this file since 1064 was 1064, checked in by alain, 3 years ago

bof...

  • Property svn:executable set to *
File size: 12.5 KB
Line 
1#!/usr/bin/env python
2
3from arch_classes import *
4
5#########################################################################################
6#   file   : arch_info.py
7#   date   : august 2016
8#   author : Alain Greiner
9#
10#   This file describes the <tsar_generic_iob> architecture for ALMOS-MKH.
11#########################################################################################
12#  This python script defines a specific instance of ithe "tsar_generic_iob" architecture
13#  for the ALMOS-MKH operating system. It is used to generate the "hard_config.h" file,
14#  used to configure the hardware architecture, and the "arch_info.bin" file, used by
15#  the ALMOS-MK bootloader.
16#
17#  The constructor prototype format is imposed by the genarch.py application,
18#  and should not be modified.
19#
20#  The "tsar_generic_iob" architecture includes 7 external peripherals, accessed
21#  through an IOB components located in cluster [0,0] or in cluster [x_size-1, y_size-1].
22#  Available peripherals are: TTY, IOC, FBF, ROM, NIC, CMA, PIC.
23#  All clusters contain (nb_cores) processors, one L2 cache, one XCU, and
24#  one optional hardware coprocessor connected to a MWMR controller.
25#
26#  As the "tsar_generic_iob" architecture is generic, the following parameters
27#  are defined as constructor arguments and can be redefined in the Makefile when
28#  a new kernel image is generated :
29#  - x_size         : number of clusters in a row (from 1 to 16)
30#  - y_size         : number of clusters in a column (from & to 16)
31#  - nb_cores       : number of processors per cluster (from 1 to 4)
32#  - nb_ttys        : number of TTY channels (can be from 1 to 8)
33#  - nb_nics        : number of NIC channels (from 1 to 2)
34#  - ioc_type       : can be IOC_BDV, IOC_HBA, IOC_SDC, IOC_SPI
35#  - txt_type       : IOB architecture use TXT_TTY
36#  - fbf_type       : IOB architecture use FBF_SCL
37#  - sys_clk        : IOB architecture is SystemC only
38#
39#  The other hardware parameters are defined below:
40#  - x_width        : number of bits for x coordinate
41#  - y_width        : number of bits for y coordinate
42#  - p_width        : number of bits for local processor index
43#  - paddr_width    : number of bits for physical address
44#  - irqs_per_core  : number of input IRQs per processor
45#  - io_cxy         : IO cluster identifier
46#  - boot_cxy       : boot cluster identifier
47#  - cache_line     : number of bytes in cache line (in 16,32,64)
48#  - devices_max    : max number of internal devices per cluster
49#  - fbf_width      : number of lines = number of pixels
50########################################################################################
51
52############################
53def arch( x_size        = 2,
54          y_size        = 2,
55          nb_cores      = 2,
56          nb_ttys       = 3,
57          nb_nics       = 1, 
58          ioc_type      = 'IOC_BDV',
59          txt_type      = 'TXT_TTY',
60          fbf_type      = 'FBF_SCL',
61          sys_clk       = 50000 ): 
62
63    ### architecture constants
64
65    p_width       = 2
66    x_width       = 4
67    y_width       = 4
68    paddr_width   = 40
69    irqs_per_core = 4           
70    io_cxy        = ((x_size-1)<<y_width) + (y_size-1)   # upper right cluster
71    boot_cxy      = 0
72    cache_line    = 64
73    devices_max   = 16 
74    fbf_width     = 1024
75
76    ### constructor parameters checking
77
78    assert( (x_size == 1) or (x_size == 2) or (x_size == 4)
79             or (x_size == 8) or (x_size == 16) )
80
81    assert( (y_size == 1) or (y_size == 2) or (y_size == 4)
82             or (y_size == 8) or (y_size == 16) )
83
84    assert( nb_cores <= 4 )
85
86    assert( (nb_ttys >= 1) and (nb_ttys <= 8) )
87
88    assert( (nb_nics >= 1) and (nb_nics <= 2) )
89
90    assert( ioc_type in ['IOC_BDV','IOC_HBA','IOC_SDC','IOC_SPI','IOC_RDK'] )
91
92    assert( (io_cxy == 0) or (io_cxy == ((x_size-1)<<y_width) + (y_size-1)) ) 
93
94    assert( ((boot_cxy >> y_width) < x_size) and ((boot_cxy & ((1<<y_width)-1)) < y_size) )
95
96    assert( (cache_line == 16) or (cache_line == 32) or (cache_line == 64)  )
97 
98    ### define platform name
99
100    platform_name = 'tsar_iob_%d_%d_%d' % ( x_size, y_size , nb_cores )
101
102    ### define physical segments replicated in all clusters
103
104    ram_base = 0x0000000000
105    ram_size = 0x4000000                   # 64 Mbytes
106
107    xcu_base = 0x00B0000000
108    xcu_size = 0x1000                      # 4 Kbytes
109
110    dma_base = 0x00B1000000
111    dma_size = 0x1000                      # 4 Kbytes
112
113    mmc_base = 0x00B2000000
114    mmc_size = 0x1000                      # 4 Kbytes
115
116    ### define physical segments for external peripherals
117    ## These segments are only defined in cluster_io
118
119    ioc_base  = 0x00B3000000               
120    ioc_size  = 0x1000                     # 4 Kbytes
121
122    tty_base  = 0x00B4000000
123    tty_size  = 0x8000                     # 4 Kbytes * 8 channels
124
125    nic_base  = 0x00B5000000
126    nic_size  = 0x4000                     # 4 Kbytes * 4 channels
127
128    fbf_base  = 0x00B7000000
129    fbf_size  = 0x400000 + 0x1000          # 4 Mbytes + 4 Kbytes
130
131    pic_base  = 0x00B8000000
132    pic_size  = 0x1000                     # 4 Kbytes
133
134    iob_base  = 0x00BE000000
135    iob_size  = 0x1000                     # 4 Kbytes
136
137    rom_base  = 0x00BFC00000
138    rom_size  = 0x4000                     # 16 Kbytes
139
140    ############################
141    ### call Header constructor
142    ############################
143
144    archi = Archinfo( name           = platform_name,
145                      x_size         = x_size,
146                      y_size         = y_size,
147                      cores_max      = nb_cores,
148                      devices_max    = devices_max,
149                      paddr_width    = paddr_width,
150                      x_width        = x_width,
151                      y_width        = y_width,
152                      irqs_per_core  = irqs_per_core,
153                      io_cxy         = io_cxy,         
154                      boot_cxy       = boot_cxy,
155                      cache_line     = cache_line,
156                      reset_address  = rom_base, 
157                      p_width        = p_width )
158
159    ####################################################
160    ### construct hardware components for each cluster
161    ####################################################
162
163    for x in xrange( x_size ):
164        for y in xrange( y_size ):
165            cxy    = (x << y_width) + y;
166            offset = cxy << (paddr_width - x_width - y_width)
167
168            # define internal devices
169            ram = archi.addDevice( ptype    = 'RAM_SCL' , 
170                                   base     = ram_base + offset, 
171                                   size     = ram_size )
172
173            xcu = archi.addDevice( ptype    = 'ICU_XCU', 
174                                   base     = xcu_base + offset, 
175                                   size     = xcu_size,
176                                   channels = 1, 
177                                   arg0     = 16,              # number of HWIs
178                                   arg1     = 16,              # number of WTIs
179                                   arg2     = 16,              # number of PTIs
180                                   arg3     = 16 )             # number of output IRQs
181
182            mmc = archi.addDevice( ptype    = 'MMC_TSR',
183                                   base     = mmc_base + offset,
184                                   size     = mmc_size )
185
186            archi.addIrq( dstdev = xcu, port = 0, srcdev = mmc )
187
188            dma = archi.addDevice( ptype    = 'DMA_SCL',
189                                   base     = dma_base + offset,
190                                   size     = dma_size,
191                                   channels = nb_cores )
192
193            for i in xrange( nb_cores ):
194                archi.addIrq( dstdev = xcu, port = i+1 , srcdev = dma, channel = i )
195
196            # define external devices
197            if( cxy == io_cxy ):
198
199                pic = archi.addDevice( ptype    ='PIC_TSR',
200                                       base     = pic_base + offset,
201                                       size     = pic_size, 
202                                       arg0     = 32 )         # number of input IRQs
203
204                iob = archi.addDevice( ptype    = 'IOB_TSR', 
205                                       base     = iob_base + offset,
206                                       size     = iob_size )
207
208                ioc = archi.addDevice( ptype    = ioc_type,
209                                       base     = ioc_base + offset,
210                                       size     = ioc_size )
211
212                tty = archi.addDevice( ptype    = 'TXT_TTY',
213                                       base     = tty_base + offset,
214                                       size     = tty_size, 
215                                       channels = nb_ttys )
216
217                nic = archi.addDevice( ptype    = 'NIC_CBF',
218                                       base     = nic_base + offset, 
219                                       size     = nic_size, 
220                                       channels = nb_nics )
221
222                fbf = archi.addDevice( ptype    = 'FBF_SCL',
223                                       base     = fbf_base + offset,
224                                       size     = fbf_size, 
225                                       arg0     = fbf_width,
226                                       arg1     = fbf_width )
227
228                rom = archi.addDevice( ptype    = 'ROM_SCL',
229                                       base     = rom_base + offset, 
230                                       size     = rom_size )
231
232                # we describe the largest config : (nb_nics = 4) & (nb_ttys = 8)
233                archi.addIrq( dstdev = pic, port = 0 , srcdev = nic, channel = 0 , is_rx = True )
234                archi.addIrq( dstdev = pic, port = 1 , srcdev = nic, channel = 1 , is_rx = True )
235                archi.addIrq( dstdev = pic, port = 2 , srcdev = nic, channel = 2 , is_rx = True )
236                archi.addIrq( dstdev = pic, port = 3 , srcdev = nic, channel = 3 , is_rx = True )
237
238                archi.addIrq( dstdev = pic, port = 4 , srcdev = nic, channel = 0 , is_rx = False )
239                archi.addIrq( dstdev = pic, port = 5 , srcdev = nic, channel = 1 , is_rx = False )
240                archi.addIrq( dstdev = pic, port = 6 , srcdev = nic, channel = 2 , is_rx = False )
241                archi.addIrq( dstdev = pic, port = 7 , srcdev = nic, channel = 3 , is_rx = False )
242
243                archi.addIrq( dstdev = pic, port = 12, srcdev = ioc )
244
245                archi.addIrq( dstdev = pic, port = 16, srcdev = tty, channel = 0 , is_rx = True )
246                archi.addIrq( dstdev = pic, port = 17, srcdev = tty, channel = 1 , is_rx = True )
247                archi.addIrq( dstdev = pic, port = 18, srcdev = tty, channel = 2 , is_rx = True )
248                archi.addIrq( dstdev = pic, port = 19, srcdev = tty, channel = 3 , is_rx = True )
249                archi.addIrq( dstdev = pic, port = 20, srcdev = tty, channel = 4 , is_rx = True )
250                archi.addIrq( dstdev = pic, port = 21, srcdev = tty, channel = 5 , is_rx = True )
251                archi.addIrq( dstdev = pic, port = 22, srcdev = tty, channel = 6 , is_rx = True )
252                archi.addIrq( dstdev = pic, port = 23, srcdev = tty, channel = 7 , is_rx = True )
253
254                archi.addIrq( dstdev = pic, port = 24, srcdev = tty, channel = 0 , is_rx = False )
255                archi.addIrq( dstdev = pic, port = 25, srcdev = tty, channel = 1 , is_rx = False )
256                archi.addIrq( dstdev = pic, port = 26, srcdev = tty, channel = 2 , is_rx = False )
257                archi.addIrq( dstdev = pic, port = 27, srcdev = tty, channel = 3 , is_rx = False )
258                archi.addIrq( dstdev = pic, port = 28, srcdev = tty, channel = 4 , is_rx = False )
259                archi.addIrq( dstdev = pic, port = 29, srcdev = tty, channel = 5 , is_rx = False )
260                archi.addIrq( dstdev = pic, port = 30, srcdev = tty, channel = 6 , is_rx = False )
261                archi.addIrq( dstdev = pic, port = 31, srcdev = tty, channel = 7 , is_rx = False )
262
263            # define cores
264            for p in xrange ( nb_cores ):
265                core = archi.addCore( (x<<(y_width+p_width)) + (y<<p_width) + p,  # hardware id
266                                      (x<<y_width) + y,                           # cluster
267                                       p )                                        # local index
268
269    return archi
270
271################################# platform test ####################################
272
273if __name__ == '__main__':
274
275    archi = arch()
276
277    print archi.xml()
278
279
280# Local Variables:
281# tab-width: 4;
282# c-basic-offset: 4;
283# c-file-offsets:((innamespace . 0)(inline-open . 0));
284# indent-tabs-mode: nil;
285# End:
286#
287# vim: filetype=python:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
288
Note: See TracBrowser for help on using the repository browser.