1 | |
---|
2 | |
---|
3 | exec(file("hard_params.py")) |
---|
4 | |
---|
5 | |
---|
6 | def hard_config(x, y, x_width, y_width, p, hard_config, protocol): |
---|
7 | |
---|
8 | x_io = get_x_io(x_width, y_width) |
---|
9 | y_io = get_y_io(x_width, y_width) |
---|
10 | |
---|
11 | seg_rom_base = BOOT_ADDR |
---|
12 | seg_rom_size = ROM_SIZE |
---|
13 | |
---|
14 | seg_ram_base = RAM_BASE |
---|
15 | seg_ram_size = ram_size(x_width, y_width) |
---|
16 | |
---|
17 | seg_xcu_base = replicated_periph_base_addr(x_width, y_width, XCU_TGTID) |
---|
18 | seg_xcu_size = XCU_SIZE |
---|
19 | |
---|
20 | seg_dma_base = replicated_periph_base_addr(x_width, y_width, DMA_TGTID) |
---|
21 | seg_dma_size = DMA_SIZE * NB_DMA_CHANNELS |
---|
22 | |
---|
23 | seg_ioc_base = periph_addr(x_width, y_width, IOC_TGTID); |
---|
24 | seg_ioc_size = IOC_SIZE |
---|
25 | |
---|
26 | seg_tty_base = periph_addr(x_width, y_width, TTY_TGTID) |
---|
27 | seg_tty_size = TTY_SIZE |
---|
28 | |
---|
29 | seg_fbf_base = periph_addr(x_width, y_width, FBF_TGTID) |
---|
30 | seg_fbf_size = FBF_X_SIZE * FBF_Y_SIZE * 2 |
---|
31 | |
---|
32 | seg_nic_base = periph_addr(x_width, y_width, NIC_TGTID) |
---|
33 | seg_nic_size = NIC_SIZE |
---|
34 | |
---|
35 | seg_cma_base = periph_addr(x_width, y_width, CMA_TGTID) |
---|
36 | seg_cma_size = CMA_SIZE * NB_CMA_CHANNELS |
---|
37 | |
---|
38 | seg_sim_base = periph_addr(x_width, y_width, SIM_TGTID) |
---|
39 | seg_sim_size = SIM_SIZE |
---|
40 | |
---|
41 | header = ''' |
---|
42 | #ifndef _HARD_CONFIG_H_ |
---|
43 | #define _HARD_CONFIG_H_ |
---|
44 | |
---|
45 | /* Generated from gen_hard_config.py */ |
---|
46 | |
---|
47 | /* General platform parameters */ |
---|
48 | |
---|
49 | #define X_SIZE %(x_size)d |
---|
50 | #define Y_SIZE %(y_size)d |
---|
51 | #define X_WIDTH %(x_width)d |
---|
52 | #define Y_WIDTH %(y_width)d |
---|
53 | #define P_WIDTH 4 |
---|
54 | #define X_IO %(x_io)d |
---|
55 | #define Y_IO %(y_io)d |
---|
56 | #define NB_PROCS_MAX %(proc_per_clus)d |
---|
57 | #define IRQ_PER_PROCESSOR 4 |
---|
58 | #define RESET_ADDRESS 0x%(seg_rom_base)x |
---|
59 | |
---|
60 | |
---|
61 | /* Peripherals */ |
---|
62 | |
---|
63 | #define RAM_TGTID %(ram_tgtid)d |
---|
64 | #define XCU_TGTID %(xcu_tgtid)d |
---|
65 | #define DMA_TGTID %(dma_tgtid)d |
---|
66 | #define TTY_TGTID %(tty_tgtid)d |
---|
67 | #define IOC_TGTID %(ioc_tgtid)d |
---|
68 | #define NIC_TGTID %(nic_tgtid)d |
---|
69 | #define ROM_TGTID %(rom_tgtid)d |
---|
70 | #define CMA_TGTID %(cma_tgtid)d |
---|
71 | #define SIM_TGTID %(sim_tgtid)d |
---|
72 | #define FBF_TGTID %(fbf_tgtid)d |
---|
73 | |
---|
74 | #define NB_TTY_CHANNELS %(nb_tty_channels)d |
---|
75 | #define NB_IOC_CHANNELS %(nb_ioc_channels)d |
---|
76 | #define NB_NIC_CHANNELS 0 |
---|
77 | #define NB_CMA_CHANNELS %(nb_cma_channels)d |
---|
78 | #define NB_TIM_CHANNELS 0 |
---|
79 | #define NB_DMA_CHANNELS %(nb_dma_channels)d |
---|
80 | |
---|
81 | #define USE_XCU 1 |
---|
82 | #define USE_IOB 0 |
---|
83 | #define USE_PIC 0 |
---|
84 | #define USE_FBF 1 |
---|
85 | |
---|
86 | #define USE_IOC_BDV 1 |
---|
87 | #define USE_IOC_SDC 0 |
---|
88 | #define USE_IOC_HBA 0 |
---|
89 | #define USE_IOC_RDK 0 |
---|
90 | |
---|
91 | #define FBF_X_SIZE %(fbf_x_size)d |
---|
92 | #define FBF_Y_SIZE %(fbf_y_size)d |
---|
93 | |
---|
94 | |
---|
95 | /* base addresses and sizes for physical segments */ |
---|
96 | |
---|
97 | #define SEG_RAM_BASE 0x%(seg_ram_base)x |
---|
98 | #define SEG_RAM_SIZE 0x%(seg_ram_size)x |
---|
99 | |
---|
100 | #define SEG_CMA_BASE 0x0 // Component requires a multiple of 4K |
---|
101 | #define SEG_CMA_SIZE 0x0 |
---|
102 | |
---|
103 | #define SEG_DMA_BASE 0x%(seg_dma_base)x |
---|
104 | #define SEG_DMA_SIZE 0x%(seg_dma_size)x |
---|
105 | |
---|
106 | #define SEG_FBF_BASE 0x%(seg_fbf_base)x |
---|
107 | #define SEG_FBF_SIZE 0x%(seg_fbf_size)x |
---|
108 | |
---|
109 | #define SEG_ICU_BASE 0xffffffff |
---|
110 | #define SEG_ICU_SIZE 0x0 |
---|
111 | |
---|
112 | #define SEG_IOB_BASE 0xffffffff |
---|
113 | #define SEG_IOB_SIZE 0x0 |
---|
114 | |
---|
115 | #define SEG_IOC_BASE 0x%(seg_ioc_base)x |
---|
116 | #define SEG_IOC_SIZE 0x%(seg_ioc_size)x |
---|
117 | |
---|
118 | #define SEG_MMC_BASE 0xffffffff |
---|
119 | #define SEG_MMC_SIZE 0x0 |
---|
120 | |
---|
121 | #define SEG_MWR_BASE 0xffffffff |
---|
122 | #define SEG_MWR_SIZE 0x0 |
---|
123 | |
---|
124 | #define SEG_ROM_BASE 0x%(seg_rom_base)x |
---|
125 | #define SEG_ROM_SIZE 0x%(seg_rom_size)x |
---|
126 | |
---|
127 | #define SEG_SIM_BASE 0x%(seg_sim_base)x |
---|
128 | #define SEG_SIM_SIZE 0x%(seg_sim_size)x |
---|
129 | |
---|
130 | #define SEG_NIC_BASE 0x%(seg_nic_base)x |
---|
131 | #define SEG_NIC_SIZE 0x%(seg_nic_size)x |
---|
132 | |
---|
133 | #define SEG_PIC_BASE 0xffffffff |
---|
134 | #define SEG_PIC_SIZE 0x0 |
---|
135 | |
---|
136 | #define SEG_TIM_BASE 0xffffffff |
---|
137 | #define SEG_TIM_SIZE 0x0 |
---|
138 | |
---|
139 | #define SEG_TTY_BASE 0x%(seg_tty_base)x |
---|
140 | #define SEG_TTY_SIZE 0x%(seg_tty_size)x |
---|
141 | |
---|
142 | #define SEG_XCU_BASE 0x%(seg_xcu_base)x |
---|
143 | #define SEG_XCU_SIZE 0x%(seg_xcu_size)x |
---|
144 | |
---|
145 | #define SEG_RDK_BASE 0xffffffff |
---|
146 | #define SEG_RDK_SIZE 0x0 |
---|
147 | |
---|
148 | ''' % dict(x_size = x, y_size = y, x_width = x_width, y_width = y_width, |
---|
149 | x_io = x_io, |
---|
150 | y_io = y_io, |
---|
151 | proc_per_clus = p, |
---|
152 | nb_tty_channels = NB_TTY_CHANNELS, |
---|
153 | nb_ioc_channels = NB_IOC_CHANNELS, |
---|
154 | nb_cma_channels = NB_CMA_CHANNELS, |
---|
155 | nb_dma_channels = NB_DMA_CHANNELS, |
---|
156 | fbf_x_size = FBF_X_SIZE, fbf_y_size = FBF_Y_SIZE, |
---|
157 | ram_tgtid = RAM_TGTID, |
---|
158 | xcu_tgtid = XCU_TGTID, |
---|
159 | dma_tgtid = DMA_TGTID, |
---|
160 | tty_tgtid = TTY_TGTID, |
---|
161 | ioc_tgtid = IOC_TGTID, |
---|
162 | nic_tgtid = NIC_TGTID, |
---|
163 | rom_tgtid = ROM_TGTID, |
---|
164 | cma_tgtid = CMA_TGTID, |
---|
165 | sim_tgtid = SIM_TGTID, |
---|
166 | fbf_tgtid = FBF_TGTID, |
---|
167 | seg_ram_base = seg_ram_base, |
---|
168 | seg_ram_size = seg_ram_size, |
---|
169 | seg_dma_base = seg_dma_base, |
---|
170 | seg_dma_size = seg_dma_size, |
---|
171 | seg_fbf_base = seg_fbf_base, |
---|
172 | seg_fbf_size = seg_fbf_size, |
---|
173 | seg_ioc_base = seg_ioc_base, |
---|
174 | seg_ioc_size = seg_ioc_size, |
---|
175 | seg_rom_base = seg_rom_base, |
---|
176 | seg_rom_size = seg_rom_size, |
---|
177 | seg_sim_base = seg_sim_base, |
---|
178 | seg_sim_size = seg_sim_size, |
---|
179 | seg_nic_base = seg_nic_base, |
---|
180 | seg_nic_size = seg_nic_size, |
---|
181 | seg_tty_base = seg_tty_base, |
---|
182 | seg_tty_size = seg_tty_size, |
---|
183 | seg_xcu_base = seg_xcu_base, |
---|
184 | seg_xcu_size = seg_xcu_size) |
---|
185 | |
---|
186 | if protocol == 'wtidl': |
---|
187 | header += '#define WT_IDL\n' |
---|
188 | |
---|
189 | header += '#endif //_HD_CONFIG_H\n' |
---|
190 | |
---|
191 | file = open(hard_config, 'w') |
---|
192 | file.write(header) |
---|
193 | file.close() |
---|
194 | |
---|
195 | |
---|
196 | if __name__ == "__main__": |
---|
197 | if len(sys.argv) != 6: |
---|
198 | print "Usage: %s <x> <y> <p> <hard_config-filename> <protocol>" % argv[0] |
---|
199 | print "with:" |
---|
200 | print "<x>: number of clusters in X" |
---|
201 | print "<y>: number of clusters in Y" |
---|
202 | print "<p>: number of processors per clusters" |
---|
203 | sys.exit(0) |
---|
204 | |
---|
205 | x = argv[1] |
---|
206 | y = argv[2] |
---|
207 | p = argv[3] |
---|
208 | hard_config_filename = argv[4] |
---|
209 | protocol = argv[5] |
---|
210 | |
---|
211 | hard_config(x, y, p, hard_config_filename, protocol) |
---|
212 | |
---|
213 | |
---|