I2C controller core之Bit controller(04)
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)的更多相关文章
- 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(01)
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(02)
4 generate clock and control signals 1 -- architecture signal iscl_oen, isda_oen : std_logic; -- int ...
- 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项目使用Controller之一 c# log4net 不输出日志 .NET Standard库引用导致的FileNotFoundException探究 获取json串里的某个属性值 common.js 如何调用common.js js 筛选数据 Join 具体用法
(六)Net Core项目使用Controller之一 一.简介 1.当前最流行的开发模式是前后端分离,Controller作为后端的核心输出,是开发人员使用最多的技术点. 2.个人所在的团队已经选择 ...
- (十)Net Core项目使用Cookies (八)Net Core项目使用Controller之三-入参
(十)Net Core项目使用Cookies 一.简介 1.Net Core可以直接使用Cookies,但是调用方式有些区别. 2.Net Core将Request和Response分开实现. 二.基 ...
随机推荐
- LINQ简记(2):重要概念
为了能让初学者更快速地掌握,在系列文章中,我尽可能地避开理论讲解,一则对于入门者来说,过多的理论叙述反而会降低大家学习编程的兴趣,二则,官方文档的资料很详细,我说了也是废话.因此,我会尽可能地多举些简 ...
- 编写who命令
第一个版本: /* who1.c - a first version of the who program * open, read UTMP file, and show results. */ # ...
- 【codeforces 758D】Ability To Convert
[题目链接]:http://codeforces.com/contest/758/problem/D [题意] 给你一个n进制的数k; 问你它可能的最小的十进制数是多少; [题解] 从右往左; 获取数 ...
- 【codeforces 768D】Jon and Orbs
[题目链接]:http://codeforces.com/contest/768/problem/D [题意] 你有一个水晶; 它每天都会产生一个球??(球有k种) 然后每种球产生的可能性是相同的-& ...
- poj 1679 判断最小生成树是否唯一
/* 只需判断等效边和必选边的个数和n-1的关系即可 */ #include<stdio.h> #include<stdlib.h> #define N 110 struct ...
- 洛谷 P2084 进制转换
P4122 [USACO17DEC]Blocked Billboard 题目描述 During long milking sessions, Bessie the cow likes to stare ...
- @PropertySource&@ImportResource&@Bean
@**PropertySource**:加载指定的配置文件: ```java /** * 将配置文件中配置的每一个属性的值,映射到这个组件中 * @ConfigurationProperties:告诉 ...
- oc25--私有变量私有方法
// // Person.h #import <Foundation/Foundation.h> @interface Person : NSObject { @public int _a ...
- bzoj 1034 [ ZJOI 2008 ] 泡泡堂BNB —— 贪心
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1034 一开始想了个很麻烦的贪心做法,对于每个 a[i],找第一个大于它的 b 匹配…… 然后 ...
- go的常量与变量
一.常量 1.1 定义 常量使用关键字const 定义,用于存储不会变化的数据 定义方法 const identifier [type] = value package main // 常量定义 co ...