Changes between Initial Version and Version 1 of Component/Iss2Api


Ignore:
Timestamp:
Sep 8, 2008, 2:56:20 PM (16 years ago)
Author:
Nicolas Pouillon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Component/Iss2Api

    v1 v1  
     1
     2[[PageOutline]]
     3
     4= Simulation API =
     5
     6This new API is an evolution of [wiki:Component/IssApi the ISS API].
     7New features are:
     8 * Use structs rather than arguments, this eases API evolution (which can be acomplished through carefully choosed default values);
     9 * support for CPU modes;
     10 * support for generic Memory management unit.
     11
     12== Structures and values ==
     13
     14=== Enumerated values ===
     15
     16Execution mode for any Instruction/Data access, checked by
     17mode-enabled caches
     18{{{
     19    enum ExecMode {
     20        MODE_HYPER,
     21        MODE_KERNEL,
     22        MODE_USER,
     23    };
     24}}}
     25
     26Operation type on Data cache access
     27{{{
     28    enum DataOperationType {
     29        DATA_READ,
     30        DATA_WRITE,
     31        DATA_LL,
     32        DATA_SC,
     33        XTN_WRITE,
     34        XTN_READ,
     35    };
     36}}}
     37
     38When operation is XTN_READ or XTN_WRITE, address field must be
     39one of these values, it determines the extended access type.
     40{{{
     41    enum ExternalAccessType {
     42        XTN_PTPR,
     43        XTN_TLB_EN,
     44        XTN_ICACHE_FLUSH,
     45        XTN_DCACHE_FLUSH,
     46        XTN_ITLB_INVAL,
     47        XTN_DTLB_INVAL,
     48        XTN_ICACHE_INVAL,
     49        XTN_DCACHE_INVAL,
     50        XTN_ICACHE_PREFETCH,
     51        XTN_DCACHE_PREFETCH,
     52        XTN_SYNC,
     53        XTN_INS_ERROR_TYPE,
     54        XTN_DATA_ERROR_TYPE,
     55        XTN_INS_BAD_VADDR,
     56        XTN_DATA_BAD_VADDR,
     57    };
     58}}}
     59
     60=== Instruction request and response ===
     61
     62Instruction request, only significant if `valid' is asserted.
     63addr must be 4-byte aligned.
     64{{{
     65    struct InstructionRequest {
     66        bool valid;
     67        addr_t addr;
     68        enum ExecMode mode;
     69    };
     70}}}
     71
     72
     73Instruction response.
     74
     75Valid is asserted when query has beed satisfied, if no request
     76is pending, valid is not asserted.
     77
     78instruction is only valid if no error is signaled.
     79{{{
     80    struct InstructionResponse {
     81        bool valid;
     82        bool error;
     83        data_t instruction;
     84    };
     85}}}
     86
     87=== Data request and response ===
     88
     89Data request, only significant if `valid' is asserted.
     90addr must be 4-byte aligned.
     91wdata is only significant for be-masked bytes.
     92 * wdata![7:0] is at ![addr], masked by be![0]
     93 * wdata![15:8] is at ![addr+1], masked by be![1]
     94 * wdata![23:16] is at ![addr+2], masked by be![2]
     95 * wdata![31:24] is at ![addr+3], masked by be![3]
     96
     97When type is XTN_READ or XTN_WRITE, addr must be an opcod of
     98enum !ExternalAccessType.  For extended access types needing an
     99address, address is passed through the wdata field.
     100{{{
     101    struct DataRequest {
     102        bool valid;
     103        addr_t addr;
     104        data_t wdata;
     105        enum DataOperationType type;
     106        be_t be;
     107        enum ExecMode mode;
     108    };
     109}}}
     110
     111
     112Data response.
     113
     114Valid is asserted when query has beed satisfied, if no request
     115is pending, valid is not asserted.
     116
     117data is only valid if no error is signaled.
     118
     119Read data is aligned with the same semantics than the wdata
     120field in struct !DataRequest. Only bytes asserted in the BE
     121field upon request are meaningful, others have an undefined
     122value, they may be non-zero.
     123{{{
     124    struct DataResponse {
     125        bool valid;
     126        bool error;
     127        data_t rdata;
     128    };
     129}}}
     130
     131== Functions ==
     132
     133=== void reset() ===
     134
     135Reset operation, Iss must behave like the processor receiving a reset cycle.
     136
     137Tell the Iss to execute *at most* ncycle cycles, knowing the
     138value of all the irq lines. Each irq is a bit in the
     139irq_bit_field word.
     140
     141=== uint32_t executeNCycles( uint32_t ncycle, uint32_t irq_bit_field ) ===
     142
     143Iss must return the number of cycles it actually executed. This
     144is at least 1, at most ncycle.
     145
     146=== void getInstructionRequest( struct !InstructionRequest & ) ===
     147
     148Iss must populate the request fields.
     149
     150=== void setInstruction( const struct !InstructionResponse & ) ===
     151
     152Iss is given back the response. It may not be valid.
     153
     154=== void getDataRequest( struct !DataRequest & ) ===
     155
     156Iss must populate the request fields.
     157
     158=== void setData( const struct !DataResponse & ) ===
     159
     160Iss is given back the response. It may not be valid.
     161
     162=== void setWriteBerr() ===
     163
     164The cache received an imprecise write error condition, this
     165signalling is asynchronous.
     166
     167= Other APIs =
     168
     169== Sideband signals ==
     170
     171In order to inform the ISS about some cache caracteristics, those functions have been defined.
     172
     173Their implementation is optional.
     174
     175=== void setICacheInfo( size_t line_size, size_t assoc, size_t n_lines ) ===
     176
     177Inform the Iss about the instruction cache caracteristics
     178
     179=== void setDCacheInfo( size_t line_size, size_t assoc, size_t n_lines ) ===
     180
     181Inform the Iss about the data cache caracteristics
     182
     183== Debugger API ==
     184
     185This API is optional, it serves to expose the internal ISS registers to a debugger.
     186
     187The debugger API is ISS-architecture independant.
     188
     189=== unsigned int debugGetRegisterCount() ===
     190
     191Iss must return the count of registers known to GDB. This must
     192follow GDB protocol for this architecture.
     193
     194=== debug_register_t debugGetRegisterValue(unsigned int reg) ===
     195
     196Accessor for an Iss register, register number meaning is
     197defined in GDB protocol for this architecture.
     198
     199=== void debugSetRegisterValue(unsigned int reg, debug_register_t value) ===
     200
     201Accessor for an Iss register, register number meaning is
     202defined in GDB protocol for this architecture.
     203
     204=== size_t debugGetRegisterSize(unsigned int reg) ===
     205
     206Get the size for a given register. This is defined in GDB
     207protocol for this architecture.
     208
     209=== addr_t debugGetPC() ===
     210
     211Get the current PC
     212
     213=== void debugSetPC(addr_t) ===
     214
     215Set the current PC