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. 【codeforces 510B】Fox And Two Dots

    [题目链接]:http://codeforces.com/contest/510/problem/B [题意] 让你在一个二维的方格里面找环; 两个点有相邻的边它们才是相连的; 有环YES,没环NO ...

  2. java中String类型转换为float类型

    import java.io.*; public class Demo1{ public static void main(String args[]) { String df="12.2& ...

  3. nyoj_38_布线问题_201403121753

    布线问题 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 南阳理工学院要进行用电线路改造,现在校长要求设计师设计出一种布线方式,该布线方式需要满足以下条件:1.把所有 ...

  4. Mac下OpenCV开发

    1.         环境搭建 a)       安装Homebrew i.            下载地址:http://github.com/mxcl/homebrew/tarball/maste ...

  5. java 执行可执行文件时提示“could not find or load main class ”的问题

  6. PF, Page File, 页面文件

    PF, Page File, 页面文件 是硬盘中用来当作内存使用的,仅仅提高物理内存可能导致CPU使用率高,因为降低了命中率: 学习了:https://baike.baidu.com/item/PF% ...

  7. 腾讯面试题:A.txt和B.txt两个文件,A有1亿个qq号,B有100万个,用代码实现交、并、差

    在STL中关于有序序列有这么四个算法: set_union(beg, end, beg, end2, dest);                    //求并集A∪B set_union(beg, ...

  8. eclipse添加插件、删除插件 示例: eclipse marketplace

    在有些版本的eclips上并没有eclipse marketplace ,这让eclipse添加插件变得比较玛法,传统的办法都是通过自行下载插件或者用 help->install new sof ...

  9. 转:java身份证格式强校验

    package com.dsh.zealandweb.utils; import java.util.HashSet; import java.util.regex.Pattern; import o ...

  10. MySQL基础教程-绝对推荐

    https://wenku.baidu.com/view/1acfe579ee06eff9aef80752.html?from=search MySQL--公司培训PPT Mysql体系结构以及与Or ...