Electrical – Generate one-input pulse in Verilog

fpgapulseverilog

I'm attempting to port discrete schematics into a FPGA. In the schematics some AND gates function as short pulse generators, when input goes low output is enabled, until input propagates down an inverter chain and disables the gate (Similar to the answer described here.) Thus a short pulse is produced every negative edge. I'm new to Verilog, and am not sure of the best way to recreate this effect in Verilog. Would the code below work and is it a proper solution?

module pulser(input in,output out);
    reg mem;
    assign out = mem & !in;
    always @(negedge in) begin
        mem <= 0;
    end
    always @(posedge in) begin
        mem <= 1;
    end
endmodule

Best Answer

Ok, theres a very simple solution which I didn't realize. All instances of this pulse circuit on the original schematics trigger the set/reset signal on a flip-flop. All I needed was one always @(negedge in) block that updated the flip-flop. I feel kinda dumb for not realizing it despite it staring me in the face. Mod can close this thread.