From f96a017bc7dffd49ed6588ecafe4637d8ee55d89 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sat, 13 Jun 2015 09:56:57 +0000 Subject: [PATCH] [SPI master] - added XFER Busy to status - don't enqueue data or commands if in reset state git-svn-id: http://moon:8086/svn/vhdl/trunk@1295 cc03376c-175c-47c8-b038-4cd826a8556b --- lib/spi/src/spi_master.vhd | 15 ++++++++++----- lib/spi/src/spi_types.vhd | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/spi/src/spi_master.vhd b/lib/spi/src/spi_master.vhd index d889e2c..aa245ee 100644 --- a/lib/spi/src/spi_master.vhd +++ b/lib/spi/src/spi_master.vhd @@ -62,11 +62,13 @@ ARCHITECTURE behavior OF spi_master IS signal cat_fifo_full : std_logic; signal cat_fifo_empty : std_logic; signal cat_fifo_re : std_logic; + signal cat_fifo_we : std_logic; signal write_fifo_din : unsigned(WORD_WIDTH-1 downto 0); signal write_fifo_dout : unsigned(WORD_WIDTH-1 downto 0); signal write_fifo_full : std_logic; signal write_fifo_empty : std_logic; + signal write_fifo_we : std_logic; signal read_fifo_full : std_logic; signal read_fifo_empty : std_logic; @@ -104,7 +106,7 @@ begin status.write_fifo_empty <= write_fifo_empty; status.read_fifo_full <= read_fifo_full; status.read_fifo_empty <= read_fifo_empty; - status.rx_valid <= read_fifo_we; + status.xfer_busy <= '0' when state = idle else '1'; mso <= slv_enable; -------------------------------------------------------------------------- @@ -120,7 +122,7 @@ begin rst => spi_rst, clk_w => clk, clk_r => spi_clk, - we => cmd_vld, + we => cat_fifo_we, re => cat_fifo_re, fifo_full => cat_fifo_full, fifo_empty => cat_fifo_empty, @@ -142,7 +144,7 @@ begin rst => spi_rst, clk_w => clk, clk_r => spi_clk, - we => din_vld, + we => write_fifo_we, re => data_load_en, fifo_full => write_fifo_full, fifo_empty => write_fifo_empty, @@ -249,7 +251,7 @@ begin end process; proc_fsm: -process(state, cat_fifo_empty, cat_fifo_full, write_fifo_empty, write_fifo_full, read_fifo_full, xfer_count_busy, data_count_busy, word_cnt_pipe, ctrl_reg) +process(state, cat_fifo_empty, cat_fifo_full, write_fifo_empty, write_fifo_full, read_fifo_full, xfer_count_busy, data_count_busy, word_cnt_pipe, ctrl_reg, cmd_vld, din_vld) begin state_next <= state; @@ -263,13 +265,16 @@ begin slv_enable <= '1'; read_fifo_we <= '0'; cat_fifo_re <= '0'; - + cat_fifo_we <= cmd_vld; + write_fifo_we <= din_vld; case state is when reset => cmd_rdy <= '0'; din_rdy <= '0'; slv_enable <= '0'; + cat_fifo_we <= '0'; + write_fifo_we <= '0'; state_next <= idle; when idle => diff --git a/lib/spi/src/spi_types.vhd b/lib/spi/src/spi_types.vhd index 976919d..033da7d 100644 --- a/lib/spi/src/spi_types.vhd +++ b/lib/spi/src/spi_types.vhd @@ -30,7 +30,7 @@ package spi_types is write_fifo_empty : std_logic; read_fifo_full : std_logic; read_fifo_empty : std_logic; - rx_valid : std_logic; + xfer_busy : std_logic; end record; -- Functions