J
john
Guest
Hello,
My 19 bit up counter is working fine but its not toggling
the "count_equal" signal. Its just keeping its value to '0'.
The comparator is not working for 19 bits but it does work for
less than 19 bits.. I am using the comparator to know that count is done!
Please advice... I am also attaching my code...
Thanks
Regards
john
Entity counter is
Port (
Qout : out unsigned (18 downto 0); -- 19 bit address bus output
Din ut unsigned (18 downto 0); -- 19 bit address bus input
DPR_CLK : in std_logic; -- Clock for the counter
P : in std_logic; -- Increment the count
count_equal: out std_logic;
Reset_c: in std_logic
);
End counter;
-------------------------------------------------------------
Architecture count_arch of counter is
Signal Q : unsigned (18 downto 0);
Signal D : unsigned ( 18 downto 0):="1111111111111111111";
Begin
Qout<=Q;
process(DPR_Clk,Reset_c)
Begin
If (Reset_c = '1') then
Q(18 downto 0) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0');
count_equal <='0';
Else if (DPR_Clk='1' and DPR_Clk'event) then
If (P = '1') then
Q <= Q + 1;
count_equal <='0';
If(Q = D) Then
count_equal<='1';
Q(18 downto 0) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0');
End if;
End if;
End If;
End If;
End process;
End count_arch ;
My 19 bit up counter is working fine but its not toggling
the "count_equal" signal. Its just keeping its value to '0'.
The comparator is not working for 19 bits but it does work for
less than 19 bits.. I am using the comparator to know that count is done!
Please advice... I am also attaching my code...
Thanks
Regards
john
Entity counter is
Port (
Qout : out unsigned (18 downto 0); -- 19 bit address bus output
Din ut unsigned (18 downto 0); -- 19 bit address bus input
DPR_CLK : in std_logic; -- Clock for the counter
P : in std_logic; -- Increment the count
count_equal: out std_logic;
Reset_c: in std_logic
);
End counter;
-------------------------------------------------------------
Architecture count_arch of counter is
Signal Q : unsigned (18 downto 0);
Signal D : unsigned ( 18 downto 0):="1111111111111111111";
Begin
Qout<=Q;
process(DPR_Clk,Reset_c)
Begin
If (Reset_c = '1') then
Q(18 downto 0) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0');
count_equal <='0';
Else if (DPR_Clk='1' and DPR_Clk'event) then
If (P = '1') then
Q <= Q + 1;
count_equal <='0';
If(Q = D) Then
count_equal<='1';
Q(18 downto 0) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0');
End if;
End if;
End If;
End If;
End process;
End count_arch ;