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

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

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. eclipse-java-2018-09-win32-x86_64配置tomcat(内含更新eclipse,如何解决添加时找不到最新tomcat版本)

    我下的是eclipse精简版,建议下载企业版,可以省略后面的很多步骤(其中的辛酸...) 这里就是说明下载精简版的eclipse如何配置tomcat的步骤,其实还是更新eclipse的步骤 1.首先点 ...

  2. Java学习day31

    同步方法的机制:synchronized,包括synchronized方法和synchronized块 同步方法:public synchronized void method(int args){ ...

  3. line-height: 1; line-height: 100%;是什么意思

    先简单看个例子: css 页面: 应该猜测出来了: line-height: 1; = line-height: 100%; = font-size: 50px; 把哪一个放到最后都是一样的.我理解的 ...

  4. Java语言学习day33--8月8日

    今日内容介绍1.基本类型包装类2.System类3.Math类4.Arrays类5.大数据运算 ###01基本数据类型对象包装类概述 *A:基本数据类型对象包装类概述 *a.基本类型包装类的产生 在实 ...

  5. ThinkPHP3.2.3反序列化链子分析

    前言 目前官方已经不再维护ThinkPHP3.2.3,本文仅对ThinkPHP3.2.3反序列化链子进行复现,如有纰漏,还望指正. 环境介绍 MAMP pro PhpStorm Xdebug 利用条件 ...

  6. 2021.08.09 P7238 迷失森林(树的直径)

    2021.08.09 P7238 迷失森林(树的直径) P7238 「DCOI」迷失森林 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 重点: 1.树的直径两种求法:两次dfs.树 ...

  7. Dapr 远程调试之 Nocalhost

    虽然Visual studio .Visual studio code 都支持debug甚至远程debug ,Dapr 搭配Bridge to Kubernetes 支持在计算机上调试 Dapr 应用 ...

  8. Spring 源码(6)BeanFactoryPostProcessor怎么执行的?

    上一篇文章 https://www.cnblogs.com/redwinter/p/16167214.html 解读了如何进行自定义属性值的编辑器的解析器,并且还介绍了BeanFactory的准备过程 ...

  9. 论文解读(GMT)《Accurate Learning of Graph Representations with Graph Multiset Pooling》

    论文信息 论文标题:Accurate Learning of Graph Representations with Graph Multiset Pooling论文作者:Jinheon Baek, M ...

  10. kill -9 进程杀不掉,怎么办?

    关注「开源Linux」,选择"设为星标" 回复「学习」,有我为您特别筛选的学习资料~ 用ps和grep命令寻找僵尸进程 ps -A -ostat,ppid,pid,cmd | gr ...