当前位置:网站首页>【牛客网刷题系列 之 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 仿真波形
敬请期待!!!
参考文献
边栏推荐
- MySQL subquery
- My creation anniversary
- Why is the test post a giant pit? The 8-year-old tester told you not to be fooled
- 热更新流程
- What are the circular statements of MySQL
- JDBC man Han building code
- Basic use of JSX
- 【HackTheBox】dancing(SMB)
- lua-protobuff emmy-lua 轮子
- The great gods take connections from the MySQL connection pool in the open of the rich function. The initialization of the connection pool is 20. If the parallelism of the rich function is 1
猜你喜欢

Runtimeerror in yolox: dataloader worker (PID (s) 17724, 1364, 18928) exited unexpectedly

安捷伦数字万用表软件NS-Multimeter,实时数据采集数据自动保存

Flyweight pattern

The 30th day of force deduction (DP topic)

SEAttention 通道注意力机制

I came from a major, so I didn't want to outsource

1018 锤子剪刀布

What are the basic usage methods of MySQL

Redis cache penetration, cache breakdown, cache avalanche

Libuv library overview and comparison of libevent, libev and libuv (Reprint)
随机推荐
1017 a divided by B
Lua protobuff Emmy Lua wheel
How to create a subtype like relationship between two generic classes when the classes are generic related
What are the MySQL database constraint types
仿真与烧录程序有哪几种方式?(包含常用工具与使用方式)
MySQL subquery
docker 创建的 mysql8 怎么改密码
Blue Bridge Cup DFS (I)
Facade pattern
BERT和ViT简介
Seattention channel attention mechanism
1015 德才论
From zero to one, I will teach you to build a "search by text and map" search service (I)
赚钱的5个层次,你在哪一层?
Redis cache penetration, cache breakdown, cache avalanche
Basic use of JSX
What are the basic usage methods of MySQL
从零到一,教你搭建「以文搜图」搜索服务(一)
[C language] explain the thread exit function pthread_ exit
[laravel series 8] out of the world of laravel