Circuits ---Sequential---Latches

Circuits--Sequential Logic--Latches and Flip-Flops--Dualedge 网址:https://hdlbits.01xz.net/wiki/Dualedge 第一种解法: module top_module ( input clk, input d, output q ); reg m = 1'b0; reg n = 1'b0; always@(posedge clk) begin m = d; end always@(negedge c 阅读详情

1. D flip-flop

module top_module (
    input clk,    // Clocks are used in sequential circuits
    input d,
    output reg q );//
 
    always @(posedge clk)
        begin
           q<=d; 
        end
 
endmodule

2.D flip-flops

module top_module (
    input clk,
    input [7:0] d,
    output [7:0] q
);
    
    always@(posedge clk)
        begin
           q<=d; 
        end
 
endmodule

3.DFF  with reset

module top_module (
    input clk,
    input reset,            // Synchronous reset
    input [7:0] d,
    output [7:0] q
);
 
    always@(posedge clk )
        begin 
            if(!reset)
                q<=d;
            else
                q<=0;
        end
    
endmodule

4.DFF with reset  value

module top_module (
    input clk,
    input reset,
    input [7:0] d,
    output [7:0] q
);
 
    always@(negedge clk)
        begin
            if(!reset)
                q<=d;
            else
                q<=8'h34;
        end
    
endmodule

5.DFF with asynch reset

module top_module (
    input clk,
    input areset,   // active high asynchronous reset
    input [7:0] d,
    output [7:0] q
);
 
    always@(posedge clk or posedge areset)
        begin
            if(areset) // 高电平有效
                q<=0;
            else 
                q<=d;
        end
    
endmodule

6.DFF with byte enable

module top_module (
    input clk,
    input resetn,
    input [1:0] byteena,
    input [15:0] d,
    output [15:0] q
);
    
    always@(posedge clk)
        begin
            if(!resetn)
                q<=0;
            else
                begin
                    if(byteena[1])
                        q[15:8]<=d[15:8]; //修改
                    else
                        q[15:8]<=q[15:8]; //保持
                    if(byteena[0])
                        q[7:0]<=d[7:0];   //修改
                    else
                        q[7:0]<=q[7:0];   //保持
                end
        end

endmodule

7.D Latch

module top_module (
    input d, 
    input ena,
    output q);
    
    always@(*)
        begin
            if(ena)
                q=d;  //仍然是顺序元素,采用非阻塞
        end

endmodule

8. DFF_1

module top_module (
    input clk,
    input d, 
    input ar,   // asynchronous reset
    output q);

    always@(posedge clk or posedge ar)
        begin
            if(ar)
                q<=0;
            else
                q<=d;
        end
    
endmodule

9.DFF_2

module top_module (
    input clk,
    input d, 
    input r,   // synchronous reset
    output q);
    
    always@(posedge clk)
        begin
            if(!r)
                q<=d;
            else
                q<=0;
        end

endmodule

10.DFF gate

module top_module (
    input clk,
    input in, 
    output out);
    
    always@(posedge clk)
        begin
           out<=out^in;   
        end

endmodule

11.Mux and DFF_1

module top_module (
	input clk,
	input L,
	input r_in,
	input q_in,
	output reg Q);
 
    always@(posedge clk)
        begin      
            case(L)
                1'b0: Q<=q_in;
                1'b1: Q<=r_in;
            endcase        
        end
    
endmodule

12..Mux and DFF_2

module top_module (
    input clk,
    input w, R, E, L,
    output Q
);
    
    wire p;
    always@(posedge clk)
        begin
            case(E)
                1'b0: p=Q;   //采用阻塞赋值
                1'b1: p=w;
            endcase
            
            case(L)
                1'b0: Q=p;
                1'b1: Q=R;
            endcase
            
        end
 
endmodule

13.DFFs and gates

module top_module (
    input clk,
    input x,
    output z
); 
    
    wire q1,q2,q3;
    always@(posedge clk)       
        begin          
            q1<=x^q1;
            q2<=x&(~q2);
            q3<=x|(~q3);          
        end
    assign z=~(q1|q2|q3);//不受时钟影响
endmodule

14.Create circuit from truth table

module top_module (
    input clk,
    input j,
    input k,
    output Q); 
      
    always@(posedge clk)
       begin
           case({j,k})
               2'b00: Q<=Q;
               2'b01: Q<=0;
               2'b10: Q<=1;
               2'b11: Q<=~Q;
           endcase
       end
endmodule

15.Detect an edge

module top_module (
    input clk,
    input [7:0] in,
    output [7:0] pedge
);
    
    reg [7:0] p;
    always@(posedge clk)
        begin
           p<=in;
           pedge<=~p&in;  //原来为0,跳变为1后,输出位才为1.即~0&1=1
        end
 
    
endmodule

16.Detect both edges

module top_module (
    input clk,
    input [7:0] in,
    output [7:0] anyedge
);
    
    reg [7:0] p;
    always@(posedge clk)
        begin
           p<=in;
           anyedge<=p^in;
        end
 
endmodule

17.Edge capture register

module top_module (
    input clk,
    input reset,
    input [31:0] in,
    output [31:0] out
);
 
    reg[31:0] p;
    
    always@(posedge clk)
        begin
           p<=in; 
        end
    
    always@(posedge clk)
        begin
            if(reset)
               out<=0;
             else
                 begin                   
                     out<=(p&~in)|out;  //捕获后,将一直保持1,只有复位才能置为0
                 end
            
        end
    
endmodule

18.Dual-edge triggered

module top_module (
    input clk,
    input d,
    output q
);
 
   reg p1,p2;
    always@(posedge clk)
        begin
           p1<=d; 
        end
    always@(negedge clk)
        begin
           p2<=d; 
        end
    assign q=clk ? p1 : p2;
    
endmodule

Circuits--Sequential Logic--Latches and Flip-Flops--Edgedetect 网址:https://hdlbits.01xz.net/wiki/Edgedetect module top_module ( input clk, input [7:0] in, output [7:0] pedge ); reg [7:0] r_in; always@(posedge clk) begin r_in = in; end always@(posedge clk) 阅读详情

相关推荐

Circuits--Sequential Logic--Latches and Flip-Flops--Exams/2014 q4a

网址:https://hdlbits.01xz.net/wiki/Exams/2014_q4a module top_module ( input clk, input w, R, E, L, output Q ); wire temp1, temp2; assign temp1 = E ? w:Q; assign temp2 = L ? R:temp1; //与上题类似,不做赘述 always @ (posedge clk)

weixin_43668420的博客 287

Circuits-Sequential Logic-Latches and Flip-Flops

目录1、D flip-flop2、D flip-flops3、DFF with reset4、DFF with reset value5、DFF with asynchronous reset6、DFF with byte enable7、D Latch8、DFF9、DFF10、DFF+gate11、MUX and DFF12、MUX and DFF13、DFFs and gates14、Create circuit from truth table15、Detect an edge16、Detect bo

醜奴兒的博客 720

HDLBits练习(十一)Circuits_Sequential Logic_Latches and Flip-Flops(1)

Dff 要求:描述一个D 触发器,由上升沿触发。 module top_module ( input clk, input d, output reg q ); always@(posedge clk) q <= d; endmodule Dff8 要求:描述一个8位D 触发器,由上升沿触发。 module top_module ( input clk, input [7:0] d, output [7:

qq_43372982的博客 417

hdlbits->circuits->sequential logic->latches and flip-flps

【代码】circuits->sequential logic->latches and flip-flps->D flip-flop。

weixin_50367479的博客 281

【KBrowser】基于 Kiwi/chromium 制作全新外壳,将 chromium 代码当作 webview 使用,实现可控核替换

chromium 其实只需几步巧妙的架构,就能拿来“换核”,甚至可以插件化,实现类似webview.apk 的效果。重新设计界面,不再是差不多的回声。而 Kiwi 基于 chrome 77 ,只有 50 MB。优势是兼容好、可安装扩展。

sinat_27171121的博客 2030

nginx+keepalived高可用

两台服务器上的keepalive是靠相互通讯来判断的,如果一台服务器上keepalived挂掉了,keepalived就会把虚拟的ip就会转移到备用的nginx服务器上,实现服务转移。keepalive只能相互检查对方的进程是否还存活,所以对nginx没有任何一点监控作用,当nginx宕机后,keepalived进程还存活着就会导致web项目无法访问,所以后续需要编写一个shell脚本来完成对nginx进程的判断。在高可用架构中,Nginx 常用作前端的负载均衡器,将流量分发到多个后端服务器上。

qq_61314298的博客 3912

【HDLBits 刷题 6】Circuits(2)Sequential Logic---Latches and Filp Flops

这部分的内容比较简单,主要就是学习了创建触发器和锁存器,以及在实际设计中常用的边沿检测。

记录学习历程 4937

【个人记录】CentOS7升级glibc至2.28

由于CentOS7系统已经停止支持, 虽然大部分业务已经迁移至OpenEuler,但仍然有部分业务系统跑在CentOS7上。在尝试部署新业务环境时经常会提示如下错误(以code-server运行需要的node 20为例)node -v为了保障业务可正常运行,通常采用Docker继承好的node环境进行部署,但部分场景还是需要宿主机使用新版glibc版本。本文记录本人一次成功升级glibc(2.17=>2.28)的步骤。

喵呜 3885

【verilog学习17】HDLBits:Circuits_Sequential Logic_Latches and Flip-Flops

Circuit单元Latches and flip-flops锁存器与触发器模块。

weixin_48052679的博客 1512

UOS系统手动添加1920x1080分辨率:xrandr命令详解与持久化配置

本文详细介绍了在UOS系统中使用xrandr命令手动添加1920x1080分辨率的方法。针对系统设置中缺失该选项的常见问题,文章提供了从识别显示设备、使用cvt生成模式、添加并切换分辨率,到通过修改.profile文件实现持久化配置的完整步骤。同时涵盖了虚拟机环境、设备名识别及排错等进阶内容,帮助用户彻底解决UOS分辨率配置难题。

weixin_29300931的博客 500

D16: OpenClaw + Notion API:知识管理新玩法

本文介绍了如何利用OpenClaw连接Notion API构建自动化知识管理系统。文章首先分析了传统知识管理的痛点,包括信息分散、更新不及时等问题,并对比了Notion与其他工具在API完整性、结构化程度等方面的优势。接着详细说明了Notion API的获取和授权流程,并设计了包含项目知识库、技术决策库和会议纪要库的三层架构系统。最后通过会议纪要自动归档的实战案例,展示了如何通过YAML配置实现从飞书会议到Notion的自动化知识沉淀流程。该方案能有效解决团队知识管理中的信息碎片化问题,提升协作效率。

刘一说的IT专栏 276

(10)HDLBits-Circuits-Sequential Logic-Latches and Flip-Flops

本文为本人在HDLBits-Circuits-Sequential Logic-Latches and Flip-Flops上的学习记录

m0_58077663的博客 527

2021.02.23丨Virsorter2安装使用及答疑

最近项目比较多,又在学英语,写文章的时间少了很多。最近接到一个病毒组装的项目。用之前组装工具(ABYSS、SPAdes)都没有能够组装较为完整的scafford,今天介绍一款专门用于组装病毒的工具——Virsorter。 Virsorter最早版本发布于2015年,目前已经有了第二个版本。主要用于病毒的组装的注释。详细情况可以查看文章:https://peerj.com/articles/985/ 安装流程 安装文档: https://github.com/jiarong/VirSorter2/b

4836

HDLBits刷题记录 Circuits—Sequential Logic—Latches and Flip-Flops

DFFs and gates,Edge capture register, Dualedge

mccree618的博客 246

【25届数字IC秋招总结】面试经验15——比特大陆-算能

25届数字ic面试记录——比特大陆-算能

lalala0635的博客 558

ArcMap|使用模型构建器将kml文件批量转图层

参考:https://www.jianshu.com/p/6de18f846024 第一步:打开模型构建器,拖入kml转图层工具 第二步:插入文件迭代器 第三步:双击“迭代文件”,选择kml所在文件夹 第四步:将“File.kml”与“KML转图层”连接,点击“输入KML文件” 第五步:双击“KML转图层”,更改输出位置,输出数据名称改为%名称% 第六步:运行模型 得到结果: ...

个人学习笔记 3602

Circuits---Sequential---Latches(3)

只写一个子模块,别想复杂了。

kamo 325

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

【HDLBits】Circuits: Sequential Logic 1—Latches and Flip-Flops合集(包含答案推导过程)

A D flip-flop is a circuit that stores a bit and is updated periodically, at the (usually) positive edge of a clock signal. 对于边沿触发的D触发器,具有两个稳定状态(“0"和"1”),D触发器在时钟脉冲CP的前沿(正跳变0→1)发生翻转。 D flip-flops are created by the logic synthesizer when a clocked always b

na__D的博客 1213

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

HDLbits: Circuits/Sequential Logic/Latches and Flip-Flops/Edgecaptu

(2) 除非复位,否则输出 out 中的所有高位都需要被保留,简单点说,一旦 out 中的某些位被置为1后,它就会一直保持,只有检测到复位信号,这些位才会重新置为0.第1个输入的 in = 32'b0000_0000_0000_0000_0000_0000_0000_0010,第2个输入的 in = 32'b0000_0000_0000_0000_0000_0000_0000_0000,可以看到,在 in[1] 这个位置有一个从 1到0 的变化,检测到这个下降沿之后,输出的 out[1] 置为1.

xiaowuguideyiba的博客 361

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

HDLBits刷题笔记8:Circuits.Sequential Logic.Latches and Flip-Flops

HDLBits刷题网站中,Circuit章节中Sequential Logical子章节下的Latch and Filp-Flops小节的题目与答案,触发器和锁存器相关题目,题量较大,但难度不高

fpga学就完事了 1116

HDL bits--circuits--sequential logic--latches and flip-flops

我不明白当byteena是01的时候,q的[15:8]不用管吗?原来这种语句也可以嵌套,记得写begin.(我靠 第一个 错的,第二个代码是对的)但是为什么啊?使能端都为0的话,输出不应该是0吗?在clk always 模块中 始终用非阻塞。不要忘记之前写那么多寄存器是干嘛用的。我其实蛮不懂的,为什么不能写下降沿啊。

fluffysusu的博客 649

Circuits--Sequential Logic--Latches and Flip-Flops--Edgecapture

网址:https://hdlbits.01xz.net/wiki/Edgecapture module top_module ( input clk, input reset, input [31:0] in, output [31:0] out ); reg [31:0] r_in; always@(posedge clk) begin r_in = in; end alwa

weixin_43668420的博客 197

HDLBits练习(十一)Circuits_Sequential Logic_Latches and Flip-Flops(2)

DFF+gate 要求:实现下图电路。 module top_module ( input clk, input in, output out); wire d; assign d = in ^ out; always@(posedge clk) out <= d; endmodule Mux and DFF (Mt2015 muxdff) 要求:考虑下面的时序电路,其中使用了具有触

qq_43372982的博客 613

Circuits--Sequential Logic--Latches and Flip-Flops--Edgedetect2

网址:https://hdlbits.01xz.net/wiki/Edgedetect2 module top_module ( input clk, input [7:0] in, output [7:0] anyedge ); reg [7:0] r_in; always@(posedge clk) begin r_in = in; end always@(posedge clk)

weixin_43668420的博客 238

Circuits---Sequential logic--------Latches (1)

【代码】Circuits---Sequential logic--------Latches (1)

kamo 187

HDLbits---Circuits---Sequential Logic---Latches and Flip-Flops

【代码】HDLbits---Circuits---Sequential Logic---Latches and Flip-Flops。

weixin_50965981的博客 567
上一篇: Circuits---Sequential logic--------Latches (1)
下一篇: Verilog---Vectors
且听风吟567
博客等级 码龄7年 231粉丝 77原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值