Skip to content
This repository was archived by the owner on Nov 22, 2023. It is now read-only.

SPI Host: FSM Bug CSAAT #387

Closed
crsystems opened this issue Apr 19, 2022 · 0 comments · Fixed by #388
Closed

SPI Host: FSM Bug CSAAT #387

crsystems opened this issue Apr 19, 2022 · 0 comments · Fixed by #388

Comments

@crsystems
Copy link

The OpenTitan SPI host FSM contains a bug as it uses the command_i.segment.csaat signal instead of the latched csaat_q from the command that is currently being executed to decide how the chip select will be handled.

See OpenTitans Fix

Patch to rectify the problem:

diff --git a/hw/vendor/lowrisc_opentitan/spi_host/rtl/spi_host_fsm.sv b/hw/vendor/lowrisc_opentitan/spi_host/rtl/spi_host_fsm.sv
index 4fb1360d..e50d0e7e 100644
--- a/hw/vendor/lowrisc_opentitan/spi_host/rtl/spi_host_fsm.sv
+++ b/hw/vendor/lowrisc_opentitan/spi_host/rtl/spi_host_fsm.sv
@@ -250,7 +250,7 @@ module spi_host_fsm
           // and of CSAAT is asserted, the details of the subsequent command.
           if (!last_bit || !last_byte) begin
             prestall_st_d = InternalClkLow;
-          end else if (!command_i.segment.csaat) begin
+          end else if (!csaat_q) begin
             prestall_st_d = WaitTrail;
           end else if (!command_valid_i) begin
             prestall_st_d = IdleCSBActive;
GiannaP pushed a commit that referenced this issue Apr 21, 2022
* snitch: Fix some latches possibly hidden by optimization

* occamy-quadrant: Remove stray comment in controller TLB connections

* vendor: Update `tech_cells_generic to newest version with fixed Bender and defines

* spi_host: Fix CSAAT behavior (See #387)

* vendor: Add `spi_host` patch
colluca pushed a commit to pulp-platform/occamy that referenced this issue Aug 19, 2023
* snitch: Fix some latches possibly hidden by optimization

* occamy-quadrant: Remove stray comment in controller TLB connections

* vendor: Update `tech_cells_generic to newest version with fixed Bender and defines

* spi_host: Fix CSAAT behavior (See pulp-platform/snitch#387)

* vendor: Add `spi_host` patch
colluca pushed a commit to pulp-platform/occamy that referenced this issue Aug 19, 2023
* snitch: Fix some latches possibly hidden by optimization

* occamy-quadrant: Remove stray comment in controller TLB connections

* vendor: Update `tech_cells_generic to newest version with fixed Bender and defines

* spi_host: Fix CSAAT behavior (See pulp-platform/snitch#387)

* vendor: Add `spi_host` patch
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant