[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
相关推荐
s090713614 小时前
FPGA中CIC设计注意事项
算法·fpga开发·cic滤波器
Aaron158814 小时前
RFSOC+VU13P在无线信道模拟中的技术应用分析
数据结构·人工智能·算法·fpga开发·硬件架构·硬件工程·射频工程
碎碎思15 小时前
BerkeleyLab Bedrock:为 FPGA 与加速计算打造的开源基石
fpga开发·开源
zidan141215 小时前
xilinx常用文档说明
fpga开发
ShiMetaPi15 小时前
GM-3568JHF丨ARM+FPGA异构开发板系列教程:外设教程 04 WIFI
网络·arm开发·fpga开发·智能路由器·fpga
FPGA_小田老师15 小时前
FPGA基础知识(二十):Xilinx Block Memory IP核(5)--ROM 详解
fpga开发·rom·coe文件格式·导入coe·block memory
FPGA_无线通信16 小时前
压缩解压缩算法 BFP-8bit
fpga开发
红糖果仁沙琪玛17 小时前
AD7616驱动开发-FPGA
驱动开发·fpga开发
坏孩子的诺亚方舟17 小时前
FPGA系统架构设计实践13_FPGA系统功能安全
fpga开发·系统架构·功能安全概念
ALINX技术博客17 小时前
【新品解读】5G/6G 基带系统级验证,AXVU13G 如何缩短高速系统研发周期
5g·fpga开发·fpga