Skip to content

Commit e0640c8

Browse files
authored
Merge pull request #315 from stnolting/hotfix_buskeeper
🐛 fix buskeeper timeout error
2 parents 09b6e8c + aa097a5 commit e0640c8

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ mimpid = 0x01040312 => 01.04.03.12 => Version 01.04.03.12 => v1.4.3.12
3232

3333
| Date (*dd.mm.yyyy*) | Version | Comment |
3434
|:----------:|:-------:|:--------|
35+
| 13.05.2022 | 1.7.1.6 | :bug: fixed bug in **BUSKEEPER** timeout logic; [#315](https://github.com/stnolting/neorv32/pull/315) |
3536
| 10.05.2022 | 1.7.1.5 | code clean-up and minor optimization of `B` extension (bit-manipulation) CPU co-processor; [#312](https://github.com/stnolting/neorv32/pull/312) |
3637
| 06.05.2022 | 1.7.1.4 | :sparkles: upgrade TRNG module to new [neoTRNG v2](https://github.com/stnolting/neoTRNG); [#311](https://github.com/stnolting/neorv32/pull/311) |
3738
| 05.05.2022 | 1.7.1.3 | :bug: bug fix in CPU counter overflow logic (`cycle` and `instret` counters); minor optimization of CPU execution unit; [#310](https://github.com/stnolting/neorv32/pull/310) |

rtl/core/neorv32_bus_keeper.vhd

+21-5
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,17 @@ architecture neorv32_bus_keeper_rtl of neorv32_bus_keeper is
9090
signal wren : std_ulogic; -- word write enable
9191
signal rden : std_ulogic; -- read enable
9292

93+
-- timeout counter size --
94+
constant cnt_width_c : natural := index_size_f(max_proc_int_response_time_c);
95+
9396
-- controller --
9497
type control_t is record
9598
pending : std_ulogic;
96-
timeout : std_ulogic_vector(index_size_f(max_proc_int_response_time_c) downto 0);
99+
timeout : std_ulogic_vector(cnt_width_c-1 downto 0);
97100
err_type : std_ulogic;
98101
bus_err : std_ulogic;
102+
ignore : std_ulogic;
103+
expired : std_ulogic;
99104
end record;
100105
signal control : control_t;
101106

@@ -154,25 +159,33 @@ begin
154159
control.bus_err <= '0'; -- required
155160
control.err_type <= '-';
156161
control.timeout <= (others => '-');
162+
control.ignore <= '-';
157163
elsif rising_edge(clk_i) then
158164
-- defaults --
159165
control.bus_err <= '0';
160166

161167
-- access monitor: IDLE --
162168
if (control.pending = '0') then
163-
control.timeout <= std_ulogic_vector(to_unsigned(max_proc_int_response_time_c, index_size_f(max_proc_int_response_time_c)+1));
169+
control.timeout <= std_ulogic_vector(to_unsigned(max_proc_int_response_time_c-1, cnt_width_c));
170+
control.ignore <= '0';
164171
if (bus_rden_i = '1') or (bus_wren_i = '1') then
165172
control.pending <= '1';
166173
end if;
167174
-- access monitor: PENDING --
168175
else
169-
control.timeout <= std_ulogic_vector(unsigned(control.timeout) - 1); -- countdown timer
176+
-- countdown timer --
177+
if (control.expired = '0') then
178+
control.timeout <= std_ulogic_vector(unsigned(control.timeout) - 1);
179+
end if;
180+
-- bus keeper shall ignore internal timeout during this access (because it's "external") --
181+
control.ignore <= control.ignore or (bus_ext_i or bus_xip_i);
182+
-- response handling --
170183
if (bus_err_i = '1') then -- error termination by bus system
171184
control.err_type <= err_device_c; -- device error
172185
control.bus_err <= '1';
173186
control.pending <= '0';
174-
elsif ((or_reduce_f(control.timeout) = '0') and (bus_ext_i = '0') and (bus_xip_i = '0')) or -- valid INTERNAL access timeout
175-
(bus_tmo_i = '1') then -- external access timeout
187+
elsif ((control.expired = '1') and (control.ignore = '0')) or -- valid INTERNAL access timeout
188+
(bus_tmo_i = '1') then -- EXTERNAL access timeout
176189
control.err_type <= err_timeout_c; -- timeout error
177190
control.bus_err <= '1';
178191
control.pending <= '0';
@@ -185,6 +198,9 @@ begin
185198
end if;
186199
end process keeper_control;
187200

201+
-- timeout counter expired? --
202+
control.expired <= '1' when (or_reduce_f(control.timeout) = '0') else '0';
203+
188204
-- signal bus error to CPU --
189205
err_o <= control.bus_err;
190206

rtl/core/neorv32_package.vhd

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ package neorv32_package is
6868
-- Architecture Constants (do not modify!) ------------------------------------------------
6969
-- -------------------------------------------------------------------------------------------
7070
constant data_width_c : natural := 32; -- native data path width - do not change!
71-
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01070105"; -- NEORV32 version - no touchy!
71+
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01070106"; -- NEORV32 version - no touchy!
7272
constant archid_c : natural := 19; -- official NEORV32 architecture ID - hands off!
7373

7474
-- Check if we're inside the Matrix -------------------------------------------------------

0 commit comments

Comments
 (0)