| 1 | |
| 2 | In order to compile a platform with soclib-cc, you need: |
| 3 | |
| 4 | * Your 'top-cell' SystemC netlist, |
| 5 | * A platform description file, listing all used components and their |
| 6 | parameters. |
| 7 | |
| 8 | |
| 9 | Your 'top-cell' file should |
| 10 | * Include all soclib component definitions |
| 11 | * Paths are relative to systemc/include |
| 12 | * Define a sc_main, |
| 13 | * Create the components, signals, ... |
| 14 | * Connect them |
| 15 | * Run simulation. |
| 16 | |
| 17 | Your platform description should be a python-parseable file, defining |
| 18 | variable `todo', instance of type `Platform'. Arguments passed to |
| 19 | `Platform' are the used components, and you custom files (You may want |
| 20 | to link in more than one custom .cc file). |
| 21 | |
| 22 | |
| 23 | Example |
| 24 | ------- |
| 25 | |
| 26 | I will only use a mapping table, instanciate it, and compile a |
| 27 | platform: |
| 28 | |
| 29 | top.cc: |
| 30 | {{{ |
| 31 | #include <iostream> |
| 32 | #include <systemc.h> |
| 33 | #include "common/mapping_table.h" |
| 34 | |
| 35 | int sc_main(int argc, char **argv) |
| 36 | { |
| 37 | using soclib::common::IntTab; |
| 38 | using soclib::common::MappingTable; |
| 39 | using soclib::common::Segment; |
| 40 | |
| 41 | MappingTable mt(32, IntTab(2), IntTab(2), 0x300000); |
| 42 | mt.add( Segment("reset", 0xbfc00000, 0x800, IntTab(0), true) ); |
| 43 | mt.add( Segment("excep", 0x80000080, 0x100, IntTab(0), true) ); |
| 44 | mt.add( Segment("data", 0x40000000, 0x4000, IntTab(1), true) ); |
| 45 | mt.add( Segment("code", 0x04000000, 0x4000, IntTab(2), true) ); |
| 46 | |
| 47 | std::cout |
| 48 | << "Mapping table is:" << std::endl |
| 49 | << mt << std::endl; |
| 50 | return 0; |
| 51 | } |
| 52 | }}} |
| 53 | |
| 54 | platform_desc: |
| 55 | {{{ |
| 56 | todo = Platform( |
| 57 | Uses('mapping_table'), |
| 58 | Source('top.cc'), |
| 59 | ) |
| 60 | }}} |
| 61 | |
| 62 | Now the compilation: |
| 63 | {{{ |
| 64 | $ soclib-cc -p platform_desc |
| 65 | soclib-cc: Entering directory `/Users/nipo/labo/soclib/rose/soclib' |
| 66 | CxxSource gen repos/release/soclib::common::MappingTable_mapping_table.cc |
| 67 | CreateDir gen repos/release |
| 68 | CxxSource gen repos/release/soclib::common::AddressDecodingTable_input_t=unsigned_int,output_t=bool_address_decoding_table.cc |
| 69 | CxxSource gen repos/release/soclib::common::AddressDecodingTable_input_t=unsigned_int,output_t=int_address_decoding_table.cc |
| 70 | CxxSource gen repos/release/soclib::common::AddressMaskingTable_data_t=unsigned_int_address_masking_table.cc |
| 71 | CxxSource gen repos/release/soclib::common::Segment_segment.cc |
| 72 | CxxCompile compile repos/release/soclib::common::MappingTable_mapping_table.o |
| 73 | CxxCompile compile repos/release/soclib::common::AddressDecodingTable_input_t=unsigned_int,output_t=bool_address_decoding_table.o |
| 74 | CxxCompile compile repos/release/soclib::common::AddressDecodingTable_input_t=unsigned_int,output_t=int_address_decoding_table.o |
| 75 | CxxCompile compile repos/release/soclib::common::AddressMaskingTable_data_t=unsigned_int_address_masking_table.o |
| 76 | CxxCompile compile repos/release/soclib::common::Segment_segment.o |
| 77 | CxxCompile compile top.o |
| 78 | CxxLink link system.x |
| 79 | $ |
| 80 | }}} |
| 81 | |
| 82 | And running: |
| 83 | {{{ |
| 84 | $ ./system.x |
| 85 | |
| 86 | SystemC 2.2.05jun06_beta --- Aug 29 2006 16:42:34 |
| 87 | Copyright (c) 1996-2006 by all Contributors |
| 88 | ALL RIGHTS RESERVED |
| 89 | Mapping table is: |
| 90 | Mapping table: ad:(2) |
| 91 | <Segment "reset": @0xbfc00000, 0x800 bytes, (0), cached> |
| 92 | <Segment "excep": @0x80000080, 0x100 bytes, (0), cached> |
| 93 | <Segment "data": @0x40000000, 0x4000 bytes, (1), cached> |
| 94 | <Segment "code": @0x4000000, 0x4000 bytes, (2), cached> |
| 95 | |
| 96 | $ |
| 97 | }}} |
| 98 | |
| 99 | For complete examples, watch in `/path/to/soclib/platforms/'. |