Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

FSM compilation error: Can't resolve multiple constant drivers for net

Status
Not open for further replies.

Opel_Corsa

Member level 1
Joined
Nov 13, 2005
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,614
I have a code for an FSM:

Code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

entity FSM is
     port(
        key : in std_logic_vector(3 downto 0);   -- pushbutton switches
        sw : in std_logic_vector(8 downto 0);    -- slide switches
        ledg : out std_logic_vector(7 downto 0); -- green LED's (you might want to use
                                                 -- this to display your current state)
        lcd_rw : out std_logic;   -- R/W control signal for the LCD
        lcd_en : out std_logic;   -- Enable control signal for the LCD
        lcd_rs : out std_logic;   -- Whether or not you are sending an instruction or character
        lcd_on : out std_logic;   -- used to turn on the LCD
        lcd_blon : out std_logic; -- used to turn on the backlight
        lcd_data : out std_logic_vector(7 downto 0));  -- used to send instructions or characters
end FSM ;

architecture behavioural of FSM is
		type state_type is (M,o,s,t,a);
		signal y : state_type;
begin
        lcd_blon <= '1';   -- backlight is always on
        lcd_on <= '1';     -- LCD is always on
        lcd_en <= key(0);  -- connect the clock to the lcd_en input
		ledg(0) <= key(0); -- send the clock to a green light, to help you debug
        lcd_rw <= '0';     -- always writing to the LCD

        [color=red]process(key)[/color]
		begin
		if (key(3) = '0') then  -- reset LCD
			lcd_rs <= '0';  -- send instructions
			lcd_data <= "00111000";  -- prepare LCD
			lcd_data <= "00111000";
			lcd_data <= "00001100";
			lcd_data <= "00000001";
			lcd_data <= "00000110";
			lcd_data <= "10000000";
		elsif (key(3) = '1') then
			lcd_rs <= '1';  -- send characters
			if (key(0)'event and key(0) = '1') then
				y <= M;
				case y is
					when M => if (sw(0) = '0') then
							  	  y <= o;
							  elsif (sw(0) = '1') then
								  y <= a;
							  end if;
					when o => if (sw(0) = '0') then
							  	  y <= s;
							  elsif (sw(0) = '1') then
								  y <= M;
							  end if;
					when s => if (sw(0) = '0') then
							  	  y <= t;
							  elsif (sw(0) = '1') then
								  y <= o;
						      end if;
					when t => if (sw(0) = '0') then
							  	  y <= a;
							  elsif (sw(0) = '1') then
								  y <= s;
							  end if;
					when a => if (sw(0) = '0') then
							  	  y <= M;
							  elsif (sw(0) = '1') then
								  y <= t;
							  end if;
				end case;
			end if;
		end if;
		end process;

		with y select
			lcd_data <= "01001101" when M,  -- display M
				 		"01101111" when o,  -- display o
						"01110011" when s,  -- display s
						"01110100" when t,  -- display t
						"01100001" when a;  -- display a

end behavioural;

However it doesn't compile and gives me the following error:
Error (10028): Can't resolve multiple constant drivers for net "lcd_data[7]" at FSM.vhd(29)
Line 29 is highlighted on the code.

Any help is greatly appreciated.
 

Re: Compilation error

I believe you are doing RTL design, coding intended for synthesis and this error came from your synthesis tool, which tool do you use?

Your lcd_data is being driven by a process as well as a concurrent statement with select and hence the issue. Why do you drive it from 2 places?

Regards
Ajeetha, CVC
www.noveldv.com
 

Re: Compilation error

Code:
		if (key(3) = '0') then  -- reset LCD
			lcd_rs <= '0';  -- send instructions
			lcd_data <= "00111000";  -- prepare LCD
			lcd_data <= "00111000";
			lcd_data <= "00001100";
			lcd_data <= "00000001";
			lcd_data <= "00000110";
			lcd_data <= "10000000";
What value should the signal lcd_data get when key(3)='0' ?
If you put it like that you'll get "10000000", so why the other assignments?


Code:
        process(key)
		begin
		if (key(3) = '0') then  -- reset LCD
			lcd_rs <= '0';  -- send instructions
			lcd_data <= "00111000";  -- prepare LCD
			lcd_data <= "00111000";
			lcd_data <= "00001100";
			lcd_data <= "00000001";
			lcd_data <= "00000110";
			lcd_data <= "10000000";
                     .   .   .
                     .   .   .
                     .   .   .

		end process;

		with y select
			lcd_data <= "01001101" when M,  -- display M
				 		"01101111" when o,  -- display o
						"01110011" when s,  -- display s
						"01110100" when t,  -- display t
						"01100001" when a;  -- display a

You can't drive the signal lcd_data in 2 diffrent processes.
 

Re: Compilation error

yes, you were both right. i heavily modified my code and now it works. thanks!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top