I\'m trying to create a FSM but I\'m getting the error can\'t resolve multiple constant drivers
Here\'s my code:
library ieee;
use ieee.std_logic_11
When you synthesise VHDL, each process becomes a lump of hardware that drives any signal that is driven by that process. If you drive a signal from more than one process then you end up with more than one lump of hardware driving that signal; that signal is driven from more than one place. In other words, you have a short circuit.
This is usually not the behaviour you want and is usually not behaviour that logic synthesisers are prepared to create. This is the case with your code:
You have three concurent processes in your code. This one:
controller <= cmd & cancel & busy & acquirekey;
which drives the signal controller
; this one:
P1: process(clk, reset) is
which drives the signals dataout
, next_state
and pre_state
; and this one:
LC1_LC2: process(pre_state, next_state) is
which also drives the signals controller
, next_state
and data_out
.
So, the signals controller
, next_state
and data_out
are driven from more than one process; these signals will be driven by more than one lump of hardware. You synthesiser doesn't likes this, I'm pretty sure this isn't want you want.
You're not writing software. VHDL is a hardware description language. You need to think more hardware.
I don't know your design intent; I can only "suspect". But, I suspect you don't need this line at all:
dataout <= "00000000";
and I suspect these lines:
if reset='1' then
next_state <= standby;
should be:
if reset='1' then
pre_state <= standby;
I suspect you don't need this line at all:
controller <= cmd & cancel & busy & acquirekey;