VHDL之concurrent之when
WHEN (simple and selected)
It is one of the fundamental concurrent statements (along with operators and GENERATE).
It appears in two forms: WHEN / ELSE (simple WHEN) and WITH / SELECT / WHEN (selected WHEN).
1) WHEN / ELSE:
assignment WHEN condition ELSE
assignment WHEN condition ELSE
...;
2) WITH / SELECT / WHEN:
WITH identifier SELECT
assignment WHEN value,
assignment WHEN value,
...;
Example

Solution 1
------- Solution 1: with WHEN/ELSE --------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
-------------------------------------------
ENTITY mux IS
PORT ( a, b, c, d: IN STD_LOGIC;
sel: IN STD_LOGIC_VECTOR ( DOWNTO );
y: OUT STD_LOGIC);
END mux;
-------------------------------------------
ARCHITECTURE mux1 OF mux IS
BEGIN
y <= a WHEN sel="" ELSE
b WHEN sel="" ELSE
c WHEN sel="" ELSE
d;
END mux1;
-------------------------------------------
Solution 2
--- Solution 2: with WITH/SELECT/WHEN -----
LIBRARY ieee;
USE ieee.std_logic_1164.all;
-------------------------------------------
ENTITY mux IS
PORT ( a, b, c, d: IN STD_LOGIC;
sel: IN STD_LOGIC_VECTOR ( DOWNTO );
y: OUT STD_LOGIC);
END mux;
-------------------------------------------
ARCHITECTURE mux2 OF mux IS
BEGIN
WITH sel SELECT
y <= a WHEN "", -- notice "," instead of ";"
b WHEN "",
c WHEN "",
d WHEN OTHERS; -- cannot be "d WHEN "11" "
END mux2;
--------------------------------------------
VHDL之concurrent之when的更多相关文章
- VHDL之concurrent之block
1 Simple BLOCK The simple block represents only a way of partitioning the code. It allows concurrent ...
- VHDL之concurrent之generate
GENERATE It is another concurrent statement (along with operators and WHEN). It is equivalent to the ...
- VHDL之concurrent之operators
Using operators Operators can be used to implement any combinational circuit. However, as will becom ...
- Concurrent.Thread.js
(function(){ if ( !this.Data || (typeof this.Data != 'object' && typeof this.Data != 'functi ...
- how to forget about delta cycles for RTL design
A delta cycle is a VHDL construct used to makeVHDL, a concurrent language, executable on asequential ...
- ConCurrent in Practice小记 (3)
ConCurrent in Practice小记 (3) 高级同步技巧 Semaphore Semaphore信号量,据说是Dijkstra大神发明的.内部维护一个许可集(Permits Set),用 ...
- ConCurrent in Practice小记 (2)
Java-ConCurrent2.html :first-child{margin-top:0!important}img.plugin{box-shadow:0 1px 3px rgba(0,0,0 ...
- VHDL基础1
Description Structure 一个可综合的VHDL描述中一般由3部分组成:LIBRARY declarations.ENTITY.ARCHITECTURE Library(库)用来设计重 ...
- 多线程爬坑之路-学习多线程需要来了解哪些东西?(concurrent并发包的数据结构和线程池,Locks锁,Atomic原子类)
前言:刚学习了一段机器学习,最近需要重构一个java项目,又赶过来看java.大多是线程代码,没办法,那时候总觉得多线程是个很难的部分很少用到,所以一直没下决定去啃,那些年留下的坑,总是得自己跳进去填 ...
随机推荐
- saving snaps iteratively with for loop in Paraview
Goal: read data 1 and slice, then save pressure, velocity contours, close data, then do loop for the ...
- libcloud代码研究(三)——bugs
Bug 1:对不可迭代类进行迭代(libcloud.storage.driver.cloudfile line. 141-142) 使用libcloud连接自搭建swift服务,自己在服务器 ...
- 爬虫——response中获取的不带主域名的url的拼接
scrapy中response提取的没有主域名的url拼接 # 1.导入urllib的parse # 2.调用parse.urljoin()进行拼接,例子中response.url会自动提取出当前页面 ...
- 造成segment fault,产生core dump的可能原因
1.内存访问越界 a) 由于使用错误的下标,导致数组访问越界 b) 搜索字符串时,依靠字符串结束符来判断字符串是否结束,但是字符串没有正常的使用结束符 c) 使用strcpy, strcat, spr ...
- Linux: 统计代码行数和SVN修改行数的命令
Mac下同样有效. 1. 统计目录下所有js文件的代码行数. find . -name '*.js' | xargs wc -l 2. 统计SVN的修改行数. svn diff -rBeginRev: ...
- HTML5:去除IE10中输入框和密码框的X按钮和小眼睛
在IE10和之后的IE版本中,当在输入框和密码框中输入的时候,后面会自动出现X按钮和小眼睛,如下图所示: 令人苦恼的是,这个效果只有IE才有,其它浏览器是没有这个功能的.为了统一,我们就需要去掉这个 ...
- c++实现数据结构1.顺序表
头文件seqlist.h #ifndef _SEQLIST_H_ #define _SEQLIST_H_ #include<iostream> using namespace std; t ...
- 2015 编程之美初赛第一场 AC题
题目1 : 彩色的树 时间限制:2000ms 单点时限:1000ms 内存限制:256MB 描述 给定一棵n个节点的树,节点编号为1, 2, …, n.树中有n - 1条边,任意两个节点间恰好有一条路 ...
- 天了噜,我国4G用户超过2亿了!
近期,看到工信部一组统计数据,小编整个人都不好了,数据显示,2015年5月我国4G用户净增2281.6万,总数超过2亿户. 没错,卡是换成了4G卡,还是那句话,然并卵,用的还是3G手机.开的还是2G网 ...
- T4语法
阅读目录 阅读目录 1.什么是T4? 2.vs插件的安装 3.T4初体验 4.T4语法 其实对于“T4模板”的学习,讲得最详细的还是MSDN,下面给出对应的链接,可以点开深入的了解. 回到顶部 1 ...