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

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

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. QGIS 安装

    QGIS 安装 官网 https://www.qgis.org/ 下载地址 https://www.qgis.org/en/site/forusers/download.html 参考文档 https ...

  2. 【面试普通人VS高手系列】Spring Boot的约定优于配置,你的理解是什么?

    对于Spring Boot约定优于配置这个问题,看看普通人和高手是如何回答的? 普通人的回答: 嗯, 在Spring Boot里面,通过约定优于配置这个思想,可以让我们少写很多的配置, 然后就只需要关 ...

  3. 都2022年了,HDFS为何还如此能战!

    摘要:HDFS也许不是最好的大数据存储技术,但依然是最重要的大数据存储技术. 本文分享自华为云社区<HDFS为何在大数据领域经久不衰?>,作者: JavaEdge. 1.概述 1.1 简介 ...

  4. NodeJs学习日报day6——路由模块

    const express = require('express') const app = express() app.get('/user', function(req, resp) { resp ...

  5. (转)Angular中的拦截器Interceptor

    什么是拦截器? 异步操作 例子 Session 注入(请求拦截器) 时间戳(请求和响应拦截器) 请求恢复 (请求异常拦截) Session 恢复 (响应异常拦截器) 转之:http://my.osch ...

  6. 团队Arpha2

    队名:观光队 组长博客 作业博客 组员实践情况 王耀鑫 **过去两天完成了哪些任务 ** 文字/口头描述 完成服务器连接数据库部分代码 展示GitHub当日代码/文档签入记录 接下来的计划 服务器网络 ...

  7. 如何查看和修改Windows远程桌面端口

    Windows远程桌面的默认端口为3389.基于安全性考虑,部分用户有修改默认端口的需要,以减少通过远程桌面恶意攻击和扫描主机的次数. 因此今天带大家一起学习下,如何查看和修改Windows远程桌面的 ...

  8. Redis设计与实现3.3:集群

    集群 这是<Redis设计与实现>系列的文章,系列导航:Redis设计与实现笔记 集群中的节点 创建集群 通过 CLUSTER NODE 命令可以查看当前集群中的节点.刚启动时,默认每一台 ...

  9. WSL2+Docker+IDEA一站式开发调试

    WSL2+Docker+IDEA一站式开发调试 前言 ​ 我们知道,Docker是一个容器引擎:对于开发者来说,使用Dokcer容器部署各种开发需要的中间件(比如myql.redis)会非常简单方便: ...

  10. 139_Power BI之某制造企业HR相关数据年度复盘

    博客:www.jiaopengzi.com 焦棚子的文章目录 请点击下载附件 一.背景 最近在忙一个关于制造企业HR年度数据复盘分析:数据已脱敏. 先来看看效果. 1.视频效果 [video widt ...