FPGA proven, AISC proven, I2C controller core from OpenCores

http://opencores.org/project,i2c

Bit-controller

-- Translate simple commands into SCL/SDA transitions
-- Each command has 5 states, A/B/C/D/idle
--
-- start: SCL ~~~~~~~~~~~~~~\____
-- SDA XX/~~~~~~~\______
-- x | A | B | C | D | i
--
-- repstart SCL ______/~~~~~~~\___
-- SDA __/~~~~~~~\______
-- x | A | B | C | D | i
--
-- stop SCL _______/~~~~~~~~~~~
-- SDA ==\___________/~~~~~
-- x | A | B | C | D | i
--
--- write SCL ______/~~~~~~~\____
-- SDA XXX===============XX
-- x | A | B | C | D | i
--
--- read SCL ______/~~~~~~~\____
-- SDA XXXXXXX=XXXXXXXXXXX
-- x | A | B | C | D | i
--

1  ports declaration

 library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all; entity i2c_master_bit_ctrl is
port (
clk : in std_logic;
rst : in std_logic;
nRst : in std_logic;
ena : in std_logic; -- core enable signal clk_cnt : in unsigned( downto ); -- clock prescale value
                                 --! type unsigned is array (natural range <>) of std_logic cmd : in std_logic_vector( downto );
cmd_ack : out std_logic; -- command completed
busy : out std_logic; -- i2c bus busy
al : out std_logic; -- arbitration lost din : in std_logic;
dout : out std_logic; -- i2c lines
scl_i : in std_logic; -- i2c clock line input
scl_o : out std_logic; -- i2c clock line output
scl_oen : out std_logic; -- i2c clock line output enable, active low
sda_i : in std_logic; -- i2c data line input
sda_o : out std_logic; -- i2c data line output
sda_oen : out std_logic -- i2c data line output enable, active low
);
end entity i2c_master_bit_ctrl;

2  signals declaration

 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 ) := ""; type states is (idle, start_a, start_b, start_c, start_d, start_e,stop_a,stop_b,
stop_c, stop_d, rd_a, rd_b, rd_c, rd_d, wr_a, wr_b, wr_c, wr_d);
signal c_state : states; signal iscl_oen, isda_oen : std_logic; -- internal I2C lines
signal sda_chk     : std_logic;     -- check SDA status (multi-master arbitration)
signal dscl_oen    : std_logic;     -- delayed scl_oen signals
signal sSCL, sSDA   : std_logic;     -- synchronized SCL and SDA inputs
signal dSCL, dSDA   : std_logic;      -- delayed versions of sSCL and sSDA
signal clk_en : std_logic;     -- statemachine clock enable
signal scl_sync, slave_wait : std_logic; -- clock generation signals
signal ial : std_logic; -- internal arbitration lost signal
signal cnt : unsigned( downto ); -- clock divider counter (synthesis) 22 -- block
signal cSCL, cSDA : std_logic_vector( downto ); -- capture SDA and SCL
signal fSCL, fSDA : std_logic_vector( downto ); -- filter inputs for SCL and SDA
signal filter_cnt : unsigned( downto ); -- clock divider for filter
signal sta_condition : std_logic; -- start detected
signal sto_condition : std_logic; -- stop detected
signal cmd_stop : std_logic; -- STOP command
signal ibusy : std_logic; -- internal busy signal

3 assign outputs

1     -- assign outputs
scl_o <= '';
scl_oen <= iscl_oen;
sda_o <= '';
sda_oen <= isda_oen;

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

  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(05)

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

  3. I2C controller core之Bit controller(04)

    4) detect start/stop condition START- falling edge on SDA while SCL is high;  STOP -  rising edge on ...

  4. I2C controller core之Bit controller(02)

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

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

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

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

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

  7. 阅读DMA Controller Core 官方手册

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

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

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

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

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

随机推荐

  1. 20170704-WNDR4300串口连接信息

    find_hif: bootstrap = 0xaf055aWASP BootROM Ver. 1.1Nand Flash initONFI: Control setting = 0xb44find_ ...

  2. 【模板】树链剖分求LCA

    洛谷3379 #include<cstdio> #include<algorithm> using namespace std; ,inf=1e9; int n,m,x,y,r ...

  3. BNUOJ 1021 信息战(七)——情报传递

    信息战(七)——情报传递 Time Limit: 3000ms Memory Limit: 262144KB 64-bit integer IO format: %lld      Java clas ...

  4. [HZOJ10420]计算

    [HZOJ10420]计算 题目 给定一个数列,第i个位置包含两个数ai,bi 每次询问给出x,y 求数列ai*x+bi*y的最大值 输入所有数为自然数,在int范围内 INPUT 第一行为n,m.n ...

  5. GSM/GPRS/EDGE/WCDMA/HSDPA/HSUPA--辨析

    一 . 网络制式 --  语音通话 GSM  CDMA 1X WCDMA TD-SCDMA CDMA EV-DO TD-LTE FDD-LTE 二.数据传输制式 -- 上网 GPRS EDGE HSD ...

  6. 洛谷 P1586 四方定理

    P1586 四方定理 题目描述 四方定理是众所周知的:任意一个正整数nn,可以分解为不超过四个整数的平方和.例如:25=1^{2}+2^{2}+2^{2}+4^{2}25=1​2​​+2​2​​+2​ ...

  7. iOS:去除UITableView的空白行

    要去除UITableView在运行时显示的多余空白行,只需要将TableView的Style从Plain改为Grouped即可.

  8. JCE, Java Cryptography Extension

    JCE, Java Cryptography Extension Java 8 JCE下载地址: http://www.oracle.com/technetwork/java/javase/downl ...

  9. Equals和==的差别

    java中的数据类型.可分为两类:  1.基本数据类型 包含:byte,short,char,int,long,float,double,boolean .基础数据类型比較大小的时候使用的是双等号(= ...

  10. cocos2d-html5开发之本地数据存储

    做游戏时常常须要的一个功能呢就是数据的保存了,比方游戏最高分.得到的金币数.物品的数量等等.cocos2d-html5使用了html5.所以html5的数据保存方法是对引擎可用的: html5本地数据 ...