I'm designing a Fahrenheit to Celsius converter using algorithmic state machines. I'm trying to get the following code to run, but all I get for output is 0.
module FtoC(clk, F_input, C_output);
input clk;
input [8:0]F_input;
output [6:0]C_output;
reg [6:0] C_output = 0;
reg [1:0] state =0;
reg [8:0] A, R;
always @ (posedge clk)
case (state)
0: begin state <= 1; C_output <= 0; A <= F_input; R <= 0; end
1: begin state <=2; R <= ({(A - 32), 2'b00} + A); end
2: if (R>9) begin R <= R - 9; C_output <= C_output + 1; end
// else state <= 0;
endcase
endmodule