On Mon, Feb 27, 2017 at 10:11 AM, Mauro Olivieri
<
olivieri...@gmail.com> wrote:
>
>
> Dear all,
>
> I apologize if this question is too basic for the standard discussions in
> this group.
This isn't a RISC-V question, it's a semantic question about ISAs themselves.
> I am referring to M-mode execution only.
>
> In the Privileged Architecture V1.9.1, it is clearly stated that some CSRs
> (e.g. time) are shadows of memory-mapped registers. Moreover, it is also
> stated that the interrupt pending bit MSIP of a hart may be set by another
> hart, by means of a non-cached write to a memory mapped CSR. The following
Insofar as no means is described for discovering addresses I regard
both of those as more implementation guidance and less normative.
> basic questions arise to me in order to set up a clear picture:
>
> - in a RISCV compliant architecture, which CSRs, if present, are
> _mandatorily_ memory-mapped?
A CSR is not a thing. A CSR is a means of accessing a physical or
logical register. There is nothing in the notion of CSR which forbids
the same physical or logical register from being accessed by other
means.
So there's no such thing as a "memory-mapped CSR". There are logical
registers which can be accessed in one or more ways. Memory, CSR,
front panel switches, something else entirely.
A minimal RISC-V compliant M-mode system is not required to have any
memory-mapped resources of any kind (although the initial program and
config string have to be in memory).
> - in a RISCV compliant architecture, which CSRs, if present, are _possibly_
> memory-mapped?
You can add additional access paths to any register without harming compliance.
> - I assume memory mapped CSRs are accessed via regular load/store
> instructions. So, a hart may indifferently access its own CSRs through a
> dedicated CSRxx instruction or through a load/store instruction. Am I
> correct?
If a register is CSR-mapped it can be accessed through CSRxx instructions.
If a register is memory-mapped it can be accessed through load-store
instructions.
If a register is both it can be accessed through either indifferently.
> - in an actual implmentation, must there be (or be preferrable) any relation
> between the 12-bit CSR address and the memory-mapped address of the CSR?
No.
> - Some memory-mapped CSRs, e.g.'time', are single, global memory-mapped
> registers. Other CSRs, e.g. the 'mip' CSR, must be memory-mapped in multiple
> versions (i.e. one for each hart) to implement the access to per-hart MSIP
> bits. Am I correct?
mip itself doesn't need to be memory-mapped; just something that
exposes the MSIP bit. Or you could use custom instructions. As long
as you can implement SBI_SEND_IPI and SBI_CLEAR_IPI the details are
less important for S-mode.
> Thank you in advance for any answer.
> Mauro
-s