MMU description » History » Revision 87
Revision 86 (Alexander Kamkin, 12/02/2014 07:33 AM) → Revision 87/132 (Alexander Kamkin, 12/02/2014 07:36 AM)
h1. MMU Description _~By Alexander Kamkin and Taya Sergeeva~_ *UNDER CONSTRUCTION* {{toc}} A _memory management unit_ (_MMU_) is known to be one of the most complex and error-prone components of a modern microprocessor. MicroTESK has a special subsystem, called _MMU subsystem_, intended for (1) specifying memory devices and (2) deriving testing knowledge from such specifications. The subsystem provides unified facilities for describing memory buffers (like _L1_ and _L2 caches_, _translation look-aside buffers_ (_TLBs_), etc.) as well as a means for connecting several buffers into a memory hierarchy. h2. Grammar <pre> startRule : bufferOrAddress* ; bufferOrAddress : address | buffer ; </pre> h2. Address Description A buffer is accessed by an _address_, which is typically a _bit vector_ of a fixed length (width). Different buffers are allowed to have a common address space (e.g., L1 and L2 are usually both addressed by physical addresses). However, in general case, each buffer has its own domain. An address space is described using a keyword @address@. The description can specify two parameters: @width@ (obligatory) and @format@ (optional). h3. Grammar <pre> address : ''address'' ID ''{'' (addressParameter '';'')* ''}'' ; addressParameter : width | format ; </pre> h3. Address Width (width) The @width@ parameter specifies the address _width_. The parameter is obligatory; its value should be non-negative (zero-length addresses are permitted). h4. Grammar <pre> width : ''width'' ''='' expr ; </pre> h3. Address Format (format) The @format@ parameter specifies the address _format_ (a number of named fields). The parameter is optional. By default, the address is unstructured (no fields are specified). A field has three attributes: a _name_, a _width_ and, optionally, an _initial value_. h4. Grammar <pre> format : ''format'' ''='' ''('' field ('','' field)* '')'' ; field : ID '':'' expr (''='' expr)? ; </pre> h2. Examples <pre> // The singleton. address Void { // The address width is zero (this is admissible for single-item buffers). width = 0; } </pre> <pre> // An unstructured 64-bit virtual addresses. address VA { // The address width. width = 64; } </pre> <pre> // A stuctured 40-bit physical addresses. address PA { // The address width. width = 40; // The address format: (<39..36>, TAG=<35..12>, INDEX=<11..5>, LOCAL=<4..0>). format. format = ( TAG : 24, // The tag (the <35..12> address bits). INDEX : 7, // The set index (the <11..5> address bits). LOCAL : 5, // The byte position (the <0..4> address bits). ); } </pre> h2. Buffer Description A buffer is described using a keyword @buffer@. The description specifies a set of parameters, including @ways@, @sets@, @format@, @index@, @match@ and @policy@. All of the parameters except @index@ (if @sets = 1@) and @policy@ are obligatory. h3. Grammar <pre> buffer : ''buffer'' bufferTypeID ''{'' (bufferParameter '';'')* ''}'' ; bufferParameter : ways | sets | format | index | match | policy ; </pre> h3. Buffer Associativity (ways) The @ways@ parameter specifies the buffer _associativity_ (the number of lines in a set). The parameter is obligatory; its value should be positive. h4. Grammar <pre> ways : ''ways'' ''='' expr ; </pre> h3. Buffer Length (sets) The @sets@ parameter specifies the buffer _length_ (the number of sets a cache). The parameter is obligatory; its value should be positive. h4. Grammar <pre> sets : ''sets'' ''='' expr ; </pre> h3. Buffer Line Format (format) The @format@ parameter specifies the buffer _line format_ (a number of named fields). The parameter is optional. By default, the buffer line is unstructured (no fields are specified). A field has three attributes: a name, a width and, optionally, an initial value. h4. Grammar <pre> format : ''format'' ''='' ''('' field ('','' field)* '')'' ; field : fieldID '':'' expr (''='' expr)? ; </pre> h3. Buffer Index Function (index) The @index@ parameter specifies the _address-to-index function_, which maps an address into the set index. The function may be omitted if the number of sets is @1@. h4. Grammar <pre> index : ''index'' ''('' addressTypeID addressArgID '')'' ''='' expr ; </pre> h3. Buffer Match Predicate (match) The @match@ parameter specifies the _address-line match predicate_, which checks if an address matches a line. The parameter is obligatory. h4. Grammar <pre> index : ''match'' ''('' addressTypeID addressArgID '')'' ''='' expr ; </pre> h3. Buffer Data Replacement Policy (policy) The @policy@ parameters specifies the _data replacement_ (_eviction_) _policy_. The parameter is optional. The list of supported policies includes: @RANDOM@, @FIFO@, @PLRU@ and @LRU@. h4. Grammar <pre> policy : ''policy'' ''='' policyID ; </pre> h3. Examples <pre> // A 4-way set associative cache (L1). buffer L1 { // The cache associativity. ways = 4; // The number of sets. sets = 128; // The line format. format = ( V : 1 = 0, // The validity flag (by default, the line is invalid). TAG : 24, // The tag (the <35..12> address bits). DATA : 256 // The data (4 double words). ); // The address-to-index function. index(PA addr) = addr<11..5>; // The address-line predicate. match(PA addr) = addr<35..12> == TAG; // The data replacement policy. policy = LRU; } </pre>