title: The output does not change synchronously on Moore circuit design
body: <p>I'm designing a Moore machine controlling traffic light.</p>
  <p>This is a part of my source code.</p>
  <pre><code>    always @(negedge resetn or posedge clk) begin
          if ( !resetn )   // reset is allowed
              state &lt;= S0;
          else if ( push_button == 2'b01 ) begin 
          case ( state )
              S0 : state &lt;= S1;
              S1 : state &lt;= S2;
              S2 : state &lt;= S1;
              S3 : state &lt;= S3;
              default : state &lt;= state;
          endcase
          end
          
          else if ( push_button == 2'b10 ) begin 
          case ( state )
              S0 : state &lt;= S3;
              S1 : state &lt;= S3;
              S2 : state &lt;= S2;
              S3 : state &lt;= S1;
              default : state &lt;= state;
          endcase
          end
          else
              state &lt;= state;
      end
  
  
      always @(posedge clk) begin
  
          case ( state )
              S0 : led_output = 6'b111111;
              S1 : led_output = 6'b010100;
              S2 : led_output = 6'b100010;
              S3 : led_output = 6'b110110;   
              default : led_output = 6'b000000;
          endcase
      end
      
  endmodule
  </code></pre>
  <p>I want this code to change their state as input (button) comes in and also change the output value at the same time. But the problem is, while testing it with simulation, the state does change immediately while the output value does not.</p>
  <p>For example, let's say initial state was <code>S0</code>, and I gave button input <code>2'b10</code>. Then the state does change to <code>S3</code>, but the output does not change to <code>6'b110110</code>.</p>
  <p>Can you give me a hint or answer for this problem?</p>