source: trunk/platforms/tsar_generic_leti/arch_info.py @ 1057

Last change on this file since 1057 was 1057, checked in by alain, 6 years ago

Introduce an arch_info.py file for ALMOS-MKH

File size: 10.8 KB
Line 
1#!/usr/bin/env python
2
3from arch_classes import *
4
5#######################################################################################
6#   file   : arch_info.py 
7#   date   : june 2018
8#   author : Alain Greiner
9#
10#  This file describes the <tsar_generic_leti> architecture for ALMOS-MKH.
11#######################################################################################
12#  This file defines a specific instance of the "tsar_generic_leti" architecture.
13#  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#  The default argument values are for the TSARLET prototype.
20#
21#  The "tsar_generic_leti" architecture  includes 6 external peripherals located
22#  in cluster[x_size-1][y_size-1]: TTY, IOC, FBF, NIC, CMA, PIC.
23#  It does not use the IOB component.
24#  It does not use an external ROM, as the preloader code is (pre)loaded
25#  at address 0x0, in the physical memory of cluster[0][0].
26#
27#  The upper row (y = y_size-1) does not contain processors or memory.
28#
29#  The "constructor" parameters (defined in Makefile) are:
30#  - x_size         : number of clusters in a row (from 1 to 16)
31#  - y_size         : number of clusters in a column (from 1 to 16)
32#  - nb_cores       : number of cores per cluster (from 1 to 4)
33#  - nb_ttys        : number of TTY channels (from 1 to 8)
34#  - nb_nics        : number of NIC channels (from 1 to 2)
35#  - fbf_width      : frame_buffer width = frame_buffer heigth
36#  - ioc_type       : can be 'IOC_BDV','IOC_HBA','IOC_SDC','IOC_RDK'
37#
38#  The others hardware parameters are defined below :
39#  - x_width        : number of bits for x coordinate
40#  - y_width        : number of bits for y coordinate
41#  - p_width        : number of bits for local core index
42#  - paddr_width    : number of bits for physical address
43#  - irq_per_proc   : number of input IRQs per processor
44#  - io_cxy         : IO_cluster identifier
45#  - boot_cxy       : boot_cluster identifier
46#  - cache_line     : number of bytes in cache line (64 for tsar)
47#  - devices_max    : max number of internal devices per cluster
48#####################################################################################
49
50
51########################
52def arch( x_size    = 2,
53          y_size    = 3,
54          nb_cores  = 4,
55          nb_ttys   = 3,
56          nb__nics  = 1,
57          fbf_width = 128,
58          ioc_type  = 'IOC_BDV'):
59
60    ### architecture constants
61
62    p_width         = 2 
63    x_width         = 4
64    y_width         = 4 
65    paddr_width     = 40 
66    irq_per_proc    = 4                                    # NetBSD constraint
67    io_cxy          = ((x_size-1)<<y_width) + (y_size-1)   # upper right cluster
68    boot_cxy        = 0
69    cache_line      = 64
70    devices_max     = 16 
71    reset_address   = 0x00000000                           # LETI constraint
72
73    ### constructors parameters checking
74
75    assert( nb_cores <= 4 )
76
77    assert( x_size <= (1 << x_width) )
78
79    assert( (y_size > 1) and (y_size <= (1 << y_width)) )
80
81    assert( (nb_ttys >= 1) and (nb_ttys <= 8) )
82
83    assert( (nb_nics >= 1) and (nb_nics <= 2) )
84
85    assert( ioc_type in ['IOC_BDV','IOC_HBA','IOC_SDC','IOC_SPI','IOC_RDK'] )
86
87    assert( ((boot_cxy >> y_width) < x_size) and ((boot_cxy & ((1<<y_width)-1)) < (y_size - 1) ) )
88
89    ### define type and name
90
91    platform_name  = 'tsar_leti_%d_%d_%d' % ( x_size, y_size, nb_cores )
92
93    ### define physical segments replicated in all non-IO clusters
94    ### the base address is extended by the cxy (8 bits)
95
96    ram_base = 0x0000000000
97    ram_size = 0x4000000                  # 64 Mbytes
98
99    xcu_base = 0x00F0000000
100    xcu_size = 0x1000                     # 4 Kbytes
101
102    mmc_base = 0x00F1000000
103    mmc_size = 0x1000                     # 4 Kbytes
104
105    ### define physical segments for external peripherals in IO cluster
106    ## These segments are extended byb the IO_cluster cxy (8bits)
107
108    ioc_base = 0x00F2000000
109    ioc_size = 0x1000                     # 4kbytes
110
111    fbf_base = 0x00F3000000
112    fbf_size = fbf_width * fbf_width      # fbf_width * fbf_width bytes
113
114    tty_base = 0x00F4000000
115    tty_size = 0x8000                     # 4 Kbytes * 8 channels
116
117    nic_base = 0x00F7000000
118    nic_size = 0x4000                     # 4 Kbytes * 4 channels
119
120    pic_base = 0x00F9000000
121    pic_size = 0x1000                     # 4 Kbytes
122
123    #############################
124    ### call header constructor
125    #############################
126
127    archi = Archinfo( name           = platform_name,
128                      x_size         = x_size,
129                      y_size         = y_size,
130                      cores_max      = nb_cores,
131                      devices_max    = devices_max,
132                      paddr_width    = paddr_width,
133                      x_width        = x_width,
134                      y_width        = y_width,
135                      irqs_per_core  = irqs_per_core,
136                      io_cxy         = io_cxy,         
137                      boot_cxy       = boot_cxy,
138                      cache_line     = cache_line,
139                      reset_address  = reset_address,
140                      p_width        = p_width )
141
142    ###########################
143    ### Hardware Description
144    ###########################
145
146    for x in xrange( x_size ):
147        for y in xrange( y_size ):
148            cluster_xy = (x << y_width) + y;
149            offset     = cluster_xy << (paddr_width - x_width - y_width)
150 
151            ### components replicated in all clusters but the upper row
152            if ( y < (y_size - 1) ):
153
154                ram = archi.addDevice( ptype = 'RAM_SCL',
155                                       base  = ram_base + offset, 
156                                       size  = ram_size )
157
158                mmc = archi.addDevice( ptype = 'MMC_TSR',
159                                       base  = mmc_base + offset, 
160                                       size  = mmc_size )
161
162                xcu = archi.addDevice( ptype    = 'ICU_XCU',
163                                       base     = xcu_base + offset, 
164                                       size     = xcu_size, 
165                                       channels = nb_cores * irq_per_proc, 
166                                       arg0 = 16, arg1 = 16, arg2 = 16 )
167
168                archi.addIrq( dstdev = xcu,
169                              port   = 8, 
170                              srcdev = mmc )
171
172                ### TTY backup
173                if ( x==0 ) and ( y==0 ):
174                    tty_bak = archi.addDevice( ptype    = 'TXT_TTY',
175                                               base     = tty_base + offset,
176                                               size     = tty_size, 
177                                               channels = nb_ttys )
178
179                    archi.addIrq( dstdev  = xcu, 
180                                  port    = 10, 
181                                  srcdev  = tty_bak,
182                                  channel = 0,
183                                  is_rx   = False )
184
185                for p in xrange ( nb_cores ):
186                    archi.addProc( x, y, p )
187
188            ###  peripherals in external cluster_io
189            if( cluster_xy == io_cxy ):
190
191                tty = archi.addDevice( ptype    = 'TXT_TTY',
192                                       base     = tty_base + offset,
193                                       size     = tty_size, 
194                                       channels = nb_ttys )
195
196                ioc = archi.addDevice( ptype    = ioc_type,
197                                       base     = ioc_base + offset,
198                                       size     = ioc_size )
199
200                nic = archi.addDevice( ptype    = 'NIC_CBF',
201                                       base     = nic_base + offset,
202                                       size     = nic_size, 
203                                       channels = nb_nics )
204
205                fbf = archi.addDevice( ptype = 'FBF_SCL',
206                                       base  = fbf_base + offset,
207                                       size  = fbf_size, 
208                                       arg0 = fbf_width, arg1 = fbf_width )
209
210                pic = archi.addDevice( 'PIC', base = pic_base + offset, size = pic_size, 
211                                         ptype = 'PIC', channels = 32 )
212
213                archi.addIrq( dstdev = pic, port = 0, srcdev = nic, channel = 0 )
214# todo
215#                archi.addIrq( pic, index = 1, src = nic,
216#                                isrtype = 'ISR_NIC_RX', channel = 1 )
217#                archi.addIrq( pic, index = 2, src = nic,
218#                                isrtype = 'ISR_NIC_TX', channel = 0 )
219#                archi.addIrq( pic, index = 3, src = nic,
220#                                isrtype = 'ISR_NIC_TX', channel = 1 )
221#                archi.addIrq( pic, index = 4, src = cma,
222#                                isrtype = 'ISR_CMA', channel = 0 )
223#                archi.addIrq( pic, index = 5, src = cma,
224#                                isrtype = 'ISR_CMA', channel = 1 )
225#                archi.addIrq( pic, index = 6, src = cma,
226#                                isrtype = 'ISR_CMA', channel = 2 )
227#                archi.addIrq( pic, index = 7, src = cma,
228#                                isrtype = 'ISR_CMA', channel = 3 )
229
230
231                archi.addIrq( dstdev = pic, port = 8, srcdev = ioc )
232
233#                archi.addIrq( pic, index = 16, src = tty,
234#                                isrtype = 'ISR_TTY_RX', channel = 0 )
235#                archi.addIrq( pic, index = 17, src = tty,
236#                                isrtype = 'ISR_TTY_RX', channel = 1 )
237#                archi.addIrq( pic, index = 18, src = tty,
238#                                isrtype = 'ISR_TTY_RX', channel = 2 )
239#                archi.addIrq( pic, index = 19, src = tty,
240#                                isrtype = 'ISR_TTY_RX', channel = 3 )
241#                archi.addIrq( pic, index = 20, src = tty,
242#                                isrtype = 'ISR_TTY_RX', channel = 4 )
243#                archi.addIrq( pic, index = 21, src = tty,
244#                                isrtype = 'ISR_TTY_RX', channel = 5 )
245#                archi.addIrq( pic, index = 22, src = tty,
246#                                isrtype = 'ISR_TTY_RX', channel = 6 )
247#                archi.addIrq( pic, index = 23, src = tty,
248#                                isrtype = 'ISR_TTY_RX', channel = 7 )
249
250    return archi
251
252########################## platform test #############################################
253
254if __name__ == '__main__':
255
256    archi = Archinfo( x_size    = 2,
257                      y_size    = 3,
258                      nb_cores  = 2 )
259
260    print archi.xml()
261
262#   print archi.giet_vsegs()
263
264
265# Local Variables:
266# tab-width: 4;
267# c-basic-offset: 4;
268# c-file-offsets:((innamespace . 0)(inline-open . 0));
269# indent-tabs-mode: nil;
270# End:
271#
272# vim: filetype=python:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
273
Note: See TracBrowser for help on using the repository browser.