Altera_Forum
Honored Contributor
9 years agoNewbie vs VHDL: season 01 episode 01
Hi all
Since I am new to VHDL I have some questions (that probably you will find trivial): 1. Is good practice to define a behavioural architecture with one single process inside or it is better to have several process? (assumed that for different signals - if correlated - they have to stay in the same process) 2. If I have to implement a high order counter let's say a 24-bit counter it is better to have 2 12 bit counter or FPGAs can handle 24bit with the same effort of a 12 bit, for example: -- 2 12 bit counter BEGIN IF rising_edge(clk_in) THEN -- clk_in is the clock signal input count1 <= count1 + '1'; -- 12 bit counter IF count1 = cnst THEN adder <= '1'; -- cnst = "111111111111" ELSE adder <= '0'; END IF; count2 <= count2 + adder; -- 12 bit counter END IF; END PROCESS; -- 24 bit counter BEGIN IF rising_edge(clk_in) THEN count1 <= count1 + '1'; -- 24 bit counter END IF; END PROCESS; 3. When defining entities and/or signals we have to iniatalize them, in which way is more efficient (if there are any differences): SIGNAL count1 : STD_LOGIC_VECTOR (11 downto 0) := "000000000000"; SIGNAL count2 : STD_LOGIC_VECTOR (11 downto 0) := X"0000"; 4. Is good practice to use as much as possible only STD_LOGIC types? Is this the best option for efficiency and speed? Thank you all :)