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

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.