题目要求如上不再赘述,主要关注到最后的四选一多路选择器。

最初编写的选择器代码如下

always@(sel)
case(sel)
2'd0:q <= d;
2'd1:q <= in1;
2'd2:q <= in2;
2'd3:q <= in3;
default: ;

此时会爆出警告

Warning (10235): Verilog HDL Always Construct warning at top_module.v(27): variable "d" is read inside the Always Construct but isn't in the Always Construct's Event Control File: /home/h/work/hdlbits.4515504/top_module.v Line: 27

Warning (10235): Verilog HDL Always Construct warning at top_module.v(28): variable "in1" is read inside the Always Construct but isn't in the Always Construct's Event Control File: /home/h/work/hdlbits.4515504/top_module.v Line: 28

Warning (10235): Verilog HDL Always Construct warning at top_module.v(29): variable "in2" is read inside the Always Construct but isn't in the Always Construct's Event Control File: /home/h/work/hdlbits.4515504/top_module.v Line: 29

然后修改代码为

always@(sel,d,in1,in2,in3)
case(sel)
2'd0:q <= d;
2'd1:q <= in1;
2'd2:q <= in2;
2'd3:q <= in3;
default: ;
endcase

此时警告消失,这是因为在always组合逻辑电路中,敏感列表应当包含always块中所有的输入信号才不会引发错误,当然此处也可以用

always@(*)
case(sel)
2'd0:q <= d;
2'd1:q <= in1;
2'd2:q <= in2;
2'd3:q <= in3;
default: ;
endcase

这样才能保证每一个敏感信号都是能够正常起作用的。

HDLBits->Verilog Language->Modules:Hierarchy->Modules and vectors的更多相关文章

  1. Creating Modules

    转自官方文档,主要说明如何创建模块 https://www.terraform.io/docs/modules/index.html A module is a container for multi ...

  2. IIS Modules Overview

    Introduction The IIS 7 and above Web server feature set is componentized into more than thirty indep ...

  3. webpack——Modules && Hot Module Replacement

    blog:JavaScript Module Systems Showdown: CommonJS vs AMD vs ES2015 官网链接: Modules 官网链接:Hot Module Rep ...

  4. Ubuntu16.04下的modules模块编译加载

    一.首先编写对应的驱动程序的相关内容:(最简单的hello.c程序) #include<linux/init.h> #include<linux/module.h> MODUL ...

  5. WeexSDK之注册Modules

    注册Modules的流程和注册Components非常类似. + (void)_registerDefaultModules { [self registerModule:@"dom&quo ...

  6. [Python] 06 - Modules --> Packages

    故事背景 一.阶级关系 1. Programs are composed of modules.2. Modules contain statements.3. Statements contain ...

  7. Eloquent JavaScript #10# Modules

    索引 Notes 背景问题 模块Modules 软件包Packages 简易模块 Evaluating data as code CommonJS modules ECMAScript modules ...

  8. HeadFirst Ruby 第九章总结 mixins & modules

    前言 如果想要复用 method, 可用的方法是针对 Class 的 inheritance,但是, inheritance has its limitations,它的缺点有: 只能 inhert ...

  9. 死磕salt系列-salt 常用modules

    saltstack 常用模块介绍 file模块 被控主机文件常见操作,包括文件读写.权限.查找.校验等 salt '*' file.get_sum /etc/resolv.conf md5 salt ...

  10. [译]The Python Tutorial#6. Modules

    [译]The Python Tutorial#Modules 6. Modules 如果你从Python解释器中退出然后重新进入,之前定义的名字(函数和变量)都丢失了.因此,如果你想写长一点的程序,使 ...

随机推荐

  1. SpringMVC快速使用——基于XML配置和Servlet3.0

    SpringMVC快速使用--基于XML配置和Servlet3.0 1.官方文档 https://docs.spring.io/spring-framework/docs/5.2.8.RELEASE/ ...

  2. 两个线程交替运行——使用synchronized+wait+notify实现

    public class ExecuteThread { private static Object obj = new Object(); private static boolean flag; ...

  3. 如何使用 python 爬取酷我在线音乐

    前言 写这篇博客的初衷是加深自己对网络请求发送和响应的理解,仅供学习使用,请勿用于非法用途!文明爬虫,从我做起.下面进入正题. 获取歌曲信息列表 在酷我的搜索框中输入关键词 aiko,回车之后可以看到 ...

  4. Codeforces Round #133 (Div. 2), A.【据图推公式】 B.【思维+简单dfs】

    Problem - 216A - Codeforces Problem - B - Codeforces A Tiling with Hexagons 题意: 给出a b c ,求里面有多少个六边形 ...

  5. 关于在PyCharm中import numpy 出现from . import _mklinit ImportError: DLL load failed: 找不到指定模块

    最近因为一些原因安装了Anaconda3并且重新配置Python环境,但是遇到了一些麻烦的事情. 首先就是在Anaconda已经装好numpy和mkl的情况下,在PyCharm中import nump ...

  6. Linux获取本机公网IP,调整双节点主从服务的RPC调用逻辑

    简单记录一次双节点的之间的服务调用叭 ~ 现有: 服务A的双节点A1.A2 服务B的双节点B1.B2 服务A 和服务B 通过 Netty 实现 RPC 通信,可能会导致比较玄学的问题.如图: 要做到 ...

  7. C/C++指针、函数、结构体、共用体

    指针 变量与地址 变量给谁用的? 变量是对某一块空间的抽象命名. 变量名就是你抽象出来的某块空间的别名. 指针就是地址.指向某个地址. 指针与指针变量 指针是指向某块地址.指针(地址)是常量. 指针变 ...

  8. 论文解读(Graphormer)《Do Transformers Really Perform Bad for Graph Representation?》

    论文信息 论文标题:Do Transformers Really Perform Bad for Graph Representation?论文作者:Chengxuan Ying, Tianle Ca ...

  9. 分享一个为Linux创建的任务管理器,看起来就像Windows的任务管理器

    关注「开源Linux」,选择"设为星标" 回复「学习」,有我为您特别筛选的学习资料~ 链接:https://www.linuxmi.com/sysmontask-linux-tas ...

  10. 【Azure Developer】使用 Microsoft Authentication Libraries (MSAL) 如何来获取Token呢 (通过用户名和密码方式获取Access Token)

    问题描述 在上一篇博文<[Azure Developer]使用 adal4j(Azure Active Directory authentication library for Java)如何来 ...