| | 1 | {{{ |
| | 2 | #!/usr/bin/env python |
| | 3 | |
| | 4 | import dsx |
| | 5 | import soclib |
| | 6 | |
| | 7 | def _cluster(arch, no, |
| | 8 | ncpu, nram, |
| | 9 | icache_lines, icache_words, |
| | 10 | dcache_lines, dcache_words): |
| | 11 | |
| | 12 | crossbar = arch.create('caba:vci_local_crossbar', 'lc%d'%no) |
| | 13 | |
| | 14 | for i in range(ncpu): |
| | 15 | cn = arch.cpu_num |
| | 16 | arch.cpu_num += 1 |
| | 17 | |
| | 18 | cpu = arch.create('caba:vci_xcache_wrapper', 'cpu%d_%d'%(no,i), |
| | 19 | iss_t='common:mips32el', |
| | 20 | ident = cn, |
| | 21 | icache_ways = 1, |
| | 22 | icache_sets = icache_lines, |
| | 23 | icache_words = icache_words, |
| | 24 | dcache_ways = 1, |
| | 25 | dcache_sets = dcache_lines, |
| | 26 | dcache_words = dcache_words, |
| | 27 | ) |
| | 28 | |
| | 29 | crossbar.to_initiator.new() // cpu.vci |
| | 30 | |
| | 31 | for i in range(nram): |
| | 32 | ram = arch.create('caba:vci_ram', 'ram%d_%d'%(no,i)) |
| | 33 | base = 0x10000000*(1+no)+0x1000000*i |
| | 34 | ram.addSegment('cram%d_%d'%(no,i), base, 0x100000, True) |
| | 35 | ram.addSegment('uram%d_%d'%(no,i), base + 0x400000, 0x100000, False) |
| | 36 | ram.vci // crossbar.to_target.new() |
| | 37 | |
| | 38 | if no == 0: |
| | 39 | ram.addSegment('boot', 0xbfc00000, 0x1000,True) |
| | 40 | ram.addSegment('excep', 0x80000080, 0x1000,True) |
| | 41 | |
| | 42 | return crossbar |
| | 43 | |
| | 44 | def ClusteredNoirqMulti( |
| | 45 | cpus = [1], |
| | 46 | rams = [1], |
| | 47 | min_latency = 10, |
| | 48 | icache_lines = 32, |
| | 49 | icache_words = 8, |
| | 50 | dcache_lines = 32, |
| | 51 | dcache_words = 8 ): |
| | 52 | |
| | 53 | arch = soclib.Architecture( |
| | 54 | cell_size = 4, |
| | 55 | plen_size = 9, |
| | 56 | addr_size = 32, |
| | 57 | rerror_size = 1, |
| | 58 | clen_size = 1, |
| | 59 | rflag_size = 1, |
| | 60 | srcid_size = 8, |
| | 61 | pktid_size = 1, |
| | 62 | trdid_size = 1, |
| | 63 | wrplen_size = 1 |
| | 64 | ) |
| | 65 | arch.cpu_num = 0 |
| | 66 | |
| | 67 | mt = arch.create('common:mapping_table', |
| | 68 | 'mapping_table', |
| | 69 | addr_bits = [5,3], |
| | 70 | srcid_bits = [4,4], |
| | 71 | cacheability_mask = 0xc00000) |
| | 72 | |
| | 73 | arch.create('common:loader', 'loader') |
| | 74 | |
| | 75 | vgmn = arch.create('caba:vci_vgmn', 'vgmn0', min_latency = min_latency, fifo_depth = 8, mt = mt) |
| | 76 | |
| | 77 | for no, (ncpu, nram) in enumerate(zip(cpus, rams)): |
| | 78 | lc = _cluster( |
| | 79 | arch, no, |
| | 80 | ncpu = ncpu, nram = nram, |
| | 81 | icache_lines = icache_lines, icache_words = icache_words, |
| | 82 | dcache_lines = dcache_lines, dcache_words = dcache_words) |
| | 83 | vgmn.to_initiator.new() // lc.initiator_to_up |
| | 84 | vgmn.to_target.new() // lc.target_to_up |
| | 85 | |
| | 86 | # if cluster == 0 |
| | 87 | # add tg at address 0x16400000 |
| | 88 | ... |
| | 89 | |
| | 90 | # if cluster == 3 |
| | 91 | # add ramdac at address 0x46400000 |
| | 92 | ... |
| | 93 | |
| | 94 | tty = arch.create('caba:vci_multi_tty', 'tty', names = ['tty0']) |
| | 95 | tty.addSegment('tty', 0x95400000, 0x20, False) |
| | 96 | tty.vci // lc.to_target.new() |
| | 97 | |
| | 98 | return arch |
| | 99 | }}} |