chandlerbing65nm
Member level 5
I'm having an error about adding 1 to a std_logic_vector in VHDl.
Here's the code: It's a 74LS163 Synchronous Binary Counter code.
I used 1076-2008 in ModelSim - Altera, as "temp <= temp + 1" should be synthesizable but it still got an error when simulated -- No feasible entries for inflix operator '+'.
I tried using x"1", x"0001" and '1' but all of these didn't worked.
Also, how should I write the code for using CEP and CET as count enables.
Here's the code: It's a 74LS163 Synchronous Binary Counter code.
Code:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
entity AAC2M2P1 is port (
CP: in std_logic; -- clock
SR: in std_logic; -- Active low, synchronous reset
P: in std_logic_vector(3 downto 0); -- Parallel input
PE: in std_logic; -- Parallel Enable (Load)
CEP: in std_logic; -- Count enable parallel input
CET: in std_logic; -- Count enable trickle input
Q: out std_logic_vector(3 downto 0);
TC: out std_logic -- Terminal Count
);
end AAC2M2P1;
architecture LS163 of AAC2M2P1 is
signal temp: std_logic_vector(0 to 3);
signal RCO: std_logic;
begin process(CP, SR, PE)
begin
if (SR = '1') then
temp <= "0000";
elsif (rising_edge(CP)) then
if (PE = '0') then
temp <= P;
if (temp = "1111") then
temp <= "0000";
RCO <= '1';
else
temp <= temp + 1; --ERROR
RCO <= '0';
end if;
end if;
end if;
end process;
Q <= temp;
TC <= RCO;
end LS163;
I used 1076-2008 in ModelSim - Altera, as "temp <= temp + 1" should be synthesizable but it still got an error when simulated -- No feasible entries for inflix operator '+'.
I tried using x"1", x"0001" and '1' but all of these didn't worked.
Also, how should I write the code for using CEP and CET as count enables.
Last edited: