- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
12 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get the feeling you dont - as this can only come about by driving state from multiple processes
Please post the whole code.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You haven't given us the full picture. There doesn't appear to be anything wrong with what you've posted...
Cheers, Alex- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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....- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- 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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is ram_addr being assinged in 2 processes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see. Thank you.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page