Skip to content

Commit e65cc88

Browse files
committed
Updated size values, added be signal, added attr signal, allowed (sometimes mandated) coprocessor to modify transactions
Signed-off-by: Arjan Bink <[email protected]>
1 parent a3bcdd7 commit e65cc88

File tree

1 file changed

+54
-7
lines changed

1 file changed

+54
-7
lines changed

docs/source/x_ext.rst

+54-7
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ A SystemVerilog interface implementation for CORE-V-XIF could look as follows:
205205
#(
206206
parameter int X_NUM_RS = 2, // Number of register file read ports that can be used by the eXtension interface
207207
parameter int X_ID_WIDTH = 4, // Identification width for the eXtension interface
208-
parameter int X_MEM_WIDTH = 32, // Memory access width for loads/stores via the eXtension interface
208+
parameter int X_MEM_WIDTH = 32, // Maximum memory access width for loads/stores via the eXtension interface
209209
parameter int X_RFR_WIDTH = 32, // Register file read access width for the eXtension interface
210210
parameter int X_RFW_WIDTH = 32, // Register file write access width for the eXtension interface
211211
parameter logic [31:0] X_MISA = '0, // MISA extensions implemented on the eXtension interface
@@ -604,7 +604,13 @@ Memory (request/response) interface
604604
+--------------+----------------------------+-----------------------------------------------------------------------------------------------------------------+
605605
| ``we`` | logic | Write enable of the memory transaction. |
606606
+--------------+----------------------------+-----------------------------------------------------------------------------------------------------------------+
607-
| ``size`` | logic [1:0] | Size of the memory transaction. 0: byte, 1: halfword, 2: word. |
607+
| ``size`` | logic [2:0] | Size of the memory transaction. 0: byte, 1: 2 bytes (halfword), 2: 4 bytes (word), 3: 8 bytes (doubleword), |
608+
| | | 4: 16 bytes, 5: 32 bytes, 6: Reserved, 7: Reserved. |
609+
+--------------+----------------------------+-----------------------------------------------------------------------------------------------------------------+
610+
| ``be`` | logic [X_MEM_WIDTH/8-1:0] | Byte enables for memory transaction. |
611+
+--------------+----------------------------+-----------------------------------------------------------------------------------------------------------------+
612+
| ``attr`` | logic [1:0] | Memory transaction attributes. attr[0] = modifiable (0 = not modifiable, 1 = modifiable). |
613+
| | | attr[1] = unaligned (0 = aligned, 1 = unaligned). |
608614
+--------------+----------------------------+-----------------------------------------------------------------------------------------------------------------+
609615
| ``wdata`` | logic [X_MEM_WIDTH-1:0] | Write data of a store memory transaction. |
610616
+--------------+----------------------------+-----------------------------------------------------------------------------------------------------------------+
@@ -619,7 +625,7 @@ they are initiated by |processor| itself or by a |coprocessor| via the memory re
619625
* PMA checks and attribution
620626
* PMU usage
621627
* MMU usage
622-
* Misaligned load/store handling
628+
* Misaligned load/store exception handling
623629
* Write buffer usage
624630

625631
As for non-offloaded load or store instructions it is assumed that execute permission is never required for offloaded load or store instructions.
@@ -630,6 +636,47 @@ Whether a load or store is treated as being speculative or not by the |processor
630636
ignore whatever value it might have communicated via ``commit_kill`` with respect to whether it treats a memory request as speculative or not. A |coprocessor|
631637
is allowed to signal ``spec`` = 1 without taking the commit transaction into account (so for example even after ``commit_kill`` = 0 has already been signaled).
632638

639+
The ``addr`` signal indicates the (byte) start address of the memory transaction. Transactions on the memory (request/response) interface cannot cross a X_MEM_WIDTH (bus width) boundary.
640+
The ``be`` signal indicates on what byte lanes to expect valid data for both read and write transactions. ``be[n]`` determines the validity of data bits ``8*N+7:8*N``.
641+
There are no limitations on the allowed ``be`` values.
642+
The ``size`` signal indicates the size of the memory transaction. ``size`` shall reflect a naturally aligned range of byte lanes to be used in a transaction.
643+
The size of a transaction shall not exceed the maximum mememory access width (memory bus width) as determined by ``X_MEM_WIDTH``.
644+
The ``addr`` signal shall be consistent with the ``be`` signal, i.e. if the maximum memory access width (memory bus width) is 2^N bytes (N=2,3,4,5) and the lowest set bit in
645+
``be`` is at index IDX, then ``addr[N-1:0]`` shall be at most IDX.
646+
647+
When for example performing a transaction that uses the middle two bytes on a 32-bit wide memory interface, the following (equivalent) `be``, ``size``, ``addr[1:0]`` combinations can be used:
648+
649+
* ``be`` = 4'b0110, ``size`` = 3'b010``, ``addr[1:0]`` = 2'b00.
650+
* ``be`` = 4'b0110, ``size`` = 3'b010``, ``addr[1:0]`` = 2'b01.
651+
652+
Note that a word transfer is needed in this example because the two bytes transfered are not halfword aligned.
653+
654+
Unaligned (i.e. non naturally aligned) transactions are supported over the memory (request/response) interface using the ``be`` signal. Not all unaligned memory operations
655+
can however be performed as single transactions on the memory (request/response) interface. Specifically if an unaligned memory operation crosses a X_MEM_WIDTH boundary, then it shall
656+
be broken into multiple transactions on the memory (request/response) interface by the |coprocessor|.
657+
658+
The ``attr`` signal indicates the attributes of the memory transaction.
659+
660+
``attr[0]`` indicates whether the transaction is a modifiable transaction. This bit shall be set if the
661+
transaction results from modifications already done in the |coprocessor| (e.g. merging, splitting, or using a transaction size larger than strictly needed (without changing the active byte lanes)) or
662+
if the |coprocessor| allows such modifications of this transaction at the system level. The |processor| shall check whether a modifiable transaction to the requested
663+
address is allowed or not (and respond with an appropriate synchronous exception via the memory response interface if needed). An example of a modified transaction is
664+
performing a (merged) word transaction as opposed of doing four byte transactions (assuming the natively intended memory operations are byte operations).
665+
666+
``attr[1]`` indicates whether the natively intended memory operation(s) resulting in this transaction is naturally aligned or not (0: aligned, 1: unaligned).
667+
In case that an unaligned native memory operation requires multiple memory request interface transactions, then the |coprocessor| is responsible for splitting the unaligned native memory operation
668+
into multiple transactions on the memory request interface, each of them having both ``attr[0]`` = 1 and ``attr[0]`` = 1.
669+
The |processor| shall check whether an unaligned transaction to the requested
670+
address is allowed or not (and respond with an appropriate synchronous exception via the memory response interface if needed).
671+
672+
.. note::
673+
674+
Even though the |coprocessor| is allowed, and sometimes even mandated, to split transacations, this does not mean that split transactions will not result in exceptions.
675+
Whether a split transaction is allowed (and makes it onto the external |processor| bus interface) or will lead to an exception, is determined by the |processor| (e.g. by its PMA).
676+
No matter if the |coprocessor| already split a transaction or not, further splitting might be required within the |processor| itself (depending on whether a transaction
677+
on the memory (request/response) interface can be handled as single transaction on the |processor|'s native bus interface or not. In general a |processor| is allowed to make any modification
678+
to a memory (request/response) interface transaction as long as it is in accordance with the modifiable physical memory attribute for the concerned address region.
679+
633680
A memory request transaction starts in the cycle that ``mem_valid`` = 1 and ends in the cycle that both ``mem_valid`` = 1 and ``mem_ready`` = 1. The signals in ``mem_req`` are
634681
valid when ``mem_valid`` is 1. The signals in ``mem_req`` shall remain stable during a memory request transaction, except that ``wdata`` is only required to remain stable during
635682
memory request transactions in which ``we`` is 1.
@@ -677,10 +724,10 @@ The signals in ``mem_resp`` are valid when ``mem_valid`` and ``mem_ready`` are
677724

678725
If ``mem_resp`` relates to an instruction that has been killed, then the |processor| is allowed to signal any value in ``mem_resp`` and the |coprocessor| shall ignore the value received via ``mem_resp``.
679726

680-
In case the memory request transaction results in a misaligned load/store operation, it is up to |processor| how or whether misaligned load/store operations are supported.
681-
The memory response and hence the memory request/response handshake may get delayed.
682-
If the first access results in a synchronous exception, the handshake can be performed immediately.
683-
Otherwise, the handshake is performed once its known whether the second access results in a synchronous exception or not.
727+
The memory response and hence the memory request/response handshake may get delayed in case that the |processor| splits a memory (request/response) interface transaction
728+
into multiple transactions on its native bus interface.
729+
Once it is known that the first, or any following, access results in a synchronous exception, the handshake can be performed immediately.
730+
Otherwise, the handshake is performed only once it is known that none of the split transactions result in a synchronous exception.
684731

685732
The memory (request/response) interface is optional. If it is included, then the memory result interface shall also be included.
686733

0 commit comments

Comments
 (0)