13

It seems like I have done this plenty of times, but for some reason today it just doesn't want to work.

I would like to assign the MSB of a 16-bit vector to a single-bit variable.

Din : in  STD_LOGIC_VECTOR (15 downto 0);

...

signal signBit : std_logic;

begin
    signBit <= Din(15 downto 15);

The error given is:

Type of signBit is incompatible with type of Din.

Yes I get it, vectors don't play nice with std_logic, but this is 1-bit, clearly denoted by (15 downto 15)

1
  • 2
    I assume there's a good reason you want to do this, and not just use Din(15). Even though your slice is only 1 bit, the fact that you're accessing it with downto makes it an array, not the scalar you expect. Commented Mar 28, 2014 at 18:22

1 Answer 1

17
Din(15 downto 15);

is a std_logic_vector, 1 bit long

Din(15);

is one element of a std_logic_vector, i.e. a std_logic.

Sign up to request clarification or add additional context in comments.

1 Comment

Ahh, I was confused. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.