OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [docs/] [datasheet/] [soc_wishbone.adoc] - Blame information for rev 61

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 60 zero_gravi
<<<
2
:sectnums:
3
==== Processor-External Memory Interface (WISHBONE) (AXI4-Lite)
4
 
5
[cols="<3,<3,<4"]
6
[frame="topbot",grid="none"]
7
|=======================
8 61 zero_gravi
| Hardware source file(s): | neorv32_wishbone.vhd |
9 60 zero_gravi
| Software driver file(s): | none             | _implicitly used_
10
| Top entity port:         | `wb_tag_o`  | request tag output (3-bit)
11
|                          | `wb_adr_o`  | address output (32-bit)
12
|                          | `wb_dat_i`  | data input (32-bit)
13
|                          | `wb_dat_o`  | data output (32-bit)
14
|                          | `wb_we_o`   | write enable (1-bit)
15
|                          | `wb_sel_o`  | byte enable (4-bit)
16
|                          | `wb_stb_o`  | strobe (1-bit)
17
|                          | `wb_cyc_o`  | valid cycle (1-bit)
18
|                          | `wb_lock_o` | exclusive access request (1-bit)
19
|                          | `wb_ack_i`  | acknowledge (1-bit)
20
|                          | `wb_err_i`  | bus error (1-bit)
21
|                          | `fence_o`   | an executed `fence` instruction
22
|                          | `fencei_o`  | an executed `fence.i` instruction
23
| Configuration generics:  | _MEM_EXT_EN_ | enable external memory interface when _true_
24
|                          | _MEM_EXT_TIMEOUT_ | number of clock cycles after which an unacknowledged external bus access will auto-terminate (0 = disabled)
25
| Configuration constants in VHDL package file `neorv32_package.vhd`: | `wb_pipe_mode_c` | when _false_ (default): classic/standard Wishbone protocol; when _true_: pipelined Wishbone protocol
26 61 zero_gravi
|                                                                     | `wb_big_endian_c` | byte-order (Endianness) of external memory interface; true=BIG, false=little (default)
27
|                                                                     | `wb_rx_buffer_c` | enable register buffer for RX path (default)
28
| CPU interrupts:          | none             |
29 60 zero_gravi
|=======================
30
 
31
The external memory interface uses the Wishbone interface protocol. The external interface port is available
32
when the _MEM_EXT_EN_ generic is _true_. This interface can be used to attach external memories, custom
33
hardware accelerators additional IO devices or all other kinds of IP blocks. All memory accesses from the
34
CPU, that do not target the internal bootloader ROM, the internal IO region or the internal data/instruction
35
memories (if implemented at all) are forwarded to the Wishbone gateway and thus to the external memory
36
interface.
37
 
38
[TIP]
39
When using the default processor setup, all access addresses between 0x00000000 and
40
0xffff0000 (= beginning of processor-internal BOOT ROM) are delegated to the external memory
41
/ bus interface if they are not targeting the (actually enabled/implemented) processor-internal
42
instruction memory (IMEM) or the (actually enabled/implemented) processor-internal data memory
43
(DMEM). See section <<_address_space>> for more information.
44
 
45
**Wishbone Bus Protocol**
46
 
47
The external memory interface either uses **standard** ("classic") Wishbone transactions (default) or
48
**pipelined** Wishbone transactions. The transaction protocol is configured via the wb_pipe_mode_c constant
49
in the in the main VHDL package file (`rtl/neorv32_package.vhd`):
50
 
51
[source,vhdl]
52
----
53 61 zero_gravi
-- external bus interface --
54 60 zero_gravi
constant wb_pipe_mode_c : boolean := false;
55
----
56
 
57
When `wb_pipe_mode_c` is disabled, all bus control signals including _STB_ are active (and stable) until the
58
transfer is acknowledged/terminated. If `wb_pipe_mode_c` is enabled, all bus control except _STB_ are active
59
(and stable) until the transfer is acknowledged/terminated. In this case, _STB_ is active only during the very
60
first bus clock cycle.
61
 
62
.Exemplary Wishbone bus accesses using "classic" and "pipelined" protocol
63
[cols="^2,^2"]
64
[grid="none"]
65
|=======================
66
a| image::wishbone_classic_read.png[700,300]
67
a| image::wishbone_pipelined_write.png[700,300]
68
| **Classic** Wishbone read access | **Pipelined** Wishbone write access
69
|=======================
70
 
71
 
72
[TOP]
73
A detailed description of the implemented Wishbone bus protocol and the according interface signals
74
can be found in the data sheet "Wishbone B4 – WISHBONE System-on-Chip (SoC) Interconnection
75
Architecture for Portable IP Cores". A copy of this document can be found in the docs folder of this
76
project.
77
 
78
**Interface Latency**
79
 
80 61 zero_gravi
By default, the Wishbone gateway introduces two additional latency cycles: processor-outgoing ("TX") and
81
processor-incoming ("RX") signals are fully registered. Thus, any access from the CPU to a processor-external devices
82
via Wishbone requires 2 additional clock cycles (at least; depending on device's latency).
83 60 zero_gravi
 
84 61 zero_gravi
If the attached Wishbone network / peripheral already provides output registers or if the Wishbone network is not relevant
85
for timing closure, the default buffering of incoming ("RX") data within the gateway can be disabled.
86
The configuration is done via the `wb_rx_buffer_c` constant in the in the main VHDL package file (`rtl/neorv32_package.vhd`):
87
 
88
[source,vhdl]
89
----
90
-- external bus interface --
91
constant wb_rx_buffer_c : boolean := false; -- false to implement "async" RX (non-default)
92
----
93
 
94 60 zero_gravi
**Bus Access Timeout**
95
 
96
The Wishbone bus interface provides an option to configure a bus access timeout counter. The _MEM_EXT_TIMEOUT_
97
top generic is used to specify the _maximum_ time (in clock cycles) a bus access can be pending before it is automatically
98
terminated. If _MEM_EXT_TIMEOUT_ is set to zero, the timeout disabled an a bus access can take an arbitrary number of cycles to complete.
99
 
100
When _MEM_EXT_TIMEOUT_ is greater than zero, the WIshbone adapter starts an internal countdown whenever the CPU
101
accesses a memory address via the external memory interface. If the accessed memory / device does not acknowledge (via `wb_ack_i`)
102
or terminate (via `wb_err_i`) the transfer within _MEM_EXT_TIMEOUT_ clock cycles, the bus access is automatically canceled
103
(setting `wb_cyc_o` low again) and a load/store/instruction fetch bus access fault exception is raised.
104
 
105
[TIP]
106
This feature can be used as **safety guard** if the external memory system does not check for "address space holes". That means that addresses, which
107
do not belong to a certain memory or device, do not permanently stall the processor due to an unacknowledged/unterminated bus access. If the external
108
memory system can guarantee to access **any** bus access (even it targets an unimplemented address) the timeout feature should be disabled
109
(_MEM_EXT_TIMEOUT_ = 0).
110
 
111
**Wishbone Tag**
112
 
113
The 3-bit wishbone `wb_tag_o` signal provides additional information regarding the access type. This signal
114
is compatible to the AXI4 _AxPROT_ signal.
115
 
116
* `wb_tag_o(0)` 1: privileged access (CPU is in machine mode); 0: unprivileged access
117
* `wb_tag_o(1)` always zero (indicating "secure access")
118
* `wb_tag_o(2)` 1: instruction fetch access, 0: data access
119
 
120
**Exclusive / Atomic Bus Access**
121
 
122
If the atomic memory access CPU extension (via _CPU_EXTENSION_RISCV_A_) is enabled, the CPU can
123
request an atomic/exclusive bus access via the external memory interface.
124
 
125
The load-reservate instruction (`lr.w`) will set the `wb_lock_o` signal telling the bus interconnect to establish a
126
reservation for the current accessed address (start of an exclusive access). This signal will stay asserted until
127
another memory access instruction is executed (for example a `sc.w`).
128
 
129
The memory system has to make sure that no other entity can access the reservated address until `wb_lock_o`
130
is released again. If this attempt fails, the memory system has to assert `wb_err_i` in order to indicate that the
131
reservation was broken.
132
 
133
[TIP]
134
See section <<_bus_interface>> for the CPU bus interface protocol.
135
 
136
**Endianness**
137
 
138
The NEORV32 CPU and the Processor setup are *little-endian* architectures. To allow direct connection
139
to a big-endian memory system the external bus interface provides an _Endianness configuration_. The
140 61 zero_gravi
Endianness (of the external memory interface) can be configured via the global `wb_big_endian_c`
141 60 zero_gravi
constant in the main VHDL package file (`rtl/neorv32_package.vhd`). By default, the external memory
142
interface uses little-endian byte-order.
143
 
144
[source,vhdl]
145
----
146 61 zero_gravi
-- external bus interface --
147
constant wb_big_endian_c : boolean := true;
148 60 zero_gravi
----
149
 
150
Application software can check the Endianness configuration of the external bus interface via the
151
_SYSINFO_FEATURES_MEM_EXT_ENDIAN_ flag in the processor's SYSINFO module (see section
152
<<_system_configuration_information_memory_sysinfo>> for more information).
153
 
154
**AXI4-Lite Connectivity**
155
 
156 61 zero_gravi
The AXI4-Lite wrapper (`rtl/templates/system/neorv32_SystemTop_axi4lite.vhd`) provides a Wishbone-to-
157 60 zero_gravi
AXI4-Lite bridge, compatible with Xilinx Vivado (IP packager and block design editor). All entity signals of
158
this wrapper are of type _std_logic_ or _std_logic_vector_, respectively.
159
 
160
The AXI Interface has been verified using Xilinx Vivado IP Packager and Block Designer. The AXI
161
interface port signals are automatically detected when packaging the core.
162
 
163
.Example AXI SoC using Xilinx Vivado
164
image::neorv32_axi_soc.png[]
165
 
166
[WARNING]
167
Using the auto-termination timeout feature (_MEM_EXT_TIMEOUT_ greater than zero) is **not AXI4 compliant** as the AXI protocol does not support canceling of
168 61 zero_gravi
bus transactions. Therefore, the NEORV32 top wrapper with AXI4-Lite interface (`rtl/templates/system/neorv32_SystemTop_axi4lite`) configures _MEM_EXT_TIMEOUT_ = 0 by default.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.