[HDLBits] Edgecapture

For each bit in a 32-bit vector, capture when the input signal changes from 1 in one clock cycle to 0 the next. "Capture" means that the output will remain 1 until the register is reset (synchronous reset).

Each output bit behaves like a SR flip-flop: The output bit should be set (to 1) the cycle after a 1 to 0 transition occurs. The output bit should be reset (to 0) at the positive clock edge when reset is high. If both of the above events occur at the same time, reset has precedence. In the last 4 cycles of the example waveform below, the 'reset' event occurs one cycle earlier than the 'set' event, so there is no conflict here.

In the example waveform below, reset, in[1] and out[1] are shown again separately for clarity.

复制代码
module top_module (
    input clk,
    input reset,
    input [31:0] in,
    output [31:0] out
);
    reg [31:0] old;
    always@(posedge clk) old<=in;
    always@(posedge clk) begin
        if(reset)
            out<=32'b0;
        else
            out<=old&(~in)|out;
        //这里需要或上一个out才能保持
    end
endmodule
相关推荐
Aaron15886 小时前
RFSOC+VU13P/VU9P+GPU通用一体化硬件平台
人工智能·算法·fpga开发·硬件架构·硬件工程·信息与通信·基带工程
XINVRY-FPGA10 小时前
XC7VX485T-2FFG1157I Xilinx Virtex-7 FPGA
arm开发·嵌入式硬件·fpga开发·硬件工程·fpga
鄙人菜鸡10 小时前
Xilinx IP Aurora 8B/10B 多级光纤串联复位时序
fpga开发
是大强11 小时前
数字 IC 设计
fpga开发
十年一梦实验室13 小时前
【Gemini+Claude】根据(工业级智能3D相机)系统描述创建软硬件架构图、爆炸图 +多线程主程序、主循环
数码相机·fpga开发
tiantianuser13 小时前
RDMA设计63:怎么进行网络嗅探功能测试
网络·fpga开发·rdma·高速传输·cmac·roce v2
Risehuxyc13 小时前
Verilog语言的标准发展历程及核心要点
fpga开发
FPGA-ADDA1 天前
第五篇(下):智能无线电与6G候选技术——从机器学习到通感一体化
人工智能·机器学习·信号处理·fpga·通信系统
maverick_1111 天前
【FPGA】关于两个数相加的“坑”
c语言·matlab·fpga开发
碎碎思1 天前
经典复活:3dfx Voodoo 显卡,正在被 FPGA“重做一遍”
fpga开发