Design requires a signal to be activated at specific circumstance on rising edge of the clock, and deactivated at another circumstance on falling edge of clock. Here's what I think:
always@(posedge CLK) begin
signal1 <= 1'b0; // reset flag
if(circumstance1) signal1 <=1'b1; // raise flag if circumstance occurs
end
always@(negedge CLK) begin
signal2 <= 1'b1; // reset flag (actually set alternate to signal1)
if(circumstance2) signal2 <=1'b0; // raise flag if circumstance occurs
end
always@(posedge signal1 or negedge signal2) begin
if(signal1) outsignal <= 1'b0; // activate outsignal
else outsignal <= 1'n1; // deactivate outsignal
end
Will that work? Are there better alternatives (doubling clock and catching single edge is not an option here).
Edit after Russell's reply. Russell, I think you propose the following:
wire nCLK = ~CLK;
always@(posedge CLK or posedge nCLK or negedge nRESET) begin
if(!nRESET) outsignal <= 1'b0;
else if(nCLK) outsignal <= 1'b1;
else outsignal <= 1'b0;
end
did I understand you properly?