[1023] | 1 | |
---|
| 2 | RAM_TGTID = 0 |
---|
| 3 | XCU_TGTID = 1 |
---|
| 4 | DMA_TGTID = 2 |
---|
| 5 | TTY_TGTID = 3 |
---|
| 6 | IOC_TGTID = 4 |
---|
| 7 | NIC_TGTID = 5 |
---|
| 8 | ROM_TGTID = 6 |
---|
| 9 | CMA_TGTID = 7 |
---|
| 10 | SIM_TGTID = 8 |
---|
| 11 | FBF_TGTID = 9 |
---|
| 12 | |
---|
| 13 | DMA_SIZE = 0X00001000 |
---|
| 14 | XCU_SIZE = 0X00001000 |
---|
| 15 | TTY_SIZE = 0X00001000 |
---|
| 16 | IOC_SIZE = 0X00001000 |
---|
| 17 | NIC_SIZE = 0x00080000 |
---|
| 18 | ROM_SIZE = 0x00100000 |
---|
| 19 | CMA_SIZE = 0x00004000 |
---|
| 20 | SIM_SIZE = 0X00001000 |
---|
| 21 | FBF_SIZE = 0X00200000 |
---|
| 22 | |
---|
| 23 | RAM_BASE = 0x0 |
---|
| 24 | RAM_MAX_TOTAL_SIZE = 0x10000000 |
---|
| 25 | RAM_MAX_CLUST_SIZE = 0x10000000 |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | NB_DMA_CHANNELS = 1 |
---|
| 29 | NB_CMA_CHANNELS = 0 |
---|
| 30 | NB_TTY_CHANNELS = 4 |
---|
| 31 | NB_IOC_CHANNELS = 1 |
---|
| 32 | TTY_CHANNEL_SIZE = 0X00000010 |
---|
| 33 | |
---|
| 34 | FBF_X_SIZE = 1024 |
---|
| 35 | FBF_Y_SIZE = 1024 |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | P_WIDTH = 4 |
---|
| 39 | |
---|
| 40 | ADDR_WIDTH = 32 |
---|
| 41 | BOOT_ADDR = 0xbfc00000 |
---|
| 42 | |
---|
| 43 | OUTPUT_IRQ_PER_PROC = 4 |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | def get_x_io(x_width, y_width): |
---|
| 47 | return BOOT_ADDR >> (ADDR_WIDTH - x_width) |
---|
| 48 | |
---|
| 49 | def get_y_io(x_width, y_width): |
---|
| 50 | return (BOOT_ADDR >> (ADDR_WIDTH - x_width - y_width)) & ((1 << y_width) - 1) |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | def replicated_periph_base_addr(x_width, y_width, tgtid): |
---|
| 54 | demi_cluster_inc = (1 << (ADDR_WIDTH - 1)) >> (x_width + y_width) |
---|
| 55 | return demi_cluster_inc + (tgtid << 19) |
---|
| 56 | |
---|
| 57 | def replicated_periph_addr(x, y, x_width, y_width, base_addr): |
---|
| 58 | cid = x * (1 << y_width) + y |
---|
| 59 | demi_cluster_inc = (1 << (ADDR_WIDTH - 1)) >> (x_width + y_width) |
---|
| 60 | return demi_cluster_inc * 2 * cid + base_addr |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | def periph_addr(x_width, y_width, tgtid): |
---|
| 65 | demi_cluster_inc = (1 << (ADDR_WIDTH - 1)) >> (x_width + y_width) |
---|
| 66 | |
---|
| 67 | x_io = get_x_io(x_width, y_width) |
---|
| 68 | y_io = get_y_io(x_width, y_width) |
---|
| 69 | cluster_io_id = x_io * (1 << y_width) + y_io |
---|
| 70 | cluster_io_offset = cluster_io_id * demi_cluster_inc * 2 |
---|
| 71 | return demi_cluster_inc + cluster_io_offset + (tgtid << 19) |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | def ram_size(x_width, y_width): |
---|
| 75 | return min(RAM_MAX_TOTAL_SIZE >> (x_width + y_width), RAM_MAX_CLUST_SIZE) |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | def ram_addr(x, y, x_width, y_width): |
---|
| 79 | cid = x * (1 << y_width) + y |
---|
| 80 | demi_cluster_inc = (1 << (ADDR_WIDTH - 1)) >> (x_width + y_width) |
---|
| 81 | return demi_cluster_inc * 2 * cid + RAM_BASE |
---|
| 82 | |
---|