Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- I hope now you will lit the leds and impress your teacher soon after holiday. --- Quote End --- Kaz, We have the worst teacher for this subject, everyone relies on you tube and google for learning this. I wanted to ask few more questions relating to the code if you don't mind: The code is the following:
entity ripple_cnt isgeneric (ORDER: natural range 2 to 24:= 19);
-- What does this means. Order is of type generic or a keyword of somekind. Can I write Border instead of order?
-- Assuming it is not a keyword, the size of ORDER is 22 is that correct?
-- The value of order is 19, Correct? Is this value in binary 19?
port( fast_clk: in std_logic;
slow_clk: out std_logic);
end ripple_cnt;
architecture structure of ripple_cnt is
--internal signals
signal clks, count : unsigned(ORDER-1 downto 0);
-- I am confused, if I assume size of ORDER is 22, the ORDER-1 to 0 should give me size of 21 down to 0 but in my simulation window the clks and count are of the size 20 downto 0. Why is that?
signal qs : unsigned(ORDER-1 downto 0):=(others=>'0');
-- Same question as above for this as well
begin
slow_clk <= qs(ORDER-1);
clks(0) <= fast_clk;
-- Cascade the FFs to implement Ripple Counter
clks(ORDER-1 downto 1) <= qs(ORDER-2 downto 0);
-- 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;
end structure; Thanks a lot.