Changes between Version 16 and Version 17 of Writing Rules/Caba
- Timestamp:
- Apr 26, 2007, 3:29:33 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Writing Rules/Caba
v16 v17 8 8 This 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. 9 9 10 Besides you may also want to follow some [WritingRules/NamingGuidelines naming guidelines] that increase code readability.11 12 Those modeling rules are based on the "Synchronous Communicating Finite State Machines" theory. The idea is to force the "event driven" SystemC simulation engine to run as a cycle based simulator.10 Besides you may also want to follow the [WritingRules/General general SoCLib rules]. 11 12 Those CABA modeling rules are based on the "Synchronous Communicating Finite State Machines" theory. The idea is to force the "event driven" SystemC simulation engine to run as a cycle based simulator. 13 13 14 14 [[Image(fsm.png,align=right,nolink)]] … … 25 25 = Components = 26 26 27 A SoCLib CABA component `XXX` is generally described as a class derived from the27 A SoCLib CABA simulation model for an hardware component `XXX` is generally described as a class derived from the 28 28 [source:trunk/soclib/systemc/include/caba/util/base_module.h soclib::caba::BaseModule] class. 29 30 29 31 30 32 At least two files are associated to each hardware component: … … 32 34 * `XXX.cc` contains the code of the methods associated to this component. 33 35 34 = Namespaces =35 36 SystemC is built upon C++. We can benefit from C++ constructs. Namespaces allows us to create unambiguous names37 while keeping them short and clean. SoCLib defines some namespaces:38 * `soclib`39 * `soclib::common`40 * `soclib::caba`41 * `soclib::tlmt`42 43 = Component indexation =44 45 In a VCI-based architecture, all initiators and targets must be indexed. Index space for targets is different from index space for initiators.46 * The target index is used by interconnects, that decode the VCI address MSB bits to get the target index.47 * The initiator index is used by the interconnect components to route the response packets.48 49 For the initiators, the index is the VCI SRCID value.50 51 Indexes can be52 * a simple scalar index, in case of a ''flat'' interconnect.53 * a composite index in case a hierarchical two level interconnect where each component is identified by two scalars: (cluster_index, local_index).54 55 [source:trunk/soclib/systemc/include/common/int_tab.h common/int_tab.h] defines an utility class storing list of indexes. All indexes are `IntTab`s.56 57 36 = VCI Interface = 58 37 59 In order to enforce interoperability between components, all SoCLib hardware components should respect the advanced VCI standard. 60 Any component having a VCI interface must include one of the the two following files 38 In order to enforce interoperability, all hardware architectures build with the SoCLib component library 39 will communicate through a "flat", shared address space, and all system interconnect will respect the VCI advanced standard. Therefore, most SoCLib components have VCI interfaces : 40 41 [[Image(WritingRules:mandatory.png, nolink)]] 42 43 All SoCLib hardware components having a VCI interface is called a ''VCI component'', and must include 44 at least one of the the two following files, defining the VCI advanced ports : 61 45 * [source:trunk/soclib/systemc/include/caba/interface/vci_target.h caba/interface/vci_target.h] 62 46 * [source:trunk/soclib/systemc/include/caba/interface/vci_initiator.h caba/interface/vci_initiator.h] 63 47 64 The advanced VCI signals are defined in [source:trunk/soclib/systemc/include/caba/interface/vci_signals.h caba/interface/vci_signals.h].65 66 48 As VCI signals can have variable widths, all VCI components must be defined with templates. The [source:trunk/soclib/systemc/include/caba/interface/vci_param.h caba/interface/vci_param.h] file contains the definition of the VCI parameters object. This object must be passed as a template parameter to the component. 67 49 68 50 A typical VCI component declaration is: 69 70 51 {{{ 71 52 #include "caba/util/base_module.h" … … 80 61 81 62 }; 82 83 63 }} 84 64 }}} 85 65 66 [[Image(WritingRules:mandatory.png, nolink)]] 67 68 The SystemC top cell defining the system architecture must include the following file, defining the advanced VCI signals : 69 * [source:trunk/soclib/systemc/include/caba/interface/vci_signals.h caba/interface/vci_signals.h]. 70 71 [[Image(WritingRules:guideline.png, nolink)]] 72 73 A SoCLib hardware component that has no VCI interface should use a dedicated VCI wrapper in order to be connected to the VCI interconnect. 86 74 87 75 = Address space segmentation = 88 76 77 [[Image(WritingRules:guideline.png, nolink)]] 89 78 In a shared memory architecture, the address space segmentation (or memory map) is a global characteristic of the system. 90 79 This memory map must be defined by the system designer, and is used by both software, and hardware components. … … 99 88 addressed by the VCI address MSB bits. 100 89 90 [[Image(WritingRules:guideline.png, nolink)]] 91 101 92 In order to simplify the memory map definition, and the hardware component configuration, a 102 93 generic object, called ''mapping table'' has been defined in … … 118 109 = Component ressources = 119 110 111 [[Image(WritingRules:guideline.png, nolink)]] 112 120 113 The component ''XXX.h'' file contains the following informations 121 114 … … 223 216 224 217 = Complete example = 218 219 == C1) Component definition == 225 220 226 221 Let's take the [source:trunk/soclib/systemc/include/caba/target/vci_locks.h soclib::caba::VciLocks] … … 295 290 }}} 296 291 297 And the [source:trunk/soclib/systemc/src/caba/target/vci_locks.cc implementation]: 292 == C2) Component implementation == 293 294 Here is the [source:trunk/soclib/systemc/src/caba/target/vci_locks.cc soclib::caba::VciLocks] component implementation: 298 295 299 296 {{{