4) detect start/stop condition

    START- falling edge on SDA while SCL is high;  STOP -  rising edge on SDA while SCL is high  

 1 -- block
signal sta_condition : std_logic; -- start detected
signal sto_condition : std_logic; -- stop detected detect_sta_sto: process(clk, nRst)
begin
if (nRst = '') then
sta_condition <= '';
sto_condition <= '';
elsif (clk'event and clk = '') then
if (rst = '') then
sta_condition <= '';
sto_condition <= '';
else
sta_condition <= (not sSDA and dSDA) and sSCL;
sto_condition <= (sSDA and not dSDA) and sSCL;
end if;
end if;
end process detect_sta_sto;

  5)  generate i2c-bus busy signal

 1 -- port
busy : out std_logic; -- i2c bus busy 4 -- architecture
signal ibusy : std_logic; -- internal busy signal gen_busy: process(clk, nRst)
begin
if (nRst = '') then
ibusy <= '';
elsif (clk'event and clk = '') then
if (rst = '') then
ibusy <= '';
else
ibusy <= (sta_condition or ibusy) and not sto_condition;
end if;
end if;
end process gen_busy; busy <= ibusy;

  6) generate arbitration lost signal

 0 -- port
1  al  : out std_logic;    -- arbitration lost
1 -- architecture
constant I2C_CMD_NOP : std_logic_vector( downto ) := "";
constant I2C_CMD_START : std_logic_vector( downto ) := "";
constant I2C_CMD_STOP : std_logic_vector( downto ) := "";
constant I2C_CMD_READ : std_logic_vector( downto ) := "";
constant I2C_CMD_WRITE : std_logic_vector( downto ) := ""; signal ial : std_logic; -- internal arbitration lost signal
signal sda_chk : std_logic; -- check SDA status (multi-master arbitration) 11 -- block
signal cmd_stop : std_logic; -- STOP command 14 -- aribitration lost when:
15 -- 1) master drives SDA high, but the i2c bus is low
16 -- 2) stop detected while not requested (detect during 'idle' state)
gen_al: process(clk, nRst)
begin
if (nRst = '') then
cmd_stop <= '';
ial <= '';
elsif (clk'event and clk = '') then
if (rst = '') then
cmd_stop <= '';
ial <= '';
else
if (clk_en = '') then
if (cmd = I2C_CMD_STOP) then
cmd_stop <= '';
else
cmd_stop <= '';
end if;
end if; if (c_state = idle) then
ial <= (sda_chk and not sSDA and isda_oen) or (sto_condition and not cmd_stop);
else
ial <= (sda_chk and not sSDA and isda_oen);
end if;
end if;
end if;
end process gen_al;
al <= ial;

  7) generate dout signal

 1 -- store dout on rising edge of SCL
gen_dout: process(clk, nReset)
begin
if (nReset = '') then
dout <= '';
elsif (clk'event and clk = '') then
if (sSCL = '' and dSCL = '') then
dout <= sSDA;
end if;
end if;
end process gen_dout;
end block bus_status_ctrl;

I2C controller core之Bit controller(04)的更多相关文章

  1. I2C controller core之Bit controller(03)

    FPGA proven, AISC proven, I2C controller core from OpenCores http://opencores.org/project,i2c Bit-co ...

  2. I2C controller core之Bit controller(01)

    FPGA proven, AISC proven, I2C controller core from OpenCores http://opencores.org/project,i2c Bit-co ...

  3. I2C controller core之Bit controller(05)

    6 generate statemachine 1 -- port cmd_ack : out std_logic; -- command completed 4 -- architecture ty ...

  4. I2C controller core之Bit controller(02)

    4 generate clock and control signals 1 -- architecture signal iscl_oen, isda_oen : std_logic; -- int ...

  5. ASP.NET Core MVC中Controller的Action,默认既支持HttpGet,又支持HttpPost

    我们知道ASP.NET Core MVC中Controller的Action上可以声明HttpGet和HttpPost特性标签,来限制可以访问Action的Http请求类型(GET.POST等). 那 ...

  6. 阅读DMA Controller Core 官方手册

    阅读DMA Controller Core 官方手册 DMA控制器框架图 怎样去设定一个DMA控制器 实例化DMA控制器 参数配置界面如下图所示: 对于width of the DMA length ...

  7. ASP.NET Core MVC中Controller的Action如何直接使用Response.Body的Stream流输出数据

    在ASP.NET Core MVC中,我们有时候需要在Controller的Action中直接输出数据到Response.Body这个Stream流中,例如如果我们要输出一个很大的文件到客户端浏览器让 ...

  8. (六)Net Core项目使用Controller之一 c# log4net 不输出日志 .NET Standard库引用导致的FileNotFoundException探究 获取json串里的某个属性值 common.js 如何调用common.js js 筛选数据 Join 具体用法

    (六)Net Core项目使用Controller之一 一.简介 1.当前最流行的开发模式是前后端分离,Controller作为后端的核心输出,是开发人员使用最多的技术点. 2.个人所在的团队已经选择 ...

  9. (十)Net Core项目使用Cookies (八)Net Core项目使用Controller之三-入参

    (十)Net Core项目使用Cookies 一.简介 1.Net Core可以直接使用Cookies,但是调用方式有些区别. 2.Net Core将Request和Response分开实现. 二.基 ...

随机推荐

  1. 【[Offer收割]编程练习赛14 D】剑刃风暴(半径为R的圆能够覆盖的平面上最多点数目模板)

    [题目链接]:http://hihocoder.com/problemset/problem/1508 [题意] [题解] 求一个半径为R的圆能够覆盖的平面上的n个点中最多的点数; O(N2log2N ...

  2. [bzoj1901][Zju2112]Dynamic Rankings_主席树

    Dynamic Rankings bzoj-1901 Zju-2112 题目大意:给定一个n个数的序列,m个操作,支持:单点修改:查询区间k小值. 注释:$1\le n,m\le 10^4$. 想法: ...

  3. Linux Container测试之block IO

      简介 Linux Container是OS级别的虚拟化方案,它相比于一般的虚拟机没有了硬件模拟以及指令模拟,相比传统虚拟机具有更低的开销,因此可以应用到私有云之中.LXC目前的版本支持对memor ...

  4. PHP array_diff_ukey()

    定义和用法 array_diff_ukey() 返回一个数组,该数组包括了所有出现在 array1 中但是未出现在任何其它参数数组中的键名的值.注意关联关系保留不变.与 array_diff() 不同 ...

  5. spark streaming updateStateByKey 使用方法

    updateStateByKey 解释: 以DStream中的数据进行按key做reduce操作,然后对各个批次的数据进行累加 在有新的数据信息进入或更新时.能够让用户保持想要的不论什么状.使用这个功 ...

  6. 多工程联编的Pods如何设置

    多工程联编的Pods如何设置 (2014-07-17 13:57:10) 转载▼ 标签: 联编 多工程 分类: iOS开发 如今,CocoaPods使用越来越多,几乎每个项目都会使用到.有时候我们的项 ...

  7. DM8168 IPNC Boa移植

    1.交叉编译openssL 下载openssL-1.0.0.tar.gz在虚拟机下进行交叉编译,生成libcrypto.a及libssl.a.将这两个文件复制到DVRRDK_03.00.00.00/b ...

  8. 刚開始学习的人非常有用之chm结尾的參考手冊打开后无法正常显示

    从网上下载了struts2的參考手冊.chm(本文适用全部已.chm结尾的文件)不能正常打开使用. 如图: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/ ...

  9. CSS3:box-sizing:不再为盒子模型而烦恼

    题外话: W3C奉行的标准,就是content-box,就是须要计算边框,填充还有内容的;可是就我个人而言, 比較喜欢的是传统IE6时候的怪异模式,不用考虑容器是否会被撑开(打乱布局); 盒子模型差异 ...

  10. Codeforces Round #277 (Div. 2)C.Palindrome Transformation 贪心

    C. Palindrome Transformation     Nam is playing with a string on his computer. The string consists o ...