This an answer to the original question, not the problem revealed in the comments
As @Tim has mentioned there is no hardware construct which can do this. always @(posedge clk)
create flip-flops which sample the data on the edge of a clk.
always @*
blocks create combinatorial logic which is evaluated by the simulator when ever the right hand side of an assignment or a select signal changes.
If you had multiple 1 bit signals driven from D-type flip-flops you could XOR (^
) the input (D) and output (Q) to create a, 1 clock cycle wide, signal indicating the value has changed. These change signals could be combined to create an enable signal. Which is used as a select or enable for a flip-flop.
always @(posedge clk or negedge rst_n) begin
if (~rst_n) begin
//reset condition
end
else if (enabled)
//Enabled condition
end
// no final else, everything will holds its value
end
Or may be as the enable for a latch :
//synopsys async_set_reset "rst_n"
always @* begin
if (~rst_n) begin
// Reset
end
else if (latch_open) begin
//next datavalue
end
end