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

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

?? wishbone_i2c_master.vhd

?? I2C總線協議 基于VHDL語言設計 需要可直接下載
?? VHD
?? 第 1 頁 / 共 2 頁
字號:
---- WISHBONE revB2 compiant I2C master core---- author: Richard Herveille-- rev. 0.1 based on simple_i2c-- rev. 0.2 april 27th 2001, fixed incomplete sensitivity list on assign_dato process (thanks to Matt Oseman)-- rev. 0.3 may 4th 2001, fixed typo rev.0.2 txt -> txr-- rev. 0.4 may 8th, added some remarks, fixed some sensitivity list issues------ Changes compared to simple_i2c-- 1) WISHBONE interface-- 2) added start/stop detection-- 3) added busy bit-- 4) removed automatic tri-state buffer insertion (for ASIC support)--library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity wishbone_i2c_master is	port (		-- wishbone signals		CLK_I : in std_logic;				-- master clock input		RST_I : in std_logic := '0';			-- synchronous active high reset		nRESET: in std_logic := '1';			-- asynchronous active low reset		ADR_I : in unsigned(1 downto 0);		-- lower address bits		DAT_I : in std_logic_vector(15 downto 0);	-- Databus input		DAT_O : out std_logic_vector(15 downto 0);	-- Databus output		SEL_I : in std_logic_vector(1 downto 0);		-- Byte select signals		WE_I : in std_logic;				-- Write enable input		STB_I : in std_logic;				-- Strobe signals / core select signal		CYC_I : in std_logic;				-- Valid bus cycle input		ACK_O : out std_logic;			-- Bus cycle acknowledge output		INTA_O : out std_logic;			-- interrupt request output signal		-- I2C signals		SCLi : in std_logic;				-- I2C clock line		SCLo : out std_logic;		SDAi : in std_logic;				-- I2C data line		SDAo : out std_logic	);end entity wishbone_i2c_master;architecture structural of wishbone_i2c_master is	component byte_ctrl is	port (		clk : in std_logic;		rst : in std_logic;		-- synchronous active high reset (WISHBONE compatible)		nReset : in std_logic;	-- asynchornous active low reset (FPGA compatible)		clk_cnt : in unsigned(15 downto 0);	-- 4x SCL 		-- input signals		ena,		start,		stop,		read,		write,		ack_in : std_logic;		Din : in std_logic_vector(7 downto 0);		-- output signals		cmd_ack : out std_logic;		ack_out : out std_logic;		Dout : out std_logic_vector(7 downto 0);		i2c_busy : out std_logic;		-- i2c signals		SCLi : in std_logic;				-- I2C clock line		SCLo : out std_logic;		SDAi : in std_logic;				-- I2C data line		SDAo : out std_logic	);	end component byte_ctrl;	-- registers	signal prer : unsigned(15 downto 0);			-- clock prescale register	signal ctr : std_logic_vector(7 downto 0);			-- control register	signal txr : std_logic_vector(7 downto 0);			-- transmit register	signal rxr : std_logic_vector(7 downto 0);			-- receive register	signal cr : std_logic_vector(7 downto 0);			-- command register	signal sr : std_logic_vector(7 downto 0);			-- status register	-- done signal: command completed, clear command register	signal done : std_logic;	-- command register signals	signal sta, sto, rd, wr, ack, iack : std_logic;	-- core enable signal	signal core_en : std_logic;	-- status register signals	signal irxack, rxack : std_logic; 			-- received aknowledge from slave	signal tip : std_logic;					-- transfer in progress	signal irq_flag : std_logic;				-- interrupt pending flag	signal i2c_busy : std_logic;				-- bus busy (start signal detected)begin	-- generate acknowledge output signal	ACK_O <= STB_I;	-- since timing is always honored 	-- assign DAT_O	assign_dato : process(ADR_I, prer, ctr, txr, cr, rxr, sr)	begin		case ADR_I is			when "00" =>				DAT_O <= std_logic_vector(prer);			when "01" =>				DAT_O <= (x"00" & ctr);			when "10" =>				DAT_O <= (txr & cr);			when "11" =>				DAT_O <= (rxr & sr);			when others =>				DAT_O <= (others => 'X');	-- for simulation only		end case;	end process assign_dato;	-- registers block	regs_block: block		-- address decode signals		signal we_a0, we_a1, we_a2, we_a3 : std_logic;	begin		-- decode address lines		we_a0 <= CYC_I and STB_I and WE_I and not ADR_I(1) and not ADR_I(0);		we_a1 <= CYC_I and STB_I and WE_I and not ADR_I(1) and       ADR_I(0);		we_a2 <= CYC_I and STB_I and WE_I and       ADR_I(1) and not ADR_I(0);		we_a3 <= CYC_I and STB_I and WE_I and       ADR_I(1) and       ADR_I(0);		-- store data in writeable registers		-- prescale register		write_prer: process(nRESET, CLK_I)		begin			if (nRESET = '0') then					prer <= (others => '1');			elsif (CLK_I'event and CLK_I = '1') then				if (RST_I = '1') then					prer <= (others => '1');				else					if ( (we_a0 and SEL_I(1)) = '1') then						prer(15 downto 8) <= unsigned(DAT_I(15 downto 8));					end if;					if ( (we_a0 and SEL_I(0)) = '1') then						prer(7 downto 0) <= unsigned(DAT_I(7 downto 0));					end if;				end if;			end if;		end process write_prer;		-- control register		write_ctr: process(nRESET, CLK_I)		begin			if (nRESET = '0') then					ctr <= (others => '0');			elsif (CLK_I'event and CLK_I = '1') then				if (RST_I = '1') then					ctr <= (others => '0');				else					if ( (we_a1 and SEL_I(0)) = '1') then						ctr <= DAT_I(7 downto 0);					end if;				end if;			end if;		end process write_ctr;		-- transmit register		write_txr: process(nRESET, CLK_I)		begin			if (nRESET = '0') then					txr <= (others => '0');			elsif (CLK_I'event and CLK_I = '1') then				if (RST_I = '1') then					txr <= (others => '0');				else					if ( (we_a2 and SEL_I(1)) = '1') then						txr <= DAT_I(15 downto 8);					end if;				end if;			end if;		end process write_txr;		-- command register		write_cr: process(nRESET, CLK_I)		begin			if (nRESET = '0') then					cr <= (others => '0');					-- asynchronous clear			elsif (CLK_I'event and CLK_I = '1') then				if (RST_I = '1') then					cr <= (others => '0');					-- synchronous clear				else					if ( (we_a2 and SEL_I(0)) = '1') then						if (core_en = '1') then							cr <= DAT_I(7 downto 0);		-- only take new commands when I2C core is enabled, pending commands are finished						end if;					else						if (done = '0') then							cr(7 downto 4) <= cr(7 downto 4);						else							cr(7 downto 0) <= (others => '0'); 	-- clear command_bits when command completed						end if;						cr(2 downto 1) <= cr(2 downto 1);						cr(0) <= cr(0) and irq_flag; 			-- automatically clear when irq_flag is cleared					end if;				end if;			end if;		end process write_cr;	end block regs_block;			-- decode command register	sta <= cr(7);	sto <= cr(6);	rd <= cr(5);	wr <= cr(4);	ack <= cr(3);	iack <= cr(0);	-- decode control register	core_en <= ctr(7);	-- hookup byte controller block	u1: byte_ctrl port map (clk => CLK_I, rst => RST_I, nReset => nRESET,  clk_cnt => prer, ena => core_en, 		start => sta,  stop => sto, read => rd, write => wr, ack_in => ack, i2c_busy => i2c_busy,		Din => txr, cmd_ack => done, ack_out => irxack, Dout => rxr, 			-- note: maybe store rxr in registers ??		SCLi => SCLi, SCLo => SCLo, SDAi => SDAi, SDAo => SDAo);	-- status register block + interrupt request signal	st_block : block	begin		-- generate status register bits		gen_sr_bits: process (CLK_I, nRESET)		begin			if (nRESET = '0') then				rxack <= '0';				tip <= '0';				irq_flag <= '0';			elsif (CLK_I'event and CLK_I = '1') then				if (RST_I = '1') then					rxack <= '0';					tip <= '0';					irq_flag <= '0';				else					rxack <= irxack;					tip <= ( rd or wr );					irq_flag <= (done or irq_flag) and not iack;	-- interrupt request flag is always generated				end if;			end if;		end process gen_sr_bits;		-- generate interrupt request signals		gen_irq: process (CLK_I, nRESET)		begin			if (nRESET = '0') then				INTA_O <= '0';			elsif (CLK_I'event and CLK_I = '1') then				if (RST_I = '1') then					INTA_O <= '0';				else					INTA_O <= irq_flag and ctr(6);			-- interrupt signal is only generated when IEN (interrupt enable bit) is set				end if;			end if;		end process gen_irq;		-- assign status register bits		sr(7) <= rxack;		sr(6) <= i2c_busy;		sr(5 downto 2) <= (others => '0'); -- reserved		sr(1) <= tip;		sr(0) <= irq_flag;	end block;end architecture structural;---------------------------------------------- Byte controller section--------------------------------------------library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity byte_ctrl is	port (		clk : in std_logic;		rst : in std_logic;		-- synchronous active high reset (WISHBONE compatible)		nReset : in std_logic;	-- asynchornous active low reset (FPGA compatible)		clk_cnt : in unsigned(15 downto 0);	-- 4x SCL 		-- input signals		ena,		start,		stop,		read,		write,		ack_in : std_logic;		Din : in std_logic_vector(7 downto 0);		-- output signals		cmd_ack : out std_logic;		ack_out : out std_logic;		Dout : out std_logic_vector(7 downto 0);		i2c_busy : out std_logic;		-- i2c signals		SCLi : in std_logic;				-- I2C clock line		SCLo : out std_logic;		SDAi : in std_logic;				-- I2C data line		SDAo : out std_logic	);end entity byte_ctrl;architecture structural of byte_ctrl is	component bit_ctrl is	port (		clk : in std_logic;		rst : in std_logic;		nReset : in std_logic;		clk_cnt : in unsigned(15 downto 0);		-- clock prescale value		ena : in std_logic;				-- core enable signal		cmd : in std_logic_vector(2 downto 0);		cmd_ack : out std_logic;		busy : out std_logic;		Din : in std_logic;		Dout : out std_logic;		SCLin : in std_logic;				-- I2C clock line		SCLout : out std_logic;		SDAin : in std_logic;				-- I2C data line		SDAout : out std_logic	);	end component bit_ctrl;	-- commands for i2c_core	constant CMD_NOP	: std_logic_vector(2 downto 0) := "000";	constant CMD_START	: std_logic_vector(2 downto 0) := "010";	constant CMD_STOP	: std_logic_vector(2 downto 0) := "011";	constant CMD_READ	: std_logic_vector(2 downto 0) := "100";	constant CMD_WRITE	: std_logic_vector(2 downto 0) := "101";	-- signals for bit_controller	signal core_cmd : std_logic_vector(2 downto 0);	signal core_ack, core_txd, core_rxd : std_logic;	-- signals for shift register	signal sr : std_logic_vector(7 downto 0); -- 8bit shift register	signal shift, ld : std_logic;	-- signals for state machine	signal go, host_ack : std_logic;begin	-- hookup bit_controller	u1: bit_ctrl port map (clk, rst, nReset, clk_cnt, ena, core_cmd, core_ack, i2c_busy, core_txd, core_rxd, SCLi, SCLo, SDAi, SDAo);	-- generate host-command-acknowledge	cmd_ack <= host_ack;		-- generate go-signal	go <= (read or write) and not host_ack;	-- assign Dout output to shift-register	Dout <= sr;	-- assign ack_out output to core_rxd (contains last received bit)	ack_out <= core_rxd;	-- generate shift register	shift_register: process(clk)	begin		if (clk'event and clk = '1') then			if (ld = '1') then				sr <= din;			elsif (shift = '1') then				sr <= (sr(6 downto 0) & core_rxd);			end if;		end if;	end process shift_register;	--	-- state machine	--	statemachine : block		type states is (st_idle, st_start, st_read, st_write, st_ack, st_stop);		signal state : states;		signal dcnt : unsigned(2 downto 0);	begin		--		-- command interpreter, translate complex commands into simpler I2C commands		--		nxt_state_decoder: process(clk, nReset, state)			variable nxt_state : states;			variable idcnt : unsigned(2 downto 0);			variable ihost_ack : std_logic;			variable icore_cmd : std_logic_vector(2 downto 0);			variable icore_txd : std_logic;			variable ishift, iload : std_logic;		begin			-- 8 databits (1byte) of data to shift-in/out			idcnt := dcnt;			-- no acknowledge (until command complete)			ihost_ack := '0';			icore_txd := core_txd;			-- keep current command to bit_controller			icore_cmd := core_cmd;			-- no shifting or loading of shift-register			ishift := '0';			iload := '0';			-- keep current state;			nxt_state := state;			case state is				when st_idle =>					if (go = '1') then						if (start = '1') then							nxt_state := st_start;								icore_cmd := CMD_START;						elsif (read = '1') then							nxt_state := st_read;							icore_cmd := CMD_READ;							idcnt := "111";						else							nxt_state := st_write;							icore_cmd := CMD_WRITE;							idcnt := "111";							iload := '1';						end if;					end if;				when st_start =>					if (core_ack = '1') then						if (read = '1') then							nxt_state := st_read;							icore_cmd := CMD_READ;							idcnt := "111";						else							nxt_state := st_write;							icore_cmd := CMD_WRITE;							idcnt := "111";							iload := '1';						end if;					end if;				when st_write =>					if (core_ack = '1') then						idcnt := dcnt -1;	-- count down Data_counter						icore_txd := sr(7);						if (dcnt = 0) then

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费一区二区三区在线观看| 五月婷婷综合在线| 国产日韩欧美在线一区| 91麻豆精品国产91久久久| 欧美影院一区二区| 在线看不卡av| 色成人在线视频| 91丝袜高跟美女视频| 91在线porny国产在线看| heyzo一本久久综合| 成人短视频下载| 大尺度一区二区| 波多野结衣中文字幕一区二区三区 | 菠萝蜜视频在线观看一区| 粉嫩aⅴ一区二区三区四区五区| 国产电影一区在线| 国产成人在线视频网站| 国产+成+人+亚洲欧洲自线| 成人午夜免费电影| 91麻豆精品在线观看| 在线观看不卡一区| 91精品国产一区二区三区| 日韩欧美一区二区免费| 久久精品一二三| 综合在线观看色| 亚洲综合激情小说| 日韩成人av影视| 国产久卡久卡久卡久卡视频精品| 成人激情小说乱人伦| 91亚洲精华国产精华精华液| 欧美系列在线观看| 欧美tickling网站挠脚心| 国产亚洲精品超碰| 国产精品国产三级国产普通话99| 亚洲精品福利视频网站| 丝袜美腿亚洲综合| 老司机免费视频一区二区| 大白屁股一区二区视频| 欧美在线看片a免费观看| 91精品欧美久久久久久动漫| 欧美成人三级电影在线| 中文字幕不卡在线观看| 亚洲sss视频在线视频| 国产一区二区在线免费观看| 97精品久久久午夜一区二区三区| 777xxx欧美| 国产精品女同互慰在线看| 亚洲va欧美va国产va天堂影院| 国产一区二区三区在线观看免费| 色综合天天综合| 精品少妇一区二区三区免费观看 | 亚洲国产cao| 国产在线播放一区三区四| 99国产精品久久| 日韩三级高清在线| 国产精品家庭影院| 日本不卡高清视频| 一本色道久久加勒比精品| 日韩一级大片在线观看| 最近日韩中文字幕| 麻豆国产一区二区| 91视频一区二区三区| 精品国产成人在线影院| 亚洲综合区在线| 国产成人综合视频| 26uuu成人网一区二区三区| 亚洲自拍欧美精品| 国产一区欧美一区| 久久久99免费| 一区二区三区中文在线| 亚洲午夜在线电影| 成人白浆超碰人人人人| 日韩免费一区二区三区在线播放| 亚洲日本电影在线| 午夜在线成人av| 狂野欧美性猛交blacked| 91丨porny丨首页| 精品少妇一区二区三区免费观看| 一区二区三区四区激情| 国产成人aaa| 欧美va天堂va视频va在线| 午夜精品免费在线| 色综合中文字幕国产| 精品播放一区二区| 日本一道高清亚洲日美韩| 91香蕉视频污在线| 国产精品天美传媒沈樵| 国产高清久久久| 精品电影一区二区三区| 青草国产精品久久久久久| 精品视频在线视频| 一个色妞综合视频在线观看| 成人高清免费观看| 久久久久久麻豆| 韩国v欧美v亚洲v日本v| 日韩三级电影网址| 免费成人你懂的| 91精品国产入口| 图片区小说区国产精品视频| 精品视频在线免费观看| 亚洲线精品一区二区三区| 在线观看一区二区精品视频| 亚洲欧美视频在线观看视频| 972aa.com艺术欧美| 国产精品麻豆久久久| 成人av在线一区二区| 国产精品美女久久久久aⅴ国产馆| 高清不卡一区二区| 中文乱码免费一区二区| 成人精品高清在线| 日韩理论片一区二区| 91在线porny国产在线看| 亚洲乱码中文字幕| 色呦呦日韩精品| 亚洲电影一区二区三区| 欧美人伦禁忌dvd放荡欲情| 日韩成人一级片| 日韩精品一区二区三区swag | 国产制服丝袜一区| 久久久一区二区三区捆绑**| 国产99一区视频免费| 国产精品你懂的| 日本韩国精品在线| 亚洲.国产.中文慕字在线| 91精品婷婷国产综合久久| 久久99久久久欧美国产| 国产午夜精品在线观看| 99在线精品观看| 亚洲一区在线观看视频| 正在播放一区二区| 国产在线播精品第三| 国产精品久久久一本精品 | 日韩免费观看高清完整版| 久久er精品视频| 国产精品高潮久久久久无| 色老汉一区二区三区| 青青草国产成人99久久| 欧美国产乱子伦| 欧美午夜不卡在线观看免费| 麻豆一区二区在线| 中文字幕精品—区二区四季| 欧美怡红院视频| 国产精一品亚洲二区在线视频| 国产精品丝袜久久久久久app| 欧美日韩一区二区三区四区| 国产精品一品视频| 亚洲高清不卡在线| 国产香蕉久久精品综合网| 在线精品视频一区二区三四| 国产一区二区三区国产| 一区二区三区在线视频免费观看| 日韩欧美一级在线播放| 色综合激情久久| 国产在线麻豆精品观看| 亚洲免费观看高清完整版在线观看熊| 正在播放亚洲一区| 成人av在线资源网| 日韩av高清在线观看| 欧美一区日韩一区| 国产盗摄一区二区| 91福利国产精品| 日韩影院精彩在线| 久久精品人人做人人爽人人| av中文字幕在线不卡| 亚洲成人免费视频| 久久精品视频免费| 欧美视频日韩视频在线观看| 成人免费毛片片v| 一区二区三区国产精品| 国产午夜精品一区二区三区视频 | 亚洲精品中文在线观看| 欧美一区二区高清| av不卡在线观看| 国产在线视频精品一区| 2023国产一二三区日本精品2022| 色噜噜狠狠成人中文综合| 粉嫩高潮美女一区二区三区| 天天色天天操综合| 亚洲一区二区三区四区的| 日韩一卡二卡三卡| 欧美撒尿777hd撒尿| 99re6这里只有精品视频在线观看| 久久精品99国产精品日本| 亚洲成人av一区二区| 国产精品久久久久久久裸模 | 国产人成亚洲第一网站在线播放| 欧洲日韩一区二区三区| 国产乱国产乱300精品| 免费成人在线网站| 一区二区高清免费观看影视大全| 久久久久久久久久美女| 欧洲精品在线观看| 色综合欧美在线视频区| 国产69精品久久777的优势| 欧美aaaaa成人免费观看视频| 肉丝袜脚交视频一区二区| 亚洲天堂2016| 中文字幕av一区二区三区高| 91精品久久久久久久久99蜜臂| 91麻豆产精品久久久久久|