J
john
Hello,
The problem is that the "Q(0)" bit of the counter is not incrementing
at the rising edge of the "inc" signal instead its incrementing when
"inc" signal goes from high to low. I want to increment Q(0) at rising
edge of the "clk" and rising edge of the signal "inc".
Please Advice!!
Thanks
john
The code is given below:
C0: counter port map (Data_out_bus(13 downto 0),DPR_CLK,inc,eq_signal,Reset_A);
Process ( State, input_signal )
Begin
Case State is
When E0 =>
Reset_A <='1';
inc <='0';
nextstate <=E1;
When E1 =>
Reset_A <='0';
inc <='1';
nextstate <=E2;
When E2 =>
Reset_A <='0';
inc <='0';
nextstate <=E1;
When others =>
nextstate <=E0;
End Case;
End Process;
-- ( 14 bit )
Entity counter is
Port (
Qout : out unsigned (13 downto 0);
CLK : in std_logic;
P : in std_logic;
count_equal: out std_logic;
Reset_c: in std_logic
);
End counter;
Architecture count_arch of counter is
Signal Q : unsigned (13 downto 0);
Begin
count_equal <= Q(0);
Process (Clk, Reset_c)
Begin
If (Reset_c = '1' ) then
Q( 13 downto 0 ) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0' );
Elsif ( Clk 'event and Clk='1' ) then
If (P= '1') then
Q <= Q + 1;
Qout <=Q;
End If;
End if;
End process;
End count_arch ;
The problem is that the "Q(0)" bit of the counter is not incrementing
at the rising edge of the "inc" signal instead its incrementing when
"inc" signal goes from high to low. I want to increment Q(0) at rising
edge of the "clk" and rising edge of the signal "inc".
Please Advice!!
Thanks
john
The code is given below:
C0: counter port map (Data_out_bus(13 downto 0),DPR_CLK,inc,eq_signal,Reset_A);
Process ( State, input_signal )
Begin
Case State is
When E0 =>
Reset_A <='1';
inc <='0';
nextstate <=E1;
When E1 =>
Reset_A <='0';
inc <='1';
nextstate <=E2;
When E2 =>
Reset_A <='0';
inc <='0';
nextstate <=E1;
When others =>
nextstate <=E0;
End Case;
End Process;
-- ( 14 bit )
Entity counter is
Port (
Qout : out unsigned (13 downto 0);
CLK : in std_logic;
P : in std_logic;
count_equal: out std_logic;
Reset_c: in std_logic
);
End counter;
Architecture count_arch of counter is
Signal Q : unsigned (13 downto 0);
Begin
count_equal <= Q(0);
Process (Clk, Reset_c)
Begin
If (Reset_c = '1' ) then
Q( 13 downto 0 ) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0' );
Elsif ( Clk 'event and Clk='1' ) then
If (P= '1') then
Q <= Q + 1;
Qout <=Q;
End If;
End if;
End process;
End count_arch ;