VHDL code - Can't resolve multiple constant drivers for net 'a'

Status
Not open for further replies.

jojo12

Newbie
Joined
Dec 4, 2022
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
24
If anyone can help it would be greatly appreciated.
I can't figure out how to specify a in the code to not get the error.

I'm getting this error for all a's (a(3), a(2), a(1), a(0))
Error (10028): Can't resolve multiple constant drivers for net "a[3]" at counter.vhd(20)

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library ieee;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_1164.all;
 
entity counter is
port (x : in std_logic_vector (3 downto 0);
clk : in std_ulogic;
y : out std_logic_vector (3 downto 0));
end entity counter;
architecture code_behavior of counter is
signal a: std_logic_vector (3 downto 0);
begin
process (clk)
begin
if rising_edge (clk) then a<= x;
end if;
end process;
process (x)
begin
if rising_edge (clk) then
 
if x < "1001" then y<=(a+"0001");
a<= a + "0001";
elsif x > "1001" then y<=(a-"0001");
a <= a - "0001";
else y<= "1001";
end if;
end if;
end process;
end architecture;

 
Last edited by a moderator:

You've got "a" assigned in two different processes. Don't do that.
 
It's also wrong to use x in the sensitivity list of a clocked process. It has no effect in hardware synthesis but causes simulation mismatch. What's your intention?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…