[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
相关推荐
Aaron158823 分钟前
全频段 SDR干扰源模块解决方案(星链干扰、LORA无人机干扰)
人工智能·算法·fpga开发·硬件架构·硬件工程·无人机·信息与通信
Kent Gu4 小时前
FPGA JTAG确认
fpga开发
北京青翼科技4 小时前
基于VITA57.1的2路125MSPS AD采集、2路250MSPS DA回放FMC子卡丨青翼科技100%国产采集卡
fpga开发·数据采集卡·fmc子卡·ad采集卡
小麦嵌入式15 小时前
FPGA入门(四):时序逻辑计数器原理与 LED 闪烁实现
linux·驱动开发·stm32·嵌入式硬件·fpga开发·硬件工程·dsp开发
ALINX技术博客16 小时前
【黑金云课堂】FPGA技术教程FPGA基础:呼吸灯实验+RAM/ROM IP设计与验证
网络协议·fpga开发·fpga
ALINX技术博客18 小时前
【黑金云课堂】FPGA技术教程Vitis开发:PS端IIC通信
fpga开发·fpga
第二层皮-合肥21 小时前
线阵相机坏点校正方案
fpga开发
cjie2211 天前
安路Modelsim仿真库编译
fpga开发
QYR-分析1 天前
全球及中国电源序列发生器行业市场发展现状与前景分析
fpga开发
alxraves1 天前
超声图像前端信号处理的关键技术
前端·fpga开发·信号处理