Verilog刷题笔记16

题目:
Since digital circuits are composed of logic gates connected with wires, any circuit can be expressed as some combination of modules and assign statements. However, sometimes this is not the most convenient way to describe the circuit. Procedures (of which always blocks are one example) provide an alternative syntax for describing circuits.

For synthesizing hardware, two types of always blocks are relevant:

Combinational: always @(*)
Clocked: always @(posedge clk)
Combinational always blocks are equivalent to assign statements, thus there is always a way to express a combinational circuit both ways. The choice between which to use is mainly an issue of which syntax is more convenient. The syntax for code inside a procedural block is different from code that is outside. Procedural blocks have a richer set of statements (e.g., if-then, case), cannot contain continuous assignments, but also introduces many new non-intuitive ways of making errors. *(*Procedural continuous assignments do exist, but are somewhat different from continuous assignments, and are not synthesizable.)

For example, the assign and combinational always block describe the same circuit. Both create the same blob of combinational logic. Both will recompute the output whenever any of the inputs (right side) changes value.
assign out1 = a & b | c ^ d;
always @(*) out2 = a & b | c ^ d;
在这里插入图片描述
在这里插入图片描述
我的解法:

// synthesis verilog_input_version verilog_2001
module top_module(input a, input b,output wire out_assign,output reg out_alwaysblock
);assign out_assign=a&b;always @(*) out_alwaysblock=a&b;
endmodule

结果正确:
在这里插入图片描述
此题考查两种赋值方法:
两种类型:

output wire out_assign
output reg out_alwaysblock

对应两种不同赋值方法:

	assign out_assign=a&b;always @(*) out_alwaysblock=a&b;

关于 wire 与 reg 的说明:赋值语句的左侧必须是 net 类型(例如,wire),而过程赋值的左侧(在 always 块中)必须是变量类型(例如,reg)。这些类型(wire 与 reg)与合成的硬件无关,只是 Verilog 用作硬件仿真语言时遗留下来的语法。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/631382.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

嵌入式软件工程师面试题——2025校招社招通用(二十一)

说明: 面试群,群号: 228447240面试题来源于网络书籍,公司题目以及博主原创或修改(题目大部分来源于各种公司);文中很多题目,或许大家直接编译器写完,1分钟就出结果了。但…

【Java】——期末复习题库(十二)

🎃个人专栏: 🐬 算法设计与分析:算法设计与分析_IT闫的博客-CSDN博客 🐳Java基础:Java基础_IT闫的博客-CSDN博客 🐋c语言:c语言_IT闫的博客-CSDN博客 🐟MySQL&#xff1a…

软件开发架构

【 一 】软件开发架构图 【 1】ATM和选课系统 三层的开发架构 前段展示台 后端逻辑层 数据处理层 【二】软件开发架构的步骤流程 需求分析:在软件开发架构设计之前,需要对应用系统进行需求分析,明确用户需求、功能模块、业务流程等内容。…

CSS Day10

10.1 2D位移 属性名:transform 属性值:translateX 水平方向的位移 相对于自身位置移动 translateY 垂直方向的位移 相对于自身位置移动 transform:translate(x,y); 位移和定位搭配使用: position:absolute; top:50%; left:50%; tr…

LeetCode881. Boats to Save People

文章目录 一、题目二、题解 一、题目 You are given an array people where people[i] is the weight of the ith person, and an infinite number of boats where each boat can carry a maximum weight of limit. Each boat carries at most two people at the same time, p…

flask 与小程序 菜品详情和分享功能

mina/pages/food/info.wxml <import src"../../wxParse/wxParse.wxml" /> <view class"container"> <!--商品轮播图--> <view class"swiper-container"><swiper class"swiper_box" autoplay"{{autop…

基于springboot+vue的校园管理系统(前后端分离)

博主主页&#xff1a;猫头鹰源码 博主简介&#xff1a;Java领域优质创作者、CSDN博客专家、公司架构师、全网粉丝5万、专注Java技术领域和毕业设计项目实战 主要内容&#xff1a;毕业设计(Javaweb项目|小程序等)、简历模板、学习资料、面试题库、技术咨询 文末联系获取 项目背景…

npm install 无反应 npm run serve 无反应

说明情况&#xff1a;其实最开始我就是发现我跟着黑马的苍穹外卖的前端day2的环境搭建做的时候&#xff0c;到这一步出现了问题&#xff0c;无论我怎么 npm install 和 npm run serve 都没有像黑马一样有很多东西进行加载&#xff0c;因此我换了一种方法 1.在这个文件夹下cmd …

Cmake 中list命令总结

Cmake 中list命令总结 获取list的长度 list(LENGTH <list> <output variable>) # LENGTH: 子命令LENGTH用于读取列表长度 # <list>&#xff1a;当前操作的列表 # <output variable>&#xff1a;新创建的变量&#xff0c;用于存储列表的长度&#xff…

docker使用指南疑难杂症

使用指南 一 常见命令 二 非常见情况 1 构建包不成功留下一堆废镜像和容器<none>如何清理&#xff1f; https://blog.csdn.net/catoop/article/details/91908719 2 docker0 ip没了怎么办&#xff1f; 容器stop&#xff08;不确定是否必须&#xff0c;关上保险&…

【Qt5】QString的成员函数arg

2024年1月16日&#xff0c;周二上午 函数的功能 当你使用QString的arg函数时&#xff0c;你可以将变量插入到字符串中&#xff0c;从而动态地构建字符串。 函数的语法格式 这个函数的一般形式是&#xff1a; QString QString::arg(const QString &a, int fieldWidth 0…

63.Spring事务的失效原因?

63.Spring事务的失效原因&#xff1f; 数据库引擎不支持事务&#xff1a;某些数据库引擎可能不支持事务操作&#xff0c;或者配置不正确&#xff0c;导致无法使用事务功能。 (1)、这里以 MySQL 为例&#xff0c;其 MyISAM 引擎是不支持事务操作的&#xff0c;InnoDB 才是支持事…

2024年1月【ORACLE战报】| 新年第一波OCP证书来了!

相关文章&#xff1a; 2023年12月【考试战报】|ORACLE OCP 19C考试通过 2023年10月【考试战报】|ORACLE OCP 19C考试通过 2023.7月最新OCP考试通过|微思-ORACLE官方授权中心 OCP 19C题库稳定&#xff01;https://download.csdn.net/download/XMWS_IT/88309681?ops_request_…

Js面试之数据类型相关

Js之数据类型 都有哪些数据类型&#xff1f;不同数据类型如何转换&#xff1f;数据类型检测方法有哪些&#xff1f;为什么说Js是动态数据类型&#xff1f;为什么说Js是弱类型语言&#xff1f; 最近在整理一些前端面试中经常被问到的问题&#xff0c;分为vue相关、react相关、js…

MySQL 8.0 架构 之错误日志文件(Error Log)(1)

文章目录 MySQL 8.0 架构 之错误日志文件&#xff08;Error Log&#xff09;&#xff08;1&#xff09;MySQL错误日志文件&#xff08;Error Log&#xff09;MySQL错误日志在哪里Window环境Linux环境 错误日志相关参数log_error_services 参考 【声明】文章仅供学习交流&#x…

【昕宝爸爸小模块】深入浅出之POI是如何做大文件的写入的

➡️博客首页 https://blog.csdn.net/Java_Yangxiaoyuan 欢迎优秀的你&#x1f44d;点赞、&#x1f5c2;️收藏、加❤️关注哦。 本文章CSDN首发&#xff0c;欢迎转载&#xff0c;要注明出处哦&#xff01; 先感谢优秀的你能认真的看完本文&…

酷狗音乐逆向(js逆向)

免责声明&#xff1a;     本篇博文的初衷是分享自己学习逆向分析时的个人感悟&#xff0c;所涉及的内容仅供学习、交流&#xff0c;请勿将其用于非法用途&#xff01;&#xff01;&#xff01;任何由此引发的法律纠纷均与作者本人无关&#xff0c;请自行负责&#xff01;&…

使用easyexcel 导出多级表头demo

先看效果&#xff1a; 1、引入maven依赖 <!--EasyExcel --> <dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>3.2.1</version> </dependency> 2、实体类 package com.…

Spring框架面试题

目录 1.Spring中bean的生命周期 2.Spring中bean的循环依赖 3.SpringMVC执行流程 4.Springboot自动装配原理 5.Spring框架常见注解(Spring、Springboot、SpringMVC) 6.mybatis执行流程 7.mybatis延迟加载使用及原理 8.mybatis一级、二级缓存 1.Spring中bean的生命周期 2.…

Unity向量叉乘

叉乘计算公式 Unity中叉乘计算 Vector3.Cross(A.position, B.position); 几何意义 假设向量A和B 都在XZ平面上 向量A叉乘向量B y大于0 证明 B在A右侧 y小于0 证明 B在A左侧 示例 Vector3 C Vector3.Cross(A.position, B.position); if(C.y > 0) {print("B在A右侧&qu…