| | 1 | = Standard usage = |
| | 2 | |
| | 3 | When using a VCI-compliant component, you must define explicitely VCI parameters: |
| | 4 | |
| | 5 | {{{ |
| | 6 | Uses('vci_multi_ram', |
| | 7 | cell_size = 4, |
| | 8 | plen_size = 1, |
| | 9 | addr_size = 32, |
| | 10 | rerror_size = 1, |
| | 11 | clen_size = 1, |
| | 12 | rflag_size = 1, |
| | 13 | srcid_size = 8, |
| | 14 | pktid_size = 1, |
| | 15 | trdid_size = 1, |
| | 16 | wrplen_size = 1 ) |
| | 17 | }}} |
| | 18 | |
| | 19 | When repeated for all components, this can be redundant and error prone (not even speaking of readability): |
| | 20 | |
| | 21 | {{{ |
| | 22 | todo = Platform( |
| | 23 | Uses('vci_multi_ram', cell_size = 4, plen_size = 1, addr_size = 32, rerror_size = 1, |
| | 24 | clen_size = 1, rflag_size = 1, srcid_size = 8, pktid_size = 1, trdid_size = 1, |
| | 25 | wrplen_size = 1 ), |
| | 26 | Uses('vci_vgmn', cell_size = 4, plen_size = 1, addr_size = 32, rerror_size = 1, |
| | 27 | clen_size = 1, rflag_size = 1, srcid_size = 8, pktid_size = 1, trdid_size = 1, |
| | 28 | wrplen_size = 1 ), |
| | 29 | Uses('vci_xcache', cell_size = 4, plen_size = 1, addr_size = 32, rerror_size = 1, |
| | 30 | clen_size = 1, rflag_size = 1, srcid_size = 8, pktid_size = 1, trdid_size = 1, |
| | 31 | wrplen_size = 1 ), |
| | 32 | Uses('vci_timer', cell_size = 4, plen_size = 1, addr_size = 32, rerror_size = 1, |
| | 33 | clen_size = 1, rflag_size = 1, srcid_size = 8, pktid_size = 1, trdid_size = 1, |
| | 34 | wrplen_size = 1 ), |
| | 35 | Uses('mips'), |
| | 36 | ) |
| | 37 | }}} |
| | 38 | |
| | 39 | So you may factor out common parameters: |
| | 40 | |
| | 41 | {{{ |
| | 42 | vci_params = dict( |
| | 43 | cell_size = 4, |
| | 44 | plen_size = 1, |
| | 45 | addr_size = 32, |
| | 46 | rerror_size = 1, |
| | 47 | clen_size = 1, |
| | 48 | rflag_size = 1, |
| | 49 | srcid_size = 8, |
| | 50 | pktid_size = 1, |
| | 51 | trdid_size = 1, |
| | 52 | wrplen_size = 1 |
| | 53 | ) |
| | 54 | |
| | 55 | todo = Platform( |
| | 56 | Uses('mips'), |
| | 57 | Uses('vci_locks', **vci_params), |
| | 58 | Uses('vci_multi_ram', **vci_params), |
| | 59 | Uses('vci_multi_tty', **vci_params), |
| | 60 | Uses('vci_timer', **vci_params), |
| | 61 | Uses('vci_vgmn', **vci_params), |
| | 62 | Uses('vci_xcache', **vci_params), |
| | 63 | Source('top.cc'), |
| | 64 | ) |
| | 65 | }}} |
| | 66 | |
| | 67 | The `**variable_name` will be expanded with all the things defined in the variable, for every line, source:trunk/soclib/platforms/timer_4mips/platform_desc is a live example. |
| | 68 | |
| | 69 | If you have some exceptionnal template parameter to add in for one component, you can specify it ''before'' the expanded one: |
| | 70 | |
| | 71 | {{{ |
| | 72 | vci_params = dict( |
| | 73 | cell_size = 4, |
| | 74 | [...] |
| | 75 | ) |
| | 76 | |
| | 77 | [...] |
| | 78 | Uses('vci_vgmn', write_buffer_depth = 16, **vci_params), |
| | 79 | [...] |
| | 80 | }}} |
| | 81 | |