I have the following code that I am trying to synthesize using FPGA Express VHDL. I am getting the error "Sequential mapping has detected that the cell '/counter-optimized/current_count_reg<0>' uses both the asynchronous 'set' and 'clear' pins." for all 32 bits in the current count register. I know the problem is being caused by the last two lines in which the 32 bit vector is being bit sliced into 2-16 bit vectors (this was tested by commenting out those lines)
My question is two fold: 1. How can I prevent this error and still be able to output the two bit slices, and 2. how can I output the two bit slices using an if statement (i.e. if run = '1' then <output the bit slices> else <bit slices <= '0'>.
Thank You
------------------------------------------------------------
entity counter is
Port (
run: in STD_LOGIC; --start @ 0 to put preset hi and low into current_count
reset: in STD_LOGIC;
clk1k : in STD_LOGIC; --1kHZ clock
preset_low: in STD_LOGIC_VECTOR(15 downto 0);
preset_hi: in STD_LOGIC_VECTOR(15 downto 0);
count_low: out STD_LOGIC_VECTOR(15 downto 0);
count_hi: out STD_LOGIC_VECTOR(15 downto 0)
);
end counter;
--------------------------------------------------------------------------------------------
architecture counter of counter is
signal current_count: STD_LOGIC_VECTOR(31 downto 0); --value of current count
signal max_count: STD_LOGIC_VECTOR(31 downto 0); --max count value
begin
max_count <= "11111111111111111111111111111111";
reg_count:
process(reset, clk1k)
begin
if reset = '1' then
current_count <= preset_hi & preset_low;
elsif (clk1k'event and clk1k = '1') then
if current_count < max_count then
current_count <= current_count + "1";
elsif current_count = max_count then
current_count <= (others => '0');
end if;
end if;
end process;
count_hi(15 downto 0) <= current_count(31 downto 16);
count_low(15 downto 0) <= current_count(15 downto 0);
end counter;
My question is two fold: 1. How can I prevent this error and still be able to output the two bit slices, and 2. how can I output the two bit slices using an if statement (i.e. if run = '1' then <output the bit slices> else <bit slices <= '0'>.
Thank You
------------------------------------------------------------
entity counter is
Port (
run: in STD_LOGIC; --start @ 0 to put preset hi and low into current_count
reset: in STD_LOGIC;
clk1k : in STD_LOGIC; --1kHZ clock
preset_low: in STD_LOGIC_VECTOR(15 downto 0);
preset_hi: in STD_LOGIC_VECTOR(15 downto 0);
count_low: out STD_LOGIC_VECTOR(15 downto 0);
count_hi: out STD_LOGIC_VECTOR(15 downto 0)
);
end counter;
--------------------------------------------------------------------------------------------
architecture counter of counter is
signal current_count: STD_LOGIC_VECTOR(31 downto 0); --value of current count
signal max_count: STD_LOGIC_VECTOR(31 downto 0); --max count value
begin
max_count <= "11111111111111111111111111111111";
reg_count:
process(reset, clk1k)
begin
if reset = '1' then
current_count <= preset_hi & preset_low;
elsif (clk1k'event and clk1k = '1') then
if current_count < max_count then
current_count <= current_count + "1";
elsif current_count = max_count then
current_count <= (others => '0');
end if;
end if;
end process;
count_hi(15 downto 0) <= current_count(31 downto 16);
count_low(15 downto 0) <= current_count(15 downto 0);
end counter;