当前位置:网站首页>【牛客网刷题系列 之 Verilog快速入门】~ 异步复位的串联T触发器
【牛客网刷题系列 之 Verilog快速入门】~ 异步复位的串联T触发器
2022-06-29 04:32:00 【AI很不错呦】
目录:
0. 前言
今天只刷了一个题,为啥呢?是因为难吗?好像不是哦!!!因为我看牛客网上的题好像是漏洞百出,所以萌生出一个大胆的想法,那就是自己写设计和测试文件,使用vcs+verdi联合仿真(随大流,哈哈哈)。咱不说别的,就光装环境花了一天,呜呜呜。不过现在基本上环境是没有问题了,关于环境,我是参考大佬做的,见参考文献。
1. 异步复位的串联T触发器
1.1 题目描述
用verilog实现两个串联的异步复位的T触发器的逻辑
1.1.1 信号示意图

1.1.2 波形示意图

1.1.3 输入描述
输入信号 data, clk, rst
类型 wire
在testbench中,clk为周期5ns的时钟,rst为低电平复位
1.1.4 输出描述
输出信号 q
类型 reg
1.2 解题思路
需要注意的是,关于各个信号是什么电平有效呢?这个需要我们根据题目要求搞清楚,这里需要吐槽的是,明明是低电平复位,官方竟然没有定义成rst_n(_n默认就是低电平有效的,个人习惯)。
知识点1:T触发器===>输入为1,输出翻转;输入为0,输出保持。
知识点2:异步复位表示不需要等待时钟就可以完成复位。同时,还有同步复位,一般情况下,最好是使用同步复位,单有时候避免不了异步复位,因为省资源,很省,哈哈,因此,出现了异步复位,同步释放的操作,广泛应用。
1.3 代码实现
`timescale 1ns/1ns
module Tff_2 (
input wire data, clk, rst,
output reg q
);
//*************code***********//
reg q_reg;
always @ (posedge clk or negedge rst) begin
if(!rst) begin
q_reg <= 1'b0;
end
else begin
if(data) begin
q_reg <= ~q_reg;
end
else begin
q_reg <= q_reg;
end
end
end
always @ (posedge clk or negedge rst) begin
if(!rst) begin
q <= 1'b0;
end
else begin
if(q_reg) begin
q <= ~q;
end
else begin
q <= q;
end
end
end
//*************code***********//
endmodule
1.4 仿真文件
关于仿真文件,我暂时还没做,等我先熟悉一下vcs和verdi联合使用,哈哈!敬请期待。
1.5 仿真波形
敬请期待!!!
参考文献
边栏推荐
- 项目开发修养
- Installation and configuration of interrealsense d435i camera driver
- Here comes Wi Fi 7. How strong is it?
- 基于.NetCore开发博客项目 StarBlog - (13) 加入友情链接功能
- JVM memory tuning method
- 1015 德才论
- MySQL subquery
- From zero to one, I will teach you to build a "search by text and map" search service (I)
- Real time waveform calculation function of Waveform Recorder mr6000
- Remediation for Unsafe Cryptographic Encryption
猜你喜欢

How to display all MySQL databases

SEAttention 通道注意力機制

不使用union实现Mysql 列转行

Blue Bridge Cup ruler method

Log in to the MySQL database and view the version number on the command line

iNFTnews | 元宇宙技术将带来全新的购物体验

PostgreSQL has a cross database references are not implemented bug

Mécanisme d'attention du canal de fixation

基于.NetCore开发博客项目 StarBlog - (13) 加入友情链接功能

Technical specifications of Tektronix tds3054b oscilloscope
随机推荐
Has my future been considered in the cloud native development route?
Nuxt - 每个页面单独设置 SEO 相关标签及网页标题、图标等(页面配置 head)
力扣解法汇总324-摆动排序 II
Call snapstateon closed sou from Oracle CDC
The last week! Summary of pre competition preparation for digital model American Games
Build a simple website by yourself
Flyweight pattern
How to write MySQL scheduled backup script in Linux
Cisco voice card handling configuration
Mediator pattern
How to test electronic components with a multimeter
Gocd is good, but talk about Jenkins
lua-protobuff emmy-lua 轮子
Open source demo| you draw and I guess -- make your life more interesting
JSX的基本使用
Basic use of JSX
赚钱的5个层次,你在哪一层?
Practical part: solving the function conflict between swagger and user-defined parameter parser
Libuv library overview and comparison of libevent, libev and libuv (Reprint)
Observer pattern