I2C controller core之Bit controller(01)
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)的更多相关文章
- I2C controller core之Bit controller(03)
FPGA proven, AISC proven, I2C controller core from OpenCores http://opencores.org/project,i2c Bit-co ...
- I2C controller core之Bit controller(05)
6 generate statemachine 1 -- port cmd_ack : out std_logic; -- command completed 4 -- architecture ty ...
- I2C controller core之Bit controller(04)
4) detect start/stop condition START- falling edge on SDA while SCL is high; STOP - rising edge on ...
- I2C controller core之Bit controller(02)
4 generate clock and control signals 1 -- architecture signal iscl_oen, isda_oen : std_logic; -- int ...
- (六)Net Core项目使用Controller之一 c# log4net 不输出日志 .NET Standard库引用导致的FileNotFoundException探究 获取json串里的某个属性值 common.js 如何调用common.js js 筛选数据 Join 具体用法
(六)Net Core项目使用Controller之一 一.简介 1.当前最流行的开发模式是前后端分离,Controller作为后端的核心输出,是开发人员使用最多的技术点. 2.个人所在的团队已经选择 ...
- ASP.NET Core MVC中Controller的Action,默认既支持HttpGet,又支持HttpPost
我们知道ASP.NET Core MVC中Controller的Action上可以声明HttpGet和HttpPost特性标签,来限制可以访问Action的Http请求类型(GET.POST等). 那 ...
- 阅读DMA Controller Core 官方手册
阅读DMA Controller Core 官方手册 DMA控制器框架图 怎样去设定一个DMA控制器 实例化DMA控制器 参数配置界面如下图所示: 对于width of the DMA length ...
- ASP.NET Core MVC中Controller的Action如何直接使用Response.Body的Stream流输出数据
在ASP.NET Core MVC中,我们有时候需要在Controller的Action中直接输出数据到Response.Body这个Stream流中,例如如果我们要输出一个很大的文件到客户端浏览器让 ...
- (十)Net Core项目使用Cookies (八)Net Core项目使用Controller之三-入参
(十)Net Core项目使用Cookies 一.简介 1.Net Core可以直接使用Cookies,但是调用方式有些区别. 2.Net Core将Request和Response分开实现. 二.基 ...
随机推荐
- ansible common modules
##Some common modules[cloud modules] [clustering modules] [command modules]command - executes a comm ...
- 虚拟机win7 自动休眠
1.问题描述:vmware 虚拟机,windows7系统.当一段时间不操作时,任务会休眠. 2.原因:win7系统自动休眠引起的. 3.解决方法:关闭win7系统的自动休眠. 依次打开“控制面板”-- ...
- 用循环链表实现Josephus问题
Josephus问题:设有n个人围坐在一个圆桌周围,现从第s个人开始报数,数到第m的人出列,然后从出列的下一个人重新开始报数,数到第m的人又出列.如此反复直到所有的人全部出列为止. 思路:构建一个没有 ...
- Train Problem II HDU 1023 卡特兰数
Problem Description As we all know the Train Problem I, the boss of the Ignatius Train Station want ...
- EF--model is being created异常
使用EF的时候出现了下面的异常,我使用了TASK和saveChangeAsync()异步 The context cannot be used while the model is being cre ...
- [bzoj1342][Baltic2007]Sound静音问题_单调队列
Sound静音问题 bzoj-1342 Baltic-2007 题目大意:给定一个n个数的序列,求所有的长度为m的区间,使得区间内最大值减去最小值不超过阈值c. 注释:$1\le n \le 10^6 ...
- RDS MySQL 表上 Metadata lock 的产生和处理
https://help.aliyun.com/knowledge_detail/41723.html?spm=5176.7841698.2.18.vNfPM3
- 2015 测试赛 同构 hihoCoder
题目1 : 同构 时间限制:2000ms 单点时限:1000ms 内存限制:256MB 描述 给定2个树A和B,保证A的节点个数>=B的节点个数. 现在你需要对树A的边进行二染色. 一个好的染色 ...
- android 通用菜单条实现(一)
一.前言介绍 直奔主题啦,非常多Android app都有菜单条.菜单条除了背景图片.图标的不同外,布局基本一致.大致能够分为三部分:菜单条的左側区域.菜单条中间区域.菜单条右側区域. 为了考虑代码的 ...
- extjs的formpanel横向滚动条的解决办法
关于formpanel设置autoscroll:true同时出现横向和纵向滚动条的解决办法: 不要设置autoscroll属性,或者autoscroll:false,然后设置bodyStyle : ' ...