1 |
2 |
zero_gravi |
-- #################################################################################################
|
2 |
|
|
-- # << NEORV32 - CPU Top Entity >> #
|
3 |
|
|
-- # ********************************************************************************************* #
|
4 |
|
|
-- # Top NEORV32 CPU: #
|
5 |
|
|
-- # * neorv32_cpu_alu: Arithemtical/logical unit #
|
6 |
|
|
-- # * neorv32_cpu_ctrl: CPU control and CSR system #
|
7 |
|
|
-- # * neorv32_cpu_decompressor: Compressed instructions decoder #
|
8 |
|
|
-- # * neorv32_cpu_bus: Memory/IO bus interface unit #
|
9 |
|
|
-- # * neorv32_cpu_cp_muldiv: MULDIV co-processor #
|
10 |
|
|
-- # * neorv32_cpu_regfile: Data register file #
|
11 |
|
|
-- # ********************************************************************************************* #
|
12 |
|
|
-- # BSD 3-Clause License #
|
13 |
|
|
-- # #
|
14 |
|
|
-- # Copyright (c) 2020, Stephan Nolting. All rights reserved. #
|
15 |
|
|
-- # #
|
16 |
|
|
-- # Redistribution and use in source and binary forms, with or without modification, are #
|
17 |
|
|
-- # permitted provided that the following conditions are met: #
|
18 |
|
|
-- # #
|
19 |
|
|
-- # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
20 |
|
|
-- # conditions and the following disclaimer. #
|
21 |
|
|
-- # #
|
22 |
|
|
-- # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
23 |
|
|
-- # conditions and the following disclaimer in the documentation and/or other materials #
|
24 |
|
|
-- # provided with the distribution. #
|
25 |
|
|
-- # #
|
26 |
|
|
-- # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
27 |
|
|
-- # endorse or promote products derived from this software without specific prior written #
|
28 |
|
|
-- # permission. #
|
29 |
|
|
-- # #
|
30 |
|
|
-- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
31 |
|
|
-- # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
32 |
|
|
-- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
33 |
|
|
-- # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
34 |
|
|
-- # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
35 |
|
|
-- # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
36 |
|
|
-- # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
37 |
|
|
-- # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
38 |
|
|
-- # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
39 |
|
|
-- # ********************************************************************************************* #
|
40 |
|
|
-- # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
41 |
|
|
-- #################################################################################################
|
42 |
|
|
|
43 |
|
|
library ieee;
|
44 |
|
|
use ieee.std_logic_1164.all;
|
45 |
|
|
use ieee.numeric_std.all;
|
46 |
|
|
|
47 |
|
|
library neorv32;
|
48 |
|
|
use neorv32.neorv32_package.all;
|
49 |
|
|
|
50 |
|
|
entity neorv32_cpu is
|
51 |
|
|
generic (
|
52 |
|
|
-- General --
|
53 |
|
|
CLOCK_FREQUENCY : natural := 0; -- clock frequency of clk_i in Hz
|
54 |
|
|
HART_ID : std_ulogic_vector(31 downto 0) := x"00000000"; -- custom hardware thread ID
|
55 |
|
|
BOOTLOADER_USE : boolean := true; -- implement processor-internal bootloader?
|
56 |
6 |
zero_gravi |
CSR_COUNTERS_USE : boolean := true; -- implement RISC-V perf. counters ([m]instret[h], [m]cycle[h], time[h])?
|
57 |
2 |
zero_gravi |
-- RISC-V CPU Extensions --
|
58 |
|
|
CPU_EXTENSION_RISCV_C : boolean := false; -- implement compressed extension?
|
59 |
|
|
CPU_EXTENSION_RISCV_E : boolean := false; -- implement embedded RF extension?
|
60 |
|
|
CPU_EXTENSION_RISCV_M : boolean := false; -- implement muld/div extension?
|
61 |
|
|
CPU_EXTENSION_RISCV_Zicsr : boolean := true; -- implement CSR system?
|
62 |
|
|
-- Memory configuration: Instruction memory --
|
63 |
|
|
MEM_ISPACE_BASE : std_ulogic_vector(31 downto 0) := x"00000000"; -- base address of instruction memory space
|
64 |
|
|
MEM_ISPACE_SIZE : natural := 8*1024; -- total size of instruction memory space in byte
|
65 |
|
|
MEM_INT_IMEM_USE : boolean := true; -- implement processor-internal instruction memory
|
66 |
|
|
MEM_INT_IMEM_SIZE : natural := 8*1024; -- size of processor-internal instruction memory in bytes
|
67 |
|
|
MEM_INT_IMEM_ROM : boolean := false; -- implement processor-internal instruction memory as ROM
|
68 |
|
|
-- Memory configuration: Data memory --
|
69 |
|
|
MEM_DSPACE_BASE : std_ulogic_vector(31 downto 0) := x"80000000"; -- base address of data memory space
|
70 |
|
|
MEM_DSPACE_SIZE : natural := 4*1024; -- total size of data memory space in byte
|
71 |
|
|
MEM_INT_DMEM_USE : boolean := true; -- implement processor-internal data memory
|
72 |
|
|
MEM_INT_DMEM_SIZE : natural := 4*1024; -- size of processor-internal data memory in bytes
|
73 |
|
|
-- Memory configuration: External memory interface --
|
74 |
|
|
MEM_EXT_USE : boolean := false; -- implement external memory bus interface?
|
75 |
|
|
MEM_EXT_TIMEOUT : natural := 15; -- cycles after which a valid bus access will timeout
|
76 |
|
|
-- Processor peripherals --
|
77 |
|
|
IO_GPIO_USE : boolean := true; -- implement general purpose input/output port unit (GPIO)?
|
78 |
|
|
IO_MTIME_USE : boolean := true; -- implement machine system timer (MTIME)?
|
79 |
|
|
IO_UART_USE : boolean := true; -- implement universal asynchronous receiver/transmitter (UART)?
|
80 |
|
|
IO_SPI_USE : boolean := true; -- implement serial peripheral interface (SPI)?
|
81 |
|
|
IO_TWI_USE : boolean := true; -- implement two-wire interface (TWI)?
|
82 |
|
|
IO_PWM_USE : boolean := true; -- implement pulse-width modulation unit (PWM)?
|
83 |
|
|
IO_WDT_USE : boolean := true; -- implement watch dog timer (WDT)?
|
84 |
|
|
IO_CLIC_USE : boolean := true; -- implement core local interrupt controller (CLIC)?
|
85 |
3 |
zero_gravi |
IO_TRNG_USE : boolean := true; -- implement true random number generator (TRNG)?
|
86 |
|
|
IO_DEVNULL_USE : boolean := true -- implement dummy device (DEVNULL)?
|
87 |
2 |
zero_gravi |
);
|
88 |
|
|
port (
|
89 |
|
|
-- global control --
|
90 |
|
|
clk_i : in std_ulogic; -- global clock, rising edge
|
91 |
|
|
rstn_i : in std_ulogic; -- global reset, low-active, async
|
92 |
|
|
-- bus interface --
|
93 |
|
|
bus_addr_o : out std_ulogic_vector(data_width_c-1 downto 0); -- bus access address
|
94 |
|
|
bus_rdata_i : in std_ulogic_vector(data_width_c-1 downto 0); -- bus read data
|
95 |
|
|
bus_wdata_o : out std_ulogic_vector(data_width_c-1 downto 0); -- bus write data
|
96 |
|
|
bus_ben_o : out std_ulogic_vector(03 downto 0); -- byte enable
|
97 |
|
|
bus_we_o : out std_ulogic; -- write enable
|
98 |
|
|
bus_re_o : out std_ulogic; -- read enable
|
99 |
|
|
bus_ack_i : in std_ulogic; -- bus transfer acknowledge
|
100 |
|
|
bus_err_i : in std_ulogic; -- bus transfer error
|
101 |
|
|
-- external interrupts --
|
102 |
|
|
clic_irq_i : in std_ulogic; -- CLIC interrupt request
|
103 |
|
|
mtime_irq_i : in std_ulogic -- machine timer interrupt
|
104 |
|
|
);
|
105 |
|
|
end neorv32_cpu;
|
106 |
|
|
|
107 |
|
|
architecture neorv32_cpu_rtl of neorv32_cpu is
|
108 |
|
|
|
109 |
|
|
-- local signals --
|
110 |
|
|
signal ctrl : std_ulogic_vector(ctrl_width_c-1 downto 0); -- main control bus
|
111 |
|
|
signal alu_cmp : std_ulogic_vector(1 downto 0); -- alu comparator result
|
112 |
|
|
signal imm : std_ulogic_vector(data_width_c-1 downto 0); -- immediate
|
113 |
|
|
signal instr : std_ulogic_vector(data_width_c-1 downto 0); -- new instruction
|
114 |
|
|
signal rs1, rs2 : std_ulogic_vector(data_width_c-1 downto 0); -- source registers
|
115 |
|
|
signal alu_res : std_ulogic_vector(data_width_c-1 downto 0); -- alu result
|
116 |
|
|
signal alu_add : std_ulogic_vector(data_width_c-1 downto 0); -- alu adder result
|
117 |
|
|
signal rdata : std_ulogic_vector(data_width_c-1 downto 0); -- memory read data
|
118 |
|
|
signal alu_wait : std_ulogic; -- alu is busy due to iterative unit
|
119 |
|
|
signal bus_wait : std_ulogic; -- wait for bus to finish operation
|
120 |
|
|
signal csr_rdata : std_ulogic_vector(data_width_c-1 downto 0); -- csr read data
|
121 |
|
|
signal mar : std_ulogic_vector(data_width_c-1 downto 0); -- current memory address register
|
122 |
|
|
signal ma_instr : std_ulogic; -- misaligned instruction address
|
123 |
|
|
signal ma_load : std_ulogic; -- misaligned load data address
|
124 |
|
|
signal ma_store : std_ulogic; -- misaligned store data address
|
125 |
|
|
signal be_instr : std_ulogic; -- bus error on instruction access
|
126 |
|
|
signal be_load : std_ulogic; -- bus error on load data access
|
127 |
|
|
signal be_store : std_ulogic; -- bus error on store data access
|
128 |
|
|
signal bus_exc_ack : std_ulogic; -- bus exception error acknowledge
|
129 |
6 |
zero_gravi |
signal bus_busy : std_ulogic; -- bus unit is busy
|
130 |
|
|
signal fetch_pc : std_ulogic_vector(data_width_c-1 downto 0); -- pc for instruction fetch
|
131 |
|
|
signal curr_pc : std_ulogic_vector(data_width_c-1 downto 0); -- current pc (for current executed instruction)
|
132 |
|
|
signal next_pc : std_ulogic_vector(data_width_c-1 downto 0); -- next pc (for current executed instruction)
|
133 |
2 |
zero_gravi |
|
134 |
|
|
-- co-processor interface --
|
135 |
|
|
signal cp0_data, cp1_data : std_ulogic_vector(data_width_c-1 downto 0);
|
136 |
|
|
signal cp0_valid, cp1_valid : std_ulogic;
|
137 |
|
|
|
138 |
|
|
begin
|
139 |
|
|
|
140 |
|
|
-- Control Unit ---------------------------------------------------------------------------
|
141 |
|
|
-- -------------------------------------------------------------------------------------------
|
142 |
|
|
neorv32_cpu_control_inst: neorv32_cpu_control
|
143 |
|
|
generic map (
|
144 |
|
|
-- General --
|
145 |
6 |
zero_gravi |
CLOCK_FREQUENCY => CLOCK_FREQUENCY, -- clock frequency of clk_i in Hz
|
146 |
|
|
HART_ID => HART_ID, -- custom hardware thread ID
|
147 |
|
|
BOOTLOADER_USE => BOOTLOADER_USE, -- implement processor-internal bootloader?
|
148 |
|
|
CSR_COUNTERS_USE => CSR_COUNTERS_USE, -- implement RISC-V perf. counters ([m]instret[h], [m]cycle[h], time[h])?
|
149 |
2 |
zero_gravi |
-- RISC-V CPU Extensions --
|
150 |
|
|
CPU_EXTENSION_RISCV_C => CPU_EXTENSION_RISCV_C, -- implement compressed extension?
|
151 |
|
|
CPU_EXTENSION_RISCV_E => CPU_EXTENSION_RISCV_E, -- implement embedded RF extension?
|
152 |
|
|
CPU_EXTENSION_RISCV_M => CPU_EXTENSION_RISCV_M, -- implement muld/div extension?
|
153 |
|
|
CPU_EXTENSION_RISCV_Zicsr => CPU_EXTENSION_RISCV_Zicsr, -- implement CSR system?
|
154 |
|
|
-- Memory configuration: Instruction memory --
|
155 |
|
|
MEM_ISPACE_BASE => MEM_ISPACE_BASE, -- base address of instruction memory space
|
156 |
|
|
MEM_ISPACE_SIZE => MEM_ISPACE_SIZE, -- total size of instruction memory space in byte
|
157 |
|
|
MEM_INT_IMEM_USE => MEM_INT_IMEM_USE, -- implement processor-internal instruction memory
|
158 |
|
|
MEM_INT_IMEM_SIZE => MEM_INT_IMEM_SIZE, -- size of processor-internal instruction memory in bytes
|
159 |
|
|
MEM_INT_IMEM_ROM => MEM_INT_IMEM_ROM, -- implement processor-internal instruction memory as ROM
|
160 |
|
|
-- Memory configuration: Data memory --
|
161 |
|
|
MEM_DSPACE_BASE => MEM_DSPACE_BASE, -- base address of data memory space
|
162 |
|
|
MEM_DSPACE_SIZE => MEM_DSPACE_SIZE, -- total size of data memory space in byte
|
163 |
|
|
MEM_INT_DMEM_USE => MEM_INT_DMEM_USE, -- implement processor-internal data memory
|
164 |
|
|
MEM_INT_DMEM_SIZE => MEM_INT_DMEM_SIZE, -- size of processor-internal data memory in bytes
|
165 |
|
|
-- Memory configuration: External memory interface --
|
166 |
|
|
MEM_EXT_USE => MEM_EXT_USE, -- implement external memory bus interface?
|
167 |
|
|
-- Processor peripherals --
|
168 |
|
|
IO_GPIO_USE => IO_GPIO_USE, -- implement general purpose input/output port unit (GPIO)?
|
169 |
|
|
IO_MTIME_USE => IO_MTIME_USE, -- implement machine system timer (MTIME)?
|
170 |
|
|
IO_UART_USE => IO_UART_USE, -- implement universal asynchronous receiver/transmitter (UART)?
|
171 |
|
|
IO_SPI_USE => IO_SPI_USE, -- implement serial peripheral interface (SPI)?
|
172 |
|
|
IO_TWI_USE => IO_TWI_USE, -- implement two-wire interface (TWI)?
|
173 |
|
|
IO_PWM_USE => IO_PWM_USE, -- implement pulse-width modulation unit (PWM)?
|
174 |
|
|
IO_WDT_USE => IO_WDT_USE, -- implement watch dog timer (WDT)?
|
175 |
|
|
IO_CLIC_USE => IO_CLIC_USE, -- implement core local interrupt controller (CLIC)?
|
176 |
3 |
zero_gravi |
IO_TRNG_USE => IO_TRNG_USE, -- implement true random number generator (TRNG)?
|
177 |
|
|
IO_DEVNULL_USE => IO_DEVNULL_USE -- implement dummy device (DEVNULL)?
|
178 |
2 |
zero_gravi |
)
|
179 |
|
|
port map (
|
180 |
|
|
-- global control --
|
181 |
|
|
clk_i => clk_i, -- global clock, rising edge
|
182 |
|
|
rstn_i => rstn_i, -- global reset, low-active, async
|
183 |
|
|
ctrl_o => ctrl, -- main control bus
|
184 |
|
|
-- status input --
|
185 |
|
|
alu_wait_i => alu_wait, -- wait for ALU
|
186 |
|
|
bus_wait_i => bus_wait, -- wait for bus
|
187 |
|
|
-- data input --
|
188 |
|
|
instr_i => instr, -- instruction
|
189 |
|
|
cmp_i => alu_cmp, -- comparator status
|
190 |
|
|
alu_add_i => alu_add, -- ALU.add result
|
191 |
|
|
-- data output --
|
192 |
|
|
imm_o => imm, -- immediate
|
193 |
6 |
zero_gravi |
fetch_pc_o => fetch_pc, -- PC for instruction fetch
|
194 |
|
|
curr_pc_o => curr_pc, -- current PC (corresponding to current instruction)
|
195 |
|
|
next_pc_o => next_pc, -- next PC (corresponding to current instruction)
|
196 |
2 |
zero_gravi |
-- csr interface --
|
197 |
|
|
csr_wdata_i => alu_res, -- CSR write data
|
198 |
|
|
csr_rdata_o => csr_rdata, -- CSR read data
|
199 |
|
|
-- external interrupt --
|
200 |
|
|
clic_irq_i => clic_irq_i, -- CLIC interrupt request
|
201 |
|
|
mtime_irq_i => mtime_irq_i, -- machine timer interrupt
|
202 |
|
|
-- bus access exceptions --
|
203 |
|
|
mar_i => mar, -- memory address register
|
204 |
|
|
ma_instr_i => ma_instr, -- misaligned instruction address
|
205 |
|
|
ma_load_i => ma_load, -- misaligned load data address
|
206 |
|
|
ma_store_i => ma_store, -- misaligned store data address
|
207 |
|
|
be_instr_i => be_instr, -- bus error on instruction access
|
208 |
|
|
be_load_i => be_load, -- bus error on load data access
|
209 |
|
|
be_store_i => be_store, -- bus error on store data access
|
210 |
6 |
zero_gravi |
bus_exc_ack_o => bus_exc_ack, -- bus exception error acknowledge
|
211 |
|
|
bus_busy_i => bus_busy -- bus unit is busy
|
212 |
2 |
zero_gravi |
);
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
-- Register File --------------------------------------------------------------------------
|
216 |
|
|
-- -------------------------------------------------------------------------------------------
|
217 |
|
|
neorv32_regfile_inst: neorv32_cpu_regfile
|
218 |
|
|
generic map (
|
219 |
|
|
CPU_EXTENSION_RISCV_E => CPU_EXTENSION_RISCV_E -- implement embedded RF extension?
|
220 |
|
|
)
|
221 |
|
|
port map (
|
222 |
|
|
-- global control --
|
223 |
|
|
clk_i => clk_i, -- global clock, rising edge
|
224 |
|
|
ctrl_i => ctrl, -- main control bus
|
225 |
|
|
-- data input --
|
226 |
|
|
mem_i => rdata, -- memory read data
|
227 |
|
|
alu_i => alu_res, -- ALU result
|
228 |
|
|
csr_i => csr_rdata, -- CSR read data
|
229 |
6 |
zero_gravi |
pc_i => next_pc, -- next pc
|
230 |
2 |
zero_gravi |
-- data output --
|
231 |
|
|
rs1_o => rs1, -- operand 1
|
232 |
|
|
rs2_o => rs2 -- operand 2
|
233 |
|
|
);
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
-- ALU ------------------------------------------------------------------------------------
|
237 |
|
|
-- -------------------------------------------------------------------------------------------
|
238 |
|
|
neorv32_cpu_alu_inst: neorv32_cpu_alu
|
239 |
|
|
port map (
|
240 |
|
|
-- global control --
|
241 |
|
|
clk_i => clk_i, -- global clock, rising edge
|
242 |
|
|
rstn_i => rstn_i, -- global reset, low-active, async
|
243 |
|
|
ctrl_i => ctrl, -- main control bus
|
244 |
|
|
-- data input --
|
245 |
|
|
rs1_i => rs1, -- rf source 1
|
246 |
|
|
rs2_i => rs2, -- rf source 2
|
247 |
6 |
zero_gravi |
pc2_i => curr_pc, -- delayed PC
|
248 |
2 |
zero_gravi |
imm_i => imm, -- immediate
|
249 |
|
|
csr_i => csr_rdata, -- csr read data
|
250 |
|
|
-- data output --
|
251 |
|
|
cmp_o => alu_cmp, -- comparator status
|
252 |
|
|
add_o => alu_add, -- OPA + OPB
|
253 |
|
|
res_o => alu_res, -- ALU result
|
254 |
|
|
-- co-processor interface --
|
255 |
|
|
cp0_data_i => cp0_data, -- co-processor 0 result
|
256 |
|
|
cp0_valid_i => cp0_valid, -- co-processor 0 result valid
|
257 |
|
|
cp1_data_i => cp1_data, -- co-processor 1 result
|
258 |
|
|
cp1_valid_i => cp1_valid, -- co-processor 1 result valid
|
259 |
|
|
-- status --
|
260 |
|
|
wait_o => alu_wait -- busy due to iterative processing units
|
261 |
|
|
);
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
-- Co-Processor 0: MULDIV Unit ------------------------------------------------------------
|
265 |
|
|
-- -------------------------------------------------------------------------------------------
|
266 |
|
|
neorv32_cpu_cp_muldiv_inst_true:
|
267 |
|
|
if (CPU_EXTENSION_RISCV_M = true) generate
|
268 |
|
|
neorv32_cpu_cp_muldiv_inst: neorv32_cpu_cp_muldiv
|
269 |
|
|
port map (
|
270 |
|
|
-- global control --
|
271 |
|
|
clk_i => clk_i, -- global clock, rising edge
|
272 |
|
|
rstn_i => rstn_i, -- global reset, low-active, async
|
273 |
|
|
ctrl_i => ctrl, -- main control bus
|
274 |
|
|
-- data input --
|
275 |
|
|
rs1_i => rs1, -- rf source 1
|
276 |
|
|
rs2_i => rs2, -- rf source 2
|
277 |
|
|
-- result and status --
|
278 |
|
|
res_o => cp0_data, -- operation result
|
279 |
|
|
valid_o => cp0_valid -- data output valid
|
280 |
|
|
);
|
281 |
|
|
end generate;
|
282 |
|
|
|
283 |
|
|
neorv32_cpu_cp_muldiv_inst_false:
|
284 |
|
|
if (CPU_EXTENSION_RISCV_M = false) generate
|
285 |
|
|
cp0_data <= (others => '0');
|
286 |
|
|
cp0_valid <= '0';
|
287 |
|
|
end generate;
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
-- Co-Processor 1: Not Implemented Yet ----------------------------------------------------
|
291 |
|
|
-- -------------------------------------------------------------------------------------------
|
292 |
|
|
cp1_data <= (others => '0');
|
293 |
|
|
cp1_valid <= '0';
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
-- Bus Unit -------------------------------------------------------------------------------
|
297 |
|
|
-- -------------------------------------------------------------------------------------------
|
298 |
|
|
neorv32_cpu_bus_inst: neorv32_cpu_bus
|
299 |
|
|
generic map (
|
300 |
6 |
zero_gravi |
MEM_EXT_TIMEOUT => MEM_EXT_TIMEOUT -- cycles after which a valid bus access will timeout
|
301 |
2 |
zero_gravi |
)
|
302 |
|
|
port map (
|
303 |
|
|
-- global control --
|
304 |
|
|
clk_i => clk_i, -- global clock, rising edge
|
305 |
|
|
rstn_i => rstn_i, -- global reset, low-active, async
|
306 |
|
|
ctrl_i => ctrl, -- main control bus
|
307 |
|
|
-- data input --
|
308 |
|
|
wdata_i => rs2, -- write data
|
309 |
6 |
zero_gravi |
pc_i => fetch_pc, -- current PC for instruction fetch
|
310 |
2 |
zero_gravi |
alu_i => alu_res, -- ALU result
|
311 |
|
|
-- data output --
|
312 |
|
|
instr_o => instr, -- instruction
|
313 |
|
|
rdata_o => rdata, -- read data
|
314 |
|
|
-- status --
|
315 |
|
|
mar_o => mar, -- current memory address register
|
316 |
|
|
ma_instr_o => ma_instr, -- misaligned instruction address
|
317 |
|
|
ma_load_o => ma_load, -- misaligned load data address
|
318 |
|
|
ma_store_o => ma_store, -- misaligned store data address
|
319 |
|
|
be_instr_o => be_instr, -- bus error on instruction access
|
320 |
|
|
be_load_o => be_load, -- bus error on load data access
|
321 |
|
|
be_store_o => be_store, -- bus error on store data access
|
322 |
|
|
bus_wait_o => bus_wait, -- wait for bus operation to finish
|
323 |
6 |
zero_gravi |
bus_busy_o => bus_busy, -- bus unit is busy
|
324 |
2 |
zero_gravi |
exc_ack_i => bus_exc_ack, -- exception controller ACK
|
325 |
|
|
-- bus system --
|
326 |
|
|
bus_addr_o => bus_addr_o, -- bus access address
|
327 |
|
|
bus_rdata_i => bus_rdata_i, -- bus read data
|
328 |
|
|
bus_wdata_o => bus_wdata_o, -- bus write data
|
329 |
|
|
bus_ben_o => bus_ben_o, -- byte enable
|
330 |
|
|
bus_we_o => bus_we_o, -- write enable
|
331 |
|
|
bus_re_o => bus_re_o, -- read enable
|
332 |
|
|
bus_ack_i => bus_ack_i, -- bus transfer acknowledge
|
333 |
|
|
bus_err_i => bus_err_i -- bus transfer error
|
334 |
|
|
);
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
end neorv32_cpu_rtl;
|