vhdl accessing std_logic_vector

OP #3101178
Rate this post
useful
not useful
Hi,
the following example won't be compiled with gvhdl:
1
library ieee;
2
use ieee.std_logic_1164.all;
3

4
entity DemultiplexerEntity is
5
  port(E: in std_logic;
6
    SEL: in std_logic_vector(1 downto 0);
7
    Y: out std_logic_vector(3 downto 0)
8
  );
9
end DemultiplexerEntity;
10

11
architecture DemultiplexerArchitectureSelektiv of DemultiplexerEntity is
12
  signal INDEX: integer;
13
begin
14
  with SEL select
15
    INDEX <= 0 when "00",
16
      1 when "01",
17
      2 when "10",
18
      3 when "11",
19
      0 when others;
20
  
21
  Y <= "0000"; -- clear
22
-- DOESNT' WORK
23
  --Y(INDEX) <= E;
24

25
end DemultiplexerArchitectureSelektiv;
It says:
1
c++: test.cc: In member function ‘virtual bool L4work_E19demultiplexerentity_A33demultiplexerarchitectureselektiv_P4_7pn::execute()’:
2
c++: test.cc:337:144: error: ‘L4work_E19demultiplexerentity_A33demultiplexerarchitectureselektiv_S5index’ was not declared in this scope
How can I access the output logic vector properly?
Moderator (Company: Titel) #3101505
Rate this post
useful
not useful
1
   Y <= "0000"; -- clear
2
-- DOESNT' WORK
3
  --Y(INDEX) <= E;
What doesn't work?
Does it not work when you uncomment the second assignment?
So, when you try at "first" clearing the vector and "afterwards" setting 
1 output bit?

> How can I access the output logic vector properly?
What do you want to do at all?
Moderator (Company: Titel) #3102428
Rate this post
useful
not useful
> The error below occurs when I uncomment the section.
> I just want to make sure that all other output bits are 0.
You cannot do this (assigning two values to one signal) with a 
concurrent statement! Use a process instead:
1
  process (E, INDEX) begin
2
    Y <= "0000";      -- default assignment
3
    Y(INDEX) <= E;    -- "last" assignment "wins" 
4
  end process;

> the following example won't be compiled with gvhdl
A simulator should be able to handle this conflict. It must result in 
"X" values, but all in all the concurrent style code is able to be 
compiled...

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now