Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Help with modelling with MODELSIM

Hello there again, I tried to simulate my first code in MODELSIM. Can someone help me simulate it properly, at the moment I am just a beginner and would like to know if there is any window which can show the errors or why the simulation is not working properly???

I just saw few videos on your tube and reached upto here. I have attached a screen shot of my code and simulation window for the experts here. Thanks

14 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It is because you have added few nodes first then you started running simulation then stopped it then added more nodes then you continued running simulation.

    All you have to do is add all nodes from start then run your simulation.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    -- Implement Toggle FFs

    ASYNCH_CNT: for i in 0 to ORDER-1 generate

    -- what does generate do? i read about loop but don't know what generate means here?

    T_FF:process(clks) is

    begin

    if rising_edge(clks(i)) then

    qs(i) <= not qs(i); -- Implements a T_ Flip Flop

    end if;

    end process T_FF;

    end generate;

    --- Quote End ---

    Does it mean that I can write this as the following:

    --- Quote Start ---

    -- Implement Toggle FFs

    --ASYNCH_CNT: for i in 0 to ORDER-1 generate

    T_FF1:process(clks) is

    begin

    if rising_edge(clks(0)) then

    qs(0) <= not qs(0); -- Implements a T_ Flip Flop

    end if;

    end process T_FF1;

    :

    :

    :

    :

    :

    T_FF20:process(clks) is

    begin

    if rising_edge(clks(20)) then

    qs(20) <= not qs(20); -- Implements a T_ Flip Flop

    end if;

    end process T_FF20;

    --end generate;

    --- Quote End ---

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    no because you need to use edge of each clk separately (clks is multiple clocks)

    edit:

    oops sorry.if you want that many processes then you can
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    As you have found out yourself the generate is unfolded by compiler into that many processes.

    Normally we can use for loop but because you can't put for loop ahead of process then generate is useful here.

    The actual purpose of generate is to tell compiler to synthesise or not depending on some condtions but here we borrowed it as loop that always generates