I am new to VHDL while working on homework.
I have a very simple clock divider using common. (This is a counter / separator.)
-- the actual divider will be 2.1e6 or so (25Mhz down to 15hz)
run_divider : clk_divider
--pragma synthesis off
generic map(clkmax => 4) -- simulation
--pragma synthesis on
generic map(clkmax => 50000) -- synthesis
port map( clk_in => mclk,
reset => rst,
clk_out => divider_out );
Have I partially used the #ifdef equivalent in VHDL to separate simulation / synthesis? with the above pragma. However, this only works in synthesis, but is a syntax error in the simulation.
Other than using an external tool (M4, C preprocessor as another answer), is there a better way to have separate code for synthesis and modeling? I would like to stop worrying about these constants when I switch between synthesis and simulation.
24MHz 12MHz 8MHz VHDL? , / , : -)
:
https://github.com/linuxlizard/vhdl/blob/master/divider.vhdl
!