HDLBits->Verilog Language->Modules:Hierarchy->Modules and vectors
题目要求如上不再赘述,主要关注到最后的四选一多路选择器。
最初编写的选择器代码如下
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的更多相关文章
- Creating Modules
转自官方文档,主要说明如何创建模块 https://www.terraform.io/docs/modules/index.html A module is a container for multi ...
- IIS Modules Overview
Introduction The IIS 7 and above Web server feature set is componentized into more than thirty indep ...
- webpack——Modules && Hot Module Replacement
blog:JavaScript Module Systems Showdown: CommonJS vs AMD vs ES2015 官网链接: Modules 官网链接:Hot Module Rep ...
- Ubuntu16.04下的modules模块编译加载
一.首先编写对应的驱动程序的相关内容:(最简单的hello.c程序) #include<linux/init.h> #include<linux/module.h> MODUL ...
- WeexSDK之注册Modules
注册Modules的流程和注册Components非常类似. + (void)_registerDefaultModules { [self registerModule:@"dom&quo ...
- [Python] 06 - Modules --> Packages
故事背景 一.阶级关系 1. Programs are composed of modules.2. Modules contain statements.3. Statements contain ...
- Eloquent JavaScript #10# Modules
索引 Notes 背景问题 模块Modules 软件包Packages 简易模块 Evaluating data as code CommonJS modules ECMAScript modules ...
- HeadFirst Ruby 第九章总结 mixins & modules
前言 如果想要复用 method, 可用的方法是针对 Class 的 inheritance,但是, inheritance has its limitations,它的缺点有: 只能 inhert ...
- 死磕salt系列-salt 常用modules
saltstack 常用模块介绍 file模块 被控主机文件常见操作,包括文件读写.权限.查找.校验等 salt '*' file.get_sum /etc/resolv.conf md5 salt ...
- [译]The Python Tutorial#6. Modules
[译]The Python Tutorial#Modules 6. Modules 如果你从Python解释器中退出然后重新进入,之前定义的名字(函数和变量)都丢失了.因此,如果你想写长一点的程序,使 ...
随机推荐
- JavaWeb学习day3-Maven&安装
1.官网下载:https://maven.apache.org/ 2.解压下载好的压缩包 3.配置环境变量 添加如下图变量 在path变量下添加下图 4.安装完成检测 cmd输入:mvn -versi ...
- 为何数据库连接池不采用IO多路复用?
今天我们聊一个不常见的 Java 面试题:为什么数据库连接池不采用 IO 多路复用? 这是一个非常好的问题.IO多路复用被视为是非常好的性能助力器.但是一般我们在使用 DB 时,还是经常性采用c3 ...
- Oracle 定时任务增删改查
创建 -- 创建定时任务 DECLARE jobno NUMBER; BEGIN dbms_job.submit ( jobno, -- 定时器ID,系统自动获得 'PRC_INSERT;', -- ...
- python自动化测试工具selenium使用指南
概述 selenium是网页应用中最流行的自动化测试工具,可以用来做自动化测试或者浏览器爬虫等.官网地址为:https://www.selenium.dev/.相对于另外一款web自动化测试工具QTP ...
- C++实例2--职工管理系统
职工管理系统 1. 头文件 1.1 workerManager.h 系统类 1 #pragma once // 防止头文件重复包含 2 #include<iostream> // 包含输 ...
- 掌握AI学习路上核心理论知识,你绝对不能错过这份最全资料包
人工智能成为当下科技发展的代表之一,持续受到了不少追捧,不管你是否是这一专业的学生或者职场人,学习并掌握一项新潮技能总是不会被同龄人淘汰的.我曾经问过别人.也被别人问过关于学习人工智能(AI)最好的方 ...
- uniapp中IOS安卓热更新和整包更新app更新
在App.vue中 onLaunch: function() { console.log('App Launch'); // #ifdef APP-PLUS this.getVersion(); // ...
- 羽夏 Bash 简明教程(上)
写在前面 该文章根据 the unix workbench 中的 Bash Programming 进行汉化处理并作出自己的整理,并参考 Bash 脚本教程 和 BashPitfalls 相关内容 ...
- Golang 的 `[]interface{}` 类型
Golang 的 []interface{} 类型 我其实不太喜欢使用 Go 语言的 interface{} 类型,一般情况下我宁愿多写几个函数:XxxInt, XxxFloat, XxxString ...
- 2022管家婆工贸版ERP T3 V22.0工厂管理软件单机网络版无限用户免狗软件可定制
管家婆工贸版是一款针对国内中小加工企业开发的管理软件,软件以财务管理为核心,集采购.销售.存货.生产.工资.固定资产.账务管理等模块于一体,对企业的信息进行监控,实现对企业物流.资金流.信息流和生产成 ...