Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI Engine: fix off-by-one sleep time #1429

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/library/spi_engine/instruction-format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ is the minimum, needed by the internal logic.

.. math::

sleep\_time = \frac{2+(t) * ((div + 1) * 2)}{f_{clk}}
sleep\_time = \frac{2+(t+1) * ((div + 1) * 2)}{f_{clk}}

.. list-table::
:widths: 10 15 75
Expand All @@ -182,7 +182,7 @@ is the minimum, needed by the internal logic.
- Description
* - t
- Time
- The amount of time to wait.
- The amount of prescaler cycles to wait, minus one.

.. _spi_engine cs-invert-mask-instruction:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ module spi_engine_execution #(
assign trigger_tx = trigger == 1'b1 && ntx_rx == 1'b0;
assign trigger_rx = trigger == 1'b1 && ntx_rx == 1'b1;

assign sleep_counter_compare = sleep_counter == cmd_d1[7:0];
assign sleep_counter_compare = sleep_counter == cmd_d1[7:0]+1;
assign cs_sleep_counter_compare = cs_sleep_counter == cmd_d1[9:8];
assign cs_sleep_early_exit = (cmd_d1[9:8] == 2'b00);

Expand Down
Loading