亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? spi_control_sm.vhd

?? SPI.zip
?? VHD
?? 第 1 頁 / 共 2 頁
字號:
-- File:     spi_control_sm.vhd
-- 
-- Created:  8-23-00 ALS
--  This file contains the overall control of the SPI interface. It generates the slave 
--  select signals and the masks so that the SCK signals output to the SPI bus align properly
--  with the data. It generates the control signals to the shift register and the receive
--  data register.
--
--  This SPI interface operates on bytes of data. When the START signal from the uC is
--  asserted the byte-wide data in the SPI transmit register is transmitted on the SPI bus.
--  When this transfer is complete, the BUSY signal is negated and the START signal is 
--  sampled. If the START signal is still asserted indicating that the uC has put new 
--  data in the SPI transmit register, the data in the transmit register will be transmitted.
--  Each byte of data received from the SPI bus is captured in the receive register.The uC can
--  read this data once the BUSY signal has negated.
--
-- Revised: 9-6-00 ALS
-- Revised: 9-12-00 ALS
-- Revised: 10-17-00 ALS
-- Revised: 10-19-00 ALS
-- Revised: 10-27-00 ALS
-- Revised: 12-12-02 JRH


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;


entity spi_control_sm is
    port(
         
         -- internal uC interface signals
         start          : in    std_logic;      -- start transfer
         done           : out   std_logic;  -- byte transfer is complete
         rcv_load       : in    std_logic;  -- load control signal to spi receive register
         ss_mask_reg    : in    std_logic_vector(7 downto 0);   -- uc slave select register
         ss_in_int      : inout std_logic;  -- internal sampled version of ss_in_n needed by
                                -- uc to generate an interrupt
         xmit_empty     : inout std_logic;  -- flag indicating that spitr is empty
         xmit_empty_reset   : in    std_logic;  -- xmit empty flag reset when spitr is written
         rcv_full       : out   std_logic;  -- flag indicating that spirr has new data
         rcv_full_reset : in    std_logic;  -- rcv full flag reset when spirr is read
         cpha           : in    std_logic;  -- clock phase from uc
         cpol           : in    std_logic;  -- clock polarity from uc
    
         -- spi interface signals
         ss_n           : out   std_logic_vector(7 downto 0);  -- slave select signals
         ss_in_n        : in    std_logic;  -- input slave select indicating master bus contention
         ss_n_int       : inout std_logic;  -- internal ss_n that is masked with 
                                            -- slave select register
         
         -- internal interface signals
         sck_int        : in    std_logic;  -- internal version of sck with cpha=1
         sck_int_re     : in    std_logic;  -- indicates rising edge on internal sck
         sck_int_fe     : in    std_logic;  -- indicates falling edge on internal sck
         sck_re         : in    std_logic;  -- indicates rising edge on external sck
         sck_fe         : in    std_logic;  -- indicates falling edge on external sck
         xmit_shift     : out   std_logic;  -- shift control signal to spi xmit shift register
         xmit_load      : inout std_logic;  -- load control signal to the spi xmit shift register
         clk1_mask      : out   std_logic;  -- masks cpha=1 version of sck 
         clk0_mask      : out   std_logic;  -- masks cpha=0 version of sck
         
         
         -- clock and reset
         reset          : in    std_logic;  -- active low reset     
         clk            : in    std_logic   -- clock
        
         );
        
end spi_control_sm;



architecture DEFINITION of spi_control_sm is

--**************************** Constants ***************************************

constant RESET_ACTIVE   : std_logic := '0';
constant EIGHT          : std_logic_vector(3 downto 0) := "1000";   

--**************************** Signals ***************************************

type SPI_STATE_TYPE is (IDLE, ASSERT_SSN1, ASSERT_SSN2, UNMASK_SCK, XFER_BIT, 
                        ASSERT_DONE, CHK_START, MASK_SCK, HOLD_SSN1, HOLD_SSN2,
                        NEGATE_SSN);
signal spi_state, next_spi_state    : SPI_STATE_TYPE;

signal bit_cnt      : STD_LOGIC_VECTOR(3 downto 0); -- bit counter output
signal bit_cnt_en   : STD_LOGIC;        -- count enable for bit counter
signal bit_cnt_rst  : STD_LOGIC;        -- reset for bit counter from SPI
                        -- control state machine
signal bit_cnt_reset    : STD_LOGIC;        -- reset to bit counter that includes
                        -- SS_IN_INT

signal ss_in_neg    : STD_LOGIC;        -- SS_IN_N sampled with rising edge of clk
signal ss_in_pos    : STD_LOGIC;        -- SS_IN_N sampled with negative edge of clk
signal ss_n_out     : STD_LOGIC_VECTOR(7 downto 0); -- output SS_N that are 3-stated if SS_IN_INT
                        -- is asserted indicating another master
                        


--**************************** Component Definitions  ********************************
-- 4-bit counter for bit counter
component upcnt4 
    port(
          
         cnt_en       : in STD_LOGIC;                        -- Count enable                       
         clr          : in STD_LOGIC;                        -- Active high clear
         clk          : in STD_LOGIC;                        -- Clock
         qout         : inout STD_LOGIC_VECTOR (3 downto 0)
        
         );
        
end component;

begin

--************************** Bit Counter Instantiation ********************************
BIT_CNTR : upcnt4
    port map(
          
         cnt_en       => bit_cnt_en,
         clr          => bit_cnt_reset,
         clk          => sck_int,
         qout         => bit_cnt
        
         );
         
--************************** SS_IN_N Input synchronization *******************************
-- When the SS_IN_N input is asserted, it indicates that there is another master on the bus
-- that has selected this master as a slave. When this signal asserts, the SPI master needs
-- to reset and tristate outputs. Therefore, the SS_IN_N input should be synchronized with the
-- system clock to prevent glitches on this signal from reseting the SPI master. The proces
-- below first samples SS_IN_N with the rising edge of the system clock and the falling edge
-- of the system clock. If both of these samples show that the signal is asserted, then the
-- internal SS_IN_INT signal will assert. SS_IN_INT is passed to the uC logic to generate an
-- interrupt if interrupts have been enabled. It is also passed to the SCK logic and the 
-- SPI Xmit shift register to tri-state the SCK and MOSI outputs.

ss_in_rising: process(clk, reset)
begin
    if reset = RESET_ACTIVE then
        ss_in_pos <= '1';
    elsif clk'event and clk = '1' then
        ss_in_pos <= ss_in_n;
    end if;
end process;

ss_in_falling: process (clk, reset)
begin
    if reset = RESET_ACTIVE then
        ss_in_neg <= '1';
    elsif clk'event and clk = '0' then
        ss_in_neg <= ss_in_n;
    end if;
end process;

ss_in_sample: process(clk,reset)
begin
    if reset = RESET_ACTIVE then
        ss_in_int <= '1';
    elsif clk'event and clk = '1' then
        if ss_in_pos = '0' and ss_in_neg = '0' then
            ss_in_int <= '0';
        else
            ss_in_int <= '1';
        end if;
    end if;
end process;

--************************** Bit Counter reset ***************************************
-- The bit counter needs to be reset when the reset signal is asserted from the SPI control
-- state machine is asserted and when SS_IN_INT is asserted
-- is asserted
bit_cnt_reset <= RESET_ACTIVE when bit_cnt_rst = RESET_ACTIVE or ss_in_int = '0'
        else not(RESET_ACTIVE);

--************************** SPI Control State Machine *******************************
-- Register process registers next state signals
-- Return to IDLE state whenever SS_IN_INT is asserted

spi_sm_reg:process(clk, reset, ss_in_int)

begin
          
          -- Set state to IDLE upon reset
          if (reset = RESET_ACTIVE or ss_in_int = '0') then
            spi_state <= IDLE;
           
     elsif clk'event and clk = '1' then

        spi_state <= next_spi_state;
      end if;

end process;

-- Combinatorial process determines next state logic

spi_sm_comb: process(spi_state, start,bit_cnt, sck_re, sck_fe, sck_int_re, sck_int_fe,
            xmit_empty, cpha, cpol)

begin

-- set defaults
clk0_mask   <= '0';
clk1_mask   <= '0';
bit_cnt_en  <= '0';
bit_cnt_rst <= RESET_ACTIVE;
next_spi_state <= spi_state;
done        <= '0';
xmit_shift  <= '0';
xmit_load   <= '0';

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一区二区三区视频视频| 国产一区二区网址| 精品日韩99亚洲| 欧美在线观看视频一区二区| 国产夫妻精品视频| 国产美女精品在线| 国产精一区二区三区| 日韩av一区二| 精品亚洲国产成人av制服丝袜| 高潮精品一区videoshd| 色久综合一二码| 国产视频一区在线播放| 亚洲欧美日韩中文字幕一区二区三区 | 日韩欧美亚洲一区二区| 国产精品视频一二三区| 成人免费视频网站在线观看| 精品国产电影一区二区| 久久久综合网站| 国产欧美日韩精品在线| 国产.欧美.日韩| 国产精品久久久久9999吃药| 国产精品亚洲综合一区在线观看| 久久久天堂av| 成人国产在线观看| 久久久亚洲午夜电影| 国产iv一区二区三区| 亚洲色大成网站www久久九九| 成人18视频在线播放| 亚洲欧美日韩久久| 亚洲一区二区美女| 日韩av不卡一区二区| 久久久另类综合| 国产精品美女久久久久高潮| 欧美夫妻性生活| 欧美一区二区在线免费观看| 国产在线观看一区二区| 国产精品美女久久久久aⅴ| 99久久伊人久久99| 欧美一区二区三区婷婷月色| 精品伊人久久久久7777人| 国产精品看片你懂得| 亚洲电影你懂得| 欧美一区二区久久久| 一区二区三区免费网站| 久久成人18免费观看| 一区二区三区四区视频精品免费 | 欧美aⅴ一区二区三区视频| av在线播放不卡| 欧美日韩一区高清| 久久9热精品视频| 国内成人免费视频| 成人黄色综合网站| 懂色av一区二区在线播放| 色综合夜色一区| 91女神在线视频| 国产成人午夜精品5599 | 欧美高清精品3d| 久久电影网站中文字幕 | 亚洲精品日韩综合观看成人91| 五月激情综合网| 欧美精品一区二区三区蜜臀| 夜夜爽夜夜爽精品视频| 国产精品456露脸| 风间由美一区二区av101| 欧美刺激午夜性久久久久久久| 91激情在线视频| 91美女在线观看| 成人av中文字幕| 成人视屏免费看| 风间由美中文字幕在线看视频国产欧美| 蜜臀av国产精品久久久久 | 日韩欧美国产综合| 欧美久久久久久蜜桃| 色婷婷国产精品久久包臀| 成人激情免费网站| 成人黄色片在线观看| 成人丝袜18视频在线观看| 国产精品一区二区无线| 国产精品一二三四| 国产成人午夜精品影院观看视频| 国产精品99久| 国内精品久久久久影院薰衣草| 久久97超碰色| 国产精品99久久久久久久vr| 国产jizzjizz一区二区| 成人永久免费视频| 成人性视频网站| 99re成人在线| 色综合天天狠狠| 欧美在线影院一区二区| 欧美中文一区二区三区| 欧美中文字幕一二三区视频| 欧美日韩精品福利| 欧美日韩高清一区二区不卡| 69久久夜色精品国产69蝌蚪网| 欧美一级夜夜爽| 精品福利av导航| 国产精品麻豆久久久| 一区二区三区产品免费精品久久75| 亚洲一区在线视频| 日本人妖一区二区| 国产成人小视频| 色8久久精品久久久久久蜜| 欧美高清视频一二三区| 久久九九影视网| 最新国产成人在线观看| 亚洲国产sm捆绑调教视频| 裸体健美xxxx欧美裸体表演| 国产精品456| 在线观看成人小视频| 欧美一区二区精品久久911| 欧美激情一区二区三区在线| 一区二区三区四区蜜桃| 六月丁香综合在线视频| 95精品视频在线| 337p亚洲精品色噜噜| 国产午夜精品美女毛片视频| 一区二区三区.www| 国产一区视频在线看| 欧美制服丝袜第一页| 久久精品无码一区二区三区| 亚洲美女电影在线| 国模少妇一区二区三区| 欧美视频在线观看一区| 精品国产麻豆免费人成网站| 亚洲靠逼com| 黄页视频在线91| 欧美日韩一区二区三区在线看 | 欧美极品少妇xxxxⅹ高跟鞋 | 在线观看91视频| 久久亚洲精精品中文字幕早川悠里| 一区二区三区在线视频免费| 国产精品99久久久| 日韩一区二区三区在线观看| 亚洲少妇屁股交4| 国产一区二区0| 这里只有精品99re| 亚洲免费观看在线观看| 国产精品一区二区男女羞羞无遮挡| 欧美日韩一区二区三区视频| 国产精品久久久久影院色老大 | av成人免费在线| 精品伦理精品一区| 亚洲成人一区在线| 91在线视频播放地址| 久久久国产一区二区三区四区小说 | 国产精品美女久久久久久久久久久 | 欧美在线观看18| 国产精品成人在线观看| 国产米奇在线777精品观看| 欧美一级黄色录像| 一区二区成人在线观看| 99久久99精品久久久久久 | 7777精品伊人久久久大香线蕉的| 亚洲欧美偷拍三级| 99久久精品免费精品国产| 26uuu精品一区二区| 蜜桃久久精品一区二区| 欧美日韩国产成人在线91| 亚洲欧美日韩在线不卡| 91亚洲资源网| 亚洲私人影院在线观看| 成人综合在线网站| 国产精品视频第一区| 国产二区国产一区在线观看| 久久婷婷国产综合国色天香| 精品一区二区三区蜜桃| 精品乱码亚洲一区二区不卡| 久久精品国产77777蜜臀| 日韩欧美黄色影院| 韩国女主播成人在线| 日韩视频免费观看高清完整版在线观看| 亚洲第一激情av| 5月丁香婷婷综合| 日本不卡一区二区三区高清视频| 91精品免费观看| 久久成人久久爱| 日本一区二区三区在线观看| 国产成人无遮挡在线视频| 欧美国产精品v| av亚洲精华国产精华精| 一级特黄大欧美久久久| 欧美精品日韩精品| 蜜桃av一区二区三区电影| 欧美电影免费观看高清完整版在 | 久久久.com| 国产成人h网站| 日韩一区在线免费观看| 欧美写真视频网站| 美女网站在线免费欧美精品| 久久这里只有精品6| 99综合影院在线| 丝袜美腿亚洲一区二区图片| 精品三级在线观看| 成人午夜精品一区二区三区| 亚洲精品免费在线观看| 91精品中文字幕一区二区三区| 国产呦萝稀缺另类资源| 亚洲色图一区二区三区| 日韩三级av在线播放|