next_state: process (clk) is begin
    if rising_edge(clk) then
        if (reset = '1') then
            math_state <= idle;
        else
            math_state <= math_state_next;
        end if;
    end if;
end process;