Reset cmd_ready_o in spi_txrx
authorAnton Blanchard <anton@linux.ibm.com>
Sun, 3 Jan 2021 18:44:23 +0000 (05:44 +1100)
committerAnton Blanchard <anton@ozlabs.org>
Sun, 3 Jan 2021 18:44:23 +0000 (05:44 +1100)
Initialize bit_count so that cmd_ready_o isn't X state immediately
after reset.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
spi_rxtx.vhdl

index acb5becb23323f0483fff26238fc6e948de7399e..f8dfb88659cbb43bc2f5127572c2bbc8964c43f6 100644 (file)
@@ -257,12 +257,16 @@ begin
     count_bit: process(clk)
     begin
         if rising_edge(clk) then
-            if start_cmd = '1' then
-                bit_count <= cmd_clks_i;
-            elsif state /= DATA then
-                bit_count <= (others => '1');
-            elsif sck_recv = '1' then
-                bit_count <= std_ulogic_vector(unsigned(bit_count) - 1);
+            if rst = '1' then
+                bit_count <= (others => '0');
+            else
+                if start_cmd = '1' then
+                    bit_count <= cmd_clks_i;
+                elsif state /= DATA then
+                    bit_count <= (others => '1');
+                elsif sck_recv = '1' then
+                    bit_count <= std_ulogic_vector(unsigned(bit_count) - 1);
+                end if;
             end if;
         end if;
     end process;