ERROR: infix expression "<=" with simple vectors

T

Trit

I'm relatively inexperienced with VHDL but am doing a project
involving it. I'm currently systematically filtering out the usual
typos and rookie mistakes...but have a problem which I cant seem to
fix and would like some advice.

The problem is that the modelsim compiler doesnt seem to accept an
assignment of signals of type std_logic_vector using quote marks of
form <= "value"

Example (first two errors in compile) of the relevant code

Library IEEE;
use IEEE.std_logic_1164.all;
use Ieee.std_logic_unsigned.all;
..
..
signal waitbit_state : std_logic_vector (2 downto 0);
signal waitbit_nextstate : std_logic_vector (2 downto 0);
..
..

30: case waitbit_state is
31: -- wait state
32: when "00"=>
33: if(waitbit_start = '0') then waitbit_nextstate <= "00",
waitbit_end <= '0';
34: else waitbit_nextstate <= "01", waitbit_end <= '0';
35: end if;

error output is

** Error: E:/project...(33): Type error resolving infix expression
"<=" as type ieee.std_logic_1163.std_logic_vector.
** Error: E:/project...(34): Type error resolving infix expression
"<=" as type ieee.std_logic_1163.std_logic_vector.

and a few more of the same for the other occurances in the state
machine

Need it be said, not being able to assign like this is awkward in a
state machine, so does anyone know any ways to solve this? I'm
assuming the issue is the "00" isn't being interpreted as a logic
vector but as a numeric form?
 
N

nuckols.jeff

I'm relatively inexperienced with VHDL but am doing a project
involving it.  I'm currently systematically filtering out the usual
typos and rookie mistakes...but have a problem which I cant seem to
fix and would like some advice.

The problem is that the modelsim compiler doesnt seem to accept an
assignment of signals of type std_logic_vector using quote marks of
form <= "value"

Example (first two errors in compile) of the relevant code

Library IEEE;
use IEEE.std_logic_1164.all;
use Ieee.std_logic_unsigned.all;
.
.
signal waitbit_state : std_logic_vector (2 downto 0);
signal waitbit_nextstate : std_logic_vector (2 downto 0);
.
.

30:     case waitbit_state is
31:     -- wait state
32:     when "00"=>
33:             if(waitbit_start = '0') then waitbit_nextstate <= "00",
waitbit_end <= '0';
34:             else waitbit_nextstate <= "01", waitbit_end <= '0';
35:             end if;

error output is

** Error: E:/project...(33): Type error resolving infix expression
"<=" as type ieee.std_logic_1163.std_logic_vector.
** Error: E:/project...(34): Type error resolving infix expression
"<=" as type ieee.std_logic_1163.std_logic_vector.

and a few more of the same for the other occurances in the state
machine

Need it be said, not being able to assign like this is awkward in a
state machine, so does anyone know any ways to solve this?  I'm
assuming the issue is the "00" isn't being interpreted as a logic
vector but as a numeric form?

You could try writing it like this:

30: case waitbit_state is
31: -- wait state
32: when "00"=>
33: if(waitbit_start = '0') then
33a: waitbit_nextstate <= "00";
33b: waitbit_end <= '0';
34: else
34a: waitbit_nextstate <= "01";
34b: waitbit_end <= '0';
35: end if;
 
N

nuckols.jeff

You could try writing it like this:

30:     case waitbit_state is
31:     -- wait state
32:     when "00"=>
33:             if(waitbit_start = '0') then
33a:                waitbit_nextstate   <= "00";
33b:                waitbit_end         <= '0';
34:             else
34a:               waitbit_nextstate    <= "01";
34b:               waitbit_end          <= '0';
35:             end if;- Hide quoted text -

- Show quoted text -

Whoops! Now I see the problem. The vectors are 3 bits (2 downto 0) and
you've assigned only 2 bits ("00" and "01"). Maybe you really want
"000" and "001".
 
T

Trit

You could try writing it like this:

30:     case waitbit_state is
31:     -- wait state
32:     when "00"=>
33:             if(waitbit_start = '0') then
33a:                waitbit_nextstate   <= "00";
33b:                waitbit_end         <= '0';
34:             else
34a:               waitbit_nextstate    <= "01";
34b:               waitbit_end          <= '0';
35:             end if;- Hide quoted text -

- Show quoted text -

I did originally try this and it didn't work (probably forgot to save
before compiling, stare at code enough and that happens).

Splitting the lines does seem to be working now, however, so thanks.
It was originally separated lines but it shifted to single line when I
changed editors. Guess I can focus on my typos now (much more fun).
 
T

Trit

Whoops! Now I see the problem. The vectors are 3 bits (2 downto 0) and
you've assigned only 2 bits ("00" and "01"). Maybe you really want
"000" and "001".- Hide quoted text -

- Show quoted text -

yeah, that problem I corrected earlier. Bad day = disorganised heap
of files in various states of debugging. I've just spent 5 mins
putting them in order so I can be more systematic lol. I'll make sure
the version i end up with has that one fixed, (it's a pretty
distictive error anyway). Mostly I have to worry about else if ->
elsif and missing underscores in signal names. Sorry about that
confusion.
 
T

Tricky

May I recommend, as you are new to VHDL, that you stop using
std_logic_unsigned/arith/signed and instead use the package
ieee.numeric_std instead? (As it is an IEEE standard, the others are
not).
Getting into the habit now will save you grief on here later.
 
T

Trit

May I recommend, as you are new to VHDL, that you stop using
std_logic_unsigned/arith/signed and instead use the package
ieee.numeric_std instead?  (As it is an IEEE standard, the others are
not).
Getting into the habit now will save you grief on here later.

Yeah, 99% of the time I don't need it and dont include it (especially
since I've seen the grief others have, and especially since the
libraries are defined per entity). There are just a few cases such as
counters where I need to add 1 and need the unsigned library, unless
there is a way to do a increment without it?
 
A

Andy Peters

Yeah, 99% of the time I don't need it and dont include it (especially
since I've seen the grief others have, and especially since the
libraries are defined per entity).  There are just a few cases such as
counters where I need to add 1 and need the unsigned library, unless
there is a way to do a increment without it?

Use numeric_std instead.

-a
 
T

Trit

Use numeric_std instead.

-a

that will still allow simple assignment of type x <= x + '1'; ?
convenient. I'll do that thanks

Cheers for the help all, finally managed to turn today around into a
productive session (after an appallingly disappointing weekend of
downloading useless applications) thanks to your advice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top