Forum Discussion
Altera_Forum
Honored Contributor
8 years agoOkay, let's go through your points one by one. But first, I make the assumption that you're using an FPGA eval board, since you're mentioning "the 50 MHz".
First, there's "wait for ... us". You only need this for simulating your code. You can use this to simulate a clock source. However, you cannot synthesize this and load it to your FPGA. Then there's "others using sentences "yes""; I don't understand. Next, "rising_edge or check change whit "variable'event"". That's just your standard synchronous process. You should understand those first before going to more complex topics like building your own clock divider and UART, but I presume you already do and just got confused. Well, you can use this to build a clock divider:
entity xyz is
clk: in std_logic;
-- ...
signal divided_clk: std_logic := '0';
-- ...
process(clk) is
begin
if(rising_edge(clk)) then
divided_clk <= not divided_clk;
end if;
end process;
Now you can use "divided_clk" as a clock for another process, and it'll run at half the clock rate! However, that has its own disadvantages. My recommendation: assuming you're using an FPGA, it'll have a PLL. A PLL is basically a component that receives a clock (your 50 MHz) and generates another clock from it (e.g. 10 MHz). Just search for "ALTPLL". So, in short, my recommendation for your particular problem: [LIST=1] [/LIST] - Make sure you understand how to develop synchronous logic
- Make sure you understand how to instantiate entities
- Use Quartus to generate an ALTPLL block that generates the clock you need
- Wire the ALTPLL instance to your design