title: Waiting posedge clk before doing a job? -- How
body: <pre><code>module DoorControl( clk, data, open,addressOftheMemory,  outp );
  
  localparam Size_ofTheWord = 32;
  input open;
  
  input [16:0] addressOftheMemory;
  input [Size_ofTheWord-1:0] data;
  
  input clk ;
  output reg outp;
  reg [WordSize-1: 0] Memory [65535: 0];
  
  
  always @ ( open )  // open is 1 or 0 
    if ( open  )          
       // i
       outp = Memory[addressOftheMemory];
    else if ( !open )    
       Memory[addressOftheMemory] = data;
  
  
  endmodule
  </code></pre>
  
  <p>Line marked with (i), I want wait just posedge clk before sending outp to output port.However, When I have tried like ;</p>
  
  <pre><code>if ( posedge clk )
  </code></pre>
  
  <p>it gives error  </p>
  
  <pre><code>while ( clk != 1 ) begin
  
  end 
  </code></pre>
  
  <p>it gives absurb answer/simulation output.
  <strong>What thing(s) should I put to that line to wait posedge clk before sending output ?</strong></p>