Is it normal that a clock divider made with ring johnson counter has output Undefined if clk starts high?
Is it normal that a clock divider made with ring johnson counter has output Undefined if clk starts high?

The short answer is Yes.

You get an event on clk assigning an initial value of '1', satisfying the if condition, assigning the value of din to qvar.

In the case of your three flip flops f0, f1 and f2 the din ports are association with either dInternal elements or the not expression of dInternal(2) using the intermediary signal dFirst.

If you were to display delta cycles in your waveform you'd see that the cause of your problem is that the assignment to dFirst occurs one delta cycle later.

For those of us who can't display delta cycles we can see that dFirst (not dInternal(2)) propagated a 'U' into the state of dbInternal because of the delta cycle delay:


(clickable)

Once in that 'U' recirculates.

You can correct the problem by using the rising_edge function found in package std_logic_1164 in your flip flop model:

library ieee;
use ieee.std_logic_1164.all;

entity ffd is
    port (
        clk:    in  std_logic;
        din:    in  std_logic;
        dout:   out std_logic
    );
end entity ffd;

architecture foo of ffd is
begin
    process (clk)
       variable qvar: std_logic := '0';
    begin
        if rising_edge(clk) then -- clk'event and clk = '1' then
            qvar := din;
        end if;
        dout &lt;= qvar;
    end process;
end architecture;


The rising_edge function qualifies it's input with a call to function TO_01 and uses the 'LAST_VALUE attribute to determine there's actually a rising edge which means it won't trigger erroneously:

    FUNCTION rising_edge  (SIGNAL s : std_ulogic) RETURN BOOLEAN IS
    BEGIN
        RETURN (s'EVENT AND (To_X01(s) = '1') AND
                            (To_X01(s'LAST_VALUE) = '0'));
    END;


This gives:


(clickable)

Just in case you were ever wondering why the rising_edge and falling_edge functions were included in package std_logic_1164, now you have a concrete example.