I2C controller core之Bit controller(03)
2024-09-07 19:12:18
FPGA proven, AISC proven, I2C controller core from OpenCores
http://opencores.org/project,i2c
Bit-controller
5 block
1) capture SCL and SDA
-- port
scl_i : in std_logic;
sda_i : in std_logic; 5 -- architecture 7 -- block
bus_status_ctrl : block
singal cSCL, cSDA : std_logic_vector( downto ); capture_scl_sda: process(clk, nRst)
begin
if (nRst = '') then
cSCL <= "";
cSDA <= "";
elsif (clk'event and clk = '') then
if (rst = '') then
cSCL <= "";
cSDA <= "";
else
cSCL <= (cSCL() & scl_i);
cSDA <= (cSDA() & sda_i);
endif;
endif;
end process capture_scl_sda;
2) filter SCL and SDA (glitch-free)
1 -- port
ena : in std_logic; -- core enable signal
clk_cnt : in unsigned( downto ); -- clock prescale value 5 -- block
signal fSCL : std_logic_vector( downto ); -- filter inputs for SCL
signal fSDA : std_logic_vector( downto ); -- filter inputs for SDA
signal filter_cnt : unsigned( downto ); -- clock divider for filter filter_divider: process(clk, nRst)
begin
if (nRst = '') then
filter_cnt <= (others => '');
elsif (clk'event and clk = '') then
if ( (rst = '') or (ena = '') ) then
filter_cnt <= (others => '');
elsif (filter_cnt = ) then
filter_cnt <= clk_cnt( downto );
else
filter_cnt <= filter_cnt -;
end if;
end if;
end process filter_divider; filter_scl_sda: process(clk, nRst)
begin
if (nRst = '') then
fSCL <= (others => '');
fSDA <= (others => '');
elsif (clk'event and clk = '') then
if (rst = '') then
fSCL <= (others => '');
fSDA <= (others => '');
elsif (filter_cnt = ) then
fSCL <= (fSCL( downto ) & cSCL());
fSDA <= (fSDA( downto ) & cSDA());
end if;
end if;
end process filter_scl_sda;
3) generate filtered SCL and SDA signals
1 -- architecture
signal sSCL, sSDA : std_logic; -- synchronized SCL and SDA inputs
signal dSCL, dSDA : std_logic; -- delayed versions ofsSCL and sSDA 5 -- block
scl_sda: process(clk, nRst)
begin
if (nRst = '') then
sSCL <= '';
sSDA <= ''; dSCL <= '';
dSDA <= '';
elsif (clk'event and clk = '') then
if (rst = '') then
sSCL <= '';
sSDA <= ''; dSCL <= '';
dSDA <= '';
else
sSCL <= (fSCL() and fSCL()) or
(fSCL() and fSCL()) or
(fSCL() and fSCL());
sSDA <= (fSDA() and fSDA()) or
(fSDA() and fSDA()) or
(fSDA() and fSDA()); dSCL <= sSCL;
dSDA <= sSDA;
end if;
end if;
end process scl_sda;
最新文章
- c#反射机制
- 关于Oracle数据库字符集
- 自定义属性 view
- ubuntu adobe flash player 安装
- Windows Azure免费空间如何搭建PHP网站/数据库、域名绑定
- java的变量
- Valuable site on github
- Hello world,Hello 2015,Bye 2014
- (转)DES、RSA、MD5、SHA、随机生成加密与解密
- android http 通信(httpclient 实现)
- DbUtility-第一次接触
- hdu 4739 Zhuge Liang&#39;s Mines (简单dfs)
- Centos6.8安装zabbix-3.2.6
- cmd 命令大全
- java记事本开发
- Nginx配置多个基于域名的虚拟主机+实验环境搭建+测试
- Centos下搭建邮件服务器
- CSS旋转缩放
- FoonSunCMS-Word图片上传功能-Xproer.WordPaster
- 单链表Java实现
热门文章
- System----堡垒机
- 【Codeforces 118B】Caesar&#39;s Legions
- [bzoj2783][JLOI2012]树_树的遍历
- P1464 Function 洛谷
- Spring MVC-表单(Form)标签-错误处理(Error Handling)示例(转载实践)
- Notepad++支持jQuery、html5、css3
- DBCP数据源使用
- MySQL 相邻两条数据相减
- Color a Tree HDU - 6241
- Codeforces 2018-2019 ICPC, NEERC, Southern Subregional Contest