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分开实现. 二.基 ...
随机推荐
- 【模板】最小生成树Kruskal
洛谷3366 #include<cstdio> #include<algorithm> using namespace std; ,maxm=; ,ans=; struct e ...
- mysql的一些高级查询
1,查出学生详情表性别为男,并同时年龄大于18的 2,根据上述的结果,查出学生表对应的姓名,年龄,性别,address 3,查出学生的(姓名,年龄,性别,所属学院) 还可以添加注释
- 【郑轻邀请赛 E】Can Win
[题目链接]:https://acm.zzuli.edu.cn/zzuliacm/problem.php?id=2131 [题意] [题解] 尽量让自己喜欢的队赢; A内组内的比赛都让自己喜欢的队赢; ...
- bupt summer training for 16 #1 ——简单题目
D.What a Mess 给n个数,求其中能满足 a[i] % a[j] == 0 的数对之和 n = 1W,max_ai = 100W 不是很大,所以就直接筛就可以了 计算可得最高复杂度 < ...
- Codeforces 263C. Appleman and Toastman
C. Appleman and Toastman time limit per test 2 seconds memory limit per test 256 megabytes input ...
- cocoa 运行apple脚本文件的方法
NSString* path = [[NSBundle mainBundle] pathForResource:@"ScriptName" ofType:@"scpt&q ...
- [bzoj2060][Usaco2010 Nov]Visiting Cows 拜访奶牛_树形dp
Visiting Cows 拜访奶牛 bzoj-2060 Usaco-2010 Nov 题目大意:题目链接. 注释:略. 想法:看起来像支配集. 只是看起来像而已. 状态:dp[pos][flag]表 ...
- N天学习一个Linux命令之mkdir
前言 暂无 用途 用于新建目录 常用参数 1.设置目录权限-m, --mode=MODE 2.递归创建目录(父目录不存在时,也创建)-p, --parents 3.其它-v, --verbose pr ...
- HDU 5435
数位DP题,然而不会做.设dp[i][j]表示前i位异或和为j的时候的个数.先dp出所有的可能组合使得异或和为j的个数,然后按位进行枚举.对于dp[i][j],其实不止是前i位,对于后i位的情况同样适 ...
- iOS获取相册/相机图片-------自定义获取图片小控件
一.功能简介 1.封装了一个按钮,点击按钮,会提示从何处获取图片:如果设备支持相机,可以从相机获取,同时还可以从手机相册获取图片. 2.选择图片后,有一个block回调,根据需求,将获得的图片拿来使用 ...