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的更多相关文章

  1. VHDL之concurrent之block

    1 Simple BLOCK The simple block represents only a way of partitioning the code. It allows concurrent ...

  2. VHDL之concurrent之generate

    GENERATE It is another concurrent statement (along with operators and WHEN). It is equivalent to the ...

  3. VHDL之concurrent之operators

    Using operators Operators can be used to implement any combinational circuit. However, as will becom ...

  4. Concurrent.Thread.js

    (function(){ if ( !this.Data || (typeof this.Data != 'object' && typeof this.Data != 'functi ...

  5. 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 ...

  6. ConCurrent in Practice小记 (3)

    ConCurrent in Practice小记 (3) 高级同步技巧 Semaphore Semaphore信号量,据说是Dijkstra大神发明的.内部维护一个许可集(Permits Set),用 ...

  7. ConCurrent in Practice小记 (2)

    Java-ConCurrent2.html :first-child{margin-top:0!important}img.plugin{box-shadow:0 1px 3px rgba(0,0,0 ...

  8. VHDL基础1

    Description Structure 一个可综合的VHDL描述中一般由3部分组成:LIBRARY declarations.ENTITY.ARCHITECTURE Library(库)用来设计重 ...

  9. 多线程爬坑之路-学习多线程需要来了解哪些东西?(concurrent并发包的数据结构和线程池,Locks锁,Atomic原子类)

    前言:刚学习了一段机器学习,最近需要重构一个java项目,又赶过来看java.大多是线程代码,没办法,那时候总觉得多线程是个很难的部分很少用到,所以一直没下决定去啃,那些年留下的坑,总是得自己跳进去填 ...

随机推荐

  1. Linux - centos7 下 MySQL(mariadb) 和 主从复制

    目录 Linux - centos7 下 MySQL(mariadb) 和 主从复制 MySQL(mariadb) 安装MySQL(mariadb) 配置数据库的中文支持 在远程用 mysql客户端去 ...

  2. 搭建 Seafile 专属网盘

    准备域名 任务时间:15min ~ 20min 域名注册 如果您还没有域名,可以在腾讯云上选购,过程可以参考下面的视频. 视频 - 在腾讯云上购买域名 域名解析 域名购买完成后, 需要将域名解析到实验 ...

  3. TypeError: CleanWebpackPlugin is not a constructor

    在项目中引入clean-webpack-plugin打包后报错 new CleanWebpackPlugin(), ^ TypeError: CleanWebpackPlugin is not a c ...

  4. 清北学堂模拟赛d5t6 cube

    题面有误!10,11,12操作类别为A,13,14,15类别为B,16,17,18类别为C. 分析:一道大暴力,每次记录一下走了多少步,上一步操作类别是啥就可以了.最后只需要写6种操作,每一次操作进行 ...

  5. 【ACM】nyoj_47_过桥问题_201308151616

    过河问题时间限制:1000 ms  |  内存限制:65535 KB 难度:5描述 在漆黑的夜里,N位旅行者来到了一座狭窄而且没有护栏的桥边.如果不借助手电筒的话,大家是无论如何也不敢过桥去的.不幸的 ...

  6. A - Number Sequence

    Given two sequences of numbers : a11, a22, ...... , aNN, and b11, b22, ...... , bMM(1 <= M <= ...

  7. [poj3070]Fibonacci_矩乘_快速幂

    Fibonacci poj-3070 题目大意:求Fibonacci第n项. 注释:模数为10000,$1\le n \le 10^9$. 想法:矩阵题,用例题6的想法,我们构造矩阵 $\begin{ ...

  8. CF #323 DIV2 D题

    可以知道,当T较大时,对于LIS,肯定会有很长的一部分是重复的,而这重复的部分,只能是一个block中出现次数最多的数字组成一序列.所以,对于T>1000时,可以直接求出LIS,剩下T-=100 ...

  9. POJ 3370 Halloween treats 鸽巢原理 解题

    Halloween treats 和POJ2356差点儿相同. 事实上这种数列能够有非常多,也能够有不连续的,只是利用鸽巢原理就是方便找到了连续的数列.并且有这种数列也必然能够找到. #include ...

  10. 深入分析JavaWeb Item38 -- 监听器(Listener)高速学习

    一.监听器介绍 1.1.监听器的概念 监听器是一个专门用于对其它对象身上发生的事件或状态改变进行监听和对应处理的对象,当被监视的对象发生情况时,马上採取对应的行动.监听器事实上就是一个实现特定接口的普 ...