To generate this circuit, we need to have a delayed version of the same signal.
Here is the code snippet for the same in SystemVerilog:
logic clk;
logic rst_n;
logic signal;
logic signal_d1;
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) signal_d <= 1'b0;
else signal_d <= signal;
// Posedge signal detection
if ( signal && ~signal_d)
//...
// Negedge signal detection
if ( ~signal && signal_d)
//...
// Pulse generation at the posedge signal
assign pulse = signal && ~signla_d;