Skip to content
Open
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
19 changes: 9 additions & 10 deletions rtl/system/spi_host.sv
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ module spi_host #(

logic [CountWidth-1:0] limit, count;
logic sck, count_at_limit, sck_pos, sck_neg;

typedef enum logic[1:0] {
IDLE,
START,
SEND,
STOP
} spi_state_t;

spi_state_t state_q, state_d;

logic sck_en;
assign sck_en = (state_q == SEND);

Expand Down Expand Up @@ -62,15 +70,6 @@ module spi_host #(
// Set to HIGH at the negedge of the serial clock, used internally.
assign sck_neg = count_at_limit && sck;

typedef enum logic[1:0] {
IDLE,
START,
SEND,
STOP
} spi_state_t;

spi_state_t state_q, state_d;

logic [2:0] bit_counter_q, bit_counter_d;
logic [7:0] current_byte_q, current_byte_d, recieved_byte_d, recieved_byte_q;

Expand Down