Entity: spi_slave_io

Diagram

PW sclk mosi ss spi_en cpol cpha lsbfirst [7:0] spi_rdata clk nreset wait_in miso spi_clk spi_write [5:0] spi_addr [7:0] spi_wdata access_out [PW-1:0] packet_out

Description

#############################################################################

Purpose: SPI slave IO state-machine

NOTE: only cpol=0, cpha=0 supported for now!!

#############################################################################

Author: Andreas Olofsson

License: MIT (see LICENSE file in OH! repository) #

#############################################################################

Generics

Generic name Type Value Description
PW 104 packet width

Ports

Port name Direction Type Description
sclk input slave clock
mosi input slave input
ss input slave select
miso output slave output
spi_en input spi enable
cpol input cpol
cpha input cpha
lsbfirst input lsbfirst
spi_clk output spi clock for regfile
spi_write output regfile write
spi_addr output [5:0] regfile addres
spi_wdata output [7:0] data for regfile
spi_rdata input [7:0] data for regfile
clk input core clock
nreset input async active low reset
access_out output read or write core command
packet_out output [PW-1:0] packet
wait_in input temporary pushback

Signals

Name Type Description
access_reg reg ############### # LOCAL WIRES ###############
spi_state reg [1:0]
bit_count reg [7:0]
command_reg reg [7:0]
fetch_command reg
rx_data wire [7:0]
tx_data wire [63:0]
rx_shift wire
tx_load wire
tx_wait wire
ss_sync wire
ss_pulse wire
spi_fetch wire
byte_done wire
shift wire
rx_clk wire
tx_clk wire
next_byte wire

Processes

Type: always

Description
state machine

Type: always

Description
case (spi_state[1:0]) bit counter

Type: always

Description
command/address register auto increment for every byte

Type: always

Description
pipeleining and holding pulse if there is wait

Instantiations

Description
#################################

SPI RX SHIFT REGISTER

#################################

Description
#################################

TX SHIFT REGISTER

#################################

Description
rx_shift
sync the ss to free running clk

Description
create single cycle pulse

State machines

  • state machine
undefined