当前位置:网站首页>【牛客网刷题系列 之 Verilog快速入门】~ 优先编码器电路①
【牛客网刷题系列 之 Verilog快速入门】~ 优先编码器电路①
2022-07-01 16:45:00 【AI很不错呦】
目录:
0. 前言
之前的十道题是Verilog的基础语法,我觉得必须掌握,但是到了第二部分这个组合逻辑这些题突然有点小恶心,所以说这块的题我就选择性的做了,我会做什么样的题呢?
里边涉及到重要的知识点的题我还会拿出来分享的。
0.1 知识点
0.1.1 关于case、casex、casez的区别
首先看一下case、casex、casez对应的真值表
0.1.2 说明:
在case语句中,敏感表达式中与各项值之间的比较是一种全等比较,每一位都相同才认为匹配。
在casez语句中,如果分支表达式某些位的值为高阻z,那么对这些位的比较就会忽略,不予考虑,而只关注其他位的比较结果。
在casex语句中,则把这种处理方式进一步扩展到对x的处理,即如果比较双方有一方的某些位的值是z或x,那么这些位的比较就不予考虑。
0.1.3 注意事项
- 一般经常使用到的是casez语句,最好少用casex
- case/casez/casex其实都是可综合的
- 在电路中,可以用?来表示无关值的z
- case的描述,匹配都是从上到下进行的
1. VL13 优先编码器电路①
1.1 题目描述
下表是某优先编码器的真值表。
①请用Verilog实现此优先编码器
1.1.1 信号示意图
无
1.1.2 波形示意图
无
1.1.3 输入描述
input [8:0] I_n
1.1.4 输出描述
output reg [3:0] Y_n
1.2 解题思路
通过题目给出的真值表,依次写出对应的输入输出即可(注意高低位)。
1.3 代码实现
`timescale 1ns/1ns
module encoder_0(
input [8:0] I_n ,
output reg [3:0] Y_n
);
always @(*)begin
casez(I_n)
9'b111111111 : Y_n = 4'b1111;
9'b0zzzzzzzz : Y_n = 4'b0110;
9'b10zzzzzzz : Y_n = 4'b0111;
9'b110zzzzzz : Y_n = 4'b1000;
9'b1110zzzzz : Y_n = 4'b1001;
9'b11110zzzz : Y_n = 4'b1010;
9'b111110zzz : Y_n = 4'b1011;
9'b1111110zz : Y_n = 4'b1100;
9'b11111110z : Y_n = 4'b1101;
9'b111111110 : Y_n = 4'b1110;
default : Y_n = 4'b1111;
endcase
end
endmodule
1.4 测试文件
待更。。。
1.5 仿真波形
待更。。。
声明
本人所有系列的文章,仅供学习,不可商用,如有侵权,请告知,立删!!!
本人主要是记录学习过程,以供自己回头复习,再就是提供给后人参考,不喜勿喷!!!
如果觉得对你有用的话,记得收藏+评论!!!
边栏推荐
- How to solve the keyboard key failure of notebook computer
- Activity的生命周期和启动模式详解
- Research and investment strategy report of hydroxypropyl beta cyclodextrin industry in China (2022 Edition)
- Judge whether the binary tree is a binary search tree
- China benzene hydrogenation Market Research and investment forecast report (2022 Edition)
- [C language supplement] judge which day tomorrow is (tomorrow's date)
- Tutorial on the principle and application of database system (001) -- MySQL installation and configuration: installation of MySQL software (Windows Environment)
- FRP intranet penetration, reverse proxy
- Redis distributed lock
- Iommu/smmuv3 code analysis (10) page table operation
猜你喜欢
The amazing open source animation library is not only awesome, but also small
SQL question brushing 586 Customers with the most orders
【splishsplash】关于如何在GUI和json上接收/显示用户参数、MVC模式和GenParam
Leetcode 77 combination -- backtracking method
How to solve the keyboard key failure of notebook computer
Redis6.0 new features
Tutorial on the principle and application of database system (001) -- MySQL installation and configuration: installation of MySQL software (Windows Environment)
[C language foundation] 12 strings
[jetsonnano] [tutorial] [introductory series] [III] build tensorflow environment
[pyg] document summary and project experience (continuously updated
随机推荐
Ring iron pronunciation, dynamic and noiseless, strong and brilliant, magic wave hifiair Bluetooth headset evaluation
SQL question brushing 586 Customers with the most orders
mysql -- explain性能优化
Hi Fun Summer, play SQL planner with starrocks!
中国乙腈市场预测与战略咨询研究报告(2022版)
AI college entrance examination volunteer filling: the gods of Dachang fight, and candidates pay to watch
P2893 [usaco08feb] making the grade g (DP & priority queue)
《中国智慧环保产业发展监测与投资前景研究报告(2022版)》
Concatenate strings to get the result with the smallest dictionary order
中国一次性卫生用品生产设备行业深度调研报告(2022版)
Buuctf gold III
China sorbitol Market Forecast and investment strategy report (2022 Edition)
[wrung Ba wrung Ba is 20] [essay] why should I learn this in college?
Soft test network engineer full truth simulation question (including answer and analysis)
China BMS battery management system Market Research Report (2022 Edition)
The amazing open source animation library is not only awesome, but also small
免费抽奖 | 《阿巴豆》探索未来系列盲盒数字版权作品全网首发!
Redis6.0 new features
Judge whether a binary tree is a balanced binary tree
What are the differences between PHP and DW