Changes between Version 17 and Version 18 of Writing Rules/Caba


Ignore:
Timestamp:
Apr 26, 2007, 4:15:01 PM (17 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Writing Rules/Caba

    v17 v18  
    44}}}
    55[[PageOutline]]
    6 = Introduction =
     6= A) Introduction =
    77
    88This manual describes the modeling rules for writing "cycle-accurate / bit-accurate" SystemC simulation models for SoCLib. Models complying with those rules can be used with the "standard" OSCI simulation engine (SystemC 2.x), but can be used also with others simulation engines, such as [SystemCass SystemCASS], which is optimized for such models.
     
    2323In this figure we represented a single FSM, but a SoCLib component contains generally several small FSMs running in parallel inside a single module. This internal parallelism should be properly described.
    2424
    25 = Components =
     25= B) CABA rules =
     26
     27== B1) Components ==
    2628
    2729A SoCLib CABA simulation model for an hardware component `XXX` is generally described as a class derived from the
    2830[source:trunk/soclib/systemc/include/caba/util/base_module.h soclib::caba::BaseModule] class.
    29 
    30 
    3131
    3232At least two files are associated to each hardware component:
     
    3434 * `XXX.cc` contains the code of the methods associated to this component.
    3535
    36 = VCI Interface =
     36== B2) VCI Interface ==
    3737
    3838In order to enforce interoperability, all hardware architectures build with the SoCLib component library
     
    7373A SoCLib hardware component that has no VCI interface should use a dedicated VCI  wrapper in order to be connected to the VCI interconnect.
    7474
    75 = Address space segmentation =
     75== B3) Address space segmentation ==
    7676
    7777[[Image(WritingRules:guideline.png, nolink)]]
     
    107107Any hardware component using the memory map should have a constant reference to the mapping table as constructor argument.
    108108
    109 = Component ressources =
     109== B4) Component definition ==
    110110
    111111[[Image(WritingRules:guideline.png, nolink)]]
     
    113113The component ''XXX.h'' file contains the following informations
    114114
    115 == Interface definition ==
     115=== Interface definition ===
    116116
    117117A typical VCI target component will contain the following ports:
     
    122122}}}
    123123
    124 == Internal registers ==
    125 
    126 All internal registers must be defined with the type ''sc_signal''
     124=== Internal registers definition ===
     125
     126All internal registers should be defined with the  ''sc_signal'' type.
    127127
    128128This point is a bit tricky: It allows the model designer to benefit from the delayed update
     
    132132`sc_signal` type is considered as a register.
    133133
    134 In order to improve the code readability, all internal registers should be prefixed with `r_`.
    135 
    136134A typical VCI target will contain the following registers :
    137135{{{
     
    144142''`typename vci_param::trdid_t` and others are generically-defined VCI field types''
    145143
    146 == Structural parameters ==
     144=== Structural parameters definition ===
    147145
    148146All structural parameters must be be defined as member variables. The values are generally defined by a constructor argument.
    149147Instance name is stored in [source:trunk/soclib/systemc/include/common/base_module.h soclib::common::BaseModule], inherited by
    150148[source:trunk/soclib/systemc/include/caba/util/base_module.h soclib::caba::BaseModule].
    151 
    152 For a VCI target, assigned segment should be copied in order to check commands.
     149For example, a VCI target will contain a reference to the the assigned segment, in order to check
     150possible segmentation errors during execution.
    153151
    154152{{{
     
    156154}}}
    157155
    158 = Constructor & destructor =
     156== B5) Constructor & destructor ==
    159157
    160158Any hardware component must have an instance name, and most SoCLib component must have
    161 a VCI index. Moreover, generic simulation models can have structural parameters defined as
    162 arguments in the constructor, and used by the constructor to configure the hardware ressources.
    163 A constructor  argument frequently
    164 used is a reference on the [source:trunk/soclib/systemc/include/common/mapping_table.h soclib::common::MappingTable],
    165 that defines the segmentation of the system address space.
     159a VCI index. Moreover, generic simulation models can have structural parameters. The parameter
     160values must be defined as constructor arguments, and used by the constructor to configure the hardware ressources. A constructor  argument frequently
     161used is a reference on the [source:trunk/soclib/systemc/include/common/mapping_table.h soclib::common::MappingTable], that defines the segmentation of the system address space.
    166162A typical VCI component will have the following constructor arguments:
    167163
     
    174170
    175171In this example, the first argument is the instance name, the second argument is the VCI target index, and the third argument is the mapping table.
     172
     173[[Image(WritingRules:mandatory.png, nolink)]]
    176174
    177175Moreover, the constructor must define the sensitivity list of the Transition(), genMoore() and genMealy()
     
    184182The register initialization must be an hardware mechanism explicitly described in the Transition function on reset condition.
    185183
    186 = member functions =
    187 
    188 The component behaviour is described by simple member functions.
    189 
    190 == transition() method ==
     184== B6) member functions ==
     185
     186The component behaviour is described by simple member functions. The type ot those methods
     187(Transition, genMoore, or genMealy) is defined by the sensitivity lists, as specified in B5.
     188
     189=== transition() method ===
    191190
    192191For each hardware component, there is only one `Transition()` method. It is called
    193192once per cycle, as the sensitivity list contains only the clock rising edge. This method
    194193computes the next values of the registers (variables that have the `sc_signal` type).
    195 
    196194No output port can be assigned in this method. Each register should be assigned only once.
    197195
    198 == genMoore() method ==
     196=== genMoore() method ===
    199197
    200198For each hardware component, there is only one `genMoore()` method. It is called once
    201199per cycle, as the sensitivity list contains only the clock falling edge. This method computes
    202200the values of the Moore output ports. (variables that have the `sc_out` type).
    203 
    204201No register can be assigned in this method. Each output port can be assigned only once.
    205202No input port can be read in this method
     
    207204== genMealy() method ==
    208205
    209 For each hardware component, there is zero, one or several `genMealy()` methods (one method
    210 for each output port). These methods can be called several times per cycle. The sensitivity
    211 list can contain several input ports. This method computes the Mealy values of the ouput ports,
    212 using only the register values and the input ports values.
    213 
     206For each hardware component, there is zero, one or several `genMealy()` methods (it can be useful
     207to have one separated `gemealy()` method for each output port). These methods can be called several times per cycle. The sensitivity list can contain several input ports. This method computes the Mealy values of the ouput ports, using only the register values and the input ports values.
    214208No register can be assigned in this method. Each output port can be assigned only once.
    215 This method can use automatic variables. It can be missing if there is no Mealy output.
    216 
    217 = Complete example =
     209
     210= C) Complete example =
    218211
    219212== C1) Component definition ==