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

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

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. linux压缩打包、定时任务

    压缩打包 gzip压缩 win中的压缩包:zip rar Linux常见的压缩包有哪些? gzip bzip2 1.gzip压缩 压缩命令:gzip [压缩文件] 解压命令:gzip -d [压缩包] ...

  2. C++五子棋(六&七)——游戏结束

    规则原理 如图 判断游戏结束 chessData.h //row,col 表示当前落子 bool checkWin(ChessData* game, int row, int col); 横.竖.斜( ...

  3. DjangoRestFramework框架三种分页功能的实现 - 在DjangoStarter项目模板中封装

    前言 继续Django后端开发系列文章.刚好遇到一个分页的需求,就记录一下. Django作为一个"全家桶"型的框架,本身啥都有,分页组件也是有的,但默认的分页组件没有对API开发 ...

  4. Java语言学习day04--7月1日

    ###09数据类型转换_自动转换     * A:   自动类型转换         * a:表示范围小的数据类型转换成范围大的数据类型,这种方式称为自动类型转换             自动类型转 ...

  5. 计算属性、侦听属性、局部与全局组件使用、组件通信(父子互传)、ref属性、动态组件和keep-alive、插槽

    今日内容概要 计算属性 侦听属性 局部组件和全局组件 组件通信之父传子 组件通信之子传父 ref属性(组件间通信) 动态组件和keep-alive 插槽 内容详细 1.计算属性 # 插值的普通函数,只 ...

  6. ChCore Lab4 多核处理 实验笔记

    本文为上海交大 ipads 研究所陈海波老师等人所著的<现代操作系统:原理与实现>的课程实验(LAB)的学习笔记的第四篇:多核处理.所有章节的笔记可在此处查看:chcore | 康宇PL' ...

  7. SQL注入之information_schema

    在学习SQL注入时, 经常拿出来的例子就是PHP+MySQL这一套经典组合. 其中又经常提到的>=5.0版本的MySQL的内置库: information_schema 简单看一下informa ...

  8. 第一个Python程序 | 机选彩票号码+爬取最新开奖号码

    (机选彩票号码+爬取最新开奖号码 | 2021-04-21) 学习记录,好记不如烂笔头 这个程序作用是<机选三种彩票类型的号码> 程序内包含功能有如下: 自动获取最新的三种彩票的开奖号码 ...

  9. python入门基础知识三(列表和元组)

    列表(list)的操作 1. 形式 var = ['char1','char2','char3',...] var = [value1,value2,value3,...] 2. 列表的增删改查 查: ...

  10. 在Windows2003 server 64位系统上使用ArcEngine开发的WCF服务

    之前大篇文章提到,ESRI说AE10.0以后已经不支持WebService的发布,经过一段时间的测试,发现目前10.2.2版本开始的WCF服务都可以正常发布,且运行正常. 先说一下之前遇到的问题,本机 ...