[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
相关推荐
国科安芯1 小时前
AS32A601型MCU芯片flash模块的擦除和编程
java·linux·前端·单片机·嵌入式硬件·fpga开发·安全性测试
Aaron158811 小时前
侦察、测向、识别、干扰一体化平台系统技术实现
人工智能·fpga开发·硬件架构·边缘计算·信息与通信·射频工程·基带工程
欢鸽儿12 小时前
Vitis】Linux 下彻底清除启动界面 Recent Workspaces 历史路径
linux·嵌入式硬件·fpga
FPGA_无线通信19 小时前
OFDM 频偏补偿和相位跟踪(1)
算法·fpga开发
HIZYUAN1 天前
AI时代,如何利用FPGA在无人机视觉等方面进行快速应用
stm32·单片机·fpga开发·视觉检测·无人机·fpga·光端机
釉色清风1 天前
openEuler 多样算力支持:CPU、GPU 与 FPGA 异构加速实战
fpga开发
Joshua-a2 天前
Quartus命令行烧录FPGA
fpga开发
FPGA_无线通信2 天前
OFDM FFT 时频域转换
fpga开发
XINVRY-FPGA2 天前
EP4CE30F23I7N Altera Cyclone IV E SRAM FPGA
嵌入式硬件·fpga开发·云计算·硬件工程·信息与通信·信号处理·fpga
156082072192 天前
FPGA(采用RGMII接口)逻辑实现千兆网TCP/IP协议栈调试记录
网络协议·tcp/ip·fpga开发