Changes between Initial Version and Version 1 of Soclib Cc


Ignore:
Timestamp:
Mar 27, 2007, 6:00:12 PM (17 years ago)
Author:
Nicolas Pouillon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Soclib Cc

    v1 v1  
     1
     2In 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
     9Your '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
     17Your platform description should be a python-parseable file, defining
     18variable `todo', instance of type `Platform'. Arguments passed to
     19`Platform' are the used components, and you custom files (You may want
     20to link in more than one custom .cc file).
     21
     22
     23Example
     24-------
     25
     26I will only use a mapping table, instanciate it, and compile a
     27platform:
     28
     29top.cc:
     30{{{
     31#include <iostream>
     32#include <systemc.h>
     33#include "common/mapping_table.h"
     34
     35int 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
     54platform_desc:
     55{{{
     56todo = Platform(
     57    Uses('mapping_table'),
     58    Source('top.cc'),
     59)
     60}}}
     61
     62Now the compilation:
     63{{{
     64$ soclib-cc -p platform_desc
     65soclib-cc: Entering directory `/Users/nipo/labo/soclib/rose/soclib'
     66CxxSource gen repos/release/soclib::common::MappingTable_mapping_table.cc
     67CreateDir gen repos/release
     68CxxSource gen repos/release/soclib::common::AddressDecodingTable_input_t=unsigned_int,output_t=bool_address_decoding_table.cc
     69CxxSource gen repos/release/soclib::common::AddressDecodingTable_input_t=unsigned_int,output_t=int_address_decoding_table.cc
     70CxxSource gen repos/release/soclib::common::AddressMaskingTable_data_t=unsigned_int_address_masking_table.cc
     71CxxSource gen repos/release/soclib::common::Segment_segment.cc
     72CxxCompile compile repos/release/soclib::common::MappingTable_mapping_table.o
     73CxxCompile compile repos/release/soclib::common::AddressDecodingTable_input_t=unsigned_int,output_t=bool_address_decoding_table.o
     74CxxCompile compile repos/release/soclib::common::AddressDecodingTable_input_t=unsigned_int,output_t=int_address_decoding_table.o
     75CxxCompile compile repos/release/soclib::common::AddressMaskingTable_data_t=unsigned_int_address_masking_table.o
     76CxxCompile compile repos/release/soclib::common::Segment_segment.o
     77CxxCompile compile top.o
     78CxxLink link system.x
     79$
     80}}}
     81
     82And 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
     89Mapping table is:
     90Mapping 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
     99For complete examples, watch in `/path/to/soclib/platforms/'.