Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,502 Views

Can't resolve multiple constant drivers

 

I have a process 

type StateType is (ST_IDLE, ST_WAIT_DONE, ST_START_RX_DATA, ST_RX_DATA0, ST_RX_DATA, ST_RX_REG_COM, ST_RX_REG_ADDR, ST_RX_REG_DATA, ST_TX_REG_COM, ST_TX_REG_ADDR, ST_TX_REG_DATA, ST_TX_REG_DONE, ST_READ_STATUS_0, ST_READ_STATUS_1, ST_START_TX_DATA, ST_TX_DATA, ST_WAIT_USER_DONE); signal State :StateType; signal NextState :StateType; mspi_mcp25625_interface: process (REG_CLK) begin if (rising_edge(REG_CLK)) then case State is when ST_IDLE => MSPI_WR_START_TRIG <= '0'; MSPI_WR_DONE_CLR <= '0'; if (MCP25625_RX0BF='0' or MCP25625_RX1BF='0') then State <= ST_START_RX_DATA; end if; when ST_WAIT_DONE => MSPI_WR_START_TRIG <= '0'; MSPI_WR_DONE_CLR <= '0'; if (MSPI_WR_DONE = '1') then MSPI_WR_DONE_CLR <= '1'; if (NextState = ST_RX_DATA) then if (rx_byte_idx < DATA_LENGHT) then temp_rx_mailbox(rx_byte_idx) <= MSPI_RD_DATA; rx_byte_idx := rx_byte_idx + 1; --index for next rx byte -- else -- rx_byte_idx := 0; -- State <= ST_IDLE; end if; elsif (NextState = ST_RX_REG_DATA) then mcp25625_reg_data <= MSPI_RD_DATA; elsif (NextState = ST_READ_STATUS_1) then mcp25625_status_reg <= MSPI_RD_DATA; end if; State <= NextState; else --timeout timeout <= timeout + 1; if (timeout >= X"FFFE") then timeout <= X"0000"; State <= ST_IDLE; end if; end if; ---------------------------------------RECEIVE MAILBOX FROM MCP25625------------------------- when ST_START_RX_DATA => --start to receive a mailbox if (MCP25625_RX0BF='0') then MSPI_WR_DATA <= X"90"; --Receive Buffer 0, Start at RXB0SIDH (0x61) elsif (MCP25625_RX1BF='0') then MSPI_WR_DATA <= X"94"; --Receive Buffer 1, Start at RXB1SIDH (0x71) end if; MSPI_CS <= '0'; --chip select low MSPI_WR_START_TRIG <= '1'; --send a byte NextState <= ST_RX_DATA0; State <= ST_WAIT_DONE; when ST_RX_DATA0 => --skip first byte - it was a command MSPI_WR_DONE_CLR <= '0'; State <= ST_RX_DATA; when ST_RX_DATA => --receive a mailbox MSPI_WR_DONE_CLR <= '0'; if (rx_byte_idx < DATA_LENGHT) then MSPI_WR_DATA <= X"00"; --load dummy byte MSPI_WR_START_TRIG <= '1'; --send a byte NextState <= ST_RX_DATA; State <= ST_WAIT_DONE; else --13 bytes received MSPI_CS <= '1'; --chip select high rx_byte_idx := 0; --MCP25625_DATA_RDY <= '1'; --WHERE TO CLEAR? rx_data_ready <= '1'; NextState <= ST_IDLE; State <= ST_IDLE; end if; when others => State <= ST_IDLE; end case; end if; end process mspi_mcp25625_interface;  

 

When I compile I get multiple errors : 

Error (10028): Can't resolve multiple constant drivers for net "State.ST_IDLE"…… 

Error (10028): Can't resolve multiple constant drivers for net "State.ST_WAIT_DONE" ….. 

Error (10028): Can't resolve multiple constant drivers for net "State.ST_START_RX_DATA" ….. 

And so on. 

 

But I use State only in this process.  

 

 

0 Kudos
12 Replies
Altera_Forum
Honored Contributor I
107 Views

I get the feeling you dont - as this can only come about by driving state from multiple processes  

Please post the whole code.
Altera_Forum
Honored Contributor I
107 Views

You haven't given us the full picture. There doesn't appear to be anything wrong with what you've posted... 

 

Cheers, 

Alex
Altera_Forum
Honored Contributor I
107 Views

This is the complete code 

 

As a standalone file it compiles without errors. The errors appear only if I make a component of the entity and map it.
Altera_Forum
Honored Contributor I
107 Views

You have assigned it in two different processes: 

process @ line 127 

process @ line 201 : mspi_mcp25625_interface 

you also have a 3rd process (@ line 433) that is commented out that also assigns state. 

 

Took me 10s to find with the search function in a text editor....
Altera_Forum
Honored Contributor I
107 Views

I see. Thank you. I've missed it. I realy need to control the State from another proccess - what should I do? 

 

I also have RAM in my project and I need to read/wrte to it fom several processes - I realize I can't do it either.
Altera_Forum
Honored Contributor I
107 Views

 

--- Quote Start ---  

I see. Thank you. I've missed it. I realy need to control the State from another proccess - what should I do? 

 

I also have RAM in my project and I need to read/wrte to it fom several processes - I realize I can't do it either. 

--- Quote End ---  

 

 

1) Send a signal from the other process to the state machine process. 

2) Build a memory arbitrator to decide who can access the ram at any given point.
Altera_Forum
Honored Contributor I
107 Views

 

--- Quote Start ---  

1) Send a signal from the other process to the state machine process. 

2) Build a memory arbitrator to decide who can access the ram at any given point. 

--- Quote End ---  

 

I see. So if I want to change State from several processes I should send several different signals – each signal belongs to its process? 

If so - I can do the same for RAM? 

 

The problem is - I set a signal high, but how do I know when to set the signal low?
Altera_Forum
Honored Contributor I
107 Views

The state machine needs to exist in a single process. 

You communicate with a process via signals. 

You can just have outputs from the state machines when something have finished etc, or just read the state of the state machine. 

 

It sounds like you're taking VHDL as a programming language. You may need to draw out your intended circuit BEFORE writing any VHDL. without knowing what circuit you want, you will not write the correct VHDL.
Altera_Forum
Honored Contributor I
107 Views

I see. Thank you.

Altera_Forum
Honored Contributor I
107 Views

One more thing  

when ST_WR_RAM => ram_addr := to_integer(unsigned(addr_bus)); ram_mem(ram_addr) <= REG_DATA1_IN; when ST_RD_RAM => ram_addr := to_integer(unsigned(addr_bus)); REG_DATA_OUT <= ram_mem(ram_addr); when ST_RAM_TO_MCP25625 => temp_ram_val <= ram_mem(ram_addr);  

I get - Error (10028): Can't resolve multiple constant drivers. 

If I comment out REG_DATA_OUT <= ram_mem(ram_addr); or temp_ram_val <= ram_mem(ram_addr); It compiles without errors. 

Why I can't write to different signals in the same process?
Altera_Forum
Honored Contributor I
107 Views

The problem is ram_addr being assinged in 2 processes.

Altera_Forum
Honored Contributor I
107 Views

I see. Thank you.

Reply