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.大多是线程代码,没办法,那时候总觉得多线程是个很难的部分很少用到,所以一直没下决定去啃,那些年留下的坑,总是得自己跳进去填 ...
随机推荐
- Flask - 请求处理流程和上下文源码分析
目录 Flask - 请求处理流程和上下文 WSGI Flask的上下文对象及源码解析 0. 请求入口 1.请求上下文对象的创建 2. 将请求上下文和应用上下文入栈 3.根据请求的URl执行响应的视图 ...
- 【codeforces 514C】Watto and Mechanism(字典树做法)
[题目链接]:http://codeforces.com/contest/514/problem/C [题意] 给你n个字符串; 然后给你m个询问;->m个字符串 对于每一个询问字符串 你需要在 ...
- python中添加日志记录到文件
1.实现python日志功能 2.只输出到文件,不输出到控制台 #encoding:utf-8 import logging from common import path_util logging_ ...
- float在内存中的存放
一个float型实数在内存中占4个字节,即32个二进制bit,从低位到高位依次叫第0位到第31位.这32位可以分为3个部分:符号位(第31位),阶码(第30位到第23位共8位),尾数(最低23位). ...
- OceanBase架构浅析(一)
简介 OceanBase是阿里集团研发的可扩展的关系数据库,实现了数千亿条记录.数百TB数据上的跨行跨表事务,截止到2012年8月,支持了收藏夹.直通车报表.天猫评价等OLTP和OLAP在线业务,线上 ...
- Maven: java.lang.ClassNotFoundException: org.eclipse.aether.spi.connector.Transfer$State
在mac中使用maven compile时发生以下错误: Maven: java.lang.ClassNotFoundException: org.eclipse.aether.spi.connect ...
- [RxJS 6] The Retry RxJs Error Handling Strategy
When we want to handle error observable in RxJS v6+, we can use 'retryWhen' and 'delayWhen': const c ...
- [Cocos2d-x v3.x]Mac OX 创建新的Cocos2d-x 3.0 项目
文章内容来自于: http://cocos2d-x.org/wiki/How_to_Start_A_New_Cocos2D-X_Game Mac OS X 10.9 Software Requirem ...
- swift 拼图小游戏
依据这位朋友的拼图小游戏改编 http://tangchaolizi.blog.51cto.com/3126463/1571616 改编主要地方是: 原本着我仁兄的代码时支持拖动小图块来移动的,我參照 ...
- C++组合通信
#include <iostream> #include<vector> #include<string> using namespace std; class A ...