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.大多是线程代码,没办法,那时候总觉得多线程是个很难的部分很少用到,所以一直没下决定去啃,那些年留下的坑,总是得自己跳进去填 ...
随机推荐
- MySql 日志查看与设置
错误日志log-errol 开启方式:在my.ini的[mysqld]选项下:添加代码:log-error=E:\log-error.txt 记录内容:主要是记录启动.运行或停止mysqld时出现的致 ...
- C++数组查重
今天课上实验课,遇到一道题目,需要查找一个数组中出现次数最多的元素和次数,并且输出.第一次用struct模拟字典,十分麻烦而且复杂度是O(n*n).其实,运用转化的思想,可以先将其排序,然后再查找即可 ...
- Ubuntu_linux系统与网络服务管理
1.远程telnet联机:telnetd: 2.远程加密ssh联机:openssh: 3.webmin远程联机:webmin: 3.VNC远程图像界面控制:vino: 4.NAT网关服务器:iptab ...
- Java8新特性之forEach遍历
参考文章: https://www.cnblogs.com/billyu/p/6118008.html
- 清北学堂模拟赛d2t5 吃东西(eat)
题目描述一个神秘的村庄里有4家美食店.这四家店分别有A,B,C,D种不同的美食.LYK想在每一家店都吃其中一种美食.每种美食需要吃的时间可能是不一样的.现在给定第1家店A种不同的美食所需要吃的时间a1 ...
- [bzoj1901][Zju2112]Dynamic Rankings_主席树
Dynamic Rankings bzoj-1901 Zju-2112 题目大意:给定一个n个数的序列,m个操作,支持:单点修改:查询区间k小值. 注释:$1\le n,m\le 10^4$. 想法: ...
- 洛谷 P2959 [USACO09OCT]悠闲漫步The Leisurely Stroll
P2959 [USACO09OCT]悠闲漫步The Leisurely Stroll 题目描述 Bessie looks out the barn door at the beautiful spri ...
- [转]SQLSERVER一些公用DLL的作用解释
转自:Leo_wlCnBlogs SQLSERVER一些公用DLL的作用解释 如果你的SQLSERVER安装在C盘的话,下面的路径就是相应SQLSERVER版本的公用DLL的存放路径 SQL2005 ...
- Codeforces Round #305 (Div. 2) D题 (线段树+RMQ)
D. Mike and Feet time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
- jQuery Validate Ajax 验证
jQuery Validate Ajax 验证 <script type="text/javascript"> $(function() { $('#formCityL ...